Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Design ideas for multiple editors/single resource
Design ideas for multiple editors/single resource [message #878670] Tue, 29 May 2012 17:36 Go to next message
Josef Pohl is currently offline Josef PohlFriend
Messages: 82
Registered: January 2012
Member
Hi there,

I apologize if this is a common question. I have not found a good resource for a possible solution yet though so I figured I would toss this out and see if I can get any good ideas.

I have a single (serialized) model instance which I would like to access from multiple (graphical) editors. The scenario is as such:
1. A single element from an original model acts as a "pivot point" for further development.
2. This single element should be extended using a new editor instance.
3. All of the extensions (which include adding further elements, editing attributes, etc...) should be displayed in the second editor but not in the first.
4. All of the extensions to the model should be saved in the original EMF resource.
5. No graphical representation, except for the original pivot point, should appear in the original editor, only in the second (new) editor.

I have tried the naive version of this to no success. That was basically two editors sharing the same EMF resource file (XMI serialization). Basically this would cause a dirty editor on any change (or simply activation) to the other editor.

I have thought about closing editors automatically but this is very disruptive to the work flow.

Has anyone come up with a nice design where two editors can (asynchronously) access the same model resource file?

Thanks,
Joe
Re: Design ideas for multiple editors/single resource [message #878715 is a reply to message #878670] Tue, 29 May 2012 19:37 Go to previous messageGo to next message
Christian W. Damus is currently offline Christian W. DamusFriend
Messages: 1195
Registered: July 2009
Location: Canada
Senior Member

Hi, Josef,

This is exactly the kind of scenario that the EMF Transaction component
is intended to support. The Graphical Modeling Framework (which you
may be using, as you mentioned graphical editors) uses this component
to allow multiple diagram editors with different viewpoints on a model
all to edit it in a well-coordinated fashion.

HTH,

Christian


On 2012-05-29 17:36:44 +0000, Josef Pohl said:

> Hi there,
>
> I apologize if this is a common question. I have not found a good
> resource for a possible solution yet though so I figured I would toss
> this out and see if I can get any good ideas.
>
> I have a single (serialized) model instance which I would like to
> access from multiple (graphical) editors. The scenario is as such: 1.
> A single element from an original model acts as a "pivot point" for
> further development. 2. This single element should be extended using a
> new editor instance.
> 3. All of the extensions (which include adding further elements,
> editing attributes, etc...) should be displayed in the second editor
> but not in the first. 4. All of the extensions to the model should be
> saved in the original EMF resource. 5. No graphical representation,
> except for the original pivot point, should appear in the original
> editor, only in the second (new) editor.
>
> I have tried the naive version of this to no success. That was
> basically two editors sharing the same EMF resource file (XMI
> serialization). Basically this would cause a dirty editor on any
> change (or simply activation) to the other editor.
> I have thought about closing editors automatically but this is very
> disruptive to the work flow.
> Has anyone come up with a nice design where two editors can
> (asynchronously) access the same model resource file?
> Thanks,
> Joe
Re: Design ideas for multiple editors/single resource [message #879737 is a reply to message #878715] Thu, 31 May 2012 18:51 Go to previous messageGo to next message
Josef Pohl is currently offline Josef PohlFriend
Messages: 82
Registered: January 2012
Member
Thanks Christian,
That does help. I will dig into it and I appreciate the feedback.

Joe
Re: Design ideas for multiple editors/single resource [message #880193 is a reply to message #879737] Fri, 01 June 2012 15:39 Go to previous messageGo to next message
Josef Pohl is currently offline Josef PohlFriend
Messages: 82
Registered: January 2012
Member
Hi there,

I did not make the connection at first but I am actually using the Transaction Component through Graphiti. My apologies about this. The only place I have used it explicitly is during diagram creation.

When a diagram is created a TED and a resource set are created to hold the diagrams resources. I create two resources, one for the diagram and one for the model. They are persisted through URI's that I provide.

In Graphiti there is a one to one relationship between the TED and a Resource Set. What I have been trying to do is, when I create the second diagram which will use the first diagrams model resource, I simply pass the URI for the model to the new diagram and let it set up its own TED and ResourceSet.

In the documentation under "Sharing Objects and Resources with Other Resource Sets", if I am reading it correctly, the resource needs to be disconnected from the first diagrams TED and connected to the second each time the diagram becomes active. Is this correct? Is there any good "location" to do this (i.e. a listener that indicates "on active"? This may be a question for Graphiti. )

Secondly, is there any good way to tell an editor to ignore, in a sense, the content of the resource that it does not actively display?

Thanks in advance. If there is any place I should be looking for answers to these questions please let me know. I will continue to dig around.

Thanks again,
Joe
Re: Design ideas for multiple editors/single resource [message #881903 is a reply to message #880193] Tue, 05 June 2012 13:12 Go to previous messageGo to next message
Christian W. Damus is currently offline Christian W. DamusFriend
Messages: 1195
Registered: July 2009
Location: Canada
Senior Member

Hi, Joe,

Sorry for the delayed reply. See some comments in-line.

cW

On 2012-06-01 15:39:09 +0000, Josef Pohl said:

> Hi there,
>
> I did not make the connection at first but I am actually using the
> Transaction Component through Graphiti. My apologies about this. The
> only place I have used it explicitly is during diagram creation.

Aha! I thought so :-)

> When a diagram is created a TED and a resource set are created to hold
> the diagrams resources. I create two resources, one for the diagram
> and one for the model. They are persisted through URI's that I provide.
> In Graphiti there is a one to one relationship between the TED and a
> Resource Set. What I have been trying to do is, when I create the
> second diagram which will use the first diagrams model resource, I
> simply pass the URI for the model to the new diagram and let it set up
> its own TED and ResourceSet.

So, you've got the resource loaded twice, once into each of two editing
domains? I don't think there's anything in EMF or the EMF Transaction
component that helps with this. Coordinating these changes probably
falls back to the platform's IResourceChangeListener API …


> In the documentation under "Sharing Objects and Resources with Other
> Resource Sets", if I am reading it correctly, the resource needs to be
> disconnected from the first diagrams TED and connected to the second
> each time the diagram becomes active. Is this correct? Is there any
> good "location" to do this (i.e. a listener that indicates "on active"?
> This may be a question for Graphiti. )

Sorry, I'm a bit lost. Which resource would be disconnected from an
editing domain? I thought each editing domain had its own resource set
with its own copy of these resources.


> Secondly, is there any good way to tell an editor to ignore, in a
> sense, the content of the resource that it does not actively display?

The editor probably has to take care of this in the listeners that it
attaches to the resource set, whether that be some kind of Adapter
(e.g., EContentAdapter) attached only to the resources of interest or a
ResourceSetListener on the TED with a filter.


> Thanks in advance. If there is any place I should be looking for
> answers to these questions please let me know. I will continue to dig
> around.
>
> Thanks again,
> Joe
Re: Design ideas for multiple editors/single resource [message #884706 is a reply to message #881903] Mon, 11 June 2012 16:31 Go to previous messageGo to next message
Josef Pohl is currently offline Josef PohlFriend
Messages: 82
Registered: January 2012
Member
>Sorry for the delayed reply. See some comments in-line.

And my apologies for the delay again. Thank you very much for your reply. I had to do a bit more investigation.

>> When a diagram is created a TED and a resource set are created to hold
>> the diagrams resources. I create two resources, one for the diagram
>> and one for the model. They are persisted through URI's that I provide.
>> In Graphiti there is a one to one relationship between the TED and a
>> Resource Set. What I have been trying to do is, when I create the
>> second diagram which will use the first diagrams model resource, I
>> simply pass the URI for the model to the new diagram and let it set up
>> its own TED and ResourceSet.

> So, you've got the resource loaded twice, once into each of two editing
> domains? I don't think there's anything in EMF or the EMF Transaction
> component that helps with this. Coordinating these changes probably
> falls back to the platform's IResourceChangeListener API ...

You are correct, I have the following structurre:
M = Model Resource
D1 = Diagram Content Resource
D2 = Diagram Content Resource

Each Diagram has TED which contains either D1 or D2 and M. Hence M can be loaded twice.
So, after my few investigations I realized that there are two issues with this scenario. One I can explain and the other I cannot.

1. If I make a change on the second diagram and then bring the original diagram back into context I get the following error (which I cannot explain).
Quote:
There are unsaved changes that conflict with changes made outside the editor. Do you wish to discard this editors changes?


If I say "Yes" to disregard, everything seems to be OK. If I say "No" then the elements added (or changed) from the second diagram are no longer added to the model file.

2. If I change either diagram the relative position of the elements change. My model file contains connections of the form
<link xsi:type="Model.MyConnection" identifier="4" to="//@node.2" from="//@node.5" />

These relative positions get updated in the diagram resource connected to the diagram which I am editing but not in the associated diagram.

I suspect there probably is a way to reflect this change back into the diagram resource that is not in context. Assuming the diagram is open. However I can envision a scenario that only one of the resources might be open and hence changes could be made that would cause the second diagram to be out of state with model.

The point being, is that I think this setup is fundamentally flawed in a number of ways.

So my question is, is there some better way to do this? Have a single model resource which is contained in parts and may have some overlap (i.e. The original pivot point that serves as the connection point between the two diagrams)?

Thanks,
Joe


Re: Design ideas for multiple editors/single resource [message #884980 is a reply to message #884706] Tue, 12 June 2012 07:58 Go to previous messageGo to next message
Peter Mising name is currently offline Peter Mising nameFriend
Messages: 95
Registered: July 2009
Member
Hi Josef,
I think your diagrams load the model independently but when you load the
same memory represantation, then both diagrams operate on the same model
resource and you don´t have sync problems.
Maybe this is some help to you:
http://code.google.com/p/gmftools/source/browse/trunk/plugins/de.itemis.gmf.runtime.extensions/templates-3.5/sharedEditingDomain/aspects/xpt/editor/DocumentProvider.xpt?spec=svn149&r=149

Am 11.06.2012 18:31, schrieb Josef Pohl:
>> Sorry for the delayed reply. See some comments in-line.
>
> And my apologies for the delay again. Thank you very much for your
> reply. I had to do a bit more investigation.
>
>>> When a diagram is created a TED and a resource set are created to
>>> hold the diagrams resources. I create two resources, one for the
>>> diagram and one for the model. They are persisted through URI's that
>>> I provide.
>>> In Graphiti there is a one to one relationship between the TED and a
>>> Resource Set. What I have been trying to do is, when I create the
>>> second diagram which will use the first diagrams model resource, I
>>> simply pass the URI for the model to the new diagram and let it set
>>> up its own TED and ResourceSet.
>
>> So, you've got the resource loaded twice, once into each of two
>> editing domains? I don't think there's anything in EMF or the EMF
>> Transaction component that helps with this. Coordinating these changes
>> probably falls back to the platform's IResourceChangeListener API ...
>
> You are correct, I have the following structurre:
> M = Model Resource
> D1 = Diagram Content Resource
> D2 = Diagram Content Resource
> Each Diagram has TED which contains either D1 or D2 and M. Hence M can
> be loaded twice. So, after my few investigations I realized that there
> are two issues with this scenario. One I can explain and the other I
> cannot.
> 1. If I make a change on the second diagram and then bring the original
> diagram back into context I get the following error (which I cannot
> explain). Quote:
>> There are unsaved changes that conflict with changes made outside the
>> editor. Do you wish to discard this editors changes?
>
>
> If I say "Yes" to disregard, everything seems to be OK. If I say "No"
> then the elements added (or changed) from the second diagram are no
> longer added to the model file.
> 2. If I change either diagram the relative position of the elements
> change. My model file contains connections of the form <link
> xsi:type="Model.MyConnection" identifier="4" to="//@node.2"
> from="//@node.5" />
>
> These relative positions get updated in the diagram resource connected
> to the diagram which I am editing but not in the associated diagram.
> I suspect there probably is a way to reflect this change back into the
> diagram resource that is not in context. Assuming the diagram is open.
> However I can envision a scenario that only one of the resources might
> be open and hence changes could be made that would cause the second
> diagram to be out of state with model.
>
> The point being, is that I think this setup is fundamentally flawed in a
> number of ways.
> So my question is, is there some better way to do this? Have a single
> model resource which is contained in parts and may have some overlap
> (i.e. The original pivot point that serves as the connection point
> between the two diagrams)?
>
> Thanks,
> Joe
>
>
>
Re: Design ideas for multiple editors/single resource [message #892631 is a reply to message #884980] Thu, 28 June 2012 20:12 Go to previous message
Josef Pohl is currently offline Josef PohlFriend
Messages: 82
Registered: January 2012
Member
Hi Peter,
Thanks for your suggestion. A slight modification of what you suggested has gotten me part of the way there. Still some residual problems but at least I am out of the hole were I was stuck.

Thanks!
Josef
Previous Topic:Collecting XMI files backing an entire EMF Model
Next Topic:Xcore codegen problem with operations throwing exceptions
Goto Forum:
  


Current Time: Fri Aug 23 22:12:51 GMT 2019

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

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

Back to the top