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.RunnableThe 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 intCREATE_EDIT_CUT_COPY_PASTEFlag for creation of Standard Edit actions Cut, Copy, Paste.static intCREATE_EDIT_DELETEFlag for creation of Standard Edit action Delete.static intCREATE_RENAMEFlag for creation of Rename.static intCREATE_SELECT_ALLFlag for creation of Select All.static intCREATE_STANDARD_EDITFlag for creation of Standard Edit actions Cut, Copy, Paste, Delete.static intCREATE_UNDO_REDOFlag for creation of Undo/Redo.static intINDEX_COPYstatic intINDEX_CUTstatic intINDEX_DELETEstatic intINDEX_PASTEstatic intINDEX_REDOstatic intINDEX_RENAMEstatic intINDEX_SELECT_ALLstatic intINDEX_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 voiddispose()Disposes of the actions.org.eclipse.jface.action.IActionget(int index)Gets the action of index.SelectionEnablergetSelectionEnabler()Gets the selection enabler instance.voidrun()Callback from undo/redo.voidselectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event)Notifies that the selection has changed.voidupdateStates()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:
selectionChangedin 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:
runin interfacejava.lang.Runnable