Class DirectEditingFeatureForPattern
- All Implemented Interfaces:
ICustomAbortableUndoRedoFeature
,ICustomUndoRedoFeature
,IDirectEditingFeature
,IFeature
,IFeatureProviderHolder
,IDirectEditing
,IDescription
,IName
-
Field Summary
Fields inherited from class org.eclipse.graphiti.features.impl.AbstractDirectEditingFeature
EMPTY_STRING_ARRAY
Fields inherited from interface org.eclipse.graphiti.func.IDirectEditing
TYPE_CUSTOM, TYPE_DROPDOWN, TYPE_DROPDOWN_READ_ONLY, TYPE_MULTILINETEXT, TYPE_NONE, TYPE_TEXT
-
Constructor Summary
ConstructorDescriptionDirectEditingFeatureForPattern
(IFeatureProvider featureProvider, IDirectEditing pattern) Creates a newDirectEditingFeatureForPattern
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
canDirectEdit
(IDirectEditingContext context) Checks if the feature can perform direct editing on the context handed over.boolean
Decides if the processed feature can be re-done.boolean
Decides if the current feature can be undone - this is the undo of the execute operation.checkValueValid
(String value, IDirectEditingContext context) This method will be called by clients many times to see if current value is valid and could be set.completeValue
(String value, int caretPos, String choosenValue, IDirectEditingContext context) Framework calls this method to let the feature calculate the new value.int
Framework calls this method to decide which UI to show up.getInitialValue
(IDirectEditingContext context) Provides the initial value for the opened text editing UI component.String[]
getPossibleValues
(IDirectEditingContext context) This value will be used if the cell editor is a combo box.The direct editing mode contains controls for code completion and the selection from a combo box.String[]
getValueProposals
(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 afterICustomUndoRedoFeature.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
Checks if auto completion is enabled.boolean
Checks if completion is available.void
This method will be called by the Graphiti framework after the EMF undo has finished.void
This method will be called by the Graphiti framework after the EMF undo is finished.void
This method will be called by the Graphiti framework before the EMF undo has triggered.void
This method will be called by the Graphiti framework before the EMF undo is triggered.void
setValue
(String value, IDirectEditingContext context) Set the new value.boolean
Stretch input field to fit its contents.Methods inherited from class org.eclipse.graphiti.features.impl.AbstractDirectEditingFeature
canExecute, execute, getName, hasDoneChanges, setValueChanged
Methods inherited from class org.eclipse.graphiti.features.impl.AbstractFeature
addGraphicalRepresentation, getAllBusinessObjectsForPictogramElement, getBusinessObjectForPictogramElement, getDescription, getDiagram, getDiagramBehavior, getFeatureProvider, getProgressCallback, getUserDecision, isAvailable, layoutPictogramElement, link, link, manageColor, manageColor, manageDefaultFont, manageFont, manageFont, setProgressCallback, toString, updatePictogramElement
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.graphiti.IDescription
getDescription
Methods inherited from interface org.eclipse.graphiti.features.IFeature
isAvailable
Methods inherited from interface org.eclipse.graphiti.features.IFeatureProviderHolder
getFeatureProvider
-
Constructor Details
-
DirectEditingFeatureForPattern
Creates a newDirectEditingFeatureForPattern
.- Parameters:
featureProvider
- the feature providerpattern
- the pattern
-
-
Method Details
-
canDirectEdit
Description copied from interface:IDirectEditing
Checks if the feature can perform direct editing on the context handed over.- Specified by:
canDirectEdit
in interfaceIDirectEditing
- Overrides:
canDirectEdit
in classAbstractDirectEditingFeature
- Parameters:
context
- the context- Returns:
- This method is equivalent to
- See Also:
-
checkValueValid
Description copied from interface:IDirectEditing
This method will be called by clients many times to see if current value is valid and could be set.- Specified by:
checkValueValid
in interfaceIDirectEditing
- Overrides:
checkValueValid
in classAbstractDirectEditingFeature
- Parameters:
value
- the valuecontext
- the context- Returns:
- null if value is okay and could be set; any text means value is not valid; text is reason for invalidality
-
completeValue
public String completeValue(String value, int caretPos, String choosenValue, IDirectEditingContext context) Description copied from interface:IDirectEditing
Framework calls this method to let the feature calculate the new value.- Specified by:
completeValue
in interfaceIDirectEditing
- Overrides:
completeValue
in classAbstractDirectEditingFeature
- Parameters:
value
- current valuecaretPos
- current cursor positionchoosenValue
- value choosen by usercontext
- the context- Returns:
- the new value
-
getPossibleValues
Description copied from interface:IDirectEditing
This value will be used if the cell editor is a combo box. This functionality only applies to TYPE_DROPDOWN.- Specified by:
getPossibleValues
in interfaceIDirectEditing
- Overrides:
getPossibleValues
in classAbstractDirectEditingFeature
- Parameters:
context
- the context- Returns:
- the possible values for the combo box.
-
getValueProposals
Description copied from interface:IDirectEditing
This proposals will be used for the completion list of a simple text cell editor. This functionality only applies to TYPE_TEXT.- Specified by:
getValueProposals
in interfaceIDirectEditing
- Overrides:
getValueProposals
in classAbstractDirectEditingFeature
- Parameters:
value
- current valuecaretPos
- current cursor positioncontext
- the context- Returns:
- the proposed values
-
isAutoCompletionEnabled
public boolean isAutoCompletionEnabled()Description copied from interface:IDirectEditing
Checks if auto completion is enabled. This functionality only applies to TYPE_TEXT.- Specified by:
isAutoCompletionEnabled
in interfaceIDirectEditing
- Overrides:
isAutoCompletionEnabled
in classAbstractDirectEditingFeature
- Returns:
- true, if proposals should appear automatically
-
isCompletionAvailable
public boolean isCompletionAvailable()Description copied from interface:IDirectEditing
Checks if completion is available. This functionality only applies to TYPE_TEXT.- Specified by:
isCompletionAvailable
in interfaceIDirectEditing
- Overrides:
isCompletionAvailable
in classAbstractDirectEditingFeature
- Returns:
- true if completion is / proposals are available at all
-
stretchFieldToFitText
public boolean stretchFieldToFitText()Description copied from interface:IDirectEditing
Stretch input field to fit its contents. This functionality applies to TYPE_TEXT, TYPE_DROPDOWN and TYPE_DROPDOWN_READ_ONLY.- Specified by:
stretchFieldToFitText
in interfaceIDirectEditing
- Overrides:
stretchFieldToFitText
in classAbstractDirectEditingFeature
- Returns:
- true if the field should exactly fit the contents
-
getEditingType
public int getEditingType()Description copied from interface:IDirectEditing
Framework calls this method to decide which UI to show up.- Specified by:
getEditingType
in interfaceIDirectEditing
- Returns:
- the editing type
-
getInitialValue
Description copied from interface:IDirectEditing
Provides the initial value for the opened text editing UI component.- Specified by:
getInitialValue
in interfaceIDirectEditing
- Parameters:
context
- the context- Returns:
- the initial value
-
setValue
Description copied from interface:IDirectEditing
Set the new value. The value comes from the text editing UI component.- Specified by:
setValue
in interfaceIDirectEditing
- Overrides:
setValue
in classAbstractDirectEditingFeature
- Parameters:
value
- the valuecontext
- the context
-
getProposalSupport
Description copied from interface:IDirectEditing
The direct editing mode contains controls for code completion and the selection from a combo box. In both cases the standard implementation supports only strings.If the customer wants to work with Objects he must provide an implementation of
IProposalSupport
. In this case the following methods ofIDirectEditing
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);- Specified by:
getProposalSupport
in interfaceIDirectEditing
- Overrides:
getProposalSupport
in classAbstractDirectEditingFeature
- Returns:
- the special implementation to support Objects in code completion and combo box
-
isAbort
public boolean isAbort()Description copied from interface:ICustomAbortableUndoRedoFeature
The Graphiti framework will call this method afterICustomUndoRedoFeature.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 returnstrue
, the operation will be cancelled by the Graphiti framework by throwing anOperationCanceledException
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.- Specified by:
isAbort
in interfaceICustomAbortableUndoRedoFeature
- Returns:
true
in case you want to cancel the current operation,false
otherwise.- Since:
- 0.12
-
canUndo
Description copied from interface:IFeature
Decides if the current feature can be undone - this is the undo of the execute operation.- Specified by:
canUndo
in interfaceICustomUndoRedoFeature
- Specified by:
canUndo
in interfaceIFeature
- Overrides:
canUndo
in classAbstractFeature
- Parameters:
context
- this is the general input for this method- Returns:
- true if the feature can be undone, false if not
- See Also:
-
preUndo
Description copied from interface:ICustomUndoRedoFeature
This method will be called by the Graphiti framework before the EMF undo is triggered. Customers may revert their non-EMF changes done by the feature here or inICustomUndoRedoFeature.postUndo(IContext)
.- Specified by:
preUndo
in interfaceICustomUndoRedoFeature
- Parameters:
context
- this is the instance of theIContext
object that was in use when executing the feature- Since:
- 0.12
-
postUndo
Description copied from interface:ICustomUndoRedoFeature
This method will be called by the Graphiti framework after the EMF undo is finished. Customers may revert their non-EMF changes done by the feature here or inICustomUndoRedoFeature.preUndo(IContext)
.- Specified by:
postUndo
in interfaceICustomUndoRedoFeature
- Parameters:
context
- this is the instance of theIContext
object that was in use when executing the feature- Since:
- 0.12
-
canRedo
Description copied from interface:ICustomUndoRedoFeature
Decides if the processed feature can be re-done. This method is called once by the Graphiti framework just before any redo work is started, e.g. beforeICustomUndoRedoFeature.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.- Specified by:
canRedo
in interfaceICustomUndoRedoFeature
- Parameters:
context
- this is the instance of theIContext
object that was in use when executing the feature- Returns:
- true if the feature can be re-done, false if not
- Since:
- 0.8
-
preRedo
Description copied from interface:ICustomUndoRedoFeature
This method will be called by the Graphiti framework before the EMF undo has triggered. Customers may re-apply their non-EMF changes done by the feature here or inICustomUndoRedoFeature.postRedo(IContext)
. (Usually it might be sufficient to delegate to the execution method of the feature.)- Specified by:
preRedo
in interfaceICustomUndoRedoFeature
- Parameters:
context
- this is the instance of theIContext
object that was in use when executing the feature- Since:
- 0.12
-
postRedo
Description copied from interface:ICustomUndoRedoFeature
This method will be called by the Graphiti framework after the EMF undo has finished. Customers may re-apply their non-EMF changes done by the feature here or inICustomUndoRedoFeature.preRedo(IContext)
. (Usually it might be sufficient to delegate to the execution method of the feature.)- Specified by:
postRedo
in interfaceICustomUndoRedoFeature
- Parameters:
context
- this is the instance of theIContext
object that was in use when executing the feature- Since:
- 0.12
-