How to avoid connecting two or more links to the same point... [message #171496] |
Tue, 05 February 2008 07:44 |
Eclipse User |
|
|
|
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.
|
|
|
Powered by
FUDForum. Page generated in 0.02733 seconds