Package org.eclipse.graphiti.ui.editor
Class DiagramEditorContextMenuProvider
java.lang.Object
org.eclipse.jface.action.ContributionManager
org.eclipse.jface.action.MenuManager
org.eclipse.gef.ContextMenuProvider
org.eclipse.graphiti.ui.editor.DiagramEditorContextMenuProvider
- All Implemented Interfaces:
org.eclipse.jface.action.IContributionItem,org.eclipse.jface.action.IContributionManager,org.eclipse.jface.action.IMenuListener,org.eclipse.jface.action.IMenuManager
public class DiagramEditorContextMenuProvider
extends org.eclipse.gef.ContextMenuProvider
Provides a standard-context-menu and adds it to the given EditPartViewer.
Another feature is, that it can set the menu-location to all Actions.
Some of the standard-menu-items are: undo/redo, delete, copy/paste, alignment, zooming.
-
Field Summary
Fields inherited from class org.eclipse.jface.action.MenuManager
MANAGER_KEY, visible -
Constructor Summary
ConstructorsConstructorDescriptionDiagramEditorContextMenuProvider(org.eclipse.gef.EditPartViewer viewer, org.eclipse.gef.ui.actions.ActionRegistry registry, IConfigurationProvider configurationProvider) Creates a new DiagramEditorContextMenuProvider. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddActionToMenu(org.eclipse.jface.action.IMenuManager manager, String actionId, String menuGroup) Adds the action to menu.protected voidaddActionToMenuIfAvailable(org.eclipse.jface.action.IMenuManager manager, String actionId, String menuGroup) Adds the action to menu if available.protected voidaddAlignmentSubMenu(org.eclipse.jface.action.IMenuManager manager, String group) Adds the alignment sub menu.protected voidaddDefaultMenuGroupEdit(org.eclipse.jface.action.IMenuManager manager) Adds the default menu group edit.protected voidaddDefaultMenuGroupPrint(org.eclipse.jface.action.IMenuManager manager) Adds the default menu group print.protected voidaddDefaultMenuGroupRest(org.eclipse.jface.action.IMenuManager manager) Adds the default menu group rest.protected voidaddDefaultMenuGroupSave(org.eclipse.jface.action.IMenuManager manager) Adds the default menu group save.protected voidaddDefaultMenuGroupUndo(org.eclipse.jface.action.IMenuManager manager) Adds the default menu group undo.protected booleanallowItem(org.eclipse.jface.action.IContributionItem itemToAdd) voidbuildContextMenu(org.eclipse.jface.action.IMenuManager manager) Adds the Actions to the given IMenuManager, which is displayed as a context-menu.Methods inherited from class org.eclipse.gef.ContextMenuProvider
getViewer, menuAboutToShow, setViewerMethods inherited from class org.eclipse.jface.action.MenuManager
addMenuListener, createContextMenu, createMenuBar, createMenuBar, dispose, doItemFill, fill, fill, fill, fill, findMenuUsingPath, findUsingPath, getId, getImageDescriptor, getMenu, getMenuItem, getMenuItemCount, getMenuItems, getMenuText, getOverrides, getParent, getRemoveAllWhenShown, isDynamic, isEnabled, isGroupMarker, isSeparator, isSubstituteFor, isVisible, markDirty, menuExist, removeMenuListener, saveWidgetState, setActionDefinitionId, setImageDescriptor, setMenuText, setOverrides, setParent, setRemoveAllWhenShown, setVisible, toString, update, update, update, update, updateAllMethods inherited from class org.eclipse.jface.action.ContributionManager
add, add, appendToGroup, appendToGroup, dumpStatistics, find, getItems, getSize, hasDynamicItems, indexOf, indexOf, insert, insertAfter, insertAfter, insertBefore, insertBefore, internalSetItems, isDirty, isEmpty, itemAdded, itemRemoved, prependToGroup, prependToGroup, remove, remove, removeAll, replaceItem, setDirtyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.jface.action.IContributionItem
isDirtyMethods inherited from interface org.eclipse.jface.action.IContributionManager
add, add, appendToGroup, appendToGroup, find, getItems, insertAfter, insertAfter, insertBefore, insertBefore, isDirty, isEmpty, prependToGroup, prependToGroup, remove, remove, removeAll
-
Constructor Details
-
DiagramEditorContextMenuProvider
public DiagramEditorContextMenuProvider(org.eclipse.gef.EditPartViewer viewer, org.eclipse.gef.ui.actions.ActionRegistry registry, IConfigurationProvider configurationProvider) Creates a new DiagramEditorContextMenuProvider.- Parameters:
viewer- The EditPartViewer, for which the context-menu shall be displayed.registry- The action-registry, which contains the actions corresponding to the menu-items.configurationProvider- the configuration provider- Since:
- 0.10
-
-
Method Details
-
buildContextMenu
public void buildContextMenu(org.eclipse.jface.action.IMenuManager manager) Adds the Actions to the given IMenuManager, which is displayed as a context-menu.- Specified by:
buildContextMenuin classorg.eclipse.gef.ContextMenuProvider- Parameters:
manager- the manager- See Also:
-
ContextMenuProvider.buildContextMenu(IMenuManager)
-
addDefaultMenuGroupUndo
protected void addDefaultMenuGroupUndo(org.eclipse.jface.action.IMenuManager manager) Adds the default menu group undo.- Parameters:
manager- the manager
-
addDefaultMenuGroupSave
protected void addDefaultMenuGroupSave(org.eclipse.jface.action.IMenuManager manager) Adds the default menu group save.- Parameters:
manager- the manager
-
addDefaultMenuGroupEdit
protected void addDefaultMenuGroupEdit(org.eclipse.jface.action.IMenuManager manager) Adds the default menu group edit.- Parameters:
manager- the manager
-
addDefaultMenuGroupPrint
protected void addDefaultMenuGroupPrint(org.eclipse.jface.action.IMenuManager manager) Adds the default menu group print.- Parameters:
manager- the manager
-
addDefaultMenuGroupRest
protected void addDefaultMenuGroupRest(org.eclipse.jface.action.IMenuManager manager) Adds the default menu group rest.- Parameters:
manager- the manager
-
addAlignmentSubMenu
Adds the alignment sub menu.- Parameters:
manager- the managergroup- the group
-
addActionToMenu
protected void addActionToMenu(org.eclipse.jface.action.IMenuManager manager, String actionId, String menuGroup) Adds the action to menu.- Parameters:
manager- the manageractionId- the action idmenuGroup- the menu group
-
addActionToMenuIfAvailable
protected void addActionToMenuIfAvailable(org.eclipse.jface.action.IMenuManager manager, String actionId, String menuGroup) Adds the action to menu if available.- Parameters:
manager- the manageractionId- the action idmenuGroup- the menu group
-
allowItem
protected boolean allowItem(org.eclipse.jface.action.IContributionItem itemToAdd) - Overrides:
allowItemin classorg.eclipse.jface.action.ContributionManager
-