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

Constructors
`DiagramEditorContextMenuProvider​(org.eclipse.gef.EditPartViewer viewer, org.eclipse.gef.ui.actions.ActionRegistry registry, IConfigurationProvider configurationProvider)` Creates a new DiagramEditorContextMenuProvider.

### Method Summary

All Methods Instance Methods Concrete Methods
`protected void` `addActionToMenu​(org.eclipse.jface.action.IMenuManager manager, java.lang.String actionId, java.lang.String menuGroup)` Adds the action to menu.
`protected void` `addActionToMenuIfAvailable​(org.eclipse.jface.action.IMenuManager manager, java.lang.String actionId, java.lang.String menuGroup)` Adds the action to menu if available.
`protected void` `addAlignmentSubMenu​(org.eclipse.jface.action.IMenuManager manager, java.lang.String group)` Adds the alignment sub menu.
`protected void` `addDefaultMenuGroupEdit​(org.eclipse.jface.action.IMenuManager manager)` Adds the default menu group edit.
`protected void` `addDefaultMenuGroupPrint​(org.eclipse.jface.action.IMenuManager manager)` Adds the default menu group print.
`protected void` `addDefaultMenuGroupRest​(org.eclipse.jface.action.IMenuManager manager)` Adds the default menu group rest.
`protected void` `addDefaultMenuGroupSave​(org.eclipse.jface.action.IMenuManager manager)` Adds the default menu group save.
`protected void` `addDefaultMenuGroupUndo​(org.eclipse.jface.action.IMenuManager manager)` Adds the default menu group undo.
`protected boolean` `allowItem​(org.eclipse.jface.action.IContributionItem itemToAdd)`
`void` `buildContextMenu​(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, setViewer`

### Methods 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, updateAll`

### Methods 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, setDirty`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.eclipse.jface.action.IContributionItem

`isDirty`

### Methods 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 Detail

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

#### 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:
  `buildContextMenu` in class `org.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

    protected void addAlignmentSubMenu​(org.eclipse.jface.action.IMenuManager manager,
                                       java.lang.String group)

Adds the alignment sub menu.

Parameters:
  `manager` - the manager
  `group` - the group

#### addActionToMenu

    protected void addActionToMenu​(org.eclipse.jface.action.IMenuManager manager,
                                   java.lang.String actionId,
                                   java.lang.String menuGroup)

Adds the action to menu.

Parameters:
  `manager` - the manager
  `actionId` - the action id
  `menuGroup` - the menu group

#### addActionToMenuIfAvailable

    protected void addActionToMenuIfAvailable​(org.eclipse.jface.action.IMenuManager manager,
                                              java.lang.String actionId,
                                              java.lang.String menuGroup)

Adds the action to menu if available.

Parameters:
  `manager` - the manager
  `actionId` - the action id
  `menuGroup` - the menu group

#### allowItem

    protected boolean allowItem​(org.eclipse.jface.action.IContributionItem itemToAdd)

Overrides:
  `allowItem` in class `org.eclipse.jface.action.ContributionManager`