Class ContextualLaunchAction
- java.lang.Object
-
- org.eclipse.debug.ui.actions.ContextualLaunchAction
-
- All Implemented Interfaces:
IMenuCreator,IActionDelegate,IObjectActionDelegate
public abstract class ContextualLaunchAction extends Object implements IObjectActionDelegate, IMenuCreator
An action delegate that builds a context menu with applicable launch shortcuts for a specific launch mode.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
Constructors Constructor Description ContextualLaunchAction(String mode)Constructs a contextual launch action for the given launch mode.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddispose()Disposes the menu returned bygetMenu.protected voidfillMenu(Menu menu)Fills the menu with applicable launch shortcutsprotected ILaunchManagergetLaunchManager()Returns the launch managerMenugetMenu(Control parent)Returns the SWT menu, created as a pop up menu parented by the given control.MenugetMenu(Menu parent)Returns an SWT menu created as a drop down menu parented by the given menu.voidrun(IAction action)Performs 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 Detail
-
ContextualLaunchAction
public ContextualLaunchAction(String mode)
Constructs a contextual launch action for the given launch mode.- Parameters:
mode- launch mode
-
-
Method Detail
-
setActivePart
public void setActivePart(IAction action, IWorkbenchPart targetPart)
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
public Menu getMenu(Control parent)
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
public Menu getMenu(Menu parent)
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
public void run(IAction action)
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
public void selectionChanged(IAction action, ISelection selection)
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
protected ILaunchManager getLaunchManager()
Returns the launch manager- Returns:
- the launch manager
- Since:
- 3.3
-
fillMenu
protected void fillMenu(Menu menu)
Fills the menu with applicable launch shortcuts- Parameters:
menu- The menu to fill
-
-