org.eclipse.emf.edit.ui.action
Class EditingDomainActionBarContributor

java.lang.Object
  extended by org.eclipse.ui.part.EditorActionBarContributor
      extended by org.eclipse.ui.part.MultiPageEditorActionBarContributor
          extended by org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor
All Implemented Interfaces:
IMenuListener, IEditorActionBarContributor, IPropertyListener
Direct Known Subclasses:
Ecore2EcoreActionBarContributor, Ecore2XMLActionBarContributor, EcoreActionBarContributor, GenModelActionBarContributor, MappingEditor.ActionBarContributor

public class EditingDomainActionBarContributor
extends MultiPageEditorActionBarContributor
implements IMenuListener, IPropertyListener

This is a contributor for an editor, multi-page or otherwise, that implements IEditingDomainProvider. It automatically hooks up the Undo, Redo, Cut, Copy, Paste, and Delete actions on the Edit menu to the corresponding commands supported by the EditingDomain. The editor site'selection provider is used to keep the Cut, Copy, Paste, and Delete actions up-to-date. The actions are also refreshed every time the editor fires to its IPropertyListeners.

Another very useful feature of this contributor is that it can be used as follows:

   ((IMenuListener)((IEditorSite)getSite()).getActionBarContributor()).menuAboutToShow(menuManager);
 
to contribute the Edit menu actions to a pop-up menu.


Field Summary
protected  IEditorPart activeEditor
          This keeps track of the current editor part.
static int ADDITIONS_LAST_STYLE
          This style bit indicates that the "additions" separator should come after the "edit" separator.
protected  ControlAction controlAction
          This is the action used to control or uncontrol a contained object.
protected  CopyAction copyAction
          This is the action used to implement copy.
protected  CutAction cutAction
          This is the action used to implement cut.
protected  DeleteAction deleteAction
          This is the action used to implement delete.
protected  LoadResourceAction loadResourceAction
          This is the action used to load a resource.
protected  PasteAction pasteAction
          This is the action used to implement paste.
protected  RedoAction redoAction
          This is the action used to implement redo.
protected  int style
          This is used to encode the style bits.
protected  UndoAction undoAction
          This is the action used to implement undo.
protected  ValidateAction validateAction
          This is the action used to perform validation.
 
Constructor Summary
EditingDomainActionBarContributor()
          This creates an instance of the contributor.
EditingDomainActionBarContributor(int style)
          This creates an instance of the contributor.
 
Method Summary
 void activate()
           
protected  void addGlobalActions(IMenuManager menuManager)
          This inserts global actions before the "additions-end" separator.
 void contributeToMenu(IMenuManager menuManager)
           
 void contributeToStatusLine(IStatusLineManager statusLineManager)
           
 void contributeToToolBar(IToolBarManager toolBarManager)
           
protected  CopyAction createCopyAction()
          Returns the action used to implement copy.
protected  CutAction createCutAction()
          Returns the action used to implement cut.
protected  DeleteAction createDeleteAction()
          Returns the action used to implement delete.
protected  PasteAction createPasteAction()
          Returns the action used to implement paste.
protected  RedoAction createRedoAction()
          Returns the action used to implement redo.
protected  UndoAction createUndoAction()
          Returns the action used to implement undo.
 void deactivate()
           
 IEditorPart getActiveEditor()
           
 void init(IActionBars actionBars)
           
 void menuAboutToShow(IMenuManager menuManager)
          This implements IMenuListener to help fill the context menus with contributions from the Edit menu.
 void propertyChanged(java.lang.Object source, int id)
           
protected  boolean removeAllReferencesOnDelete()
          This determines whether or not the delete action should clean up all references to the deleted objects.
 void setActiveEditor(IEditorPart part)
           
 void setActivePage(IEditorPart part)
           
 void setActiveView(IViewPart part)
          Deprecated.  
 void shareGlobalActions(IPage page, IActionBars actionBars)
           
 void update()
           
 
Methods inherited from class org.eclipse.ui.part.EditorActionBarContributor
contributeToCoolBar, dispose, getActionBars, getPage, init
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

activeEditor

protected IEditorPart activeEditor
This keeps track of the current editor part.


deleteAction

protected DeleteAction deleteAction
This is the action used to implement delete.


cutAction

protected CutAction cutAction
This is the action used to implement cut.


copyAction

protected CopyAction copyAction
This is the action used to implement copy.


pasteAction

protected PasteAction pasteAction
This is the action used to implement paste.


undoAction

protected UndoAction undoAction
This is the action used to implement undo.


redoAction

protected RedoAction redoAction
This is the action used to implement redo.


loadResourceAction

protected LoadResourceAction loadResourceAction
This is the action used to load a resource.


controlAction

protected ControlAction controlAction
This is the action used to control or uncontrol a contained object.


validateAction

protected ValidateAction validateAction
This is the action used to perform validation.


ADDITIONS_LAST_STYLE

public static final int ADDITIONS_LAST_STYLE
This style bit indicates that the "additions" separator should come after the "edit" separator.

See Also:
Constant Field Values

style

protected int style
This is used to encode the style bits.

Constructor Detail

EditingDomainActionBarContributor

public EditingDomainActionBarContributor()
This creates an instance of the contributor.


EditingDomainActionBarContributor

public EditingDomainActionBarContributor(int style)
This creates an instance of the contributor.

Method Detail

init

public void init(IActionBars actionBars)
Overrides:
init in class EditorActionBarContributor

createDeleteAction

protected DeleteAction createDeleteAction()
Returns the action used to implement delete.

Since:
2.6
See Also:
deleteAction

createCutAction

protected CutAction createCutAction()
Returns the action used to implement cut.

Since:
2.6
See Also:
cutAction

createCopyAction

protected CopyAction createCopyAction()
Returns the action used to implement copy.

Since:
2.6
See Also:
copyAction

createPasteAction

protected PasteAction createPasteAction()
Returns the action used to implement paste.

Since:
2.6
See Also:
pasteAction

createUndoAction

protected UndoAction createUndoAction()
Returns the action used to implement undo.

Since:
2.6
See Also:
undoAction

createRedoAction

protected RedoAction createRedoAction()
Returns the action used to implement redo.

Since:
2.6
See Also:
redoAction

removeAllReferencesOnDelete

protected boolean removeAllReferencesOnDelete()
This determines whether or not the delete action should clean up all references to the deleted objects. It is false by default, to provide the same beahviour, by default, as in EMF 2.1 and before. You should probably override this method to return true, in order to get the new, more useful beahviour.

Since:
2.2

contributeToMenu

public void contributeToMenu(IMenuManager menuManager)
Overrides:
contributeToMenu in class EditorActionBarContributor

contributeToStatusLine

public void contributeToStatusLine(IStatusLineManager statusLineManager)
Overrides:
contributeToStatusLine in class EditorActionBarContributor

contributeToToolBar

public void contributeToToolBar(IToolBarManager toolBarManager)
Overrides:
contributeToToolBar in class EditorActionBarContributor

shareGlobalActions

public void shareGlobalActions(IPage page,
                               IActionBars actionBars)

setActiveView

@Deprecated
public void setActiveView(IViewPart part)
Deprecated. 


getActiveEditor

public IEditorPart getActiveEditor()

setActiveEditor

public void setActiveEditor(IEditorPart part)
Specified by:
setActiveEditor in interface IEditorActionBarContributor
Overrides:
setActiveEditor in class MultiPageEditorActionBarContributor

setActivePage

public void setActivePage(IEditorPart part)
Specified by:
setActivePage in class MultiPageEditorActionBarContributor

deactivate

public void deactivate()

activate

public void activate()

update

public void update()

menuAboutToShow

public void menuAboutToShow(IMenuManager menuManager)
This implements IMenuListener to help fill the context menus with contributions from the Edit menu.

Specified by:
menuAboutToShow in interface IMenuListener

addGlobalActions

protected void addGlobalActions(IMenuManager menuManager)
This inserts global actions before the "additions-end" separator.


propertyChanged

public void propertyChanged(java.lang.Object source,
                            int id)
Specified by:
propertyChanged in interface IPropertyListener

Copyright 2001-2006 IBM Corporation and others.
All Rights Reserved.