Package org.eclipse.gef.editpolicies
Class BendpointEditPolicy
java.lang.Object
org.eclipse.gef.editpolicies.AbstractEditPolicy
org.eclipse.gef.editpolicies.GraphicalEditPolicy
org.eclipse.gef.editpolicies.SelectionEditPolicy
org.eclipse.gef.editpolicies.SelectionHandlesEditPolicy
org.eclipse.gef.editpolicies.BendpointEditPolicy
- All Implemented Interfaces:
- PropertyChangeListener,- EventListener,- IAdaptable,- EditPolicy,- RequestConstants
public abstract class BendpointEditPolicy
extends SelectionHandlesEditPolicy
implements PropertyChangeListener
Used to add bendpoint handles on a 
ConnectionEditPart.
 
 BendpointEditPolicy will automatically observe the
 Connection figure. If the number of bends in the
 Connection changes, the handles will be updated.
- 
Field SummaryFields inherited from class org.eclipse.gef.editpolicies.SelectionHandlesEditPolicyhandlesFields 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 TypeMethodDescriptionvoidactivate()activate()is extended to add a listener to theConnectionfigure.protected List<? extends BendpointHandle> Creates selection handles for the bendpoints.voiddeactivate()is extended to remove the property change listener on theConnectionfigure.protected voideraseConnectionFeedback(BendpointRequest request) Erases all bendpoint feedback.voideraseSourceFeedback(Request request) Does nothing by default.getCommand(Request request) Factors the Request into either a MOVE, a DELETE, or a CREATE of a bendpoint.protected ConnectionConvenience method for obtaining the host'sConnectionfigure.protected abstract CommandImplement this method to return a Command that will create a bendpoint.protected abstract CommandImplement this method to return a Command that will delete a bendpoint.getHost()Cast the parent getHost to GraphicalEditPart This reduces the necessary cast operations in this and all child classes as well as in any users of a GraphicalEditPolicy.protected abstract CommandgetMoveBendpointCommand(BendpointRequest request) Implement this method to return a Command that will move a bendpoint.voidIf the number of bendpoints changes, handles are updated.protected voidRestores the original constraint that was saved before feedback began to show.protected voidSince the original figure is used for feedback, this method saves the original constraint, so that is can be restored when the feedback is erased.protected voidShows feedback when a bendpoint is being created.protected voidShows feedback when a bendpoint is being deleted.protected voidShows feedback when a bendpoint is being moved.voidshowSourceFeedback(Request request) Shows feedback when appropriate.Methods inherited from class org.eclipse.gef.editpolicies.SelectionHandlesEditPolicyaddSelectionHandles, getAdapter, hideSelection, removeSelectionHandles, showSelectionMethods inherited from class org.eclipse.gef.editpolicies.SelectionEditPolicyaddSelectionListener, getTargetEditPart, hideFocus, removeSelectionListener, setFocus, setSelectedState, showFocus, showPrimarySelectionMethods inherited from class org.eclipse.gef.editpolicies.GraphicalEditPolicyaddFeedback, getFeedbackLayer, getHostFigure, getLayer, removeFeedbackMethods inherited from class org.eclipse.gef.editpolicies.AbstractEditPolicydebugFeedback, eraseTargetFeedback, setHost, showTargetFeedback, toString, understandsRequest
- 
Constructor Details- 
BendpointEditPolicypublic BendpointEditPolicy()
 
- 
- 
Method Details- 
activatepublic void activate()activate()is extended to add a listener to theConnectionfigure.- Specified by:
- activatein interface- EditPolicy
- Overrides:
- activatein class- SelectionEditPolicy
- See Also:
 
- 
createSelectionHandlesCreates selection handles for the bendpoints. Explicit (user-defined) bendpoints will haveBendpointMoveHandles on them with a singleBendpointCreationHandlebetween 2 consecutive explicit bendpoints. If implicit bendpoints (such as those created by theAutomaticRouter) are used, oneBendpointCreationHandleis placed in the middle of the Connection.- Specified by:
- createSelectionHandlesin class- SelectionHandlesEditPolicy
- Returns:
- List of handles; cannot be null
- See Also:
 
- 
deactivatepublic void deactivate()deactivate()is extended to remove the property change listener on theConnectionfigure.- Specified by:
- deactivatein interface- EditPolicy
- Overrides:
- deactivatein class- SelectionEditPolicy
- See Also:
 
- 
eraseConnectionFeedbackErases all bendpoint feedback. Since the originalConnectionfigure is used for feedback, we just restore the original constraint that was saved before feedback started to show.- Parameters:
- request- the BendpointRequest
 
- 
eraseSourceFeedbackDescription copied from class:AbstractEditPolicyDoes nothing by default.- Specified by:
- eraseSourceFeedbackin interface- EditPolicy
- Overrides:
- eraseSourceFeedbackin class- AbstractEditPolicy
- Parameters:
- request- the Request
- See Also:
 
- 
getCommandFactors the Request into either a MOVE, a DELETE, or a CREATE of a bendpoint.- Specified by:
- getCommandin interface- EditPolicy
- Overrides:
- getCommandin class- AbstractEditPolicy
- Parameters:
- request- the Request
- Returns:
- nullor a Command contribution
- See Also:
 
- 
getConnectionConvenience method for obtaining the host'sConnectionfigure.- Returns:
- the Connection figure
 
- 
getCreateBendpointCommandImplement this method to return a Command that will create a bendpoint.- Parameters:
- request- the BendpointRequest
- Returns:
- a Command to create a bendpoint
 
- 
getDeleteBendpointCommandImplement this method to return a Command that will delete a bendpoint.- Parameters:
- request- the BendpointRequest
- Returns:
- a Command to delete a bendpoint
 
- 
getHostDescription copied from class:GraphicalEditPolicyCast the parent getHost to GraphicalEditPart This reduces the necessary cast operations in this and all child classes as well as in any users of a GraphicalEditPolicy.- Specified by:
- getHostin interface- EditPolicy
- Overrides:
- getHostin class- GraphicalEditPolicy
- Returns:
- the host EditPart on which this policy is installed.
- Since:
- 3.17
- See Also:
 
- 
getMoveBendpointCommandImplement this method to return a Command that will move a bendpoint.- Parameters:
- request- the BendpointRequest
- Returns:
- a Command to move a bendpoint
 
- 
propertyChangeIf the number of bendpoints changes, handles are updated.- Specified by:
- propertyChangein interface- PropertyChangeListener
- See Also:
 
- 
restoreOriginalConstraintprotected void restoreOriginalConstraint()Restores the original constraint that was saved before feedback began to show.
- 
saveOriginalConstraintprotected void saveOriginalConstraint()Since the original figure is used for feedback, this method saves the original constraint, so that is can be restored when the feedback is erased.
- 
showCreateBendpointFeedbackShows feedback when a bendpoint is being created. The original figure is used for feedback and the original constraint is saved, so that it can be restored when feedback is erased.- Parameters:
- request- the BendpointRequest
 
- 
showDeleteBendpointFeedbackShows feedback when a bendpoint is being deleted. This method is only called once when the bendpoint is first deleted, not every mouse move. The original figure is used for feedback and the original constraint is saved, so that it can be restored when feedback is erased.- Parameters:
- request- the BendpointRequest
 
- 
showMoveBendpointFeedbackShows feedback when a bendpoint is being moved. Also checks to see if the bendpoint should be deleted and then callsshowDeleteBendpointFeedback(BendpointRequest)if needed. The original figure is used for feedback and the original constraint is saved, so that it can be restored when feedback is erased.- Parameters:
- request- the BendpointRequest
 
- 
showSourceFeedbackShows feedback when appropriate. Calls a different method depending on the request type.- Specified by:
- showSourceFeedbackin interface- EditPolicy
- Overrides:
- showSourceFeedbackin class- AbstractEditPolicy
- Parameters:
- request- the Request
- See Also:
 
 
-