Class CommonActions

  • All Implemented Interfaces:
    java.lang.Runnable, org.eclipse.jface.viewers.ISelectionChangedListener

    public class CommonActions
    extends java.lang.Object
    implements org.eclipse.jface.viewers.ISelectionChangedListener, java.lang.Runnable
    The Common Actions are Undo, Redo, Cut, Copy, Paste, Delete, Select All, Rename. This class is instantiated for parts requiring these actions in form of "global action bars" implementation.
    Author:
    Christopher Mindus
    • Constructor Summary

      Constructors 
      Constructor Description
      CommonActions​(org.eclipse.ui.IWorkbenchPart part, org.eclipse.swt.widgets.Composite composite, IPropUndoRedo undoRedo, org.eclipse.core.commands.operations.IUndoContext undoContext, org.eclipse.jface.viewers.ISelectionProvider selectionProvider, SelectionEnabler selectionEnabler, java.lang.Runnable updateStatesRunnable, int flags)
      Constructor for a part.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void dispose()
      Disposes of the actions.
      org.eclipse.jface.action.IAction get​(int index)
      Gets the action of index.
      SelectionEnabler getSelectionEnabler()
      Gets the selection enabler instance.
      void run()
      Callback from undo/redo.
      void selectionChanged​(org.eclipse.jface.viewers.SelectionChangedEvent event)
      Notifies that the selection has changed.
      void updateStates()
      Updates the states, call only at initialize of part, once everything is set-up.
      • Methods inherited from class java.lang.Object

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

      • CommonActions

        public CommonActions​(org.eclipse.ui.IWorkbenchPart part,
                             org.eclipse.swt.widgets.Composite composite,
                             IPropUndoRedo undoRedo,
                             org.eclipse.core.commands.operations.IUndoContext undoContext,
                             org.eclipse.jface.viewers.ISelectionProvider selectionProvider,
                             SelectionEnabler selectionEnabler,
                             java.lang.Runnable updateStatesRunnable,
                             int flags)
        Constructor for a part. The part must be either a IViewPart or an IEditorPart, and it must implement a working selection provider.
        Parameters:
        part - The workbench part, can be null if no part is used.
        composite - The composite.
        undoRedo - The undo/redo instance.
        undoContext - The undo context.
        selectionProvider - The selection provider.
        selectionEnabler - A created SelectionEnabler, if null one will be created.
        updateStatesRunnable - Callback to update states, null for none.
        flags - Creation flags.
    • Method Detail

      • dispose

        public void dispose()
        Disposes of the actions.
      • getSelectionEnabler

        public SelectionEnabler getSelectionEnabler()
        Gets the selection enabler instance.
      • selectionChanged

        public void selectionChanged​(org.eclipse.jface.viewers.SelectionChangedEvent event)
        Notifies that the selection has changed.
        Specified by:
        selectionChanged in interface org.eclipse.jface.viewers.ISelectionChangedListener
        Parameters:
        event - Event object describing the change.
      • updateStates

        public void updateStates()
        Updates the states, call only at initialize of part, once everything is set-up. It is not required afterwards, the state is checked by itself using listeners.
      • get

        public org.eclipse.jface.action.IAction get​(int index)
        Gets the action of index.
        Returns:
        null If not created.
      • run

        public void run()
        Callback from undo/redo.
        Specified by:
        run in interface java.lang.Runnable