Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How GMF reuse EMF ?
How GMF reuse EMF ? [message #217691] Sun, 08 February 2009 01:18 Go to next message
maatari is currently offline maatariFriend
Messages: 74
Registered: July 2009
Member
> This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

--B_3316904289_1052030
Content-type: text/plain;
charset="ISO-8859-1"
Content-transfer-encoding: 8bit

Dear All,

I have been working on a EMF model building its editor with EMFTools. Now I
want to go toward the realization of an GMF graphical editor. What I
understand, is that
GMF only generate, the diagramatic editor. Therefore, you still have to
generate the Edit and model using the EMF.Gen. At least that what have been
able to do to run the examples. My GMF.gen does not generate anything else.
Consequently, my questions here are:

1- Does the code I did with EMF remains used by GMF? More specifically, I
have only touched at the model and the provider, A.K.A the EMF.model and
EMF.model. I have modified my item provider as well as adding new command
that are triggers trough the use of EMF standard generated action coming
from the Editor. In other terms my commands are only called by my
ItemProvidersAdpters. Hence I would like to know if it is still ok when
combined and regenerated under GMF.


3- My EMF model is modeled as follows: OPERAMODEL (Class) represent the
model, it is composed of two other models IS(interaction-structure) and
SS(social-structure) which are the diagrams Views. In SS you have Role and
Dependency. In other term it is a view where you represent, some role and
their dependences. All the previous relation are containment of course.
3.a-/ Using the GMF creation wizard process, whether it is in the graphical
or tools, I
Re: How GMF reuse EMF ? [message #217837 is a reply to message #217691] Mon, 09 February 2009 10:24 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Daniel,

> 1- Does the code I did with EMF remains used by GMF? More
Partially yes.

> specifically, I have only touched at the model and the provider, A.K.A
> the EMF.model and EMF.model. I have modified my item provider as well
> as adding new command that are triggers trough the use of EMF standard
> generated action coming from the Editor. In other terms my commands
> are only called by my ItemProvidersAdpters. Hence I would like to know
> if it is still ok when combined and regenerated under GMF.
EMF-generated ItemProviders are used by GMF to display model tree structures
+ icons/labels. Additional code will be generated by GMF to modify (create/delete/..)
domain model elements in an underlying model while editing it through diagram
editor.

> or tools, Im, confused about what should be chosen as the diagram
> element or the canvas element. Can someone
I suppose you have to create two different diagram definitions. One – for
IS and another one – for SS root elements. (I suppose you are going to edit
both IS and SS on a diagram editor). As a result you should generate two
different diagram editors allowing you to edit IS/SS in accordance.

> 3.b/ Following my explanation above, it obviously also lead me to ask,
> how to support multiple diagram in GMF. In other terms, in our case, that
> would mean a diagram for SS and IS?
If you are opening these diagrams sequentially (one by one) then this is
not a problem – you can open IS diagram for one part of the model, edit it
and save, then you can open SS diagram for another aspect of the model, edit
it and save – both diagrams will save changes into the same EMF resource
and (thanks to the non- simultaneous changes) reload modified model content
(EMF resource) on saving an opposite editor. If you are going to edit both
models in parallel then you should either implement extended synchronization
mechanism handling concurrent changes in underlying EMF resource and reloading
proper parts of the model or use same EditingDomain instance for both diagram
editors to get rid of synchronization (share same EObject/Resources across
both editors).

> 4 Finally, and that would be my last question :-), I want an Editor
> that has both a graphical and tree based view capability, should I use
> both EMF and GMF generated editor or only the later suffice?
I suppose you have to create multipage editor embedding EMF and GMF editors
(in this case it is natural to share same EditingDomain/Resources/EObject
across all the pages in this editor). As a starting point I can suggest you
to read this article: http://www.eclipse.org/articles/article.php?file=Article-Int egrating-EMF-GMF-Editors/index.html.
I have to warn you: you can face some other problems while making your MPE
fully functioning, but I suggest you to start with the steps described in
this article and I can assure of the fact that with appropriate knowledge
of EMF you definitely can make this editor working. :-)

-----------------
Alex Shatalin
Re: How GMF reuse EMF ? [message #217889 is a reply to message #217837] Mon, 09 February 2009 12:08 Go to previous messageGo to next message
maatari is currently offline maatariFriend
Messages: 74
Registered: July 2009
Member
Hi Alex,

Thank you verry much for your explanation it did clarify and helped a lot.

Hwever One thing I'm wondering is when you say:

Additional code will be generated by GMF to modify (create/delete/..)
domain model elements in an underlying model while editing it through
diagram editor.

Where is that code? What I mean is that, aren't you implying that it
generate more code in the Edit part ? It's only in the diagram Part right?

When you talk about more code for deleting etc....

If in my EMF model I have already coded some behavior about the delete for
instance. Meaning that when you call a remove command in EMF trought the
Editing domain which call the item providers to edit domain data, you finaly
call my remove command which is special and manage the behavior I want in
the model?

So to narrow my question, When the Editing domain of GMF try to edit the
domain, does it use the ItemprovidersAdapters like for retreiving the
content?


Kind regards,
Daniel


On 2/9/09 11:24 AM, in article
3c3172e62a5368cb58c02b915cce@news.eclipse.org, "Alex Shatalin"
<vano@borland.com> wrote:

> Additional code will be generated by GMF to modify (create/delete/..)
> domain model elements in an underlying model while editing it through diagram
> editor.
Re: How GMF reuse EMF ? [message #217918 is a reply to message #217889] Mon, 09 February 2009 12:36 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Daniel,

> Where is that code? What I mean is that, aren't you implying that it
> generate more code in the Edit part ? It's only in the diagram Part
> right?
Generated EditParts will be extended from GMF runtime framework classes these
EditParts (SuperClasses) will have some EditPolicies installed + some custom
behaviour coded there. This is one way to handle domain model changes coming
from diagram.

In addition GMF will generate a number ot EditPolicies + install then upon
generated EditPart. This is another way to handle domain model modifications.


I suggest you generating the diagram first and then try to play with and
realize how does it handle different domain model modifications.

> So to narrow my question, When the Editing domain of GMF try to edit
> the domain, does it use the ItemprovidersAdapters like for retreiving
> the content?
I think it does not. I suppose only EMF-generated API used to modify underlying
domain model. I can be wrong in some particular cases (GMF has a big runtime
framework handling different aspects of the diagramming), but for now my
answer is: GMF is not using EMF-generated itemproviders (including your customizations)
for domain model editing.

BTW, you can easily prove my words by generating simple diagram and debugging
it with a breakpoints added to customized ItemProviders.

-----------------
Alex Shatalin
Re: How GMF reuse EMF ? [message #218030 is a reply to message #217837] Tue, 10 February 2009 02:03 Go to previous messageGo to next message
maatari is currently offline maatariFriend
Messages: 74
Registered: July 2009
Member
Hi,

While re-reading your answer I realize that I did not completely catch
something, could be a bit more clear when you say:

If you are opening these diagrams sequentially (one by one) then this is
not a problem ­ you can open IS diagram for one part of the model, edit it
and save, then you can open SS diagram for another aspect of the model, edit
it and save ­ both diagrams will save changes into the same EMF resource
and (thanks to the non- simultaneous changes) reload modified model content
(EMF resource) on saving an opposite editor. ???

What is tricky for me here is: How two diagrams meaning two file with tow
different extensions could be in the same resource and furthermore getting
synchronized automatically ?





I'm going to talke the extended version issue by the way but it was just for
my understating.

On 2/9/09 11:24 AM, in article
3c3172e62a5368cb58c02b915cce@news.eclipse.org, "Alex Shatalin"
<vano@borland.com> wrote:

>> 3.b/ Following my explanation above, it obviously also lead me to ask,
>> how to support multiple diagram in GMF. In other terms, in our case, that
>> would mean a diagram for SS and IS?
> If you are opening these diagrams sequentially (one by one) then this is
> not a problem ­ you can open IS diagram for one part of the model, edit it
> and save, then you can open SS diagram for another aspect of the model, edit
> it and save ­ both diagrams will save changes into the same EMF resource
> and (thanks to the non- simultaneous changes) reload modified model content
> (EMF resource) on saving an opposite editor. If you are going to edit both
> models in parallel then you should either implement extended synchronization
> mechanism handling concurrent changes in underlying EMF resource and reloading
> proper parts of the model or use same EditingDomain instance for both diagram
> editors to get rid of synchronization (share same EObject/Resources across
> both editors).
Re: How GMF reuse EMF ? [message #218037 is a reply to message #217918] Tue, 10 February 2009 02:26 Go to previous messageGo to next message
maatari is currently offline maatariFriend
Messages: 74
Registered: July 2009
Member
Hi again,

One thing that might be interesting to have some indication for is how:

To have One tree editor for instance on the left and each element pointing
out at different model, because in fact, that is what I'm looking for.
Regarding my exemple that would mean Having on top OperAModel then creating
an IS would automatically create the element in the tree but also lauch the
diagram or at least after double clicking it.

I know you already gave me the right pointers but still with the tries and
reading I have done until now I still can't visualize the all picture. I
would like to have this architectural information without having to learn
the all GMF code first :-)

What I can see for the moment is that when I generate My diagram for the SS,
when opening with the Editor from EMF, I can see that there is the two tree:
The SS and The Diagram that come with it and is stored in EMF but my Top
level OperAModel is not there. Meaning that it is not in the resource.
Until now everything is fine but then it doesn't permit me to envision how
from the tree which by the way will have the OperAModel element, I can have
two diagram editor inside of it. Also I don't see what it means from the
resource perspective. I guess I have to investigate severely here:-).There
is a lot to learn. Still if you have tips that might avoid me.... I'll take
them :-)


Many thanks, Dan.


On 2/9/09 1:36 PM, in article 3c3172e62a5548cb58d28620aa59@news.eclipse.org,
"Alex Shatalin" <vano@borland.com> wrote:

> Hello Daniel,
>
>> Where is that code? What I mean is that, aren't you implying that it
>> generate more code in the Edit part ? It's only in the diagram Part
>> right?
> Generated EditParts will be extended from GMF runtime framework classes these
> EditParts (SuperClasses) will have some EditPolicies installed + some custom
> behaviour coded there. This is one way to handle domain model changes coming
> from diagram.
>
> In addition GMF will generate a number ot EditPolicies + install then upon
> generated EditPart. This is another way to handle domain model modifications.
>
>
> I suggest you generating the diagram first and then try to play with and
> realize how does it handle different domain model modifications.
>
>> So to narrow my question, When the Editing domain of GMF try to edit
>> the domain, does it use the ItemprovidersAdapters like for retreiving
>> the content?
> I think it does not. I suppose only EMF-generated API used to modify
> underlying
> domain model. I can be wrong in some particular cases (GMF has a big runtime
> framework handling different aspects of the diagramming), but for now my
> answer is: GMF is not using EMF-generated itemproviders (including your
> customizations)
> for domain model editing.
>
> BTW, you can easily prove my words by generating simple diagram and debugging
> it with a breakpoints added to customized ItemProviders.
>
> -----------------
> Alex Shatalin
>
>
Re: How GMF reuse EMF ? [message #218048 is a reply to message #217918] Tue, 10 February 2009 03:50 Go to previous messageGo to next message
maatari is currently offline maatariFriend
Messages: 74
Registered: July 2009
Member
I forgot to mention that IS and SS are Linked, more specifically, IS
referenced element of SS. SS is a pre-requisite to IS.

Regards,
Maatari


On 2/9/09 1:36 PM, in article 3c3172e62a5548cb58d28620aa59@news.eclipse.org,
"Alex Shatalin" <vano@borland.com> wrote:

> Hello Daniel,
>
>> Where is that code? What I mean is that, aren't you implying that it
>> generate more code in the Edit part ? It's only in the diagram Part
>> right?
> Generated EditParts will be extended from GMF runtime framework classes these
> EditParts (SuperClasses) will have some EditPolicies installed + some custom
> behaviour coded there. This is one way to handle domain model changes coming
> from diagram.
>
> In addition GMF will generate a number ot EditPolicies + install then upon
> generated EditPart. This is another way to handle domain model modifications.
>
>
> I suggest you generating the diagram first and then try to play with and
> realize how does it handle different domain model modifications.
>
>> So to narrow my question, When the Editing domain of GMF try to edit
>> the domain, does it use the ItemprovidersAdapters like for retreiving
>> the content?
> I think it does not. I suppose only EMF-generated API used to modify
> underlying
> domain model. I can be wrong in some particular cases (GMF has a big runtime
> framework handling different aspects of the diagramming), but for now my
> answer is: GMF is not using EMF-generated itemproviders (including your
> customizations)
> for domain model editing.
>
> BTW, you can easily prove my words by generating simple diagram and debugging
> it with a breakpoints added to customized ItemProviders.
>
> -----------------
> Alex Shatalin
>
>
Re: How GMF reuse EMF ? [message #218056 is a reply to message #218030] Tue, 10 February 2009 10:16 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Daniel,

> What is tricky for me here is: How two diagrams meaning two file with
> tow different extensions could be in the same resource and furthermore
> getting synchronized automatically ?
By default GMF-generated code will store diagram information separated from
domain model information. This means – you’ll have two resources one for
diagram and one more for domain model (it’s not a big deal to store diagram(s)
in the same EMF resource as domain model – can be useful for your use case
if you are going to work with the same EditingDomain and not separate diagram
files from each other).

By “both diagrams will save changes into the same EMF resource” I meant same
domain model resource. I’ll try to explain it by writing down more detailed
sequence of “events” I kept in mind:
- open first diagram editor (SS, supposing domain model element associated
with diagram is stored in the separate domain model resource)
- open second diagram editor (IS, supposing domain model element associated
with diagram is stored in the same “separate domain model resource” – just
nearby to the SS diagram root element)
- modify IS diagram (add new element)
- save it -> two EMF resources will be modified: diagram information stored
in one of them, domain model – in another. In this moment opened SS diagram
editor will receive a notification from eclipse resources subsystem and reload
underlying domain model file (modified on disk while saving IS editor). As
a result SS editor will load all the modifications made by IS editor and
(even if all elements visible on IS editor are invisible on SS one) will
get updated domain model resource content to not overwrite it on subsequent
saving SS editor.

-----------------
Alex Shatalin
Re: How GMF reuse EMF ? [message #218064 is a reply to message #218037] Tue, 10 February 2009 10:31 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Daniel,

> Until now everything is fine but then it doesn't permit me to
> envision how from the tree which by the way will have the OperAModel element,
I can
> have two diagram editor inside of it. Also I don't see what it means from
Well, if you need to store IS and SS diagram root elements (elements from
the underlying domain model) then you can create OperAModel in a separate
resource and add reference from this element to IS/SS diagram roots. These
references can be even containment (thanks to EMF cross-resource containment
feature).

But unless you explicitly need it I suggest you to store all domain model
elements in the same (single) domain model resource. It is possible to associate
diagram with non-root domain model element. GMF should generate “Initialize
… diagram” action for you – with this action you can select any domain model
element stored in the selected file (not only root one) with the appropriate
metaclass (<diagram root element EClass>.isSuperTypeOf(<selected object EClass>))
You can definitely invoke this initialization code from you other places
in your system/editor so it’ not necessary to call GMF-generated action –
you can use custom code to initialize diagram in a way transparent (invisible)
to user.

In addition (if you are going to edit all the diagrams from the same editor)
it looks reasonable to store all information in the same EMF resource (domain
model + all the created diagrams). In this case you’ll end up with the single
file opened by multi-page editor allowing to edit either whole domain model
ore some particular model “concepts” in a special diagram pages (IS/SS diagrams).
All the diagram information management like: creation IS/SS diagram elements,
opening IS/SS diagram tabs/… can be implemented in a specific actions like
double-click on IS diagram root element in tree view.


> the resource perspective. I guess I have to investigate severely
As I already suggested, you can put everything into the same resource. All
diagrams can be stored just in the root of resource (resource.getContents().add(myNewDiagram)).

-----------------
Alex Shatalin
Re: How GMF reuse EMF ? [message #218094 is a reply to message #218064] Tue, 10 February 2009 12:36 Go to previous messageGo to next message
maatari is currently offline maatariFriend
Messages: 74
Registered: July 2009
Member
Hi,

Well, if you need to store IS and SS diagram root elements (elements from
the underlying domain model) then you can create OperAModel in a separate
resource and add reference from this element to IS/SS diagram roots. These
references can be even containment (thanks to EMF cross-resource containment
feature).

Please, How do you do that? I'm not sure to understand.


On 2/10/09 11:31 AM, in article
3c3172e62a5a48cb598a3050a132@news.eclipse.org, "Alex Shatalin"
<vano@borland.com> wrote:

> Well, if you need to store IS and SS diagram root elements (elements from
> the underlying domain model) then you can create OperAModel in a separate
> resource and add reference from this element to IS/SS diagram roots. These
> references can be even containment (thanks to EMF cross-resource containment
> feature).
Re: How GMF reuse EMF ? [message #218102 is a reply to message #218064] Tue, 10 February 2009 12:57 Go to previous messageGo to next message
maatari is currently offline maatariFriend
Messages: 74
Registered: July 2009
Member
Hi,

Could you please be a bit more specific on some points.

In my GmfGen, I have chosen the same file for diagram and model. Now the
problem that it cause me is that, when I try to use my EMF generated Editor
which has as its roots the OperAModel element, it Cause a problem because I
also added that I want the same extension for domain model and diagram. So
I'm stuck. It says, simply that, the model do not contain the diagram. But
anyway it doesn't stops me.

Because, normally, what I would like to have is a tree first opened in the
EMF based EDITOR then I want to be able to create a SS structure element
which will be associated to GMF EDITOR that has at the end to manipulate the
same file. (what are the command from which menu that you use to related
both model)

Could you tell me the steps for that. Also it's a bit a shame at this point,
but it seams I'm a bit confused with the notion of Ressourceset, Ressource
and my file. Could you try, inspired from the case describe above, to let me
know what you call file , ressources and ressourceSet, domail ressource. So
that I can be sure of our terminology. If I talk about ressourcest it is
because since I have the combination of editors my only page working is the
ressourceset page. Strangely no tree, selection, nor list (although they are
activated.)

Many thanks,
-M-


On 2/10/09 11:31 AM, in article
3c3172e62a5a48cb598a3050a132@news.eclipse.org, "Alex Shatalin"
<vano@borland.com> wrote:

> Hello Daniel,
>
>> Until now everything is fine but then it doesn't permit me to
>> envision how from the tree which by the way will have the OperAModel element,
> I can
>> have two diagram editor inside of it. Also I don't see what it means from
> Well, if you need to store IS and SS diagram root elements (elements from
> the underlying domain model) then you can create OperAModel in a separate
> resource and add reference from this element to IS/SS diagram roots. These
> references can be even containment (thanks to EMF cross-resource containment
> feature).
>
> But unless you explicitly need it I suggest you to store all domain model
> elements in the same (single) domain model resource. It is possible to
> associate
> diagram with non-root domain model element. GMF should generate ³Initialize
> Š diagram² action for you ­ with this action you can select any domain model
> element stored in the selected file (not only root one) with the appropriate
> metaclass (<diagram root element EClass>.isSuperTypeOf(<selected object
> EClass>))
> You can definitely invoke this initialization code from you other places
> in your system/editor so it¹ not necessary to call GMF-generated action ­
> you can use custom code to initialize diagram in a way transparent (invisible)
> to user.
>
> In addition (if you are going to edit all the diagrams from the same editor)
> it looks reasonable to store all information in the same EMF resource (domain
> model + all the created diagrams). In this case you¹ll end up with the single
> file opened by multi-page editor allowing to edit either whole domain model
> ore some particular model ³concepts² in a special diagram pages (IS/SS
> diagrams).
> All the diagram information management like: creation IS/SS diagram elements,
> opening IS/SS diagram tabs/Š can be implemented in a specific actions like
> double-click on IS diagram root element in tree view.
>
>
>> the resource perspective. I guess I have to investigate severely
> As I already suggested, you can put everything into the same resource. All
> diagrams can be stored just in the root of resource
> (resource.getContents().add(myNewDiagram)).
>
> -----------------
> Alex Shatalin
>
>
Re: How GMF reuse EMF ? [message #218110 is a reply to message #218094] Tue, 10 February 2009 13:10 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Daniel,

>>Well, if you need to store IS and SS diagram root elements (elements from
the
>> underlying domain model) then you can create OperAModel in a separate
resource
I meant “if you need to store IS and SS diagram root elements (elements from
the
underlying domain model) IN A SEPARATE RESOURCES ...”.
Sorry - part of the sentence was missed..

>>and add reference from this element to IS/SS diagram roots. These references
can
>>be even containment (thanks to EMF cross-resource containment feature).
> Please, How do you do that? I'm not sure to understand.
It is possible to store child elements in different resources since https://bugs.eclipse.org/bugs/show_bug.cgi?id=105937
was fixed.
AFAIU you can just create new EObject, assign it to the container's containment
feature and then put it into the root of another resource.
As a result, container.getChildren() will return collection containing this
very EObject,
but actual information about this EObject (+ all child elements) will be
stored in separate resource.
I think you can ask more about this feature in EMF newsgroup.

-----------------
Alex Shatalin
Re: How GMF reuse EMF ? [message #218165 is a reply to message #218102] Tue, 10 February 2009 13:50 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Daniel,

> In my GmfGen, I have chosen the same file for diagram and model. Now
> the problem that it cause me is that, when I try to use my EMF
> generated Editor which has as its roots the OperAModel element, it
> Cause a problem because I also added that I want the same extension
> for domain model and diagram. So I'm stuck. It says, simply that, the
> model do not contain the diagram. But anyway it doesn't stops me.
That’s right – if you created this model with EMF-generated new model wizard
then diagram was not created there and you can not open this file with GMF-generated
editor. You can try creating new diagram with GMF-generated wizard and compare
created file with one you have using EMF-generated editor.
To create new diagram for an existing domain model you can call “Initialize
… diagram file” action from the pop-up menu on model file.
In future you should take care on diagram initialization then it is necessary
– before diagram editor opening. You can use “Initialize … diagram file”
action code to get basic understanding of this process.

> the EMF based EDITOR then I want to be able to create a SS structure
> element which will be associated to GMF EDITOR that has at the end to
> manipulate the same file. (what are the command from which menu that
> you use to related both model)
To implement this you have to:
- Either create new diagram instance (org.eclipse.gmf.runtime.notation.Diagram)
using GMF-way (through ViewService) associated with corresponding domain
model element (SS structure element) and store it in a resource root or locate
appropriate diagram instance if it was already created for this SS element
before
- open GMF-generated diagram editor using URIEditorInput pointing to the
URI the Diagram instance from the step above

> Ressourceset, Ressource and my file. Could you try, inspired from the
> case describe above, to let me know what you call file , ressources
> and ressourceSet, domail ressource. So that I can be sure of our
> terminology. If I talk about ressourcest it is because since I have
It’s more EMF question then GMF..

Anyway, Resource is EMF interface used as universal access to the EObjects
stored in different storages. This interface in composition with ResourceSet
provides the possibility to address EObject instance using it’s URI (like
a full name).
File is one of the possible storage implementation, so you can load EMF objects
from a file.
Each file can be represented by single Resource instance in a ResourceSet.
ResourceSet – is a set of Resoruces loaded by your code (editing session).
It is important to share ResourceSet (aggregated by EditingDomain) across
different pages of the same multipage Editor.

For example, to let GMF- and EMF-generated editors working simultaneously
on different pages of the same MPE you have to share ResourceSet (by sharing
EditingDomain) instance across them. As a result, you can create new instance
of the Diagram (see above), assign it to the Resource root and pass appropriate
URIEditorInput (pointing to the Diagram object using its URI only) to the
GMF-generated editor. This editor will be able to locate exactly the same
in-memory instance of Diagram (was not saved into a file yet!) by using appropriate
EditingDomain/ResourceSet assigned to it on creation time (see http://www.eclipse.org/articles/article.php?file=Article-Int egrating-EMF-GMF-Editors/index.html
for the details).

Domain resource is an instance of EMF resource holding domain model (instances
of the interfaces generated by EMF using .ecore model file).

-----------------
Alex Shatalin
Re: How GMF reuse EMF ? [message #218213 is a reply to message #218165] Tue, 10 February 2009 16:42 Go to previous message
maatari is currently offline maatariFriend
Messages: 74
Registered: July 2009
Member
Thank you very much for all your explanation. Now I need to do my part :-) I
got things to read :-). I did not understood everything but enough to know
what knowledge I lack here :-). I'll try to let you know how I figure out
the all.

Regards,
Maatari


On 2/10/09 2:50 PM, in article
3c3172e62a5bc8cb59a615061e31@news.eclipse.org, "Alex Shatalin"
<vano@borland.com> wrote:

> Hello Daniel,
>
>> In my GmfGen, I have chosen the same file for diagram and model. Now
>> the problem that it cause me is that, when I try to use my EMF
>> generated Editor which has as its roots the OperAModel element, it
>> Cause a problem because I also added that I want the same extension
>> for domain model and diagram. So I'm stuck. It says, simply that, the
>> model do not contain the diagram. But anyway it doesn't stops me.
> That¹s right ­ if you created this model with EMF-generated new model wizard
> then diagram was not created there and you can not open this file with
> GMF-generated
> editor. You can try creating new diagram with GMF-generated wizard and compare
> created file with one you have using EMF-generated editor.
> To create new diagram for an existing domain model you can call ³Initialize
> Š diagram file² action from the pop-up menu on model file.
> In future you should take care on diagram initialization then it is necessary
> ­ before diagram editor opening. You can use ³Initialize Š diagram file²
> action code to get basic understanding of this process.
>
>> the EMF based EDITOR then I want to be able to create a SS structure
>> element which will be associated to GMF EDITOR that has at the end to
>> manipulate the same file. (what are the command from which menu that
>> you use to related both model)
> To implement this you have to:
> - Either create new diagram instance
> (org.eclipse.gmf.runtime.notation.Diagram)
> using GMF-way (through ViewService) associated with corresponding domain
> model element (SS structure element) and store it in a resource root or locate
> appropriate diagram instance if it was already created for this SS element
> before
> - open GMF-generated diagram editor using URIEditorInput pointing to the
> URI the Diagram instance from the step above
>
>> Ressourceset, Ressource and my file. Could you try, inspired from the
>> case describe above, to let me know what you call file , ressources
>> and ressourceSet, domail ressource. So that I can be sure of our
>> terminology. If I talk about ressourcest it is because since I have
> It¹s more EMF question then GMF..
>
> Anyway, Resource is EMF interface used as universal access to the EObjects
> stored in different storages. This interface in composition with ResourceSet
> provides the possibility to address EObject instance using it¹s URI (like
> a full name).
> File is one of the possible storage implementation, so you can load EMF
> objects
> from a file.
> Each file can be represented by single Resource instance in a ResourceSet.
> ResourceSet ­ is a set of Resoruces loaded by your code (editing session).
> It is important to share ResourceSet (aggregated by EditingDomain) across
> different pages of the same multipage Editor.
>
> For example, to let GMF- and EMF-generated editors working simultaneously
> on different pages of the same MPE you have to share ResourceSet (by sharing
> EditingDomain) instance across them. As a result, you can create new instance
> of the Diagram (see above), assign it to the Resource root and pass
> appropriate
> URIEditorInput (pointing to the Diagram object using its URI only) to the
> GMF-generated editor. This editor will be able to locate exactly the same
> in-memory instance of Diagram (was not saved into a file yet!) by using
> appropriate
> EditingDomain/ResourceSet assigned to it on creation time (see
> http://www.eclipse.org/articles/article.php?file=Article-Int egrating-EMF-GMF-E
> ditors/index.html
> for the details).
>
> Domain resource is an instance of EMF resource holding domain model (instances
> of the interfaces generated by EMF using .ecore model file).
>
> -----------------
> Alex Shatalin
>
>
Previous Topic:How to use the provided edit.helpers?
Next Topic:Alas, GMF still unusable after all these years...
Goto Forum:
  


Current Time: Mon Mar 08 07:21:00 GMT 2021

Powered by FUDForum. Page generated in 0.02224 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top