Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Connections and Drag&Drop
Connections and Drag&Drop [message #213144] Mon, 03 April 2006 14:32
Eclipse UserFriend
Originally posted by: sami.lakka.watechnologies.no_spam.com

My editor allows users to drag & drop model elements from a tree to GEF
editor. Between model elements there can be connections and my problem is
that I don't want to draw the connections if the other model element isn't
in the diagram. I handle this in getModelSource/Target methods where I first
check if the other part of the connection is already in the diagram and if
it is I call the targetParts refreshTargetConnection method. I have to do
this because otherwise the
connection isn't attached to the target part. Now in getModelTarget I have
to call again to getModelSource to ascertain that the source connections are
ok. This leads to awful code that doesn't seem to work in every occasion so
I was wondering is there a simpler/nicer way to do this?


Pseudocode:

private boolean isUpdating = false;

protected List getModelSourceConnections() {
...

if (isInDiagram(targetModel)) {
if (isUpdating)
sourceConnections.add(association);
else
targetPart.refreshTargetConnections();
}
}

protected List getModelTargetConnections() {

if (!isInDiagram(sourceModel)) {
sourcePart = (JavaElementEditPart)
getViewer().getEditPartRegistry().get(sourceModel);
sourcePart.setUpdating(true);
sourcePart.refreshSourceConnections();
sourcePart.setUpdating(false);
connections.add(association)
}

}
Previous Topic:Changing zoommanager
Next Topic:Could connection linked to Figures that using FreeformLayout?
Goto Forum:
  


Current Time: Thu Apr 25 12:42:18 GMT 2024

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

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

Back to the top