Class AbstractAction

  • All Implemented Interfaces:
    org.eclipse.core.commands.IHandler, org.eclipse.core.commands.IHandler2, org.eclipse.ui.IActionDelegate, org.eclipse.ui.IEditorActionDelegate, org.eclipse.ui.IViewActionDelegate, org.eclipse.ui.IWorkbenchWindowActionDelegate
    Direct Known Subclasses:
    AbstractOpenAction, AbstractTextAction, ToggleWhitespace

    public abstract class AbstractAction
    extends org.eclipse.core.commands.AbstractHandler
    implements org.eclipse.ui.IWorkbenchWindowActionDelegate, org.eclipse.ui.IViewActionDelegate, org.eclipse.ui.IEditorActionDelegate
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractAction()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected AbstractEditor createActiveEditorDelegate()  
      void dispose()  
      java.lang.Object execute​(org.eclipse.core.commands.ExecutionEvent event)  
      CombinedPreferences getCombinedPreferences()  
      protected AbstractEditor getEditor()  
      org.eclipse.core.resources.IFile getFile()  
      protected org.eclipse.ui.IViewPart getViewPart()  
      org.eclipse.ui.IWorkbenchWindow getWindow()  
      void init​(org.eclipse.ui.IViewPart view)  
      void init​(org.eclipse.ui.IWorkbenchWindow window1)  
      void run​(org.eclipse.jface.action.IAction action)  
      void selectionChanged​(org.eclipse.jface.action.IAction action, org.eclipse.jface.viewers.ISelection selection)  
      void setActiveEditor​(org.eclipse.jface.action.IAction action, org.eclipse.ui.IEditorPart targetEditor)  
      void setEditor​(AbstractEditor editor)  
      void setFile​(org.eclipse.core.resources.IFile file)  
      • Methods inherited from class org.eclipse.core.commands.AbstractHandler

        addHandlerListener, fireHandlerChanged, hasListeners, isEnabled, isHandled, removeHandlerListener, setBaseEnabled, setEnabled
      • Methods inherited from class org.eclipse.core.commands.common.EventManager

        addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • file

        private org.eclipse.core.resources.IFile file
      • window

        private org.eclipse.ui.IWorkbenchWindow window
      • part

        private org.eclipse.ui.IWorkbenchPart part
    • Constructor Detail

      • AbstractAction

        public AbstractAction()
    • Method Detail

      • execute

        public java.lang.Object execute​(org.eclipse.core.commands.ExecutionEvent event)
                                 throws org.eclipse.core.commands.ExecutionException
        Specified by:
        execute in interface org.eclipse.core.commands.IHandler
        Throws:
        org.eclipse.core.commands.ExecutionException
      • getViewPart

        protected org.eclipse.ui.IViewPart getViewPart()
      • run

        public void run​(org.eclipse.jface.action.IAction action)
        Specified by:
        run in interface org.eclipse.ui.IActionDelegate
      • createActiveEditorDelegate

        protected AbstractEditor createActiveEditorDelegate()
      • dispose

        public void dispose()
        Specified by:
        dispose in interface org.eclipse.core.commands.IHandler
        Specified by:
        dispose in interface org.eclipse.ui.IWorkbenchWindowActionDelegate
        Overrides:
        dispose in class org.eclipse.core.commands.AbstractHandler
      • setActiveEditor

        public void setActiveEditor​(org.eclipse.jface.action.IAction action,
                                    org.eclipse.ui.IEditorPart targetEditor)
        Specified by:
        setActiveEditor in interface org.eclipse.ui.IEditorActionDelegate
      • init

        public void init​(org.eclipse.ui.IWorkbenchWindow window1)
        Specified by:
        init in interface org.eclipse.ui.IWorkbenchWindowActionDelegate
      • selectionChanged

        public void selectionChanged​(org.eclipse.jface.action.IAction action,
                                     org.eclipse.jface.viewers.ISelection selection)
        Specified by:
        selectionChanged in interface org.eclipse.ui.IActionDelegate
      • getFile

        public org.eclipse.core.resources.IFile getFile()
        Returns:
        could return null, if we do not have associated file and operating on editor inputs instead
      • setFile

        public void setFile​(org.eclipse.core.resources.IFile file)
        Parameters:
        file - to perform operation on
      • getWindow

        public org.eclipse.ui.IWorkbenchWindow getWindow()
        Returns:
        may be null if this action is not yet initialized
      • init

        public final void init​(org.eclipse.ui.IViewPart view)
        Specified by:
        init in interface org.eclipse.ui.IViewActionDelegate