org.eclipse.xpand.ui.refactoring.actions
Class QuickMenuAction

java.lang.Object
  extended by org.eclipse.core.commands.common.EventManager
      extended by org.eclipse.jface.action.AbstractAction
          extended by org.eclipse.jface.action.Action
              extended by org.eclipse.xpand.ui.refactoring.actions.QuickMenuAction
All Implemented Interfaces:
org.eclipse.jface.action.IAction

public abstract class QuickMenuAction
extends org.eclipse.jface.action.Action

A quick menu actions provides support to assign short cuts to sub menus.

Since:
3.0

Field Summary
 
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
QuickMenuAction(java.lang.String commandId)
          Creates a new quick menu action with the given command id.
 
Method Summary
 java.lang.String addShortcut(java.lang.String menuText)
          Adds the shortcut to the given menu text and returns it.
protected  org.eclipse.swt.graphics.Point computeMenuLocation(org.eclipse.swt.custom.StyledText text)
          Hook to compute the menu location if the focus widget is a styled text widget.
protected  org.eclipse.swt.graphics.Point computeMenuLocation(org.eclipse.swt.widgets.Table table)
          Hook to compute the menu location if the focus widget is a table widget.
protected  org.eclipse.swt.graphics.Point computeMenuLocation(org.eclipse.swt.widgets.Tree tree)
          Hook to compute the menu location if the focus widget is a tree widget.
protected abstract  void fillMenu(org.eclipse.jface.action.IMenuManager menu)
          Hook to fill a menu manager with the items of the sub menu.
 void run()
          
 
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, isEnabled, isHandled, notifyResult, removeAcceleratorText, removeMnemonics, runWithEvent, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipText
 
Methods inherited from class org.eclipse.jface.action.AbstractAction
addPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListener
 
Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
 
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, removePropertyChangeListener
 

Constructor Detail

QuickMenuAction

public QuickMenuAction(java.lang.String commandId)
Creates a new quick menu action with the given command id.

Parameters:
commandId - the command id of the short cut used to open the sub menu
Method Detail

run

public void run()

Specified by:
run in interface org.eclipse.jface.action.IAction
Overrides:
run in class org.eclipse.jface.action.Action

fillMenu

protected abstract void fillMenu(org.eclipse.jface.action.IMenuManager menu)
Hook to fill a menu manager with the items of the sub menu.

Parameters:
menu - the sub menu to fill

addShortcut

public java.lang.String addShortcut(java.lang.String menuText)
Adds the shortcut to the given menu text and returns it.

Parameters:
menuText - the menu text
Returns:
the menu text with the shortcut
Since:
3.1

computeMenuLocation

protected org.eclipse.swt.graphics.Point computeMenuLocation(org.eclipse.swt.custom.StyledText text)
Hook to compute the menu location if the focus widget is a styled text widget.

Parameters:
text - the styled text widget that has the focus
Returns:
a widget relative position of the menu to pop up or null if now position inside the widget can be computed

computeMenuLocation

protected org.eclipse.swt.graphics.Point computeMenuLocation(org.eclipse.swt.widgets.Tree tree)
Hook to compute the menu location if the focus widget is a tree widget.

Parameters:
tree - the tree widget that has the focus
Returns:
a widget relative position of the menu to pop up or null if now position inside the widget can be computed

computeMenuLocation

protected org.eclipse.swt.graphics.Point computeMenuLocation(org.eclipse.swt.widgets.Table table)
Hook to compute the menu location if the focus widget is a table widget.

Parameters:
table - the table widget that has the focus
Returns:
a widget relative position of the menu to pop up or null if now position inside the widget can be computed