Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to avoid connecting two or more links to the same point...
How to avoid connecting two or more links to the same point... [message #171496] Tue, 05 February 2008 07:44
Eclipse UserFriend
Originally posted by: gmerin.integranova.com

Hello everyone! Sorry for bothering but I need a hand..

My question is quite simple, does anyone know how prevent two or more
links getting connected to the same point?

I mean, if I draw a link A between two nodes, I don't any other link
created or reconnected afterwards to get connected to source/target
points of link A.

I've tryied to accomplish this catching the
CreateConnectionViewAndElementRequest (and the ReconnectRequest) in the
NodesEditPart code:

@Override
public Command getCommand(Request _request) {

if (_request instanceof CreateConnectionViewAndElementRequest) {

CreateConnectionViewAndElementRequest createViewAndElemReq =
(CreateConnectionViewAndElementRequest) _request;

// Check if there is another element in the same point
if (!MessageCommonUtil.checkFreeConnectionEnds(_request)) {
return null;
}

....

}

But I don't know how to get the information of source and target points
because the following code does not work:

sourceEditPart = (ShapeNodeEditPart) createRequest .getSourceEditPart();
sourceRefLocation = sourceEditPart.getSourceConnectionAnchor(
createRequest).getReferencePoint();

targetEditPart = (ShapeNodeEditPart) createRequest
.getTargetEditPart();
targetRefLocation = targetEditPart.getTargetConnectionAnchor(
createRequest).getReferencePoint();

Any help?

Thanks in advance.
Previous Topic:Enabling Selection
Next Topic:Re: Problems with use of EMF contextmenu in GMF Editor
Goto Forum:
  


Current Time: Thu Jul 03 14:20:43 EDT 2025

Powered by FUDForum. Page generated in 0.02733 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top