2 different top level node types from same model element type [message #228619] |
Thu, 30 April 2009 19:39  |
Eclipse User |
|
|
|
I need to display 2 different types of top level nodes for a given type
of model element, where each type displays different relevant
information about the model element. For example, suppose I have a
model element type FOLDER that always contains TEXT_FILES, but sometimes
(rarely) also contains IMAGE_FILES. I need one top level node type,
which has a compartment showing the TEXT_FILES. And I also need a
different top level node type, which has a compartment showing the
IMAGE_FILES. When I create the two top level nodes in the .gmfmap file
everything generates ok, that is there are 2 different editParts
generated for the 2 different top nodes, but only one type of nodes
(eg., TEXT_FILES) are displayed.
Is this concept of multiple (different) Top Level Nodes for same model
element type supported directly by GMF? Is there a way to modify the
generated code to accomplish this? Thanks for any help in advance!
|
|
|
Re: 2 different top level node types from same model element type [message #228635 is a reply to message #228619] |
Fri, 01 May 2009 03:58   |
Eclipse User |
|
|
|
Hello, John!
I guess you need to add OCL constraints to each of node mappings for
FOLDER, so that GMF can choose the right type of node to display (I think
in your case at the moment it just peeks the first node mapping which
works for the FOLDER meta-element).
For the FOLDER only with TEXT_FILES it would be something like
'self.IMAGE_FILES->isEmpty()' and for the second node which has an image
compartment: 'self.IMAGE_FILES->notEmpty()'. Here I suggest that
IMAGE_FILES is a collection contained in the FOLDER.
John Yotka wrote:
> I need to display 2 different types of top level nodes for a given type
> of model element, where each type displays different relevant
> information about the model element. For example, suppose I have a
> model element type FOLDER that always contains TEXT_FILES, but sometimes
> (rarely) also contains IMAGE_FILES. I need one top level node type,
> which has a compartment showing the TEXT_FILES. And I also need a
> different top level node type, which has a compartment showing the
> IMAGE_FILES. When I create the two top level nodes in the .gmfmap file
> everything generates ok, that is there are 2 different editParts
> generated for the 2 different top nodes, but only one type of nodes
> (eg., TEXT_FILES) are displayed.
> Is this concept of multiple (different) Top Level Nodes for same model
> element type supported directly by GMF? Is there a way to modify the
> generated code to accomplish this? Thanks for any help in advance!
I suggest that you need to add OCL constraints
|
|
|
Re: 2 different top level node types from same model element type [message #229378 is a reply to message #228619] |
Mon, 11 May 2009 11:21  |
Eclipse User |
|
|
|
Hello John,
Currently generated code is not able to show two different diagram nodes
for the same domain model element. By default each domain model element can
be represented by only one particular diagram node. If you need to display
two diagram nodes representing different aspects of same domain model then
you have to modify generated code. Common practice in GMF for such a use
cases is: use compartments to group child element of this domain model one,
so you can create two compartments first will list all the text files and
second – for image files.
-----------------
Alex Shatalin
|
|
|
Powered by
FUDForum. Page generated in 0.07730 seconds