Class AbstractDirectEditingFeature
java.lang.Object
org.eclipse.graphiti.features.impl.AbstractFeature
org.eclipse.graphiti.features.impl.AbstractDirectEditingFeature
- All Implemented Interfaces:
IDirectEditingFeature
,IFeature
,IFeatureProviderHolder
,IDirectEditing
,IDescription
,IName
- Direct Known Subclasses:
DirectEditingFeatureForPattern
public abstract class AbstractDirectEditingFeature
extends AbstractFeature
implements IDirectEditingFeature
The Class AbstractDirectEditingFeature.
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final String[]
The Constant 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
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canDirectEdit
(IDirectEditingContext context) Checks if the feature can perform direct editing on the context handed over.boolean
canExecute
(IContext context) Decides if the current feature can execute with the given context.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.void
Executes the current feature with the given context.getName()
Gets the name.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
Returns true only if the direct editing feature really has changed anything.boolean
Checks if auto completion is enabled.boolean
Checks if completion is available.void
setValue
(String value, IDirectEditingContext context) Set the new value.final void
Called by the framework (@see DirectEditingFeatureCommandWithContext) to indicate that this direct editing feature execution has really changed something.boolean
Stretch input field to fit its contents.Methods inherited from class org.eclipse.graphiti.features.impl.AbstractFeature
addGraphicalRepresentation, canUndo, 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.func.IDirectEditing
getEditingType, getInitialValue
Methods inherited from interface org.eclipse.graphiti.features.IFeature
canUndo, isAvailable
Methods inherited from interface org.eclipse.graphiti.features.IFeatureProviderHolder
getFeatureProvider
-
Field Details
-
EMPTY_STRING_ARRAY
The Constant EMPTY_STRING_ARRAY.
-
-
Constructor Details
-
AbstractDirectEditingFeature
Creates a newAbstractDirectEditingFeature
.- Parameters:
fp
- the fp
-
-
Method Details
-
canExecute
Description copied from interface:IFeature
Decides if the current feature can execute with the given context.- Specified by:
canExecute
in interfaceIFeature
- Parameters:
context
- this is the general input for this method- Returns:
- true if the feature can be executed, false if not
- See Also:
-
canDirectEdit
Description copied from interface:IDirectEditing
Checks if the feature can perform direct editing on the context handed over.- Specified by:
canDirectEdit
in interfaceIDirectEditing
- Parameters:
context
- the context- Returns:
- This method is equivalent to
- See Also:
-
execute
Description copied from interface:IFeature
Executes the current feature with the given context. -
hasDoneChanges
public boolean hasDoneChanges()Returns true only if the direct editing feature really has changed anything. This is indicated by the execution of the feature in the DirectEditingFeatureCommandWithContext.execute method.- Specified by:
hasDoneChanges
in interfaceIFeature
- Overrides:
hasDoneChanges
in classAbstractFeature
- Returns:
true
if the feature should appear in the undo stack,false
otherwise
-
setValueChanged
public final void setValueChanged()Called by the framework (@see DirectEditingFeatureCommandWithContext) to indicate that this direct editing feature execution has really changed something. Only in this case there should be an entry in the undo stack and the editor should get dirty. -
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
- 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
- Parameters:
value
- current valuecaretPos
- current cursor positioncontext
- the context- Returns:
- the proposed values
-
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
- 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
- Parameters:
value
- current valuecaretPos
- current cursor positionchoosenValue
- value choosen by usercontext
- the context- Returns:
- the new value
-
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
- Returns:
- true if the field should exactly fit the contents
-
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
- 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
- Returns:
- true if completion is / proposals are available at all
-
getName
Description copied from interface:IName
Gets the name.- Specified by:
getName
in interfaceIName
- Overrides:
getName
in classAbstractFeature
- Returns:
- the name
-
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
- Returns:
- the special implementation to support Objects in code completion and combo box
- Since:
- 0.8
-
setValue
Description copied from interface:IDirectEditing
Set the new value. The value comes from the text editing UI component.- Specified by:
setValue
in interfaceIDirectEditing
- Parameters:
value
- the valuecontext
- the context- Since:
- 0.8
-