Class ContextualLaunchAction
- All Implemented Interfaces:
IMenuCreator,IActionDelegate,IObjectActionDelegate
This class can be sub-classed and contributed as an object contribution pop-up menu extension action. When invoked, it becomes a sub-menu that dynamically builds a list of applicable launch shortcuts for the current selection. Each launch shortcut may have optional information to support a context menu action.
Clients may subclass this class.
- Since:
- 3.0
-
Constructor Summary
ConstructorsConstructorDescriptionContextualLaunchAction(String mode) Constructs a contextual launch action for the given launch mode. -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()Disposes the menu returned bygetMenu.protected voidFills the menu with applicable launch shortcutsprotected ILaunchManagerReturns the launch managerReturns the SWT menu, created as a pop up menu parented by the given control.Returns an SWT menu created as a drop down menu parented by the given menu.voidPerforms this action.voidselectionChanged(IAction action, ISelection selection) Notifies this action delegate that the selection in the workbench has changed.voidsetActivePart(IAction action, IWorkbenchPart targetPart) Sets the active part for the delegate.
-
Constructor Details
-
ContextualLaunchAction
Constructs a contextual launch action for the given launch mode.- Parameters:
mode- launch mode
-
-
Method Details
-
setActivePart
Description copied from interface:IObjectActionDelegateSets the active part for the delegate. The active part is commonly used to get a working context for the action, such as the shell for any dialog which is needed.This method will be called every time the action appears in a popup menu. The targetPart may change with each invocation.
- Specified by:
setActivePartin interfaceIObjectActionDelegate- Parameters:
action- the action proxy that handles presentation portion of the action; must not benull.targetPart- the new part target; must not benull.
-
dispose
public void dispose()Description copied from interface:IMenuCreatorDisposes the menu returned bygetMenu. Does nothing if there is no menu. This method will be executed only when the parent of the menu is disposed.- Specified by:
disposein interfaceIMenuCreator
-
getMenu
Description copied from interface:IMenuCreatorReturns the SWT menu, created as a pop up menu parented by the given control. In most cases, this menu can be created once, cached and reused when the pop-up/drop-down action occurs. If the menu must be dynamically created (i.e., each time it is popped up or dropped down), the old menu should be disposed of before replacing it with the new menu.- Specified by:
getMenuin interfaceIMenuCreator- Parameters:
parent- the parent control- Returns:
- the menu, or
nullif the menu could not be created
-
getMenu
Description copied from interface:IMenuCreatorReturns an SWT menu created as a drop down menu parented by the given menu. In most cases, this menu can be created once, cached and reused when the pop-up/drop-down action occurs. If the menu must be dynamically created (i.e., each time it is popped up or dropped down), the old menu should be disposed of before replacing it with the new menu.- Specified by:
getMenuin interfaceIMenuCreator- Parameters:
parent- the parent menu- Returns:
- the menu, or
nullif the menu could not be created
-
run
Description copied from interface:IActionDelegatePerforms this action.This method is called by the proxy action when the action has been triggered. Implement this method to do the actual work.
Note: If the action delegate also implements
IActionDelegate2, then this method is not invoked but instead therunWithEvent(IAction, Event)method is called.- Specified by:
runin interfaceIActionDelegate- Parameters:
action- the action proxy that handles the presentation portion of the action
-
selectionChanged
Description copied from interface:IActionDelegateNotifies this action delegate that the selection in the workbench has changed.Implementers can use this opportunity to change the availability of the action or to modify other presentation properties.
When the selection changes, the action enablement state is updated based on the criteria specified in the plugin.xml file. Then the delegate is notified of the selection change regardless of whether the enablement criteria in the plugin.xml file is met.
- Specified by:
selectionChangedin interfaceIActionDelegate- Parameters:
action- the action proxy that handles presentation portion of the actionselection- the current selection, ornullif there is no selection.
-
getLaunchManager
Returns the launch manager- Returns:
- the launch manager
- Since:
- 3.3
-
fillMenu
Fills the menu with applicable launch shortcuts- Parameters:
menu- The menu to fill
-