Package com.iizigo.handler
Class CommonActions
- java.lang.Object
- com.iizigo.handler.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
Field Summary
Fields Modifier and Type Field Description static int
CREATE_EDIT_CUT_COPY_PASTE
Flag for creation of Standard Edit actions Cut, Copy, Paste.static int
CREATE_EDIT_DELETE
Flag for creation of Standard Edit action Delete.static int
CREATE_RENAME
Flag for creation of Rename.static int
CREATE_SELECT_ALL
Flag for creation of Select All.static int
CREATE_STANDARD_EDIT
Flag for creation of Standard Edit actions Cut, Copy, Paste, Delete.static int
CREATE_UNDO_REDO
Flag for creation of Undo/Redo.static int
INDEX_COPY
static int
INDEX_CUT
static int
INDEX_DELETE
static int
INDEX_PASTE
static int
INDEX_REDO
static int
INDEX_RENAME
static int
INDEX_SELECT_ALL
static int
INDEX_UNDO
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.
Field Detail
CREATE_UNDO_REDO
public static final int CREATE_UNDO_REDO
Flag for creation of Undo/Redo.- See Also:
- Constant Field Values
CREATE_EDIT_CUT_COPY_PASTE
public static final int CREATE_EDIT_CUT_COPY_PASTE
Flag for creation of Standard Edit actions Cut, Copy, Paste.- See Also:
- Constant Field Values
CREATE_EDIT_DELETE
public static final int CREATE_EDIT_DELETE
Flag for creation of Standard Edit action Delete.- See Also:
- Constant Field Values
CREATE_STANDARD_EDIT
public static final int CREATE_STANDARD_EDIT
Flag for creation of Standard Edit actions Cut, Copy, Paste, Delete.- See Also:
- Constant Field Values
CREATE_SELECT_ALL
public static final int CREATE_SELECT_ALL
Flag for creation of Select All.- See Also:
- Constant Field Values
CREATE_RENAME
public static final int CREATE_RENAME
Flag for creation of Rename.- See Also:
- Constant Field Values
INDEX_UNDO
public static final int INDEX_UNDO
- See Also:
- Constant Field Values
INDEX_REDO
public static final int INDEX_REDO
- See Also:
- Constant Field Values
INDEX_CUT
public static final int INDEX_CUT
- See Also:
- Constant Field Values
INDEX_COPY
public static final int INDEX_COPY
- See Also:
- Constant Field Values
INDEX_PASTE
public static final int INDEX_PASTE
- See Also:
- Constant Field Values
INDEX_DELETE
public static final int INDEX_DELETE
- See Also:
- Constant Field Values
INDEX_SELECT_ALL
public static final int INDEX_SELECT_ALL
- See Also:
- Constant Field Values
INDEX_RENAME
public static final int INDEX_RENAME
- See Also:
- Constant Field Values
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 interfaceorg.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 interfacejava.lang.Runnable