Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Add sub-nodes programmatically after creating node (GMF 2.2)
Add sub-nodes programmatically after creating node (GMF 2.2) [message #233871] Wed, 17 June 2009 09:41 Go to next message
Peter Lang is currently offline Peter LangFriend
Messages: 153
Registered: July 2009
Senior Member
When creating a node using palette, I display a wizard, and depending on
the users selection I add sub-elements to the newly created node
(displayed as border items).

I realized this with a custom CreateCommand, where I add the sub-elements
after the parent node has been created. This worked fine with GMF 2.1.3.

With GMF 2.2 it seems to work too, sub-nodes are displayed properly. But
when I save, close and reopen my diagram, the sub-nodes are not displayed
any more.

I have split diagram/model files. The sub-elements are in the model file
but they seem to be missing in the diagram file.

Is there a better way to create the sub-nodes?
Is this a bug?

Thanks in advance!
Re: Add sub-nodes programmatically after creating node (GMF 2.2) [message #233891 is a reply to message #233871] Wed, 17 June 2009 10:31 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Peter,

> But when I save, close and reopen my diagram, the sub-nodes are not
> displayed any more.
What if you create such an element (having corresponding sub-nodes), select
it and press F5 (canonical update)?
Will corresponding sub-nodes be deleted from diagram?

-----------------
Alex Shatalin
Re: Add sub-nodes programmatically after creating node (GMF 2.2) [message #233899 is a reply to message #233891] Wed, 17 June 2009 11:27 Go to previous messageGo to next message
Peter Lang is currently offline Peter LangFriend
Messages: 153
Registered: July 2009
Senior Member
Hello Alex,

>> But when I save, close and reopen my diagram, the sub-nodes are not
>> displayed any more.
> What if you create such an element (having corresponding sub-nodes), select
> it and press F5 (canonical update)?
> Will corresponding sub-nodes be deleted from diagram?
Pressing F5 after creating the element does not seem to help. When I
reopen the diagram, the sub-nodes are still missing.

When I select my parent-node then and press F5, the sub-nodes reappear.
The diagram file does not get "dirty" though (no asterisk before filename).

Moving my node to mark the diagram "dirty" and saving then does not help,
sub-nodes are still missing after restarting the application.

Another strange thing:
When I just close the diagram file and reopen it without restarting the
application, sub-nodes are still displayed. Only when I restart the
application and reopen the file, the sub-nodes are gone. Is there
something cached?

Regards, Peter
Re: Add sub-nodes programmatically after creating node (GMF 2.2) [message #233914 is a reply to message #233899] Wed, 17 June 2009 11:43 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Peter,

> Another strange thing:
> When I just close the diagram file and reopen it without restarting
> the
> application, sub-nodes are still displayed. Only when I restart the
> application and reopen the file, the sub-nodes are gone. Is there
> something cached?
ok. Looks like a problem described in: https://bugs.eclipse.org/bugs/show_bug.cgi?id=261188
To workaround this problem you can remove object/context constraints (xml
tags) from viewProvder declaration generated into plugin.xml

-----------------
Alex Shatalin
Re: Add sub-nodes programmatically after creating node (GMF 2.2) [message #233937 is a reply to message #233914] Wed, 17 June 2009 12:28 Go to previous messageGo to next message
Peter Lang is currently offline Peter LangFriend
Messages: 153
Registered: July 2009
Senior Member
Hi Alex,

>> Another strange thing:
>> When I just close the diagram file and reopen it without restarting
>> the
>> application, sub-nodes are still displayed. Only when I restart the
>> application and reopen the file, the sub-nodes are gone. Is there
>> something cached?
> ok. Looks like a problem described in:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=261188
> To workaround this problem you can remove object/context constraints (xml
> tags) from viewProvder declaration generated into plugin.xml

You're definitely right. It works now, thanks a lot ;-)

What are the side-effects of this workaround?

Btw, instead of changing the generated plugin.xml, I copied the extension
point to my custom plugin.xml, raising priority and removing
object/context there. Should have the same effect, right?
When migrating to GMF 2.2, I was really glad I had not changed much within
the generated sources...
Re: Add sub-nodes programmatically after creating node (GMF 2.2) [message #233997 is a reply to message #233937] Wed, 17 June 2009 17:08 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Peter,

> What are the side-effects of this workaround?
Generated diagram editor plugin will be loaded to instantiate Viewprovider
on first View (diagram element) created on any other GMF-based diagram deployed
to the platform.

> Btw, instead of changing the generated plugin.xml, I copied the
> extension
> point to my custom plugin.xml, raising priority and removing
> object/context there. Should have the same effect, right?
Should be the same.

-----------------
Alex Shatalin
Re: Add sub-nodes programmatically after creating node (GMF 2.2) [message #234392 is a reply to message #233997] Mon, 22 June 2009 08:07 Go to previous message
Peter Lang is currently offline Peter LangFriend
Messages: 153
Registered: July 2009
Senior Member
>> What are the side-effects of this workaround?
> Generated diagram editor plugin will be loaded to instantiate Viewprovider
> on first View (diagram element) created on any other GMF-based diagram
deployed
> to the platform.
Should not be a problem for my application.

Thank you very much, Alex!
Previous Topic:Drag and Drop within the diagram editor
Next Topic:Copy & Paste, CopyPaste, Duplication
Goto Forum:
  


Current Time: Thu Apr 09 21:35:58 GMT 2020

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

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

Back to the top