Package com.iizigo.handler
Class CommonHandler
- java.lang.Object
- org.eclipse.core.commands.common.EventManager
- org.eclipse.core.commands.AbstractHandler
- com.iizigo.handler.CommonHandler
- All Implemented Interfaces:
org.eclipse.core.commands.IHandler,org.eclipse.core.commands.IHandler2
- Direct Known Subclasses:
Copy,Cut,Delete,Link,Move,Open,Paste,PasteAfter,PasteBefore,PasteLink,Rename
public abstract class CommonHandler extends org.eclipse.core.commands.AbstractHandlerThe common handler check for valid handled state and enabled state for the common action handlers.- Author:
- Christopher Mindus
Field Summary
Fields Modifier and Type Field Description protected SelectionEnablerselectionEnablerThe current selection enabler.
Constructor Summary
Constructors Constructor Description CommonHandler()
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voiddoExecute()Performs the operation.java.lang.Objectexecute(org.eclipse.core.commands.ExecutionEvent event)Performs the operation.protected org.eclipse.jface.viewers.IStructuredSelectiongetCurrentSelection()Gets the current selection.protected org.eclipse.swt.widgets.ShellgetShell()Gets the shell.static org.eclipse.core.commands.operations.IUndoContextgetUndoContext(org.eclipse.ui.IWorkbenchPart part)Gets the undo context out of a part.protected IPropUndoRedogetUndoRedo()Gets the IPropUndoRedo for an event.protected java.lang.RunnablegetUpdateStatesRunnable()Gets the asynchronous update states runnable.booleanisHandled()Whether this handler is capable of handling delegated responsibilities at this time.protected abstract voidsetEnabled(SelectionEnabler se)Sets the enabled state for the selection.voidsetEnabled(java.lang.Object evaluationContext)Called by the framework to allow the handler to update its enabled state by extracting the same information available at execution time.Methods inherited from class org.eclipse.core.commands.AbstractHandler
addHandlerListener, dispose, fireHandlerChanged, hasListeners, isEnabled, removeHandlerListener, setBaseEnabled
Field Detail
selectionEnabler
protected SelectionEnabler selectionEnabler
The current selection enabler.
Method Detail
setEnabled
public final void setEnabled(java.lang.Object evaluationContext)
Called by the framework to allow the handler to update its enabled state by extracting the same information available at execution time.- Specified by:
setEnabledin interfaceorg.eclipse.core.commands.IHandler2- Overrides:
setEnabledin classorg.eclipse.core.commands.AbstractHandler- Parameters:
evaluationContext- The application context. May benull.
isHandled
public boolean isHandled()
Whether this handler is capable of handling delegated responsibilities at this time. Subclasses may override this method.- Specified by:
isHandledin interfaceorg.eclipse.core.commands.IHandler- Overrides:
isHandledin classorg.eclipse.core.commands.AbstractHandler- Returns:
true
getCurrentSelection
protected org.eclipse.jface.viewers.IStructuredSelection getCurrentSelection()
Gets the current selection.
setEnabled
protected abstract void setEnabled(SelectionEnabler se)
Sets the enabled state for the selection.
execute
public final java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent event)
Performs the operation.
doExecute
protected abstract void doExecute()
Performs the operation.
getUndoRedo
protected IPropUndoRedo getUndoRedo()
Gets the IPropUndoRedo for an event.
getShell
protected org.eclipse.swt.widgets.Shell getShell()
Gets the shell.
getUndoContext
public static org.eclipse.core.commands.operations.IUndoContext getUndoContext(org.eclipse.ui.IWorkbenchPart part)
Gets the undo context out of a part.
getUpdateStatesRunnable
protected java.lang.Runnable getUpdateStatesRunnable()
Gets the asynchronous update states runnable.