Class DefaultReconnectionFeature
java.lang.Object
org.eclipse.graphiti.features.impl.AbstractFeature
org.eclipse.graphiti.features.impl.DefaultReconnectionFeature
- All Implemented Interfaces:
IFeature
,IFeatureProviderHolder
,IReconnectionFeature
,IReconnection
,IDescription
,IName
The default implementation for the
IReconnectionFeature
interface. Is
used by default by the framework for any reconnection requests triggered in
the diagram. May be subclassed and adapted by clients.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
canceledReconnect
(IReconnectionContext context) Called by the framework in case a started reconnection operation has been cancelled, e.g.boolean
canExecute
(IContext context) Called by the framework to check if this feature can perform the currently triggered reconnection request.boolean
canReconnect
(IReconnectionContext context) Called by the framework to check if this feature can perform the currently triggered reconnection request.boolean
canStartReconnect
(IReconnectionContext context) Called by the framework after the connection has been selected.void
Called by the framework to execute this feature to perform the currently triggered reconnection request.getName()
Returns the display name of the feature to use e.g.protected Anchor
getNewAnchor
(IReconnectionContext context) Can be overridden by the user to influence the target anchor to use for the reconnect.void
postReconnect
(IReconnectionContext context) Hook that is called by thereconnect(IReconnectionContext)
method after the actual reconnect is done.void
preReconnect
(IReconnectionContext context) Hook that is called by thereconnect(IReconnectionContext)
method before the actual reconnect is done.final void
reconnect
(IReconnectionContext context) Called by the framework to perform the currently triggered reconnection request.Methods inherited from class org.eclipse.graphiti.features.impl.AbstractFeature
addGraphicalRepresentation, canUndo, getAllBusinessObjectsForPictogramElement, getBusinessObjectForPictogramElement, getDescription, getDiagram, getDiagramBehavior, getFeatureProvider, getProgressCallback, getUserDecision, hasDoneChanges, 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
canUndo, hasDoneChanges, isAvailable
Methods inherited from interface org.eclipse.graphiti.features.IFeatureProviderHolder
getFeatureProvider
-
Constructor Details
-
DefaultReconnectionFeature
Creates a newDefaultReconnectionFeature
.- Parameters:
fp
- the feature provider to use
-
-
Method Details
-
canReconnect
Called by the framework to check if this feature can perform the currently triggered reconnection request. The default implementation checks if- A connection and a new target anchor are passed in the given
IReconnectionContext
- The connection passed in the context has a start and end anchor
- The new anchor is not located directly in the diagram
- Specified by:
canReconnect
in interfaceIReconnection
- Parameters:
context
- the context object holding all the reconnection information- Returns:
true
if the feature is able to deal with the reconnection request,false
otherwise or if the tool needs to prohibit the reconnection for the given situation.
- A connection and a new target anchor are passed in the given
-
getNewAnchor
Can be overridden by the user to influence the target anchor to use for the reconnect.- Parameters:
context
- the context holding the reconnection information- Returns:
- the new anchor to use as target for the reconnect
-
reconnect
Called by the framework to perform the currently triggered reconnection request. The default implementation calls thepreReconnect(IReconnectionContext)
andpostReconnect(IReconnectionContext)
hooks. The reconnect is done by either replacing the start anchor (in case it matches the old anchor passed in the context) or the end anchor with the new anchor.- Specified by:
reconnect
in interfaceIReconnection
- Parameters:
context
- the context object holding all the reconnection information
-
preReconnect
Hook that is called by thereconnect(IReconnectionContext)
method before the actual reconnect is done. Can be overridden by clients to add additional functionality.- Specified by:
preReconnect
in interfaceIReconnection
- Parameters:
context
- the context object holding all the reconnection information
-
postReconnect
Hook that is called by thereconnect(IReconnectionContext)
method after the actual reconnect is done. Can be overridden by clients to add additional functionality.- Specified by:
postReconnect
in interfaceIReconnection
- Parameters:
context
- the context object holding all the reconnection information
-
canExecute
Called by the framework to check if this feature can perform the currently triggered reconnection request. Delegates to thecanReconnect(IReconnectionContext)
method in case the passed context is aIReconnectionContext
.- Specified by:
canExecute
in interfaceIFeature
- Parameters:
context
- the context object holding all the reconnection information- Returns:
true
if the feature is able to deal with the reconnection request,false
otherwise or if the tool needs to prohibit the reconnection for the given situation.- See Also:
-
execute
Called by the framework to execute this feature to perform the currently triggered reconnection request. Delegates to thereconnect(IReconnectionContext)
method in case the passed context is aIReconnectionContext
. -
getName
Returns the display name of the feature to use e.g. within a context menu.- Specified by:
getName
in interfaceIName
- Overrides:
getName
in classAbstractFeature
- Returns:
- the display name of the feature
-
canceledReconnect
Called by the framework in case a started reconnection operation has been cancelled, e.g. by pressing ESC, selecting another tool from the palette etc.- Specified by:
canceledReconnect
in interfaceIReconnection
- Parameters:
context
- the context object holding all the reconnection information- Since:
- 0.9
-
canStartReconnect
Called by the framework after the connection has been selected. Determines whether connection endpoint can be dragged to start reconnection.- Specified by:
canStartReconnect
in interfaceIReconnection
- Parameters:
context
- the context object holding information about the connection and old anchor- Returns:
true
- Since:
- 0.11
-