Remote Systems
v6.4.1

com.ibm.etools.systems.core.ui.actions
Class SystemBaseSubMenuAction

java.lang.Object
  extended byAction
      extended bycom.ibm.etools.systems.core.ui.actions.SystemBaseAction
          extended bycom.ibm.etools.systems.core.ui.actions.SystemBaseSubMenuAction
All Implemented Interfaces:
ISystemAction
Direct Known Subclasses:
SystemCascadingBrowseWithAction, SystemCascadingCompareWithAction, SystemCascadingCompileAction, SystemCascadingExpandToAction, SystemCascadingGoToAction, SystemCascadingGotoActionOLD, SystemCascadingNewAction, SystemCascadingOpenWithAction, SystemCascadingPreferencesAction, SystemCascadingPulldownMenuAction, SystemCascadingRemoteServerBaseAction, SystemCascadingRemoteServersAction, SystemCascadingReplaceWithAction, SystemCascadingUserIdPerSystemTypeAction, SystemCascadingViewAction, SystemCascadingWorkWithAction, SystemCompileCascadeByProfileAction, SystemFilterCascadingNewFilterPoolReferenceAction, SystemFilterCascadingNewFilterPoolReferenceFPMgrAction, SystemUDACascadeAction, SystemUDACascadeByProfileAction

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.

See Also:
Serialized Form

Field Summary
protected  String actionLabel
           
static String copyright
           
protected  boolean createMenuEachTime
           
protected  String menuID
           
protected  boolean populateMenuEachTime
           
protected  String prefix
           
protected  ResourceBundle rb
           
protected  SystemSubMenuManager subMenu
           
 
Fields inherited from class com.ibm.etools.systems.core.ui.actions.SystemBaseAction
allowOnMultipleSelection, arrowCursor, helpId, selectionSensitive, shell, sSelection, traceSelections, traceTarget, viewer, waitCursor
 
Constructor Summary
protected SystemBaseSubMenuAction(ResourceBundle rb, String prefix, ImageDescriptor image, Shell shell)
          Constructor for SystemBaseSubMenuAction when there is an image
protected SystemBaseSubMenuAction(ResourceBundle rb, String prefix, Shell shell)
          Constructor for SystemBaseSubMenuAction when there is no image
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
 
Method Summary
protected  void cascadeAllInputs()
          Called when actions added dynamically
protected  SystemViewMenuListener createMnemonicsListener(boolean setMnemonicsOnlyOnce)
          Overridable method that instantiates the menu listener who job is to add mnemonics.
protected  void createStandardGroups(IMenuManager menu)
          Creates the standard groups for the context sub-menu.
 IAction[] getActions()
          Return the actions currently in the menu.
 IStructuredSelection getSelection()
          Return the selection.
 Shell getShell()
          Return the shell.
 IMenuManager getSubMenu()
          Return the MenuManager object.
 Viewer getViewer()
          Return the viewer.
abstract  IMenuManager populateSubMenu(IMenuManager menu)
          Must be overridden Example of this: menu.add(new MyAction1());
 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.
 void setEnabled(boolean enable)
          Enable/disable this menu action.
 void setInputs(Shell shell, Viewer v, ISelection selection)
          An optimization for performance reasons that allows all inputs to be set in one call.
 void setInputsFromSubMenuManager(Shell shell, Viewer v, ISelection selection)
          Special method called by our submenu manager when from its setInputs method.
 void setMenuID(String Id)
          Set the menu ID.
 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.
 void setSelection(ISelection selection)
          This is called by the framework to set the selection input, just prior to showing the popup menu.
 void setShell(Shell shell)
          Sets the parent shell for this action.
 void setTest(boolean testMode)
          Set test mode on
 void setViewer(Viewer v)
          This is called by the framework to set the selection input, just prior to showing the popup menu.
 
Methods inherited from class com.ibm.etools.systems.core.ui.actions.SystemBaseAction
allowOnMultipleSelection, checkObjectType, getAdapter, getContextMenuGroup, getCurrentTreeView, getDescription, getFirstSelection, getHelpContextId, getLabel, getNextSelection, getRemoteAdapter, getSelectionProvider, getShell, getString, getStringOrNull, getSystemConnection, getToolTip, isDummy, isEnabled, isSelectionSensitive, issueTraceMessage, run, selectionChanged, setAvailableOffline, setBusyCursor, setContextMenuGroup, setDisplayCursor, setDisplayCursor, setHelp, setSelectionProvider, setSelectionSensitive, setSystemConnection, setTracing, setTracing, updateSelection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

copyright

public static final String copyright
See Also:
Constant Field Values

subMenu

protected SystemSubMenuManager subMenu

rb

protected ResourceBundle rb

prefix

protected String prefix

actionLabel

protected String actionLabel

menuID

protected String menuID

createMenuEachTime

protected boolean createMenuEachTime

populateMenuEachTime

protected boolean populateMenuEachTime
Constructor Detail

SystemBaseSubMenuAction

protected SystemBaseSubMenuAction(ResourceBundle rb,
                                  String prefix,
                                  ImageDescriptor image,
                                  Shell shell)
Constructor for SystemBaseSubMenuAction when there is an image

Parameters:
rb - ResourceBundle containing action's label, tooltip and description
prefix - The root resource bundle key to which ".label" and ".tooltip" are appended
image - The image to display for this action
shell - The owning shell. If you pass null now, be sure to call setShell later

SystemBaseSubMenuAction

protected SystemBaseSubMenuAction(ResourceBundle rb,
                                  String prefix,
                                  Shell shell)
Constructor for SystemBaseSubMenuAction when there is no image

Parameters:
rb - ResourceBundle containing action's label, tooltip and description
prefix - The root resource bundle key to which ".label" and ".tooltip" are appended
shell - The owning shell. If you pass null now, be sure to call setShell later

SystemBaseSubMenuAction

protected SystemBaseSubMenuAction(String label,
                                  Shell shell)
Constructor for SystemBaseSubMenuAction when there is just a string

Parameters:
label - The label to display

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
Method Detail

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 SystemViewMenuListener 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

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!


Remote Systems
v6.4.1

Copyright © 2005 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.