Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Containers of Contains Behaving Weird(GMF Containers)
Containers of Contains Behaving Weird [message #663350] Mon, 04 April 2011 13:53 Go to next message
Erik Englund is currently offline Erik Englund
Messages: 49
Registered: July 2009
Member
I have created a simple GMF library based off the Library EMF Model. I've modified it such that a library can contain a Library and I created another root object Bookstore that also contains Books.

For one when I create a Diagram based off this model I get lots of duplicate Edit Parts. For example:
LibraryEditPart
Library2EditPart

Secondly, I get strange behavior whenever I drag a sub library out into the root context. I get two libraries to show up in the root context.

I can update load the sample projects somewhere to anyone if if think it would help.
Re: Containers of Contains Behaving Weird [message #663369 is a reply to message #663350] Mon, 04 April 2011 15:31 Go to previous messageGo to next message
Aurelien Pupier is currently offline Aurelien Pupier
Messages: 558
Registered: July 2009
Location: Grenoble, FRANCE
Senior Member

Hi,

Erik Englund wrote on Mon, 04 April 2011 19:53
I have created a simple GMF library based off the Library EMF Model. I've modified it such that a library can contain a Library and I created another root object Bookstore that also contains Books.

For one when I create a Diagram based off this model I get lots of duplicate Edit Parts. For example:
LibraryEditPart
Library2EditPart


That is normal. You can have different behavior depending on teh container easily.

Erik Englund wrote on Mon, 04 April 2011 19:53

Secondly, I get strange behavior whenever I drag a sub library out into the root context. I get two libraries to show up in the root context.



It should be a known bugs: https://bugs.eclipse.org/bugs/show_bug.cgi?id=318585

Regards,


Aurélien Pupier - BonitaSoft S.A.
My blog
My company Eclipse-related blog
Re: Containers of Contains Behaving Weird [message #663377 is a reply to message #663369] Mon, 04 April 2011 15:51 Go to previous messageGo to next message
Erik Englund is currently offline Erik Englund
Messages: 49
Registered: July 2009
Member
So then I have a question on best practices. How should I go about customizing the behavior of this edit part. Should I use the edit policy extension point to change its behavior. Or should I override the behavior in each of the generated edit parts by marking them generated not.

My big problem is that in my diagram I want to display as root nodes items that are not directly accessible from the root element of the model. Should I do this by providing my own CanonicalEditPolicy?

If so how should I register it. I'd prefer to not have to reference any of the VISUAL_ID generated by the tooling since those could possibly change if my model changes.
Re: Containers of Contains Behaving Weird [message #663385 is a reply to message #663377] Mon, 04 April 2011 16:03 Go to previous messageGo to next message
Aurelien Pupier is currently offline Aurelien Pupier
Messages: 558
Registered: July 2009
Location: Grenoble, FRANCE
Senior Member

Hi,

Erik Englund wrote on Mon, 04 April 2011 21:51
So then I have a question on best practices. How should I go about customizing the behavior of this edit part. Should I use the edit policy extension point to change its behavior. Or should I override the behavior in each of the generated edit parts by marking them generated not.


My point of view is:
- NEVER use @generated NOT
- try to use extension points and providers first
- use GMF aspect templates if there are no extension points available or if the modification occured on every elements of your model.

Erik Englund wrote on Mon, 04 April 2011 21:51

My big problem is that in my diagram I want to display as root nodes items that are not directly accessible from the root element of the model. Should I do this by providing my own CanonicalEditPolicy?


not sure, but you can take a look to phantom nodes.


Erik Englund wrote on Mon, 04 April 2011 21:51

If so how should I register it. I'd prefer to not have to reference any of the VISUAL_ID generated by the tooling since those could possibly change if my model changes.


In order to avoid that, you just have to keep the .trace file that is generated.

Regards,


Aurélien Pupier - BonitaSoft S.A.
My blog
My company Eclipse-related blog
Re: Containers of Contains Behaving Weird [message #663395 is a reply to message #663369] Mon, 04 April 2011 16:31 Go to previous message
Aurelien Pupier is currently offline Aurelien Pupier
Messages: 558
Registered: July 2009
Location: Grenoble, FRANCE
Senior Member

Aurelien Pupier wrote on Mon, 04 April 2011 21:31
Hi,

Erik Englund wrote on Mon, 04 April 2011 19:53
I have created a simple GMF library based off the Library EMF Model. I've modified it such that a library can contain a Library and I created another root object Bookstore that also contains Books.

For one when I create a Diagram based off this model I get lots of duplicate Edit Parts. For example:
LibraryEditPart
Library2EditPart


That is normal. You can have different behavior depending on teh container easily.




BTW, there is a feature request to don't have this behavior: https://bugs.eclipse.org/bugs/show_bug.cgi?id=332224


Aurélien Pupier - BonitaSoft S.A.
My blog
My company Eclipse-related blog
Previous Topic:Duplicated elements after Drag&Drop to compartment
Next Topic:the label remains close (attach) the association
Goto Forum:
  


Current Time: Fri Aug 29 16:18:44 EDT 2014

Powered by FUDForum. Page generated in 0.01684 seconds