Skip to main content

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.

Jump to: navigation, search

FIxedConnectionAnchor

Revision as of 00:53, 7 September 2007 by Unnamed Poltroon (Talk) (How to stop Connection from moving when Nodes are moved?)

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)

Back to the top