Create connections programmatically [message #100015] |
Thu, 01 February 2007 07:27  |
Eclipse User |
|
|
|
Originally posted by: seliva.gmail.com
Hi!
I am trying to add a function to my GMF editor. Lets say that I have a
connection drawn between the figures A and B:
(A----B)
and I want that, when right-clicked the connection, a new figure C will
appear between A and B:
(A----C----B)
I know how to create the new figure C, but I am not sure about how to
handle the connection part. I think I should delete the old connection and
generate 2 new ones, one from A to C and one from C to B. Is there any
method to do this automatically?
Also, I am not sure about how to create a new connection. I tried using
the same way as the objects:
creationCommand = new RecordingCommand(editingDomain) {
@SuppressWarnings("unchecked") //$NON-NLS-1$
protected void doExecute() {
Connection newMod = YardFactory.eINSTANCE.createConnection();
newMod.setSource(source);
newMod.setTarget(target);
}
};
editingDomain.getCommandStack().execute(creationCommand);
but nothing happens. I wanted to try by adding:
source.getConnection().add(****newConnection****);
but I dont know how to get the newConnectionObject resulted from the
execute command. Any help??
Thanks!!
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.24715 seconds