This tutorial is an EMF tutorial but to go faster it takes the output of the GMF tutorial 2 as an input (in order not to have to build a new ecore model).
It shows how to persist your date in several ecore files instead of one.
This can be very interesting at least in two situations :
This tutorial is based on the model built in the second GMF tutorial wich is availabale through :
This tutorial has been built with :
filesystem.ecore
fileFilesystem.folders : Folder
association (sub node of the Filesystem
node)Resolve Proxies
to true
Filesystem.files : File
Folder.folders : Folder
Folder.files : File
filesystem.genmodel
fileFilesystem
and in the properties view set the Containment proxies
to true
Folder.folders : Folder
association (sub node of the Filesystem
node)Children
and Create Child
to true
(in order to have a context menu allowing to create a child node in the generated EMF editor)Folder.files : File
nodefilesystem.genmodel
filefilesystem.gmfgen
fileGen Editor Generator jfb.examples.gmf.filesystem.diagram
and in the properties view set the Same File For Diagram And Model
to false
Transform
label of the dashboardGenerate diagram editor
label in the dashboard.Filesystem model
file named parent.filesystem
(not a diagram file)Filesystem
model object and click Ok
Filesystem
node and select New Child → Folder
Folder
node that has just been created, right click and select Control
Browse Workspace
, select your project and type child.filesystem
child.filesystem
, modify your folder (for example choose a name in the properties view for that folder, save the file and look at the parent.filesystem
file ; it may have been updated automatically !Cick Control | Select a file | The result… |
---|---|---|
parent.filesystem
file and selecting Initialize filesystem_diagram diagram file
and every modification in the diagram editor will be propagated to the two ecore files
I hope that this material will be helpful for you. If you want to support it, your help is welcome :
Discussion
Hi,
is there a way to model a child.filesystem_diagram and then drag and drop it the the parent.filesystem_diagram?
Thanks
Hello,
As far as I can see, it is possible to create a child.filesystem_diagram in association with child.filesystem. But you will not need to drag and drop the child.filesystem_diagram in the parent.filesystem_diagram. Every modification made to the child.filesystem from the child.filesystem_diagram will be automatically available in the parent.filesystem_diagram (except that you will probably have to re-arrange the nodes in the diagram if you've created several new nodes in the child diagram).
Regards,
JFB
Yes, I know!
Anyway what I asked is different!
I'd like to model the child first and then create the parent and drag the child in the parent! In this way I can reuse the same child in different parent diagrams!
Regards,
Luca
Hummm… I maybe don't understand what you want to do, but what I said in the previous message can be generalized with several parents, each parent model containing the child (but this implies that your model doesn't have a bidirectional relation between the the child and the parent file). In other words, you would have something like :
Is that what you want to do ?
Regards,
JFB
mmm…i want to modeling one child and use that in different parents. Let's suppose you have a model of a processor (child) and you want to use the same model in different pc models (parent).
I'd like to operate in the following order:
1) modeling the processor → processor.model_diagram 2) modeling the first pc → pc1.model_diagram 3) drag the processor model into the pc model in order to reuse it. 4) modeling another pc and reuse again the processor model.
I hope that now my idea is more clear. Thanks, Luca
When the processor is reused in a pc diagram, do you want to keep the processor's appearance that you had obtained in the initial processor diagram (the child) ? Or are you only interested to share the underlying model of the processor among a processor diagram and several PC diagrams ? In the last case, what I said in the previous message is compatible with it as far as I can see. In the first case, thing get more complicated according to me !!!!….
I think that this question is dependent on the number of elements contained in the processor diagram. If there are a lot of figures, you should be interested in rearranging not all these figures in the parent diagrams. But the processor has a few elements, it is acceptable to rearrange the processor elements on each diagram.
JF