VR
- The visual root node of the UI toolkit, e.g. javafx.scene.Node in
case of JavaFX.public class ChangeFocusOperation<VR> extends AbstractOperation implements ITransactionalOperation
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_LABEL
"change-focus"
The default label for this operation (i.e. used if no label is
specified).
|
Constructor and Description |
---|
ChangeFocusOperation(IViewer<VR> viewer,
IContentPart<VR,? extends VR> newFocused)
Creates a new
ChangeFocusOperation to assign focus to the given
newFocused IContentPart within the given IViewer . |
ChangeFocusOperation(java.lang.String label,
IViewer<VR> viewer,
IContentPart<VR,? extends VR> newFocused)
Creates a new
ChangeFocusOperation to assign focus to the given
newFocused IContentPart within the given IViewer . |
Modifier and Type | Method and Description |
---|---|
IStatus |
execute(IProgressMonitor monitor,
IAdaptable info) |
protected FocusModel<VR> |
getFocusModel()
Returns the
FocusModel adapted to the viewer. |
boolean |
isContentRelevant()
Returns
true if this ITransactionalOperation is
actually changing model data (instead of only affecting the
visualization). |
boolean |
isNoOp()
Returns
true if this ITransactionalOperation has no
effect (in comparison to its initial state). |
IStatus |
redo(IProgressMonitor monitor,
IAdaptable info) |
void |
setNewFocused(IContentPart<VR,? extends VR> newFocused)
Sets the new focussed part to the given one.
|
IStatus |
undo(IProgressMonitor monitor,
IAdaptable info) |
addContext, canExecute, canRedo, canUndo, dispose, getContexts, getLabel, hasContext, removeContext, setLabel, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addContext, canExecute, canRedo, canUndo, dispose, getContexts, getLabel, hasContext, removeContext
public static final java.lang.String DEFAULT_LABEL
"change-focus"The default label for this operation (i.e. used if no label is specified).
public ChangeFocusOperation(IViewer<VR> viewer, IContentPart<VR,? extends VR> newFocused)
ChangeFocusOperation
to assign focus to the given
newFocused IContentPart
within the given IViewer
.
When the operation is undone, focus is assigned to the given
oldFocused IContentPart
.viewer
- The IViewer
for which the FocusModel
is to be
changed.newFocused
- The IContentPart
to which focus will be assigned.public ChangeFocusOperation(java.lang.String label, IViewer<VR> viewer, IContentPart<VR,? extends VR> newFocused)
ChangeFocusOperation
to assign focus to the given
newFocused IContentPart
within the given IViewer
.
When the operation is undone, focus is assigned to the given
oldFocused IContentPart
. The given label is used as
the label for the operation.label
- The operation's label.viewer
- The IViewer
for which the FocusModel
is to be
changed.newFocused
- The IContentPart
to which focus will be assigned.public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
execute
in interface IUndoableOperation
execute
in class AbstractOperation
ExecutionException
protected FocusModel<VR> getFocusModel()
FocusModel
adapted to the viewer.FocusModel
adapter.public boolean isContentRelevant()
ITransactionalOperation
true
if this ITransactionalOperation
is
actually changing model data (instead of only affecting the
visualization). Otherwise returns false
. The content
relevancy of an ITransactionalOperation
can be checked to
determine if the execution of the operation will affect the model, for
example, to set an editor's dirty flag.isContentRelevant
in interface ITransactionalOperation
true
if this ITransactionalOperation
is
actually changing model data, otherwise false
.public boolean isNoOp()
ITransactionalOperation
true
if this ITransactionalOperation
has no
effect (in comparison to its initial state). Otherwise returns
false
.isNoOp
in interface ITransactionalOperation
true
if this ITransactionalOperation
has no
effect, otherwise false
.public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
redo
in interface IUndoableOperation
redo
in class AbstractOperation
ExecutionException
public void setNewFocused(IContentPart<VR,? extends VR> newFocused)
newFocused
- The new focus part.public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
undo
in interface IUndoableOperation
undo
in class AbstractOperation
ExecutionException
Copyright (c) 2014 itemis AG and others. All rights reserved.