Add sub-nodes programmatically after creating node (GMF 2.2) [message #233871] |
Wed, 17 June 2009 05:41  |
Eclipse User |
|
|
|
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 #233899 is a reply to message #233891] |
Wed, 17 June 2009 07:27   |
Eclipse User |
|
|
|
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 #233937 is a reply to message #233914] |
Wed, 17 June 2009 08:28   |
Eclipse User |
|
|
|
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...
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06090 seconds