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.AbstractHandler
The common handler check for valid handled state and enabled state for the common action handlers.
- Author:
- Christopher Mindus
Field Summary
Constructor Summary
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
Performs the operation.final Object
execute
(org.eclipse.core.commands.ExecutionEvent event) Performs the operation.protected org.eclipse.jface.viewers.IStructuredSelection
Gets the current selection.protected org.eclipse.swt.widgets.Shell
getShell()
Gets the shell.static org.eclipse.core.commands.operations.IUndoContext
getUndoContext
(org.eclipse.ui.IWorkbenchPart part) Gets the undo context out of a part.protected IPropUndoRedo
Gets the IPropUndoRedo for an event.protected Runnable
Gets the asynchronous update states runnable.boolean
Whether this handler is capable of handling delegated responsibilities at this time.protected abstract void
Sets the enabled state for the selection.final void
setEnabled
(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
Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
Field Details
selectionEnabler
The current selection enabler.
Constructor Details
CommonHandler
public CommonHandler()
Method Details
setEnabled
Called by the framework to allow the handler to update its enabled state by extracting the same information available at execution time.- Specified by:
setEnabled
in interfaceorg.eclipse.core.commands.IHandler2
- Overrides:
setEnabled
in 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:
isHandled
in interfaceorg.eclipse.core.commands.IHandler
- Overrides:
isHandled
in classorg.eclipse.core.commands.AbstractHandler
- Returns:
true
getCurrentSelection
protected org.eclipse.jface.viewers.IStructuredSelection getCurrentSelection()Gets the current selection.setEnabled
Sets the enabled state for the selection.execute
Performs the operation.doExecute
protected abstract void doExecute()Performs the operation.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
Gets the asynchronous update states runnable.