Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Create connections programmatically
Create connections programmatically [message #100015] Thu, 01 February 2007 07:27 Go to next message
Eclipse UserFriend
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!!
Re: Create connections programmatically [message #100070 is a reply to message #100015] Thu, 01 February 2007 08:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: reneschm.cs.tu-berlin.de

Hi,

please take a look at this post
http://dev.eclipse.org/newslists/news.eclipse.modeling.gmf/m sg03885.html
If you are interested, I can tell you something more about it

Rene Schmutzler

TU Berlin - Tiger Team

Noelia Rodriguez schrieb:
> 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!!
>
>
>
Re: Create connections programmatically [message #100127 is a reply to message #100070] Thu, 01 February 2007 09:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: seliva.gmail.com

Hi Rene!

yes, that is more or less what I am looking for. Initially I was thinking
to right-clicked on the connection and choose "add element" but drag and
drop from the palette is also convenient for me.

I saw at the link the screen shots of what your extension does. Could I
get an explanation about the code needed or at least of the part where the
"new" connections are created?

Thanks!!!

/Noelia
Re: Create connections programmatically [message #100154 is a reply to message #100127] Thu, 01 February 2007 10:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: reneschm.cs.tu-berlin.de

Hi Noelia,
we are using a metamodel transformation with an modified gmf environment
based on GMF2.0M3 I will write a short howto and than will post the link
to it. For the moment you can take a look at
http://tfs.cs.tu-berlin.de/emftrans/ and where you can find some
information about the transformationsystem.

Rene Schmutzler

TU Berlin - Tiger Team

Noelia Rodriguez schrieb:
> Hi Rene!
>
> yes, that is more or less what I am looking for. Initially I was
> thinking to right-clicked on the connection and choose "add element" but
> drag and drop from the palette is also convenient for me.
> I saw at the link the screen shots of what your extension does. Could I
> get an explanation about the code needed or at least of the part where
> the "new" connections are created?
>
> Thanks!!!
>
> /Noelia
>
Re: Create connections programmatically [message #100389 is a reply to message #100154] Fri, 02 February 2007 03:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: reneschm.cs.tu-berlin.de

Hi Noelia,

you can find a short howto at
http://user.cs.tu-berlin.de/~reneschm/gmf/Howto.pdf
if you have further questions please contact me.

Rene Schmutzler

TU Berlin - Tiger Team

rene schmutzler schrieb:
> Hi Noelia,
> we are using a metamodel transformation with an modified gmf environment
> based on GMF2.0M3 I will write a short howto and than will post the link
> to it. For the moment you can take a look at
> http://tfs.cs.tu-berlin.de/emftrans/ and where you can find some
> information about the transformationsystem.
>
> Rene Schmutzler
>
> TU Berlin - Tiger Team
>
> Noelia Rodriguez schrieb:
>> Hi Rene!
>>
>> yes, that is more or less what I am looking for. Initially I was
>> thinking to right-clicked on the connection and choose "add element"
>> but drag and drop from the palette is also convenient for me.
>> I saw at the link the screen shots of what your extension does. Could
>> I get an explanation about the code needed or at least of the part
>> where the "new" connections are created?
>>
>> Thanks!!!
>>
>> /Noelia
>>
Re: Create connections programmatically [message #100487 is a reply to message #100389] Fri, 02 February 2007 06:41 Go to previous message
Eclipse UserFriend
Originally posted by: seliva.gmail.com

Hi Rene!

thank you very much for the How-To file! I will let you know if I have
some problems or questions.

/Noelia
Previous Topic:diagram link not updating
Next Topic:Adding\Removing children to a node based on its property change
Goto Forum:
  


Current Time: Tue May 06 19:08:49 EDT 2025

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

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

Back to the top