Create Connection in a command [message #146259] |
Fri, 10 August 2007 19:14  |
Eclipse User |
|
|
|
Originally posted by: mom.mom.gmx.net
I have the situation, that when I create a Node, I automatically want to
create a second one which is connected to the first one. This is allready
working, I just overwrote the xxxCreateElementCommand where I create the new
Model and add it to it's container. So both models were created and
correctly added ans setup. So this is fine.
But the 'missing' piece is the connection between this two nodes, it is not
visible/created. Some times ago I used GEF, back then I had to create the
connetion manually in the Command. Do I need to do this here too? And if so
how?
Actuall I personally guess this is just a refresh problem, beause when I
save the diagram and reopen it the connection is drawn.
regards Rainer
|
|
|
Re: Create Connection in a command [message #146268 is a reply to message #146259] |
Fri, 10 August 2007 21:56   |
Eclipse User |
|
|
|
Perhaps this part of the tutorial will help:
http://wiki.eclipse.org/GMF_Tutorial_Part_3#Custom_Actions
Best,
Rich
On 8/10/07 7:14 PM, in article f9irhv$58m$1@build.eclipse.org, "Rainer
Weinhold" <mom.mom@gmx.net> wrote:
> I have the situation, that when I create a Node, I automatically want to
> create a second one which is connected to the first one. This is allready
> working, I just overwrote the xxxCreateElementCommand where I create the new
> Model and add it to it's container. So both models were created and
> correctly added ans setup. So this is fine.
>
> But the 'missing' piece is the connection between this two nodes, it is not
> visible/created. Some times ago I used GEF, back then I had to create the
> connetion manually in the Command. Do I need to do this here too? And if so
> how?
> Actuall I personally guess this is just a refresh problem, beause when I
> save the diagram and reopen it the connection is drawn.
>
> regards Rainer
>
>
>
|
|
|
|
|
Re: Create Connection in a command [message #147045 is a reply to message #146530] |
Sun, 19 August 2007 08:48  |
Eclipse User |
|
|
|
Originally posted by: mom.mom.gmx.net
I'm pretty sure you're right. The Problem is, how to tell the notation model
that it should now 'resync' oder whatever is needed to display the
Connection.
"SKuhn" <kuhn@oio.de> schrieb im Newsbeitrag
news:f9sb9d$okr$1@build.eclipse.org...
> For a newbie (me) it sounds like that you've created the connection just
> in the semantic model not in the notation model.
>
> -stefan
>
>
>
> Rainer Weinhold schrieb:
>> I'm not sure if this is the right solution in my case, cause I'm allready
>> in a command. I actually searching for one line of code just creating the
>> Connection.
>>
>> cause I done stuff with GEF, I think in the similar way. So at the moment
>> i have changed the Command :
>>
>> private void execute() {
>> // create the Port Object we need
>> AnonymousClassInterface classInterface =
>> CjdFactory.eINSTANCE.createAnonymousClassInterface();
>>
>> Component comp=(Component) getCreateRequest().getContainer();
>> AnonymousClass anonClass = ((AnonymousClass)getNewElement());
>> classInterface.setAnonymousClass(anonClass);
>> anonClass.setAnonymousClassInterface(classInterface);
>>
>> // Add the code object to the model --> is also correctly show
>> comp.getCodeUnits().add(classInterface);
>>
>> AnonymousClass anClass = ...; // Get the class (I know how.)
>>
>> // Now we need a connection. GEF code: (Portline is the Figure from
>> .gmfgraph)
>> new Portline( anClass , classInterface );
>> }
>>
>> The last line with the new Portline , is somthing I would have done
>> with GEF, but I don't know how to do it with GMF. Or, because the link
>> mapping is correct am GMF is allready creating the connection when I save
>> and reopen the diagram, I probably just have to call a
>> refreshConnection() type of command.
>>
>>
>> "Richard Gronback" <richard.gronback@borland.com> schrieb im Newsbeitrag
>> news:C2E28FA6.19B1B%richard.gronback@borland.com...
>>> Perhaps this part of the tutorial will help:
>>> http://wiki.eclipse.org/GMF_Tutorial_Part_3#Custom_Actions
>>
|
|
|
Powered by
FUDForum. Page generated in 0.05503 seconds