Class BendpointEditPolicyFixed
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.graphiti.ui.internal.policy.BendpointEditPolicyFixed
- All Implemented Interfaces:
PropertyChangeListener,EventListener,org.eclipse.core.runtime.IAdaptable,org.eclipse.gef.EditPolicy,org.eclipse.gef.RequestConstants
- Direct Known Subclasses:
ConnectionBendpointEditPolicy
public abstract class BendpointEditPolicyFixed
extends org.eclipse.gef.editpolicies.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 Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected static final List<org.eclipse.draw2d.Bendpoint>protected List<?>protected static final org.eclipse.draw2d.geometry.Pointprotected static final org.eclipse.draw2d.geometry.PointFields inherited from class org.eclipse.gef.editpolicies.SelectionHandlesEditPolicy
handlesFields inherited from interface org.eclipse.gef.EditPolicy
COMPONENT_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.RequestConstants
REQ_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 Summary
ConstructorsConstructorDescriptionBendpointEditPolicyFixed(IConfigurationProviderInternal configurationProvider) -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate()activate()is extended to add a listener to theConnectionfigure.protected List<org.eclipse.gef.handles.BendpointHandle>protected List<org.eclipse.gef.handles.BendpointHandle>protected List<org.eclipse.gef.handles.BendpointHandle>Creates selection handles for the bendpoints.voiddeactivate()is extended to remove the property change listener on theConnectionfigure.protected voideraseConnectionFeedback(org.eclipse.gef.requests.BendpointRequest request) Erases all bendpoint feedback.voideraseSourceFeedback(org.eclipse.gef.Request request) org.eclipse.gef.commands.CommandgetCommand(org.eclipse.gef.Request request) Factors the Request into either a MOVE, a DELETE, or a CREATE of a bendpoint.protected IConfigurationProviderInternalprotected org.eclipse.draw2d.ConnectionConvenience method for obtaining the host'sConnectionfigure.protected List<org.eclipse.draw2d.Bendpoint>protected abstract org.eclipse.gef.commands.CommandgetCreateBendpointCommand(org.eclipse.gef.requests.BendpointRequest request) Implement this method to return a Command that will create a bendpoint.protected abstract org.eclipse.gef.commands.CommandgetDeleteBendpointCommand(org.eclipse.gef.requests.BendpointRequest request) Implement this method to return a Command that will delete a bendpoint.protected IFeatureProviderprotected abstract org.eclipse.gef.commands.CommandgetMoveBendpointCommand(org.eclipse.gef.requests.BendpointRequest request) Implement this method to return a Command that will move a bendpoint.protected booleanprotected booleanlineContainsPoint(org.eclipse.draw2d.geometry.Point p1, org.eclipse.draw2d.geometry.Point p2, org.eclipse.draw2d.geometry.Point p) 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 voidsetReferencePoints(org.eclipse.gef.requests.BendpointRequest request) protected voidshowCreateBendpointFeedback(org.eclipse.gef.requests.BendpointRequest request) Shows feedback when a bendpoint is being created.protected voidshowDeleteBendpointFeedback(org.eclipse.gef.requests.BendpointRequest request) Shows feedback when a bendpoint is being deleted.protected voidshowMoveBendpointFeedback(org.eclipse.gef.requests.BendpointRequest request) Shows feedback when a bendpoint is being moved.voidshowSourceFeedback(org.eclipse.gef.Request request) Shows feedback when appropriate.Methods inherited from class org.eclipse.gef.editpolicies.SelectionHandlesEditPolicy
addSelectionHandles, getAdapter, hideSelection, removeSelectionHandles, showSelectionMethods inherited from class org.eclipse.gef.editpolicies.SelectionEditPolicy
addSelectionListener, getTargetEditPart, hideFocus, removeSelectionListener, setFocus, setSelectedState, showFocus, showPrimarySelectionMethods inherited from class org.eclipse.gef.editpolicies.GraphicalEditPolicy
addFeedback, getFeedbackLayer, getHost, getHostFigure, getLayer, removeFeedbackMethods inherited from class org.eclipse.gef.editpolicies.AbstractEditPolicy
debugFeedback, eraseTargetFeedback, setHost, showTargetFeedback, toString, understandsRequest
-
Field Details
-
NULL_CONSTRAINT
-
originalConstraint
-
isDeleting
protected boolean isDeleting -
ref1
protected static final org.eclipse.draw2d.geometry.Point ref1 -
ref2
protected static final org.eclipse.draw2d.geometry.Point ref2
-
-
Constructor Details
-
BendpointEditPolicyFixed
-
-
Method Details
-
activate
public void activate()activate()is extended to add a listener to theConnectionfigure.- Specified by:
activatein interfaceorg.eclipse.gef.EditPolicy- Overrides:
activatein classorg.eclipse.gef.editpolicies.SelectionEditPolicy- See Also:
-
EditPolicy.activate()
-
createHandlesForAutomaticBendpoints
-
createHandlesForUserBendpoints
-
createSelectionHandles
Creates 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 classorg.eclipse.gef.editpolicies.SelectionHandlesEditPolicy- See Also:
-
SelectionHandlesEditPolicy.createSelectionHandles()
-
deactivate
public void deactivate()deactivate()is extended to remove the property change listener on theConnectionfigure.- Specified by:
deactivatein interfaceorg.eclipse.gef.EditPolicy- Overrides:
deactivatein classorg.eclipse.gef.editpolicies.SelectionEditPolicy- See Also:
-
EditPolicy.deactivate()
-
eraseConnectionFeedback
protected void eraseConnectionFeedback(org.eclipse.gef.requests.BendpointRequest request) Erases 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
-
eraseSourceFeedback
public void eraseSourceFeedback(org.eclipse.gef.Request request) - Specified by:
eraseSourceFeedbackin interfaceorg.eclipse.gef.EditPolicy- Overrides:
eraseSourceFeedbackin classorg.eclipse.gef.editpolicies.AbstractEditPolicy- See Also:
-
EditPolicy.eraseSourceFeedback(Request)
-
getCommand
public org.eclipse.gef.commands.Command getCommand(org.eclipse.gef.Request request) Factors the Request into either a MOVE, a DELETE, or a CREATE of a bendpoint.- Specified by:
getCommandin interfaceorg.eclipse.gef.EditPolicy- Overrides:
getCommandin classorg.eclipse.gef.editpolicies.AbstractEditPolicy- See Also:
-
EditPolicy.getCommand(Request)
-
getConnection
protected org.eclipse.draw2d.Connection getConnection()Convenience method for obtaining the host'sConnectionfigure.- Returns:
- the Connection figure
-
getCreateBendpointCommand
protected abstract org.eclipse.gef.commands.Command getCreateBendpointCommand(org.eclipse.gef.requests.BendpointRequest request) Implement this method to return a Command that will create a bendpoint.- Parameters:
request- the BendpointRequest- Returns:
- a Command to create a bendpoint
-
getDeleteBendpointCommand
protected abstract org.eclipse.gef.commands.Command getDeleteBendpointCommand(org.eclipse.gef.requests.BendpointRequest request) Implement this method to return a Command that will delete a bendpoint.- Parameters:
request- the BendpointRequest- Returns:
- a Command to delete a bendpoint
-
getMoveBendpointCommand
protected abstract org.eclipse.gef.commands.Command getMoveBendpointCommand(org.eclipse.gef.requests.BendpointRequest request) Implement this method to return a Command that will move a bendpoint.- Parameters:
request- the BendpointRequest- Returns:
- a Command to move a bendpoint
-
isAutomaticallyBending
protected boolean isAutomaticallyBending() -
lineContainsPoint
protected boolean lineContainsPoint(org.eclipse.draw2d.geometry.Point p1, org.eclipse.draw2d.geometry.Point p2, org.eclipse.draw2d.geometry.Point p) -
propertyChange
If the number of bendpoints changes, handles are updated.- Specified by:
propertyChangein interfacePropertyChangeListener- See Also:
-
restoreOriginalConstraint
protected void restoreOriginalConstraint()Restores the original constraint that was saved before feedback began to show. -
saveOriginalConstraint
protected 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. -
setReferencePoints
protected void setReferencePoints(org.eclipse.gef.requests.BendpointRequest request) -
showCreateBendpointFeedback
protected void showCreateBendpointFeedback(org.eclipse.gef.requests.BendpointRequest request) Shows 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
-
showDeleteBendpointFeedback
protected void showDeleteBendpointFeedback(org.eclipse.gef.requests.BendpointRequest request) Shows 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
-
showMoveBendpointFeedback
protected void showMoveBendpointFeedback(org.eclipse.gef.requests.BendpointRequest request) Shows 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
-
showSourceFeedback
public void showSourceFeedback(org.eclipse.gef.Request request) Shows feedback when appropriate. Calls a different method depending on the request type.- Specified by:
showSourceFeedbackin interfaceorg.eclipse.gef.EditPolicy- Overrides:
showSourceFeedbackin classorg.eclipse.gef.editpolicies.AbstractEditPolicy- Parameters:
request- the Request- See Also:
-
getConfigurationProvider
-
getFeatureProvider
-
getConnectionRoutingConstraint
-