Class EMFUndoRedoActionBarContributor

  • All Implemented Interfaces:
    org.eclipse.jface.action.IMenuListener, org.eclipse.ui.IEditorActionBarContributor, org.eclipse.ui.IPropertyListener

    public class EMFUndoRedoActionBarContributor
    extends org.eclipse.ui.part.MultiPageEditorActionBarContributor
    implements org.eclipse.jface.action.IMenuListener, org.eclipse.ui.IPropertyListener
    This is a contributor for an editor, multi-page or otherwise, that implements IEditingDomainProvider. It automatically hooks up the Undo, Redo actions on the Edit menu to the corresponding commands supported by the EditingDomain. 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

      Fields 
      Modifier and Type Field Description
      protected org.eclipse.ui.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 org.eclipse.emf.edit.ui.provider.DiagnosticDecorator.LiveValidator.LiveValidationAction liveValidationAction
      This is the action used to perform validation.
      protected org.eclipse.emf.edit.ui.action.RedoAction redoAction
      This is the action used to implement redo.
      protected int style
      This is used to encode the style bits.
      protected org.eclipse.emf.edit.ui.action.UndoAction undoAction
      This is the action used to implement undo.
      protected org.eclipse.emf.edit.ui.action.ValidateAction validateAction
      This is the action used to perform validation.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void activate()  
      protected void addGlobalActions​(org.eclipse.jface.action.IMenuManager menuManager)
      This inserts global actions before the "additions-end" separator.
      void contributeToMenu​(org.eclipse.jface.action.IMenuManager menuManager)  
      void contributeToStatusLine​(org.eclipse.jface.action.IStatusLineManager statusLineManager)  
      void contributeToToolBar​(org.eclipse.jface.action.IToolBarManager toolBarManager)  
      protected org.eclipse.emf.edit.ui.action.RedoAction createRedoAction()
      Returns the action used to implement redo.
      protected org.eclipse.emf.edit.ui.action.UndoAction createUndoAction()
      Returns the action used to implement undo.
      void deactivate()  
      org.eclipse.ui.IEditorPart getActiveEditor()  
      void init​(org.eclipse.ui.IActionBars actionBars)  
      void menuAboutToShow​(org.eclipse.jface.action.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​(org.eclipse.ui.IEditorPart part)  
      void setActivePage​(org.eclipse.ui.IEditorPart part)  
      void setActiveView​(org.eclipse.ui.IViewPart part)
      Deprecated. 
      void shareGlobalActions​(org.eclipse.ui.part.IPage page, org.eclipse.ui.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 org.eclipse.ui.IEditorPart activeEditor
        This keeps track of the current editor part.
      • undoAction

        protected org.eclipse.emf.edit.ui.action.UndoAction undoAction
        This is the action used to implement undo.
      • redoAction

        protected org.eclipse.emf.edit.ui.action.RedoAction redoAction
        This is the action used to implement redo.
      • validateAction

        protected org.eclipse.emf.edit.ui.action.ValidateAction validateAction
        This is the action used to perform validation.
      • liveValidationAction

        protected org.eclipse.emf.edit.ui.provider.DiagnosticDecorator.LiveValidator.LiveValidationAction liveValidationAction
        This is the action used to perform validation.
        Since:
        2.9
      • 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

      • EMFUndoRedoActionBarContributor

        public EMFUndoRedoActionBarContributor()
        This creates an instance of the contributor.
      • EMFUndoRedoActionBarContributor

        public EMFUndoRedoActionBarContributor​(int style)
        This creates an instance of the contributor.
    • Method Detail

      • init

        public void init​(org.eclipse.ui.IActionBars actionBars)
        Overrides:
        init in class org.eclipse.ui.part.EditorActionBarContributor
      • createUndoAction

        protected org.eclipse.emf.edit.ui.action.UndoAction createUndoAction()
        Returns the action used to implement undo.
        Since:
        2.6
        See Also:
        undoAction
      • createRedoAction

        protected org.eclipse.emf.edit.ui.action.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​(org.eclipse.jface.action.IMenuManager menuManager)
        Overrides:
        contributeToMenu in class org.eclipse.ui.part.EditorActionBarContributor
      • contributeToStatusLine

        public void contributeToStatusLine​(org.eclipse.jface.action.IStatusLineManager statusLineManager)
        Overrides:
        contributeToStatusLine in class org.eclipse.ui.part.EditorActionBarContributor
      • contributeToToolBar

        public void contributeToToolBar​(org.eclipse.jface.action.IToolBarManager toolBarManager)
        Overrides:
        contributeToToolBar in class org.eclipse.ui.part.EditorActionBarContributor
      • shareGlobalActions

        public void shareGlobalActions​(org.eclipse.ui.part.IPage page,
                                       org.eclipse.ui.IActionBars actionBars)
      • setActiveView

        @Deprecated
        public void setActiveView​(org.eclipse.ui.IViewPart part)
        Deprecated.
      • getActiveEditor

        public org.eclipse.ui.IEditorPart getActiveEditor()
      • setActiveEditor

        public void setActiveEditor​(org.eclipse.ui.IEditorPart part)
        Specified by:
        setActiveEditor in interface org.eclipse.ui.IEditorActionBarContributor
        Overrides:
        setActiveEditor in class org.eclipse.ui.part.MultiPageEditorActionBarContributor
      • setActivePage

        public void setActivePage​(org.eclipse.ui.IEditorPart part)
        Specified by:
        setActivePage in class org.eclipse.ui.part.MultiPageEditorActionBarContributor
      • deactivate

        public void deactivate()
      • activate

        public void activate()
      • update

        public void update()
      • menuAboutToShow

        public void menuAboutToShow​(org.eclipse.jface.action.IMenuManager menuManager)
        This implements IMenuListener to help fill the context menus with contributions from the Edit menu.
        Specified by:
        menuAboutToShow in interface org.eclipse.jface.action.IMenuListener
      • addGlobalActions

        protected void addGlobalActions​(org.eclipse.jface.action.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 org.eclipse.ui.IPropertyListener