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_ARRAYFields inherited from interface org.eclipse.graphiti.func.IDirectEditing
TYPE_CUSTOM, TYPE_DROPDOWN, TYPE_DROPDOWN_READ_ONLY, TYPE_MULTILINETEXT, TYPE_NONE, TYPE_TEXT -
Constructor Summary
ConstructorsConstructorDescriptionDirectEditingFeatureForPattern(IFeatureProvider featureProvider, IDirectEditing pattern) Creates a newDirectEditingFeatureForPattern. -
Method Summary
Modifier and TypeMethodDescriptionbooleancanDirectEdit(IDirectEditingContext context) Checks if the feature can perform direct editing on the context handed over.booleanDecides if the processed feature can be re-done.booleanDecides 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.intFramework 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.booleanisAbort()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.booleanChecks if auto completion is enabled.booleanChecks if completion is available.voidThis method will be called by the Graphiti framework after the EMF undo has finished.voidThis method will be called by the Graphiti framework after the EMF undo is finished.voidThis method will be called by the Graphiti framework before the EMF undo has triggered.voidThis method will be called by the Graphiti framework before the EMF undo is triggered.voidsetValue(String value, IDirectEditingContext context) Set the new value.booleanStretch input field to fit its contents.Methods inherited from class org.eclipse.graphiti.features.impl.AbstractDirectEditingFeature
canExecute, execute, getName, hasDoneChanges, setValueChangedMethods 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, updatePictogramElementMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.graphiti.IDescription
getDescriptionMethods inherited from interface org.eclipse.graphiti.features.IFeature
isAvailableMethods 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:IDirectEditingChecks if the feature can perform direct editing on the context handed over.- Specified by:
canDirectEditin interfaceIDirectEditing- Overrides:
canDirectEditin classAbstractDirectEditingFeature- Parameters:
context- the context- Returns:
- This method is equivalent to
- See Also:
-
checkValueValid
Description copied from interface:IDirectEditingThis method will be called by clients many times to see if current value is valid and could be set.- Specified by:
checkValueValidin interfaceIDirectEditing- Overrides:
checkValueValidin 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:IDirectEditingFramework calls this method to let the feature calculate the new value.- Specified by:
completeValuein interfaceIDirectEditing- Overrides:
completeValuein classAbstractDirectEditingFeature- Parameters:
value- current valuecaretPos- current cursor positionchoosenValue- value choosen by usercontext- the context- Returns:
- the new value
-
getPossibleValues
Description copied from interface:IDirectEditingThis value will be used if the cell editor is a combo box. This functionality only applies to TYPE_DROPDOWN.- Specified by:
getPossibleValuesin interfaceIDirectEditing- Overrides:
getPossibleValuesin classAbstractDirectEditingFeature- Parameters:
context- the context- Returns:
- the possible values for the combo box.
-
getValueProposals
Description copied from interface:IDirectEditingThis proposals will be used for the completion list of a simple text cell editor. This functionality only applies to TYPE_TEXT.- Specified by:
getValueProposalsin interfaceIDirectEditing- Overrides:
getValueProposalsin classAbstractDirectEditingFeature- Parameters:
value- current valuecaretPos- current cursor positioncontext- the context- Returns:
- the proposed values
-
isAutoCompletionEnabled
public boolean isAutoCompletionEnabled()Description copied from interface:IDirectEditingChecks if auto completion is enabled. This functionality only applies to TYPE_TEXT.- Specified by:
isAutoCompletionEnabledin interfaceIDirectEditing- Overrides:
isAutoCompletionEnabledin classAbstractDirectEditingFeature- Returns:
- true, if proposals should appear automatically
-
isCompletionAvailable
public boolean isCompletionAvailable()Description copied from interface:IDirectEditingChecks if completion is available. This functionality only applies to TYPE_TEXT.- Specified by:
isCompletionAvailablein interfaceIDirectEditing- Overrides:
isCompletionAvailablein classAbstractDirectEditingFeature- Returns:
- true if completion is / proposals are available at all
-
stretchFieldToFitText
public boolean stretchFieldToFitText()Description copied from interface:IDirectEditingStretch input field to fit its contents. This functionality applies to TYPE_TEXT, TYPE_DROPDOWN and TYPE_DROPDOWN_READ_ONLY.- Specified by:
stretchFieldToFitTextin interfaceIDirectEditing- Overrides:
stretchFieldToFitTextin classAbstractDirectEditingFeature- Returns:
- true if the field should exactly fit the contents
-
getEditingType
public int getEditingType()Description copied from interface:IDirectEditingFramework calls this method to decide which UI to show up.- Specified by:
getEditingTypein interfaceIDirectEditing- Returns:
- the editing type
-
getInitialValue
Description copied from interface:IDirectEditingProvides the initial value for the opened text editing UI component.- Specified by:
getInitialValuein interfaceIDirectEditing- Parameters:
context- the context- Returns:
- the initial value
-
setValue
Description copied from interface:IDirectEditingSet the new value. The value comes from the text editing UI component.- Specified by:
setValuein interfaceIDirectEditing- Overrides:
setValuein classAbstractDirectEditingFeature- Parameters:
value- the valuecontext- the context
-
getProposalSupport
Description copied from interface:IDirectEditingThe 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 ofIDirectEditingare 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:
getProposalSupportin interfaceIDirectEditing- Overrides:
getProposalSupportin classAbstractDirectEditingFeature- Returns:
- the special implementation to support Objects in code completion and combo box
-
isAbort
public boolean isAbort()Description copied from interface:ICustomAbortableUndoRedoFeatureThe 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 anOperationCanceledExceptionthat 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:
isAbortin interfaceICustomAbortableUndoRedoFeature- Returns:
truein case you want to cancel the current operation,falseotherwise.- Since:
- 0.12
-
canUndo
Description copied from interface:IFeatureDecides if the current feature can be undone - this is the undo of the execute operation.- Specified by:
canUndoin interfaceICustomUndoRedoFeature- Specified by:
canUndoin interfaceIFeature- Overrides:
canUndoin 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:ICustomUndoRedoFeatureThis 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:
preUndoin interfaceICustomUndoRedoFeature- Parameters:
context- this is the instance of theIContextobject that was in use when executing the feature- Since:
- 0.12
-
postUndo
Description copied from interface:ICustomUndoRedoFeatureThis 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:
postUndoin interfaceICustomUndoRedoFeature- Parameters:
context- this is the instance of theIContextobject that was in use when executing the feature- Since:
- 0.12
-
canRedo
Description copied from interface:ICustomUndoRedoFeatureDecides 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
falsehere, also all consecutive entries in the command stack are no longer reachable for redo.- Specified by:
canRedoin interfaceICustomUndoRedoFeature- Parameters:
context- this is the instance of theIContextobject 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:ICustomUndoRedoFeatureThis 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:
preRedoin interfaceICustomUndoRedoFeature- Parameters:
context- this is the instance of theIContextobject that was in use when executing the feature- Since:
- 0.12
-
postRedo
Description copied from interface:ICustomUndoRedoFeatureThis 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:
postRedoin interfaceICustomUndoRedoFeature- Parameters:
context- this is the instance of theIContextobject that was in use when executing the feature- Since:
- 0.12
-