Package org.eclipse.gef.editpolicies
Class GraphicalNodeEditPolicy
java.lang.Object
org.eclipse.gef.editpolicies.AbstractEditPolicy
org.eclipse.gef.editpolicies.GraphicalEditPolicy
org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy
- All Implemented Interfaces:
- EditPolicy,- RequestConstants
A GraphicalNodeEditPolicy is responsible for creating and reconnecting
 connections graphically.
 Created on :Nov 11, 2002
- Since:
- 2.0
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected ConnectionThe connection feedback displayed during createsprotected FeedbackHelperthe current FeedbackHelperFields inherited from interface org.eclipse.gef.EditPolicyCOMPONENT_ROLE, CONNECTION_BENDPOINTS_ROLE, CONNECTION_ENDPOINTS_ROLE, CONNECTION_ROLE, CONTAINER_ROLE, DIRECT_EDIT_ROLE, GRAPHICAL_NODE_ROLE, LAYOUT_ROLE, NODE_ROLE, PRIMARY_DRAG_ROLE, SELECTION_FEEDBACK_ROLE, TREE_CONTAINER_ROLEFields inherited from interface org.eclipse.gef.RequestConstantsREQ_ADD, REQ_ALIGN, REQ_ALIGN_CHILDREN, REQ_CLONE, REQ_CONNECTION_END, REQ_CONNECTION_START, REQ_CREATE, REQ_CREATE_BENDPOINT, REQ_DELETE, REQ_DELETE_DEPENDANT, REQ_DIRECT_EDIT, REQ_MOVE, REQ_MOVE_BENDPOINT, REQ_MOVE_CHILDREN, REQ_OPEN, REQ_ORPHAN, REQ_ORPHAN_CHILDREN, REQ_RECONNECT_SOURCE, REQ_RECONNECT_TARGET, REQ_RESIZE, REQ_RESIZE_CHILDREN, REQ_SELECTION, REQ_SELECTION_HOVER
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected ConnectionReturns a connection to be used as feeback during creates.voidDoes nothing by default.protected voidErases connection feedback if necessary.voideraseSourceFeedback(Request request) CallseraseCreationFeedback(CreateConnectionRequest)when appropriate.protected voideraseTargetConnectionFeedback(DropRequest request) Override to erase target feedback.voideraseTargetFeedback(Request request) CallseraseTargetConnectionFeedback(DropRequest)when appropriate.getCommand(Request request) Factors the request into one of four abstract methods.protected abstract CommandReturns the Command that will create the connection.protected abstract CommandReturns the command that represents the first half of creating a connection.protected ConnectionRouterReturns the ConnectionRouter for the creation feedback's connection.protected FeedbackHelpergetFeedbackHelper(CreateConnectionRequest request) Returns the FeedbackHelper that is ready to use.protected abstract CommandReturns theCommandto reconnect a connection's source end to the host.protected abstract CommandReturns theCommandto reconnect a connection's target end to the host.protected ConnectionAnchorCalled during the display of creation feedback to snap the feedback to the nearest source ConnectionAnchor.protected ConnectionAnchorCalled during the display of creation feedback to snap the feedback to the nearest target ConnectionAnchor.getTargetEditPart(Request request) Returns the host for the appropriateRequests.protected voidShows feedback during a creation.voidshowSourceFeedback(Request request) callsshowCreationFeedback(CreateConnectionRequest)when appropriate.protected voidshowTargetConnectionFeedback(DropRequest request) Override to show target connection feedback.voidshowTargetFeedback(Request request) CallsshowTargetConnectionFeedback(DropRequest)when appropriate.Methods inherited from class org.eclipse.gef.editpolicies.GraphicalEditPolicyaddFeedback, getFeedbackLayer, getHost, getHostFigure, getLayer, removeFeedbackMethods inherited from class org.eclipse.gef.editpolicies.AbstractEditPolicyactivate, debugFeedback, setHost, toString, understandsRequest
- 
Field Details- 
feedbackHelperthe current FeedbackHelper
- 
connectionFeedbackThe connection feedback displayed during creates
 
- 
- 
Constructor Details- 
GraphicalNodeEditPolicypublic GraphicalNodeEditPolicy()
 
- 
- 
Method Details- 
createDummyConnectionReturns a connection to be used as feeback during creates.- Parameters:
- req- the operation being performed
- Returns:
- a connection to use as feedback
 
- 
deactivatepublic void deactivate()Description copied from class:AbstractEditPolicyDoes nothing by default.- Specified by:
- deactivatein interface- EditPolicy
- Overrides:
- deactivatein class- AbstractEditPolicy
- See Also:
 
- 
eraseCreationFeedbackErases connection feedback if necessary. Frees unused fields.- Parameters:
- request- the CreateConnectionRequest
 
- 
eraseSourceFeedbackCallseraseCreationFeedback(CreateConnectionRequest)when appropriate.- Specified by:
- eraseSourceFeedbackin interface- EditPolicy
- Overrides:
- eraseSourceFeedbackin class- AbstractEditPolicy
- Parameters:
- request- the Request
- See Also:
 
- 
eraseTargetConnectionFeedbackOverride to erase target feedback. Does nothing by default.- Parameters:
- request- the DropRequest
 
- 
eraseTargetFeedbackCallseraseTargetConnectionFeedback(DropRequest)when appropriate.- Specified by:
- eraseTargetFeedbackin interface- EditPolicy
- Overrides:
- eraseTargetFeedbackin class- AbstractEditPolicy
- Parameters:
- request- the Request
- See Also:
 
- 
getCommandFactors the request into one of four abstract methods. Subclasses must implement these methods.- Specified by:
- getCommandin interface- EditPolicy
- Overrides:
- getCommandin class- AbstractEditPolicy
- Parameters:
- request- the Request
- Returns:
- nullor a Command contribution
- See Also:
 
- 
getConnectionCompleteCommandReturns the Command that will create the connection. This is second part of creation.CreateConnectionRequest.getStartCommand()is used here to obtain the contribution from the EditPart from which the User started the creation.- Parameters:
- request- the CreateConnectionRequest
- Returns:
- the complete command to create a connection
 
- 
getConnectionCreateCommandReturns the command that represents the first half of creating a connection. In case the first half of the connection creation was successful (i.e. the returned start command is executable), the target edit part is then responsible of creating a Command that represents the entire creation. In case the target edit part needs to refer to the start command to achieve this, the start command may be registered on the passed in create request (seeCreateConnectionRequest.setStartCommand(Command)) before returning it here.- Parameters:
- request- the CreateConnectionRequest
- Returns:
- a Command representing half of a connection creation
- See Also:
 
- 
getDummyConnectionRouterReturns the ConnectionRouter for the creation feedback's connection.- Parameters:
- request- the create request
- Returns:
- a connection router
- Since:
- 3.2
 
- 
getFeedbackHelperReturns the FeedbackHelper that is ready to use. The feedback helper must be configured with the connection that will be used to display feedback, and that connection must be added to the appropriate layer in the diagram.- Parameters:
- request- the CreateConnectionRequest
- Returns:
- a FeedbackHelper
 
- 
getReconnectTargetCommandReturns theCommandto reconnect a connection's target end to the host.- Parameters:
- request- the ReconnectRequest
- Returns:
- a Command
 
- 
getReconnectSourceCommandReturns theCommandto reconnect a connection's source end to the host.- Parameters:
- request- the ReconnectRequest
- Returns:
- a Command
 
- 
getSourceConnectionAnchorCalled during the display of creation feedback to snap the feedback to the nearest source ConnectionAnchor.- Parameters:
- request- CreateConnectionRequest
- Returns:
- nullor the nearest source ConnectionAnchor
 
- 
getTargetConnectionAnchorCalled during the display of creation feedback to snap the feedback to the nearest target ConnectionAnchor.- Parameters:
- request- CreateConnectionRequest
- Returns:
- nullor the nearest target ConnectionAnchor
 
- 
getTargetEditPartReturns the host for the appropriateRequests. Returnsnullotherwise.- Specified by:
- getTargetEditPartin interface- EditPolicy
- Overrides:
- getTargetEditPartin class- AbstractEditPolicy
- Parameters:
- request- the Request
- Returns:
- nullor the appropriate target- EditPart
- See Also:
 
- 
showCreationFeedbackShows feedback during a creation.- Parameters:
- request- CreateConnectionRequest
 
- 
showSourceFeedbackcallsshowCreationFeedback(CreateConnectionRequest)when appropriate.- Specified by:
- showSourceFeedbackin interface- EditPolicy
- Overrides:
- showSourceFeedbackin class- AbstractEditPolicy
- Parameters:
- request- the Request
- See Also:
 
- 
showTargetConnectionFeedbackOverride to show target connection feedback. Does nothing by default.- Parameters:
- request- the DropRequest
 
- 
showTargetFeedbackCallsshowTargetConnectionFeedback(DropRequest)when appropriate.- Specified by:
- showTargetFeedbackin interface- EditPolicy
- Overrides:
- showTargetFeedbackin class- AbstractEditPolicy
- Parameters:
- request- the Request
- See Also:
 
 
-