Package org.eclipse.ui.internal
Class PerspectiveTracker
java.lang.Object
org.eclipse.ui.PerspectiveAdapter
org.eclipse.ui.internal.PerspectiveTracker
- All Implemented Interfaces:
IPageListener
,IPerspectiveListener
,IPerspectiveListener2
,IPerspectiveListener3
,IPerspectiveListener4
Utility class for tracking the active perspective in a window.
- Since:
- 3.1
-
Constructor Summary
ModifierConstructorDescriptionprotected
PerspectiveTracker
(IWorkbenchWindow window) Creates a perspective tracker for the given window.PerspectiveTracker
(IWorkbenchWindow window, IAction action) Creates a perspective tracker for the given window which will enable the given action only when there is an active perspective. -
Method Summary
Modifier and TypeMethodDescriptionvoid
dispose()
Disposes the tracker.void
pageActivated
(IWorkbenchPage page) Notifies this listener that the given page has been activated.void
pageClosed
(IWorkbenchPage page) Notifies this listener that the given page has been closed.void
pageOpened
(IWorkbenchPage page) Notifies this listener that the given page has been opened.void
perspectiveActivated
(IWorkbenchPage page, IPerspectiveDescriptor perspective) Notifies this listener that a perspective in the given page has been activated.protected void
update
(IPerspectiveDescriptor persp) Performs some function based on the active perspective in the window.Methods inherited from class org.eclipse.ui.PerspectiveAdapter
perspectiveChanged, perspectiveChanged, perspectiveClosed, perspectiveDeactivated, perspectiveOpened, perspectivePreDeactivate, perspectiveSavedAs
-
Constructor Details
-
PerspectiveTracker
Creates a perspective tracker for the given window. Subclasses should overrideupdate(IPerspectiveDescriptor)
to get notified of perspective changes.- Parameters:
window
- the window to track
-
PerspectiveTracker
Creates a perspective tracker for the given window which will enable the given action only when there is an active perspective.- Parameters:
window
- the window to trackaction
- the action to enable or disable
-
-
Method Details
-
dispose
public void dispose()Disposes the tracker. -
pageActivated
Description copied from interface:IPageListener
Notifies this listener that the given page has been activated.- Specified by:
pageActivated
in interfaceIPageListener
- Parameters:
page
- the page that was activated- See Also:
-
pageClosed
Description copied from interface:IPageListener
Notifies this listener that the given page has been closed.- Specified by:
pageClosed
in interfaceIPageListener
- Parameters:
page
- the page that was closed- See Also:
-
pageOpened
Description copied from interface:IPageListener
Notifies this listener that the given page has been opened.- Specified by:
pageOpened
in interfaceIPageListener
- Parameters:
page
- the page that was opened- See Also:
-
perspectiveActivated
Description copied from interface:IPerspectiveListener
Notifies this listener that a perspective in the given page has been activated.- Specified by:
perspectiveActivated
in interfaceIPerspectiveListener
- Overrides:
perspectiveActivated
in classPerspectiveAdapter
- Parameters:
page
- the page containing the activated perspectiveperspective
- the perspective descriptor that was activated- See Also:
-
update
Performs some function based on the active perspective in the window.The default implementation enables the action (if given) if there is an active perspective, otherwise it disables it.
Subclasses may override or extend.
- Parameters:
persp
- the active perspective in the window, ornull
if none
-