|
org.eclipse.rse.ui.actions
Class SystemBaseSubMenuAction
java.lang.Object
org.eclipse.core.commands.common.EventManager
org.eclipse.jface.action.AbstractAction
org.eclipse.jface.action.Action
org.eclipse.rse.ui.actions.SystemBaseAction
org.eclipse.rse.ui.actions.SystemBaseSubMenuAction
-
All Implemented Interfaces:
-
IAction,
ISelectionChangedListener,
ISystemAction
-
public abstract class SystemBaseSubMenuAction
- extends
SystemBaseAction
Our framework is designed to allow actions to be added to popup menus.
Sometimes, we want an expandable or cascading menu item for an action.
That is what this class is designed for. It represents a populated submenu.
Fields inherited from interface org.eclipse.jface.action.
IAction
|
AS_CHECK_BOX,
AS_DROP_DOWN_MENU,
AS_PUSH_BUTTON,
AS_RADIO_BUTTON,
AS_UNSPECIFIED,
CHECKED,
DESCRIPTION,
ENABLED,
HANDLED,
IMAGE,
RESULT,
TEXT,
TOOL_TIP_TEXT
|
Constructor Summary
|
protected
|
SystemBaseSubMenuAction
(
ResourceBundle rb,
String label,
String tooltip,
ImageDescriptor image,
Shell shell)
Deprecated. use fields from resource class directly now instead of via ResourceBundle
|
protected
|
SystemBaseSubMenuAction
(
String label,
ImageDescriptor image,
Shell shell)
Constructor for SystemBaseSubMenuAction when there is just a string and image |
protected
|
SystemBaseSubMenuAction
(
String label,
Shell shell)
Constructor for SystemBaseSubMenuAction when there is just a string |
protected
|
SystemBaseSubMenuAction
(
String label,
String tooltip,
ImageDescriptor image,
Shell shell)
Constructor for SystemBaseSubMenuAction when there is just a string and image |
protected
|
SystemBaseSubMenuAction
(
String label,
String tooltip,
Shell shell)
Constructor for SystemBaseSubMenuAction when there is just a string |
Methods inherited from class org.eclipse.rse.ui.actions.
SystemBaseAction
|
allowOnMultipleSelection,
checkObjectType,
getContextMenuGroup,
getCurrentTreeView,
getFirstSelection,
getHelpContextId,
getNextSelection,
getRemoteAdapter,
getSelectionProvider,
getShell,
getSystemConnection,
getViewAdapter,
isDummy,
isEnabled,
isSelectionSensitive,
issueTraceMessage,
run,
selectionChanged,
setAvailableOffline,
setBusyCursor,
setContextMenuGroup,
setDisplayCursor,
setDisplayCursor,
setHelp,
setHost,
setSelectionProvider,
setSelectionSensitive,
setTracing,
setTracing,
updateSelection
|
Methods inherited from class org.eclipse.jface.action.
Action
|
convertAccelerator,
convertAccelerator,
findKeyCode,
findKeyString,
findModifier,
findModifierString,
getAccelerator,
getActionDefinitionId,
getDescription,
getDisabledImageDescriptor,
getHelpListener,
getHoverImageDescriptor,
getId,
getImageDescriptor,
getMenuCreator,
getStyle,
getText,
getToolTipText,
isChecked,
isHandled,
notifyResult,
removeAcceleratorText,
removeMnemonics,
runWithEvent,
setAccelerator,
setActionDefinitionId,
setChecked,
setDescription,
setDisabledImageDescriptor,
setHelpListener,
setHoverImageDescriptor,
setId,
setImageDescriptor,
setMenuCreator,
setText,
setToolTipText
|
Methods inherited from class java.lang.
Object
|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
|
Methods inherited from interface org.eclipse.jface.action.
IAction
|
addPropertyChangeListener,
getAccelerator,
getActionDefinitionId,
getDescription,
getDisabledImageDescriptor,
getHelpListener,
getHoverImageDescriptor,
getId,
getImageDescriptor,
getMenuCreator,
getStyle,
getText,
getToolTipText,
isChecked,
isHandled,
removePropertyChangeListener,
runWithEvent,
setAccelerator,
setActionDefinitionId,
setChecked,
setDescription,
setDisabledImageDescriptor,
setHelpListener,
setHoverImageDescriptor,
setId,
setImageDescriptor,
setMenuCreator,
setText,
setToolTipText
|
actionLabel
protected
String actionLabel
menuID
protected
String menuID
createMenuEachTime
protected boolean createMenuEachTime
populateMenuEachTime
protected boolean populateMenuEachTime
SystemBaseSubMenuAction
protected SystemBaseSubMenuAction(
ResourceBundle rb,
String label,
String tooltip,
ImageDescriptor image,
Shell shell)
-
Deprecated. use fields from resource class directly now instead of via ResourceBundle
- Constructor for SystemBaseSubMenuAction when there is an image
-
Parameters:
-
label - -
tooltip - -
image - The image to display for this action -
shell - the parent shell. If you pass null now, be sure to call
setShell(Shell) later.
SystemBaseSubMenuAction
protected SystemBaseSubMenuAction(
String label,
Shell shell)
- Constructor for SystemBaseSubMenuAction when there is just a string
-
Parameters:
-
label - the label to display. -
shell - the parent shell. If you pass null now, be sure to call
setShell(Shell) later.
SystemBaseSubMenuAction
protected SystemBaseSubMenuAction(
String label,
String tooltip,
Shell shell)
- Constructor for SystemBaseSubMenuAction when there is just a string
-
Parameters:
-
label - the label to display. -
tooltip - the tooltip to display. -
shell - the parent shell. If you pass null now, be sure to call
setShell(Shell) later.
SystemBaseSubMenuAction
protected SystemBaseSubMenuAction(
String label,
ImageDescriptor image,
Shell shell)
- Constructor for SystemBaseSubMenuAction when there is just a string and image
-
Parameters:
-
label - the label to display. -
image - the image descriptor for the action. -
shell - the parent shell. If you pass null now, be sure to call
setShell(Shell) later.
SystemBaseSubMenuAction
protected SystemBaseSubMenuAction(
String label,
String tooltip,
ImageDescriptor image,
Shell shell)
- Constructor for SystemBaseSubMenuAction when there is just a string and image
-
Parameters:
-
label - the label to display. -
tooltip - the tooltip to display. -
image - the image descriptor for the action. -
shell - the parent shell. If you pass null now, be sure to call
setShell(Shell) later.
setMenuID
public void setMenuID(
String Id)
- Set the menu ID. This is important to allow action contributions via the popupMenus extension point.
-
setCreateMenuEachTime
public void setCreateMenuEachTime(boolean eachTime)
- Call this if the submenu should be created on-the-fly every time, versus creating and populating it
only on the first usage.
-
setPopulateMenuEachTime
public void setPopulateMenuEachTime(boolean eachTime)
- Call this if the submenu should be populated on-the-fly every time, versus populating it
only on the first usage. This only makes sense to be true if setCreateMenuEachTime is false.
-
setTest
public void setTest(boolean testMode)
- Set test mode on
-
populateSubMenu
public abstract
IMenuManager populateSubMenu(
IMenuManager menu)
-
Must be overridden
Example of this:
menu.add(new MyAction1());
-
-
Parameters:
-
menu - The cascading menu, which is created for you. Add your actions to it.
-
Returns:
- The given menu if you just populated it, or a new menu if you want to create the menu yourself.
getSubMenu
public
IMenuManager getSubMenu()
- Return the MenuManager object. It is this that is added to the primary popup menu.
-
createStandardGroups
protected void createStandardGroups(
IMenuManager menu)
- Creates the standard groups for the context sub-menu.
-
getActions
public
IAction[] getActions()
- Return the actions currently in the menu.
Never returns null, but may return an empty array.
-
createMnemonicsListener
protected
ISystemViewMenuListener createMnemonicsListener(boolean setMnemonicsOnlyOnce)
- Overridable method that instantiates the menu listener who job is to add
mnemonics.
-
-
Parameters:
-
setMnemonicsOnlyOnce - true if the menu is static and so mnemonics
need only be set once. False if it is dynamic -
Since:
- 3.0 replaced SystemViewMenuListener by ISystemViewMenuListener
setShell
public void setShell(
Shell shell)
- Sets the parent shell for this action. This is an override of our parent's method so we can
cascade it to each sub-action.
-
-
Specified by:
-
setShell
in interface
ISystemAction
-
Overrides:
-
setShell
in class
SystemBaseAction
-
setSelection
public void setSelection(
ISelection selection)
- This is called by the framework to set the selection input, just prior to showing the popup menu.
We cascade this down to all of the actions added to this submenu.
-
-
Specified by:
-
setSelection
in interface
ISystemAction
-
Overrides:
-
setSelection
in class
SystemBaseAction
-
-
See Also:
-
SystemBaseAction.selectionChanged(SelectionChangedEvent event)
setViewer
public void setViewer(
Viewer v)
- This is called by the framework to set the selection input, just prior to showing the popup menu.
We cascade this down to all of the actions added to this submenu.
-
-
Specified by:
-
setViewer
in interface
ISystemAction
-
Overrides:
-
setViewer
in class
SystemBaseAction
-
getShell
public
Shell getShell()
- Return the shell. If not set locally, queries it from the submenu, which is where it is set by the RSE framework
-
-
Specified by:
-
getShell
in interface
ISystemAction
-
Overrides:
-
getShell
in class
SystemBaseAction
-
getSelection
public
IStructuredSelection getSelection()
- Return the selection. If not set locally, queries it from the submenu, which is where it is set by the RSE framework
-
-
Specified by:
-
getSelection
in interface
ISystemAction
-
Overrides:
-
getSelection
in class
SystemBaseAction
-
getViewer
public
Viewer getViewer()
- Return the viewer. If not set locally, queries it from the submenu, which is where it is set by the RSE framework
-
-
Specified by:
-
getViewer
in interface
ISystemAction
-
Overrides:
-
getViewer
in class
SystemBaseAction
-
setInputsFromSubMenuManager
public void setInputsFromSubMenuManager(
Shell shell,
Viewer v,
ISelection selection)
- Special method called by our submenu manager when from its setInputs method. No need to
cascade as the menu manager will do it for us.
-
setInputs
public void setInputs(
Shell shell,
Viewer v,
ISelection selection)
- An optimization for performance reasons that allows all inputs to be set in one call.
Intercept of parent so we can cascade to sub-actions. Note however this won't really ever
get called. This is because for cascading menu actions we don't put this action object into
the menumanager ... we put the SystemSubMenu object so that is what the SystemView will call.
-
-
Specified by:
-
setInputs
in interface
ISystemAction
-
Overrides:
-
setInputs
in class
SystemBaseAction
-
cascadeAllInputs
protected void cascadeAllInputs()
- Called when actions added dynamically
-
setEnabled
public void setEnabled(boolean enable)
- Enable/disable this menu action. This amounts to enabling/disabling the associated sub menu.
Unfortunately, there is no way to do this!
-
-
Specified by:
-
setEnabled
in interface
IAction
-
Overrides:
-
setEnabled
in class
Action
-
Copyright (c) IBM Corporation and others 2000, 2008. All Rights Reserved.
|
|