|
|
|
|
org.eclipse.ui.actions
Class PerspectiveMenu
java.lang.Object
org.eclipse.jface.action.ContributionItem
org.eclipse.ui.actions.PerspectiveMenu
-
All Implemented Interfaces:
-
IContributionItem
-
Direct Known Subclasses:
-
OpenNewPageMenu,
OpenNewWindowMenu,
OpenPerspectiveMenu
-
public abstract class PerspectiveMenu
- extends
ContributionItem
A menu for perspective selection.
A PerspectiveMenu is used to populate a menu with
perspective shortcut items. If the user selects one of these items
an action is performed for the selected perspective.
The visible perspective items within the menu are dynamic and reflect the
available set generated by each subclass. The default available set consists
of the perspective shortcut list of the current perspective.
This class is abstract. Subclasses must implement the run method,
which performs a specialized action for the selected perspective.
Method Summary
|
void
|
fill
(
Menu menu,
int index)
The default implementation of this IContributionItem
method does nothing. |
protected
ArrayList
|
getPerspectiveItems
()
Returns the available list of perspectives to display in the menu. |
protected boolean
|
getShowActive
()
Returns whether the menu item representing the active perspective
will have a check mark. |
protected
IWorkbenchWindow
|
getWindow
()
Returns the window for this menu. |
boolean
|
isDirty
()
The default implementation of this IContributionItem
method returns false . |
boolean
|
isDynamic
()
The default implementation of this IContributionItem
method returns false . |
protected abstract void
|
run
(
IPerspectiveDescriptor desc)
Runs an action for a particular perspective. |
protected void
|
run
(
IPerspectiveDescriptor desc,
SelectionEvent event)
Runs an action for a particular perspective. |
protected void
|
showActive
(boolean b)
Sets the showActive flag. |
Methods inherited from class org.eclipse.jface.action.
ContributionItem
|
dispose,
fill,
fill,
fill,
getId,
getParent,
isEnabled,
isGroupMarker,
isSeparator,
isVisible,
saveWidgetState,
setId,
setParent,
setVisible,
toString,
update,
update
|
SHOW_PERSP_ID
protected static final
String SHOW_PERSP_ID
-
Deprecated. As of 3.5, replaced by
IWorkbenchCommandConstants.PERSPECTIVES_SHOW_PERSPECTIVE
-
Since:
- 3.4
-
See Also:
-
Constant Field Values
PerspectiveMenu
public PerspectiveMenu(
IWorkbenchWindow window,
String id)
- Constructs a new instance of
PerspectiveMenu .
-
Parameters:
-
window - the window containing this menu -
id - the menu id
fill
public void fill(
Menu menu,
int index)
-
Description copied from class:
ContributionItem
- The default implementation of this
IContributionItem
method does nothing. Subclasses may override.
-
-
Specified by:
-
fill
in interface
IContributionItem
-
Overrides:
-
fill
in class
ContributionItem
-
-
Parameters:
-
menu - the parent menu -
index - the index where the controls are inserted,
or -1 to insert at the end
getPerspectiveItems
protected
ArrayList getPerspectiveItems()
- Returns the available list of perspectives to display in the menu.
By default, the list contains the perspective shortcuts
for the current perspective.
Subclasses can override this method to return a different list.
-
-
Returns:
- an
ArrayList of perspective items IPerspectiveDescriptor
getShowActive
protected boolean getShowActive()
- Returns whether the menu item representing the active perspective
will have a check mark.
-
-
Returns:
-
true if a check mark is shown, false otherwise
getWindow
protected
IWorkbenchWindow getWindow()
- Returns the window for this menu.
-
-
Returns:
- the window
isDirty
public boolean isDirty()
-
Description copied from class:
ContributionItem
- The default implementation of this
IContributionItem
method returns false . Subclasses may override.
-
-
Specified by:
-
isDirty
in interface
IContributionItem
-
Overrides:
-
isDirty
in class
ContributionItem
-
-
Returns:
-
true if this item is dirty
isDynamic
public boolean isDynamic()
-
Description copied from class:
ContributionItem
- The default implementation of this
IContributionItem
method returns false . Subclasses may override.
-
-
Specified by:
-
isDynamic
in interface
IContributionItem
-
Overrides:
-
isDynamic
in class
ContributionItem
-
-
Returns:
-
true if this item is dynamic, and
false for normal items
run
protected abstract void run(
IPerspectiveDescriptor desc)
- Runs an action for a particular perspective. The behavior of the
action is defined by the subclass.
-
-
Parameters:
-
desc - the selected perspective
run
protected void run(
IPerspectiveDescriptor desc,
SelectionEvent event)
- Runs an action for a particular perspective. The behavior of the action
is defined by the subclass. By default, this just calls
run(IPerspectiveDescriptor) .
-
-
Parameters:
-
desc - the selected perspective -
event - SelectionEvent - the event send along with the selection
callback
showActive
protected void showActive(boolean b)
- Sets the showActive flag. If
showActive == true then the
active perspective is hilighted with a check mark.
-
-
Parameters:
-
b - the new showActive flag
Guidelines for using Eclipse APIs.
Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.
|
|
|