public class DirectEditingFeatureForPattern extends AbstractDirectEditingFeature implements ICustomAbortableUndoRedoFeature
TYPE_CUSTOM, TYPE_DROPDOWN, TYPE_DROPDOWN_READ_ONLY, TYPE_MULTILINETEXT, TYPE_NONE, TYPE_TEXT
Constructor and Description |
---|
DirectEditingFeatureForPattern(IFeatureProvider featureProvider,
IDirectEditing pattern)
Creates a new
DirectEditingFeatureForPattern . |
Modifier and Type | Method and Description |
---|---|
boolean |
canDirectEdit(IDirectEditingContext context)
Checks if the feature can perform direct editing on the context handed
over.
|
boolean |
canRedo(IContext context)
Decides if the processed feature can be re-done.
|
boolean |
canUndo(IContext context)
Decides if the current feature can be undone - this is the undo of the
execute operation.
|
java.lang.String |
checkValueValid(java.lang.String value,
IDirectEditingContext context)
This method will be called by clients many times to see if current value
is valid and could be set.
|
java.lang.String |
completeValue(java.lang.String value,
int caretPos,
java.lang.String choosenValue,
IDirectEditingContext context)
Framework calls this method to let the feature calculate the new value.
|
int |
getEditingType()
Framework calls this method to decide which UI to show up.
|
java.lang.String |
getInitialValue(IDirectEditingContext context)
Provides the initial value for the opened text editing UI component.
|
java.lang.String[] |
getPossibleValues(IDirectEditingContext context)
This value will be used if the cell editor is a combo box.
|
IProposalSupport |
getProposalSupport()
The direct editing mode contains controls for code completion and the
selection from a combo box.
|
java.lang.String[] |
getValueProposals(java.lang.String value,
int caretPos,
IDirectEditingContext context)
This proposals will be used for the completion list of a simple text cell
editor.
|
boolean |
isAbort()
The Graphiti framework will call this method after
ICustomUndoRedoFeature.preUndo(org.eclipse.graphiti.features.context.IContext) /
ICustomUndoRedoFeature.preRedo(org.eclipse.graphiti.features.context.IContext) have
been called and before the actual undo/redo operation is triggered. |
boolean |
isAutoCompletionEnabled()
Checks if auto completion is enabled.
|
boolean |
isCompletionAvailable()
Checks if completion is available.
|
void |
postRedo(IContext context)
This method will be called by the Graphiti framework after the EMF undo
has finished.
|
void |
postUndo(IContext context)
This method will be called by the Graphiti framework after the EMF undo
is finished.
|
void |
preRedo(IContext context)
This method will be called by the Graphiti framework before the EMF undo
has triggered.
|
void |
preUndo(IContext context)
This method will be called by the Graphiti framework before the EMF undo
is triggered.
|
void |
setValue(java.lang.String value,
IDirectEditingContext context)
Set the new value.
|
boolean |
stretchFieldToFitText()
Stretch input field to fit its contents.
|
canExecute, execute, getName, hasDoneChanges, setValueChanged
getDescription, getFeatureProvider, isAvailable, manageFont, manageFont, setProgressCallback, toString
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
isAvailable
getDescription
getFeatureProvider
public DirectEditingFeatureForPattern(IFeatureProvider featureProvider, IDirectEditing pattern)
DirectEditingFeatureForPattern
.featureProvider
- the feature providerpattern
- the patternpublic boolean canDirectEdit(IDirectEditingContext context)
IDirectEditing
canDirectEdit
in interface IDirectEditing
canDirectEdit
in class AbstractDirectEditingFeature
context
- the contextIFeature.canExecute(org.eclipse.graphiti.features.context.IContext)
public java.lang.String checkValueValid(java.lang.String value, IDirectEditingContext context)
IDirectEditing
checkValueValid
in interface IDirectEditing
checkValueValid
in class AbstractDirectEditingFeature
value
- the valuecontext
- the contextpublic java.lang.String completeValue(java.lang.String value, int caretPos, java.lang.String choosenValue, IDirectEditingContext context)
IDirectEditing
completeValue
in interface IDirectEditing
completeValue
in class AbstractDirectEditingFeature
value
- current valuecaretPos
- current cursor positionchoosenValue
- value choosen by usercontext
- the contextpublic java.lang.String[] getPossibleValues(IDirectEditingContext context)
IDirectEditing
getPossibleValues
in interface IDirectEditing
getPossibleValues
in class AbstractDirectEditingFeature
context
- the contextpublic java.lang.String[] getValueProposals(java.lang.String value, int caretPos, IDirectEditingContext context)
IDirectEditing
getValueProposals
in interface IDirectEditing
getValueProposals
in class AbstractDirectEditingFeature
value
- current valuecaretPos
- current cursor positioncontext
- the contextpublic boolean isAutoCompletionEnabled()
IDirectEditing
isAutoCompletionEnabled
in interface IDirectEditing
isAutoCompletionEnabled
in class AbstractDirectEditingFeature
public boolean isCompletionAvailable()
IDirectEditing
isCompletionAvailable
in interface IDirectEditing
isCompletionAvailable
in class AbstractDirectEditingFeature
public boolean stretchFieldToFitText()
IDirectEditing
stretchFieldToFitText
in interface IDirectEditing
stretchFieldToFitText
in class AbstractDirectEditingFeature
public int getEditingType()
IDirectEditing
getEditingType
in interface IDirectEditing
public java.lang.String getInitialValue(IDirectEditingContext context)
IDirectEditing
getInitialValue
in interface IDirectEditing
context
- the contextpublic void setValue(java.lang.String value, IDirectEditingContext context)
IDirectEditing
setValue
in interface IDirectEditing
setValue
in class AbstractDirectEditingFeature
value
- the valuecontext
- the contextpublic IProposalSupport getProposalSupport()
IDirectEditing
If the customer wants to work with Objects he must provide an
implementation of IProposalSupport
. In this case the following
methods of IDirectEditing
are ignored:
* String checkValueValid(String value, IDirectEditingContext context);
* String completeValue(String value, int caretPosition, String choosenValue, IDirectEditingContext context);
* String[] getPossibleValues(IDirectEditingContext context);
* String[] getValueProposals(String value, int caretPosition, IDirectEditingContext context);
* void setValue(String value, IDirectEditingContext context);
getProposalSupport
in interface IDirectEditing
getProposalSupport
in class AbstractDirectEditingFeature
public boolean isAbort()
ICustomAbortableUndoRedoFeature
ICustomUndoRedoFeature.preUndo(org.eclipse.graphiti.features.context.IContext)
/
ICustomUndoRedoFeature.preRedo(org.eclipse.graphiti.features.context.IContext)
have
been called and before the actual undo/redo operation is triggered. In
case this method returns true
, the operation will be
cancelled by the Graphiti framework by throwing an
OperationCanceledException
that causes am EMF revert of the
operation.
Implementing classes might e.g. set a flag in
ICustomUndoRedoFeature.preUndo(org.eclipse.graphiti.features.context.IContext)
/
ICustomUndoRedoFeature.preRedo(org.eclipse.graphiti.features.context.IContext)
as
cancellation indication and check that that flag here.
isAbort
in interface ICustomAbortableUndoRedoFeature
true
in case you want to cancel the current
operation, false
otherwise.public boolean canUndo(IContext context)
IFeature
canUndo
in interface ICustomUndoRedoFeature
canUndo
in interface IFeature
canUndo
in class AbstractFeature
context
- this is the general input for this methodIContext
public void preUndo(IContext context)
ICustomUndoRedoFeature
ICustomUndoRedoFeature.postUndo(IContext)
.preUndo
in interface ICustomUndoRedoFeature
context
- this is the instance of the IContext
object that was
in use when executing the featurepublic void postUndo(IContext context)
ICustomUndoRedoFeature
ICustomUndoRedoFeature.preUndo(IContext)
.postUndo
in interface ICustomUndoRedoFeature
context
- this is the instance of the IContext
object that was
in use when executing the featurepublic boolean canRedo(IContext context)
ICustomUndoRedoFeature
ICustomUndoRedoFeature.preRedo(IContext)
.
Note that as soon as any feature reports false
here, also
all consecutive entries in the command stack are no longer reachable for
redo.
canRedo
in interface ICustomUndoRedoFeature
context
- this is the instance of the IContext
object that was
in use when executing the featurepublic void preRedo(IContext context)
ICustomUndoRedoFeature
ICustomUndoRedoFeature.postRedo(IContext)
. (Usually it might be
sufficient to delegate to the execution method of the feature.)preRedo
in interface ICustomUndoRedoFeature
context
- this is the instance of the IContext
object that was
in use when executing the featurepublic void postRedo(IContext context)
ICustomUndoRedoFeature
ICustomUndoRedoFeature.preRedo(IContext)
. (Usually it might be
sufficient to delegate to the execution method of the feature.)postRedo
in interface ICustomUndoRedoFeature
context
- this is the instance of the IContext
object that was
in use when executing the feature