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
FieldsConstructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionprotected abstract voidPerforms the operation.final Objectexecute(org.eclipse.core.commands.ExecutionEvent event) Performs the operation.protected org.eclipse.jface.viewers.IStructuredSelectionGets 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 IPropUndoRedoGets the IPropUndoRedo for an event.protected RunnableGets the asynchronous update states runnable.booleanWhether this handler is capable of handling delegated responsibilities at this time.protected abstract voidSets the enabled state for the selection.final voidsetEnabled(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, setBaseEnabledMethods 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:
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
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.