|
|
Re: Defining and instantiating shapes using GMF editor [message #219169 is a reply to message #218433] |
Wed, 18 February 2009 13:27 |
Venkanna Messages: 2 Registered: July 2009 |
Junior Member |
|
|
Thanks Alex for your responses. Please see my comments below...
Alex Shatalin wrote:
>> 3) How to instantiate the defined object in other editor? Is there
>> anything I can do at the modeling level. If I have achieve this by
>> writing the code, can someone help out with clues on what to change?
> In this place I do not understand you completely. Do you want to create new
> meta-object (EClass instance) and then instantiate this meta-object (create
> corresponding EObject referencing this EClass) or are you just going to open
> sub-diagram visualizing internal structure of the âdefined objectâ?
In my case, I have two classes (EClass objects) Symbol and Instance. I
also have two kind of diagrams. Diagram-1 is used to define a shape Symbol
object (e.g., NAND gate shape with two inputs and one output). An Instance
object is created from Symbol object using its graphics shapes and ports
(much like a copy of an object. However Symbol represents a diagram and
Instance is like a Node). In Diagram-2, User should be able to select a
symbol object and place an Instance object corresponding to the Symbol
object.
In this regard, what I am struggling here is that, the graphics data for
Symbol object is stored in a diagram file. I should somehow access the
diagram data and create an Instance object which contains the same graphic
shapes and ports.
One way I thought was to put the diagram data (shapes properties,
coordinates) as a part of the domain data model. Hence I asked the below
question. Do you see any other way I can achieve what I wanted?
Symbol has a set of graphics and ports (
>> 4) Also I would like to maintain all of diagram data in the domain
>> model itself and have figures updates based on the attributes of
>> domain model objects. Is this kind of usecase supported by GMF
>> modeling?
> It should be possible with GMF. There is an option in .gmfgen model
switching
> between different and same file for domain and diagram modes. Concerning
> figures update â you have to create several mappings with appropriate
constraints
> + call diagram update then corresponding attribute was changed (using the
> custom code).
I used the Same File for Diagram and Model option in gmfgen. Basically it
keeps both diagram and domain model in the same file instead of two files.
However what I wanted is single model which also contains graphics data.
Are you saying this is possible with GMF? If so, could you please explain
with more details? For example, I have a simple domain model for shapes
(like circle, rectangle), Can I generate GMF based editor such that all
the graphical data is stored in the domain model (The Ecore domain
model)itself .
|
|
|
Re: Defining and instantiating shapes using GMF editor [message #219466 is a reply to message #219169] |
Fri, 20 February 2009 11:27 |
Alexander Shatalin Messages: 2928 Registered: July 2009 |
Senior Member |
|
|
Hello Venkanna,
> In my case, I have two classes (EClass objects) Symbol and Instance. I
> also have two kind of diagrams. Diagram-1 is used to define a shape
> Symbol object (e.g., NAND gate shape with two inputs and one output).
> An Instance object is created from Symbol object using its graphics
> shapes and ports (much like a copy of an object. However Symbol
> represents a diagram and Instance is like a Node). In Diagram-2, User
> should be able to select a symbol object and place an Instance object
> corresponding to the Symbol object.
Well, this use case is not covered in GMF now. So you can definitely generate
come code with GMF and then you have to modify this code significantly.
> In this regard, what I am struggling here is that, the graphics data
> for Symbol object is stored in a diagram file. I should somehow access
> the diagram data and create an Instance object which contains the same
> graphic shapes and ports.
You can do it - graphical data is stored by EMF, so you can use EMF to load
it (get instances of GMF notation model) and use it to access actual data.
> below question. Do you see any other way I can achieve what I wanted?
No - your plan to create this kind of diagram looks good.
> I used the Same File for Diagram and Model option in gmfgen. Basically
> it keeps both diagram and domain model in the same file instead of two
> files. However what I wanted is single model which also contains
> graphics data. Are you saying this is possible with GMF? If so, could\
It is possible, but you have to be ready to modify generated code (or code
generation templates) a lot.
> you please explain with more details? For example, I have a simple
> domain model for shapes (like circle, rectangle), Can I generate GMF
> based editor such that all the graphical data is stored in the domain
You can not genrate it with GMF now. You have to modify code/better - templates
for it. As a starting point you can have a look on org.eclipse.gmf.graphdef.editor
plugin - this is WYSIWYG diagram editor for GMF graphical model, so it solves
nearly the same problem.
-----------------
Alex Shatalin
|
|
|
Powered by
FUDForum. Page generated in 0.03018 seconds