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 Details

    • addPartListener

      void addPartListener(IPartListener listener)
      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

      void addPartListener(IPartListener2 listener)
      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 null if no part is currently active
    • getActivePartReference

      IWorkbenchPartReference getActivePartReference()
      Returns the active part reference.
      Returns:
      the active part reference, or null if no part is currently active
    • removePartListener

      void removePartListener(IPartListener listener)
      Removes the given part listener. Has no effect if an identical listener is not registered.
      Parameters:
      listener - a part listener
    • removePartListener

      void removePartListener(IPartListener2 listener)
      Removes the given part listener. Has no effect if an identical listener is not registered.
      Parameters:
      listener - a part listener