Package org.eclipse.ui
Interface IPartService
- All Known Subinterfaces:
IWorkbenchPage
- All Known Implementing Classes:
PartService,SlavePartService,WorkbenchPage
public interface IPartService
A part service tracks the creation and activation of parts within a workbench
page.
This service can be acquired from your service locator:
IPartService service = (IPartService) getSite().getService(IPartService.class);This service is not available globally, only from the workbench window level down.
- See Also:
- Restriction:
- This interface is not intended to be implemented by clients.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddPartListener(IPartListener listener) Adds the given listener for part lifecycle events.voidaddPartListener(IPartListener2 listener) Adds the given listener for part lifecycle events.Returns the active part.Returns the active part reference.voidremovePartListener(IPartListener listener) Removes the given part listener.voidremovePartListener(IPartListener2 listener) Removes the given part listener.
-
Method Details
-
addPartListener
Adds the given listener for part lifecycle events. Has no effect if an identical listener is already registered.Note: listeners should be removed when no longer necessary. If not, they will be removed when the IServiceLocator used to acquire this service is disposed.
- Parameters:
listener- a part listener- See Also:
-
addPartListener
Adds the given listener for part lifecycle events. Has no effect if an identical listener is already registered.As of 3.5, the IPartListener2 can also implement IPageChangedListener to be notified about any parts that implement IPageChangeProvider and post PageChangedEvents.
Note: listeners should be removed when no longer necessary. If not, they will be removed when the IServiceLocator used to acquire this service is disposed.
- Parameters:
listener- a part listener- See Also:
-
getActivePart
IWorkbenchPart getActivePart()Returns the active part.- Returns:
- the active part, or
nullif no part is currently active
-
getActivePartReference
IWorkbenchPartReference getActivePartReference()Returns the active part reference.- Returns:
- the active part reference, or
nullif no part is currently active
-
removePartListener
Removes the given part listener. Has no effect if an identical listener is not registered.- Parameters:
listener- a part listener
-
removePartListener
Removes the given part listener. Has no effect if an identical listener is not registered.- Parameters:
listener- a part listener
-