Class AbstractPattern
- All Implemented Interfaces:
IFeatureProviderHolder
,IAdd
,ICreate
,ICreateInfo
,IDelete
,IDirectEditing
,ILayout
,IMoveShape
,IRemove
,IResizeShape
,IUpdate
,IPattern
- Direct Known Subclasses:
TypedPattern
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final String[]
An empty string array used in direct editing.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
ConstructorDescriptionCreates a newAbstractPattern
.AbstractPattern
(IPatternConfiguration patternConfiguration) Creates a newAbstractPattern
holding the givenIPatternConfiguration
. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addGraphicalRepresentation
(IAreaContext context, Object newObject) Adds the graphical representation of the given newObject
with the information in the givenIAreaContext
.protected boolean
Clients can override to indicate that moving to negative coordinates should be possible.boolean
canCreate
(ICreateContext context) Clients must override this method to indicate that the pattern can be used to create domain objects as defined in the givenICreateContext
.boolean
canDelete
(IDeleteContext context) Clients can override to modify the default behavior if the pattern can (and wants to) handle a delete request.boolean
canDirectEdit
(IDirectEditingContext context) Clients can override this method to indicate that the pattern allows direct editing for the shape described in the passedIDirectEditingContext
.boolean
canLayout
(ILayoutContext context) Clients may override this method to indicate that the pattern can be used to layout a shape for a domain objects as defined in the givenILayoutContext
.boolean
canMoveShape
(IMoveShapeContext context) Clients may override this method to indicate that the pattern can be used to move the shape of a domain objects as defined in the givenIMoveShapeContext
.boolean
canRemove
(IRemoveContext context) Clients can override to modify the default behavior if the pattern can (and wants to) handle a remove request.boolean
canResizeShape
(IResizeShapeContext context) Clients may override this method to indicate that the pattern can be used to resize the shape of a domain objects as defined in the givenIResizeShapeContext
.boolean
canUpdate
(IUpdateContext context) Clients may override this method to indicate that the pattern can be used to update the shape of a domain objects as defined in the givenIUpdateContext
.checkValueValid
(String value, IDirectEditingContext context) This method will be called by the framework to check if the passed String is valid as new value for the shape.void
completeInfo
(IDirectEditingInfo info, Object bo) Clients can override to complete theIDirectEditingInfo
info.void
completeInfo
(IDirectEditingInfo info, Object bo, String keyProperty) Clients can override to complete theIDirectEditingInfo
info.completeValue
(String value, int caretPos, String chosenValue, IDirectEditingContext context) Can be overridden by clients to define completion functionality for direct editing.Object[]
create
(ICreateContext context) Clients must override this method to implement the functionality to create a new domain object as defined in the givenICreateContext
.protected IDeleteFeature
createDeleteFeature
(IDeleteContext context) Creates theIDeleteFeature
instance that handles the deletion of business objects and diagram elements.protected IRemoveFeature
createRemoveFeature
(IRemoveContext context) Creates theIRemoveFeature
instance that handles the removal of diagram elements.void
delete
(IDeleteContext context) Clients can override to modify the default delete behavior.Client should override to return a string description of the type of domain object that is created with this pattern.Client should override to return a string id of the the image icon for the domain object that is created with this pattern.Client should override to return a string id of the the large image icon for the domain object that is created with this pattern.Client should override to return the name of the domain object that is created with this pattern.int
The Graphiti framework calls this method to decide which UI to show up for direct editing.getInitialValue
(IDirectEditingContext context) Provides the initial value for display in the newly opened text editing UI component.protected IPatternConfiguration
Returns theIPatternConfiguration
instance used within this pattern ornull
in case none is used.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.Clients may override to modify the resize behavior.String[]
getValueProposals
(String value, int caretPos, IDirectEditingContext context) This proposals will be used for the completion list of a simple text cell editor.boolean
hasDoneChanges
(Class<?> actionType) Is queried by the framework after a pattern has been executed to find out if this pattern should appear in the undo stack.protected void
internalMove
(IMoveShapeContext context) Default implementation of the move functionality.boolean
Checks if auto completion is enabled.boolean
Checks if completion is available.boolean
The Graphiti framework will call this method afterIDelete.preDelete(IDeleteContext)
has been called and before the actual delete is done.abstract boolean
isMainBusinessObjectApplicable
(Object mainBusinessObject) Clients must override this method to indicate that the pattern uses the given domain object as its main domain object.boolean
Is queried by the Graphiti framework to check if the pattern should create a new domain object entry in the editor palette.protected abstract boolean
isPatternControlled
(PictogramElement pictogramElement) This method must be implemented by clients to indicate that the givenPictogramElement
is controlled by this pattern.protected abstract boolean
isPatternRoot
(PictogramElement pictogramElement) This method must be implemented by clients to indicate that the givenPictogramElement
is the root shape of this pattern.boolean
The Graphiti framework will call this method afterIRemove.preRemove(IRemoveContext)
has been called and before the actual remove is done.boolean
layout
(ILayoutContext context) Clients can override this method to implement the functionality to layout a shape for the given domain object as defined in the givenILayoutContext
.protected void
Helper method that triggers a layout of the givenPictogramElement
.protected void
moveAllBendpoints
(IMoveShapeContext context) Default implementation of the move functionality to move all bendpoints within a container shape.void
moveShape
(IMoveShapeContext context) Clients can override this method to implement the functionality to move a shape for the given domain object as defined in the givenIMoveShapeContext
.void
postDelete
(IDeleteContext context) Clients can override to add actions after the default delete behavior is triggered.protected void
postMoveShape
(IMoveShapeContext context) Hook clients can override to add additional steps after the move of the shape happened.void
postRemove
(IRemoveContext context) Clients can override to add actions after the default remove behavior is triggered.void
preDelete
(IDeleteContext context) Clients can override to add actions before the default delete behavior is triggered.protected void
preMoveShape
(IMoveShapeContext context) Hook clients can override to add additional steps before the move of the shape happens.void
preRemove
(IRemoveContext context) Clients can override to add actions before the default remove behavior is triggered.void
remove
(IRemoveContext context) Clients can override to modify the default remove behavior.void
resizeShape
(IResizeShapeContext context) Clients can override this method to implement the functionality to resize a shape for the given domain object as defined in the givenIResizeShapeContext
.protected void
setPatternConfiguration
(IPatternConfiguration patternConfiguration) Sets theIPatternConfiguration
instance to be used with this pattern.void
setValue
(String value, IDirectEditingContext context) Set the new value after direct editing is finished.boolean
Defines if the input field should be streched to fit its contents.boolean
update
(IUpdateContext context) Clients can override this method to implement the functionality to update a shape for the given domain object as defined in the givenIUpdateContext
.updateNeeded
(IUpdateContext context) Clients can override this method to indicate if an update of a shape for the given domain object as defined in the givenIUpdateContext
needs to be triggered.protected void
Helper method that triggers an update of the givenPictogramElement
.Methods inherited from class org.eclipse.graphiti.pattern.AbstractBasePattern
add, canAdd, getBusinessObjectForPictogramElement, getDiagram, getDiagramBehavior, getFeatureProvider, getMappingProvider, link, link, manageColor, manageColor, manageFont, manageFont, setFeatureProvider
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.eclipse.graphiti.pattern.IPattern
add, canAdd, setFeatureProvider
-
Field Details
-
EMPTY_STRING_ARRAY
An empty string array used in direct editing.
-
-
Constructor Details
-
AbstractPattern
Creates a newAbstractPattern
holding the givenIPatternConfiguration
.- Parameters:
patternConfiguration
- The pattern configuration to use within this pattern instance ofnull
in case no configuration is needed.
-
AbstractPattern
public AbstractPattern()Creates a newAbstractPattern
. This is a convenience method for patterns working without any configuration.- Since:
- 0.10
-
-
Method Details
-
isPaletteApplicable
public boolean isPaletteApplicable()Is queried by the Graphiti framework to check if the pattern should create a new domain object entry in the editor palette.- Specified by:
isPaletteApplicable
in interfaceIPattern
- Returns:
true
in case a palette entry shall be created,false
otherwise.
-
canCreate
Clients must override this method to indicate that the pattern can be used to create domain objects as defined in the givenICreateContext
. Corresponds to the methodICreate.canCreate(ICreateContext)
. The default implementation simply returnsfalse
. -
canLayout
Clients may override this method to indicate that the pattern can be used to layout a shape for a domain objects as defined in the givenILayoutContext
. Corresponds to the methodILayout.canLayout(ILayoutContext)
. The default implementation checks if thePictogramElement
in the given contextisPatternControlled(PictogramElement)
. -
canMoveShape
Clients may override this method to indicate that the pattern can be used to move the shape of a domain objects as defined in the givenIMoveShapeContext
. Corresponds to the methodDefaultMoveShapeFeature.canMoveShape(IMoveShapeContext)
. The default implementation checks if thePictogramElement
in the given contextisPatternControlled(PictogramElement)
and the source and target containers of the shape are the same.- Specified by:
canMoveShape
in interfaceIMoveShape
- Parameters:
context
- The context holding information on the domain object to be moved.- Returns:
true
in case this pattern can move a shape for such a domain object,false
otherwise.
-
canResizeShape
Clients may override this method to indicate that the pattern can be used to resize the shape of a domain objects as defined in the givenIResizeShapeContext
. Corresponds to the methodDefaultResizeShapeFeature.canResizeShape(IResizeShapeContext)
. The default implementation checks if thePictogramElement
in the given context fulfillsisPatternRoot(PictogramElement)
.- Specified by:
canResizeShape
in interfaceIResizeShape
- Parameters:
context
- The context holding information on the domain object to be resized.- Returns:
true
in case this pattern can resize a shape for such a domain object,false
otherwise.
-
canUpdate
Clients may override this method to indicate that the pattern can be used to update the shape of a domain objects as defined in the givenIUpdateContext
. Corresponds to the methodIUpdate.canUpdate(IUpdateContext)
. The default implementation checks if thePictogramElement
in the given contextisPatternControlled(PictogramElement)
. -
create
Clients must override this method to implement the functionality to create a new domain object as defined in the givenICreateContext
. Corresponds to the methodICreate.create(ICreateContext)
. The default implementation simply does nothing and returns an empty object array. -
getCreateDescription
Client should override to return a string description of the type of domain object that is created with this pattern. The Graphiti framework uses this information to fill a tooltip for the creation tool entry in the palette. The default implementation simply returnsnull
which indicates that no tooltip shall be displayed.- Specified by:
getCreateDescription
in interfaceICreateInfo
- Specified by:
getCreateDescription
in interfaceIPattern
- Returns:
- A
String
holding the tooltip
-
getCreateImageId
Client should override to return a string id of the the image icon for the domain object that is created with this pattern. The Graphiti framework uses this information to add an icon to the creation tool entry in the palette. The default implementation simply returnsnull
which indicates that no icon shall be displayed.- Specified by:
getCreateImageId
in interfaceICreateInfo
- Returns:
- A
String
holding the id of the icon as defined in the AbstractImageProvider.
-
getCreateLargeImageId
Client should override to return a string id of the the large image icon for the domain object that is created with this pattern. The Graphiti framework uses this information to add a large icon to the creation tool entry in the palette. The default implementation simply returnsnull
which indicates that no icon shall be displayed.- Specified by:
getCreateLargeImageId
in interfaceICreateInfo
- Returns:
- A
String
holding the id of the large icon as defined in the AbstractImageProvider.
-
getCreateName
Client should override to return the name of the domain object that is created with this pattern. The Graphiti framework uses this information to fill the text for the creation tool entry in the palette. The default implementation simply returnsnull
which results in an empty entry in the palette.- Specified by:
getCreateName
in interfaceICreateInfo
- Specified by:
getCreateName
in interfaceIPattern
- Returns:
- A
String
holding the name of the domain object.
-
isMainBusinessObjectApplicable
Clients must override this method to indicate that the pattern uses the given domain object as its main domain object.- Specified by:
isMainBusinessObjectApplicable
in interfaceIPattern
- Parameters:
mainBusinessObject
- The object to check if it is the main domain object of the pattern.- Returns:
true
in case the pattern has the given domain object as its main domain object,false
otherwise.
-
layout
Clients can override this method to implement the functionality to layout a shape for the given domain object as defined in the givenILayoutContext
. Corresponds to the methodILayout.layout(ILayoutContext)
. The default implementation simply does nothing and returnsfalse
as indication of this. -
moveShape
Clients can override this method to implement the functionality to move a shape for the given domain object as defined in the givenIMoveShapeContext
. Corresponds to the methodDefaultMoveShapeFeature.moveShape(IMoveShapeContext)
.- Specified by:
moveShape
in interfaceIMoveShape
- Parameters:
context
- The context holding information on the domain object to be moved.
-
postMoveShape
Hook clients can override to add additional steps after the move of the shape happened.- Parameters:
context
- The context holding information on the domain object that was moved.
-
preMoveShape
Hook clients can override to add additional steps before the move of the shape happens.- Parameters:
context
- The context holding information on the domain object to be moved.
-
internalMove
Default implementation of the move functionality. Moves shapes to new coordinates and adapts parents in case this is needed.- Parameters:
context
- The context holding information on the domain object to be moved.
-
moveAllBendpoints
Default implementation of the move functionality to move all bendpoints within a container shape.- Parameters:
context
- The context holding information on the domain object to be moved.
-
resizeShape
Clients can override this method to implement the functionality to resize a shape for the given domain object as defined in the givenIResizeShapeContext
. Corresponds to the methodDefaultResizeShapeFeature.resizeShape(IResizeShapeContext)
.- Specified by:
resizeShape
in interfaceIResizeShape
- Parameters:
context
- The context holding information on the domain object to be resized.
-
update
Clients can override this method to implement the functionality to update a shape for the given domain object as defined in the givenIUpdateContext
. Corresponds to the methodIUpdate.update(IUpdateContext)
. -
updateNeeded
Clients can override this method to indicate if an update of a shape for the given domain object as defined in the givenIUpdateContext
needs to be triggered. Corresponds to the methodIUpdate.updateNeeded(IUpdateContext)
.- Specified by:
updateNeeded
in interfaceIUpdate
- Parameters:
context
- The context holding information on the domain object to be updated.- Returns:
- true if parts of the pictogram model needs to be updated with the latest values from the business model
-
addGraphicalRepresentation
Adds the graphical representation of the given newObject
with the information in the givenIAreaContext
.- Parameters:
context
- The area context defining where the new object should placednewObject
- The new object instance itself
-
avoidNegativeCoordinates
protected boolean avoidNegativeCoordinates()Clients can override to indicate that moving to negative coordinates should be possible. The default implementation prohibits this by returning false.- Returns:
true
in case moving a shape to negative coordinates should be possible,false
otherwise.
-
isPatternControlled
This method must be implemented by clients to indicate that the givenPictogramElement
is controlled by this pattern.- Parameters:
pictogramElement
- The pictogram element to check- Returns:
true
in case the pictogram element is controlled by this pattern,false
otherwise.
-
isPatternRoot
This method must be implemented by clients to indicate that the givenPictogramElement
is the root shape of this pattern.- Parameters:
pictogramElement
- The pictogram element to check- Returns:
true
in case the pictogram element is the root shape of this pattern,false
otherwise.
-
layoutPictogramElement
Helper method that triggers a layout of the givenPictogramElement
. The default implementation queries the feature provider and tries to find a functionality either in the pattern of an additionalAbstractLayoutFeature
that can handle the request and triggers the operation.- Parameters:
pe
- The pictogram element to layout
-
updatePictogramElement
Helper method that triggers an update of the givenPictogramElement
. The default implementation queries the feature provider and tries to find a functionality either in the pattern of an additionalAbstractUpdateFeature
that can handle the request and triggers the operation.- Parameters:
pe
- The pictogram element to update
-
setPatternConfiguration
Sets theIPatternConfiguration
instance to be used with this pattern.- Parameters:
patternConfiguration
- The new patternConfiguration
-
getPatternConfiguration
Returns theIPatternConfiguration
instance used within this pattern ornull
in case none is used.- Returns:
- The patternConfiguration instance or
null
it there is none set
-
completeInfo
Clients can override to complete theIDirectEditingInfo
info. This information is needed to switch automatically into the direct editing mode. (e.g. after creation of a new object).- Specified by:
completeInfo
in interfaceIPattern
- Parameters:
info
- The direct editing infobo
- The domain object
-
completeInfo
Clients can override to complete theIDirectEditingInfo
info. This information is needed to switch automatically into the direct editing mode. (e.g. after creation of a new object)- Specified by:
completeInfo
in interfaceIPattern
- Parameters:
info
- The direct editing infobo
- The domain objectkeyProperty
- The key property
-
getResizeConfiguration
Clients may override to modify the resize behavior. The default implementation returns a new instance ofDefaultResizeConfiguration
, which allows bothe the horizontal and vertical resize of a shape.- Specified by:
getResizeConfiguration
in interfaceIPattern
- Parameters:
context
- Context object holding information about the shape to be resized.- Returns:
- An instance of
IResizeConfiguration
defining the resize behavior.
-
createDeleteFeature
Creates theIDeleteFeature
instance that handles the deletion of business objects and diagram elements. The default implementation just creates an adaptedDefaultDeleteFeature
. Concrete pattern implementations may either override this method to provide their own subclass ofDefaultDeleteFeature
or override and extend the individual methods provided byIDelete
.The difference of the delete feature returned here to the standard
DefaultDeleteFeature
is simply that the instance returned here cares about the delegation to the pattern'spreDelete(IDeleteContext)
,isDeleteAbort()
andpostDelete(IDeleteContext)
methods. Clients overriding this method should re-implement that pattern, in case the delegation is desired.- Parameters:
context
- the deletion context- Returns:
- the
IDeleteFeature
instance to use for this pattern - See Also:
-
canDelete
Clients can override to modify the default behavior if the pattern can (and wants to) handle a delete request. The default implementation callscreateDeleteFeature(IDeleteContext)
and asks the result's canDelete method. -
preDelete
Clients can override to add actions before the default delete behavior is triggered. The default implementation does nothing and is called from the registered delete feature. -
delete
Clients can override to modify the default delete behavior. The default implementation callscreateDeleteFeature(IDeleteContext)
and triggers the result's delete method. -
postDelete
Clients can override to add actions after the default delete behavior is triggered. The default implementation does nothing and is called from the registered delete feature.- Specified by:
postDelete
in interfaceIDelete
- Parameters:
context
- The context describing the delete request
-
createRemoveFeature
Creates theIRemoveFeature
instance that handles the removal of diagram elements. The default implementation just creates an adaptedDefaultRemoveFeature
. Concrete pattern implementations may either override this method to provide their own subclass ofDefaultRemoveFeature
or override and extend the individual methods provided byIRemove
.The difference of the remove feature returned here to the standard
DefaultRemoveFeature
is simply that the instance returned here cares about the delegation to the pattern'spreRemove(IRemoveContext)
,isRemoveAbort()
andpostRemove(IRemoveContext)
methods. Clients overriding this method should re-implement that pattern, in case the delegation is desired.- Parameters:
context
- the removal context- Returns:
- the
IRemoveFeature
instance to use for this pattern - See Also:
-
canRemove
Clients can override to modify the default behavior if the pattern can (and wants to) handle a remove request. The default implementation callscreateRemoveFeature(IRemoveContext)
and asks the result's canRemove method. -
preRemove
Clients can override to add actions before the default remove behavior is triggered. The default implementation does nothing and is called from the registered remove feature. -
remove
Clients can override to modify the default remove behavior. The default implementation callscreateRemoveFeature(IRemoveContext)
and triggers the result's remove method. -
postRemove
Clients can override to add actions after the default remove behavior is triggered. The default implementation does nothing and is called from the registered remove feature.- Specified by:
postRemove
in interfaceIRemove
- Parameters:
context
- The context describing the remove request
-
canDirectEdit
Clients can override this method to indicate that the pattern allows direct editing for the shape described in the passedIDirectEditingContext
. Corresponds to the methodAbstractDirectEditingFeature.canDirectEdit(IDirectEditingContext)
. The default implementation simply returnsfalse
.- Specified by:
canDirectEdit
in interfaceIDirectEditing
- Parameters:
context
- A context object describing the direct edit request.- Returns:
true
in case direct editing shall be allowed,false
otherwise.- See Also:
-
checkValueValid
This method will be called by the framework to check if the passed String is valid as new value for the shape. This method's response time should be small since the method is queried after each change of the value in the direct edit UI. The default implementation simply returns null to indicate that all values are valid. In case of a not valid value, the returned string shall indicate the reason why the value is not valid. Corresponds to the methodAbstractDirectEditingFeature.checkValueValid(String, IDirectEditingContext)
.- Specified by:
checkValueValid
in interfaceIDirectEditing
- Parameters:
value
- The new value to checkcontext
- A context object describing the direct edit request.- Returns:
null
in case of a valid value, a string describing the reason for being not valid otherwise.
-
completeValue
public String completeValue(String value, int caretPos, String chosenValue, IDirectEditingContext context) Can be overridden by clients to define completion functionality for direct editing. Corresponds toAbstractDirectEditingFeature.completeValue(String, int, String, IDirectEditingContext)
. The default implementation simply returns the parameter chosenValue.- Specified by:
completeValue
in interfaceIDirectEditing
- Parameters:
value
- The current valuecaretPosition
- The current cursor positionchoosenValue
- The value chosen by usercontext
- A context object describing the direct edit request.- Returns:
- The new value
-
getPossibleValues
This value will be used if the cell editor is a combo box. This functionality only applies to TYPE_DROPDOWN. Corresponds to the methodAbstractDirectEditingFeature.getPossibleValues(IDirectEditingContext)
. The default implementation returns an empty string array.- Specified by:
getPossibleValues
in interfaceIDirectEditing
- Parameters:
context
- A context object describing the direct edit request.- Returns:
- The possible values for the combo box.
-
getValueProposals
This proposals will be used for the completion list of a simple text cell editor. This functionality only applies to TYPE_TEXT. Corresponds to the methodAbstractDirectEditingFeature.getValueProposals(String, int, IDirectEditingContext)
. The default implementation returns an empty string array.- Specified by:
getValueProposals
in interfaceIDirectEditing
- Parameters:
value
- The current valuecaretPosition
- The current cursor positioncontext
- A context object describing the direct edit request.- Returns:
- The proposed values
-
isAutoCompletionEnabled
public boolean isAutoCompletionEnabled()Checks if auto completion is enabled. This functionality only applies to TYPE_TEXT. Corresponds to methodAbstractDirectEditingFeature.isAutoCompletionEnabled()
. The default implementation simply returnsfalse
.- Specified by:
isAutoCompletionEnabled
in interfaceIDirectEditing
- Returns:
true
, if proposals should appear automatically,false
otherwise.
-
isCompletionAvailable
public boolean isCompletionAvailable()Checks if completion is available. This functionality only applies to TYPE_TEXT. Corresponds to methodAbstractDirectEditingFeature.isCompletionAvailable()
. The default implementation simply returnsfalse
.- Specified by:
isCompletionAvailable
in interfaceIDirectEditing
- Returns:
true
if completion is / proposals are available at all,false
otherwise.
-
stretchFieldToFitText
public boolean stretchFieldToFitText()Defines if the input field should be streched to fit its contents. This functionality applies to TYPE_TEXT, TYPE_DROPDOWN and TYPE_DROPDOWN_READ_ONLY. Corresponds to methodAbstractDirectEditingFeature.stretchFieldToFitText()
. The default implementation simply returnsfalse
.- Specified by:
stretchFieldToFitText
in interfaceIDirectEditing
- Returns:
true
if the field should exactly fit the contents,false
otherwise.
-
getEditingType
public int getEditingType()The Graphiti framework calls this method to decide which UI to show up for direct editing. Corresponds to the methodIDirectEditing.getEditingType()
. The default implementation returnIDirectEditing.TYPE_NONE
, other valid type are defined by the TYPE_* constants inIDirectEditing
.- Specified by:
getEditingType
in interfaceIDirectEditing
- Returns:
- The desired editing type
-
getInitialValue
Provides the initial value for display in the newly opened text editing UI component. Corresponds to the methodIDirectEditing.getInitialValue(IDirectEditingContext)
. The default implementation always returns an empty string.- Specified by:
getInitialValue
in interfaceIDirectEditing
- Parameters:
context
- A context object describing the direct edit request.- Returns:
- The initial string value to be displayed for editing by the user.
-
setValue
Set the new value after direct editing is finished. The value comes from the text editing UI component. Corresponds to the methodAbstractDirectEditingFeature.setValue(String, IDirectEditingContext)
. The default implementation does nothing.- Specified by:
setValue
in interfaceIDirectEditing
- Parameters:
value
- The new value to be setcontext
- A context object describing the direct edit request.
-
getProposalSupport
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 client wants to work with Objects he must provide an implementation of
IProposalSupport
. In this case the following methods of the pattern 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);
Corresponds to the methodAbstractDirectEditingFeature.getProposalSupport()
. The default implementation returnsnull
to enable the standard string-based direct editing functionality.- Specified by:
getProposalSupport
in interfaceIDirectEditing
- Returns:
- The special implementation to support Objects in code completion and combo box
- Since:
- 0.8
-
hasDoneChanges
Is queried by the framework after a pattern has been executed to find out if this pattern should appear in the undo stack. By default all patterns should appear there (see implementation in AbstractPattern), but single pattern functionality may decide to override this behavior. Note that this is a dynamic attribute of the pattern that is queried each time after the pattern functionality has been executed.IMPORTANT NOTE: The implementor of the feature is responsible for correctly implementing this method! It will lead to inconsistencies if this method returns
false
although the pattern did changes.- Specified by:
hasDoneChanges
in interfaceIPattern
- Parameters:
actionType
- the followings types are currently supported:IDelete.class, IRemove.class
- Returns:
true
if the last action of the pattern from this action type should appear in the undo stack,false
otherwise- Since:
- 0.9
-
isDeleteAbort
public boolean isDeleteAbort()Description copied from interface:IDelete
The Graphiti framework will call this method afterIDelete.preDelete(IDeleteContext)
has been called and before the actual delete is done. 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
IDelete.preDelete(IDeleteContext)
as cancellation indication and check that that flag here.- Specified by:
isDeleteAbort
in interfaceIDelete
- Returns:
true
in case you want to cancel the current operation,false
otherwise.- Since:
- 0.12
-
isRemoveAbort
public boolean isRemoveAbort()Description copied from interface:IRemove
The Graphiti framework will call this method afterIRemove.preRemove(IRemoveContext)
has been called and before the actual remove is done. 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
IRemove.preRemove(IRemoveContext)
as cancellation indication and check that that flag here.- Specified by:
isRemoveAbort
in interfaceIRemove
- Returns:
true
in case you want to cancel the current operation,false
otherwise.- Since:
- 0.12
-