org.eclipse.graphiti.ui.editor
Class DiagramEditorContextMenuProvider

java.lang.Object
  extended by ContextMenuProvider
      extended by org.eclipse.graphiti.ui.editor.DiagramEditorContextMenuProvider

public class DiagramEditorContextMenuProvider
extends 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
private  ActionRegistry actionRegistry
           
private  IConfigurationProvider configurationProvider
           
 
Constructor Summary
DiagramEditorContextMenuProvider(EditPartViewer viewer, ActionRegistry registry, IConfigurationProvider configurationProvider)
          Creates a new DiagramEditorContextMenuProvider.
 
Method Summary
protected  void addActionToMenu(IMenuManager manager, String actionId, String menuGroup)
          Adds the action to menu.
protected  void addActionToMenuIfAvailable(IMenuManager manager, String actionId, String menuGroup)
          Adds the action to menu if available.
protected  void addAlignmentSubMenu(IMenuManager manager, String group)
          Adds the alignment sub menu.
protected  void addDefaultMenuGroupEdit(IMenuManager manager)
          Adds the default menu group edit.
protected  void addDefaultMenuGroupPrint(IMenuManager manager)
          Adds the default menu group print.
protected  void addDefaultMenuGroupRest(IMenuManager manager)
          Adds the default menu group rest.
protected  void addDefaultMenuGroupSave(IMenuManager manager)
          Adds the default menu group save.
protected  void addDefaultMenuGroupUndo(IMenuManager manager)
          Adds the default menu group undo.
private  void addEntries(IMenuManager manager, IContextMenuEntry[] contextMenuEntries, ICustomContext context, String groupID, String textParentEntry)
           
protected  boolean allowItem(IContributionItem itemToAdd)
           
private  void appendContributionItem(IMenuManager manager, String groupID, IContributionItem contributionItem)
           
 void buildContextMenu(IMenuManager manager)
          Adds the Actions to the given IMenuManager, which is displayed as a context-menu.
private  void extendCustomContext(PictogramElement pe, CustomContext context)
           
private  IConfigurationProvider getConfigurationProvider()
           
private  DiagramEditorInternal getEditor()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

actionRegistry

private final ActionRegistry actionRegistry

configurationProvider

private final IConfigurationProvider configurationProvider
Constructor Detail

DiagramEditorContextMenuProvider

public DiagramEditorContextMenuProvider(EditPartViewer viewer,
                                        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
Method Detail

buildContextMenu

public void buildContextMenu(IMenuManager manager)
Adds the Actions to the given IMenuManager, which is displayed as a context-menu.

Parameters:
manager - the manager
See Also:
ContextMenuProvider#buildContextMenu(IMenuManager)

addDefaultMenuGroupUndo

protected void addDefaultMenuGroupUndo(IMenuManager manager)
Adds the default menu group undo.

Parameters:
manager - the manager

addDefaultMenuGroupSave

protected void addDefaultMenuGroupSave(IMenuManager manager)
Adds the default menu group save.

Parameters:
manager - the manager

addDefaultMenuGroupEdit

protected void addDefaultMenuGroupEdit(IMenuManager manager)
Adds the default menu group edit.

Parameters:
manager - the manager

addDefaultMenuGroupPrint

protected void addDefaultMenuGroupPrint(IMenuManager manager)
Adds the default menu group print.

Parameters:
manager - the manager

addDefaultMenuGroupRest

protected void addDefaultMenuGroupRest(IMenuManager manager)
Adds the default menu group rest.

Parameters:
manager - the manager

addEntries

private void addEntries(IMenuManager manager,
                        IContextMenuEntry[] contextMenuEntries,
                        ICustomContext context,
                        String groupID,
                        String textParentEntry)

appendContributionItem

private void appendContributionItem(IMenuManager manager,
                                    String groupID,
                                    IContributionItem contributionItem)

extendCustomContext

private void extendCustomContext(PictogramElement pe,
                                 CustomContext context)

addAlignmentSubMenu

protected void addAlignmentSubMenu(IMenuManager manager,
                                   String group)
Adds the alignment sub menu.

Parameters:
manager - the manager
group - the group

addActionToMenu

protected void addActionToMenu(IMenuManager manager,
                               String actionId,
                               String menuGroup)
Adds the action to menu.

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

addActionToMenuIfAvailable

protected void addActionToMenuIfAvailable(IMenuManager manager,
                                          String actionId,
                                          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(IContributionItem itemToAdd)

getConfigurationProvider

private IConfigurationProvider getConfigurationProvider()

getEditor

private DiagramEditorInternal getEditor()


Copyright (c) SAP AG 2005, 2010.