Package com.iizigo.handler
Class SelectionEnabler
java.lang.Object
com.iizigo.handler.SelectionEnabler
The enabler class processes selection changes from handlers, viewers, etc, and sets the state of the commands accordingly.
- Author:
- Christopher Mindus
Field Summary
Modifier and TypeFieldDescriptionboolean
The current states.boolean
The current states.boolean
The current states.boolean
The current states.boolean
The current states.boolean
The current states.boolean
The current states.boolean
The current states.boolean
The current states.boolean
The current states.boolean
The current states.boolean
The current states.boolean
The current states.boolean
The current states.boolean
The current states.GProp<?>[]
The currently selected properties as a property array, never null.The single designer property target, null when multiple are defined.The currently selected properties as a DesignerProp list, never null.Constructor Summary
ConstructorDescriptionCreates an instance with all disabled.SelectionEnabler
(org.eclipse.swt.widgets.Shell shell, org.eclipse.ui.IWorkbenchPart part, ISelectionEnablerHandler selectionEnablerHandler, IPropUndoRedo undoRedo, org.eclipse.core.commands.operations.IUndoContext undoContext, org.eclipse.jface.viewers.IStructuredSelection selection) Constructor.SelectionEnabler
(org.eclipse.ui.IWorkbenchPart part, org.eclipse.jface.viewers.IStructuredSelection selection) Creates an instance for a selection synthesizing all other instanced, used for the Common Navigator and the Common Actions.Method Summary
Modifier and TypeMethodDescriptionstatic SelectionEnabler
Gets the SelectionEnabler instance from an evaluation context.org.eclipse.jface.viewers.IStructuredSelection
Gets the selection.org.eclipse.core.commands.operations.IUndoContext
Gets the undo context.org.eclipse.ui.IWorkbenchPart
Gets the workbench part.void
Invalidates this selection enabler, e.g.void
setUndoContext
(org.eclipse.core.commands.operations.IUndoContext undoContext) Sets the undo context.void
update
(org.eclipse.jface.viewers.IStructuredSelection selection) Updates the selection.
Field Details
isHandled
public boolean isHandledThe current states.canCut
public boolean canCutThe current states.canCopy
public boolean canCopyThe current states.canPaste
public boolean canPasteThe current states.canPasteBefore
public boolean canPasteBeforeThe current states.canPasteAfter
public boolean canPasteAfterThe current states.canPasteLink
public boolean canPasteLinkThe current states.canDelete
public boolean canDeleteThe current states.canRename
public boolean canRenameThe current states.canOpen
public boolean canOpenThe current states.canMove
public boolean canMoveThe current states.canLink
public boolean canLinkThe current states.isNonModuleProject
public boolean isNonModuleProjectThe current states.containsModuleRoot
public boolean containsModuleRootThe current states.containsModuleFolder
public boolean containsModuleFolderThe current states.targets
The currently selected properties as a DesignerProp list, never null.props
The currently selected properties as a property array, never null.target
The single designer property target, null when multiple are defined.
Constructor Details
SelectionEnabler
public SelectionEnabler()Creates an instance with all disabled.SelectionEnabler
public SelectionEnabler(org.eclipse.ui.IWorkbenchPart part, org.eclipse.jface.viewers.IStructuredSelection selection) Creates an instance for a selection synthesizing all other instanced, used for the Common Navigator and the Common Actions.SelectionEnabler
public SelectionEnabler(org.eclipse.swt.widgets.Shell shell, org.eclipse.ui.IWorkbenchPart part, ISelectionEnablerHandler selectionEnablerHandler, IPropUndoRedo undoRedo, org.eclipse.core.commands.operations.IUndoContext undoContext, org.eclipse.jface.viewers.IStructuredSelection selection) Constructor.- Parameters:
shell
- The shell, null for none present.part
- The workbench part, null if none is present.selectionEnablerHandler
- The selection enabler handler, null not to use the handler.undoRedo
- The undo/redo instance, may be null.undoContext
- The undo context, null for workspace common undo context.selection
- The selection.
Method Details
get
Gets the SelectionEnabler instance from an evaluation context. An attempt to use a cached context is done. If not possible, get a new one.getSelection
public org.eclipse.jface.viewers.IStructuredSelection getSelection()Gets the selection.- Returns:
- The selection or null for failure.
update
public void update(org.eclipse.jface.viewers.IStructuredSelection selection) Updates the selection.setUndoContext
public void setUndoContext(org.eclipse.core.commands.operations.IUndoContext undoContext) Sets the undo context.getUndoContext
public org.eclipse.core.commands.operations.IUndoContext getUndoContext()Gets the undo context.getWorkbenchPart
public org.eclipse.ui.IWorkbenchPart getWorkbenchPart()Gets the workbench part.invalidate
public void invalidate()Invalidates this selection enabler, e.g. when clipboard has been changed, or selection, and the requirement to call update is needed.