Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "FIxedConnectionAnchor"
(stop Connection from moving when Nodes are moved) |
(→How to stop Connection from moving when Nodes are moved?) |
||
Line 20: | Line 20: | ||
return fixedAnchor; | return fixedAnchor; | ||
} | } | ||
+ | --[[User:Akhandelwal6.csc.com|Akhandelwal6.csc.com]] 00:53, 7 September 2007 (EDT) |
Revision as of 00:53, 7 September 2007
How to stop Connection from moving when Nodes are moved?
for this to take place we need to understand the concept of fixedconnectionAnchor. Try to extend the class AbstractConnectionAnchor and override the mehods getLocation() and the getOwner() method to suit to your needs.
Then go to the editpart you wish the connection to stick to and just write the following code -
public ConnectionAnchor getTargetConnectionAnchor(ConnectionEditPart connEditPart) { if (fixedAnchor == null) { fixedAnchor = new FixedConnectionAnchor(getNodeFigure()); getNodeFigure().addAncestorListener(fixedAnchor); } return fixedAnchor; }
public ConnectionAnchor getTargetConnectionAnchor(Request request) { if (fixedAnchor == null) { fixedAnchor = new FixedConnectionAnchor(getNodeFigure()); getNodeFigure().addAncestorListener(fixedAnchor); } return fixedAnchor; }
--Akhandelwal6.csc.com 00:53, 7 September 2007 (EDT)