Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » how to refer to the same instance of the model from different notation diagrams
how to refer to the same instance of the model from different notation diagrams [message #44757] Mon, 11 September 2006 12:20 Go to next message
Eclipse UserFriend
Originally posted by: marguu.libero.it

Hi all! I'd like to know how I can refer to the same instance of the mod=
el =

from different instances of the diagram. I've modified the code of my g=
mf =

editor to point always t the same model file, but i'd like to be able to=
=

operate on a unique instance in memory of the root element of the resour=
ce =

associated with this file. How can I reach this aim?
Thanks in advance

-- =

Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
Re: how to refer to the same instance of the model from different notation diagrams [message #44933 is a reply to message #44757] Mon, 11 September 2006 15:01 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Angelo,

Looks like you should always use single instance of the EditingDomain.
Take a look on the following thread: http://dev.eclipse.org/newslists/news.eclipse.technology.gmf /msg04116.html.

-----------------
Alex Shatalin
Re: how to refer to the same instance of the model from different notation diagrams [message #44979 is a reply to message #44933] Mon, 11 September 2006 15:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: marguu.libero.it

Thanks for the reply. I just use a single instance of the EditingDomain.=
=

All works fine, but if I try to modify simultaneously two diagrams I =

obtain an incosistence like in the following scenario:

1. I create two diagrams A and B
2. I add an element "a" in the diagram A
3. I don't save
4. I add an element "b" in the diagram B
5. I save the diagram A
6. The model contains the new element "a"
7. I save the diagram B
8. In the model the element "b" overrides the element "a"

Where is the error? I'd like to obtain a consistent model.

Note: if I add a new element and save the diagram before I switch into a=
n =

another diagram, I don't reach problems. What should I do?

Thanks Angelo


On Mon, 11 Sep 2006 15:01:33 +0000 (UTC), Alex Shatalin <vano@borland.co=
m> =

wrote:

> Hello Angelo,
>
> Looks like you should always use single instance of the EditingDomain.=
=

> Take a look on the following thread: =

> http://dev.eclipse.org/newslists/news.eclipse.technology.gmf /msg04116.=
html.
>
> -----------------
> Alex Shatalin
>
>



-- =

Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
Re: how to refer to the same instance of the model from different notation diagrams [message #44997 is a reply to message #44979] Mon, 11 September 2006 15:43 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Angelo,

> Thanks for the reply. I just use a single instance of the
> EditingDomain.
If you are using the same instance of editing domain for both diagrams,
once you modify first diagram second one will be automatically marked as
"changed" and this is my suggestions for now.

> 8. In the model the element "b" overrides the element "a"
> Where is the error? I'd like to obtain a consistent model.
You can use different editing domain for different diagrams and perform
this synchronization by yourself or use single instance of EditingDomain
and get it for free.

-----------------
Alex Shatalin
Re: how to refer to the same instance of the model from different notation diagrams [message #45797 is a reply to message #44997] Tue, 12 September 2006 09:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: marguu.libero.it

I've tried to use an unique editingDomain (I used a static value in the =
=

XXXDiagramEditor.createEditingDomain()) but I found two problems:


1. Resourses: if I operate simultaneously fow example on three diagrams =
=

all works fine. But if I delete all the diagram files and then I create =
a =

new diagram file in the workspace I find three files (one is new and it =
is =

consistence; two have the old names but they are corrupted). How can I =

delete these old references?


2. CommandStack: if I use an unique editingDomain I have to use a unique=
=

command stack, isn't it? For example:

a) I create the diagram A and the diagram B
b) I add the element 1 in the diagram A
c) I add the element 2 in the diagram B
d) I switch again in the diagram A
e) I undo the last change

In this manner I delete the element 2 in the diagram B, not the element=
1 =

in the diagram A as I aspect

How can I workaround this problem?

Thanks in advance
Re: how to refer to the same instance of the model from different notation diagrams [message #45856 is a reply to message #45797] Tue, 12 September 2006 09:41 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Angelo,

> 1. Resourses: if I operate simultaneously fow example on three
> diagrams
Looks like a problem described in this request: https://bugs.eclipse.org/bugs/show_bug.cgi?id=153893
Should be fixed in 1.0.1 and 2.0 builds.

> 2. CommandStack: if I use an unique editingDomain I have to use a
> unique
This is a question to runtime team, but it looks like a side-effect your
application will have.

-----------------
Alex Shatalin
Re: how to refer to the same instance of the model from different notation diagrams [message #45951 is a reply to message #45856] Tue, 12 September 2006 10:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: marguu.libero.it

The bug that you suggest me can resolve a problem of mine, but it doesn'=
t =

work for the problem described in the following example (I rewrite it in=
=

order to be comprehensible for everyone):

"If I operate simultaneously for example on three diagrams all works fin=
e. =

But if I delete all the diagram files and then I create a new diagram fi=
le =

in the workspace I find three files (one is new and it is consistence; t=
wo =

have the old names but they are corrupted). How can I delete these old =

references?"


On Tue, 12 Sep 2006 09:41:26 +0000 (UTC), Alex Shatalin <vano@borland.co=
m> =

wrote:

> Hello Angelo,
>
>> 1. Resourses: if I operate simultaneously fow example on three
>> diagrams
> Looks like a problem described in this request: =

> https://bugs.eclipse.org/bugs/show_bug.cgi?id=3D153893 Should be fixed=
in =

> 1.0.1 and 2.0 builds.
>
>> 2. CommandStack: if I use an unique editingDomain I have to use a
>> unique
> This is a question to runtime team, but it looks like a side-effect=
=

> your application will have.
>
> -----------------
> Alex Shatalin
>
>



-- =

Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
Re: how to refer to the same instance of the model from different notation diagrams [message #45978 is a reply to message #45951] Tue, 12 September 2006 10:59 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Angelo,

> But if I delete all the diagram files and then I create a new diagram
> file in the workspace I find three files (one is new and it is consistence;
> two have the old names but they are corrupted). How can I delete these old
> references?"
AFAIU these two additional (corrupted) files will be created in a workspace
as a side-effect of that bug (at least I suppose so and you can check it).
If you update GMF with the fix to the mentioned request in this situation
two unnecessary files should not be created anymore. Did you tried to update
to the latest build and get the same problem? Does mentioned fix solve the
problem or are you talking about the possibility to remove references to
the corresponding resources (two closed diagrams) from the shared ResourceSet?

-----------------
Alex Shatalin
Re: how to refer to the same instance of the model from different notation diagrams [message #46489 is a reply to message #45978] Tue, 12 September 2006 13:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: marguu.libero.it

Thanks for the suggestion! I've installed the last 1.0 Stream Maintenanc=
e =

Build (in particulary the file GMF-sdk-M20060907.zip, is it rigth? What =
is =

the meant of the X icon on the left?) and all works fine.
Now I'd like to solve another problem: I'd like to make dirty only the =

editor that I'm modifying. How can I reach this aim? How does the =

DemultiplexingListener.handleNotification() operation in the =

XXXDocumentProvider.CustomModificationListener work?

I have even a question: in the previous answer you told me to ask for th=
e =

CommandStack problem to the runtime team. In which newsgroup have I to =

post this question?

Thanks, Angelo


On Tue, 12 Sep 2006 10:59:40 +0000 (UTC), Alex Shatalin <vano@borland.co=
m> =

wrote:

> Hello Angelo,
>
>> But if I delete all the diagram files and then I create a new diagram=

>> file in the workspace I find three files (one is new and it is =

>> consistence;
>> two have the old names but they are corrupted). How can I delete thes=
e =

>> old
>> references?"
> AFAIU these two additional (corrupted) files will be created in a =

> workspace as a side-effect of that bug (at least I suppose so and you =
=

> can check it). If you update GMF with the fix to the mentioned request=
=

> in this situation two unnecessary files should not be created anymore.=
=

> Did you tried to update to the latest build and get the same problem? =
=

> Does mentioned fix solve the problem or are you talking about the =

> possibility to remove references to the corresponding resources (two =

> closed diagrams) from the shared ResourceSet?
>
> -----------------
> Alex Shatalin
>
>



-- =

Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
Re: how to refer to the same instance of the model from different notation diagrams [message #46517 is a reply to message #46489] Tue, 12 September 2006 14:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: marguu.libero.it

In particular I'd like to know how the code =

"document.setContent(document.getContent());" works. In fact if I commen=
t =

this line in the DemultiplexingListener.handleNotification() operation, =
I =

obtain the wanted result!

Thanks in advance.


On Tue, 12 Sep 2006 15:59:30 +0200, Angelo Marguglio <marguu@libero.it> =
=

wrote:

> Thanks for the suggestion! I've installed the last 1.0 Stream =

> Maintenance Build (in particulary the file GMF-sdk-M20060907.zip, is i=
t =

> rigth? What is the meant of the X icon on the left?) and all works fin=
e.
> Now I'd like to solve another problem: I'd like to make dirty only the=
=

> editor that I'm modifying. How can I reach this aim? How does the =

> DemultiplexingListener.handleNotification() operation in the =

> XXXDocumentProvider.CustomModificationListener work?
>
> I have even a question: in the previous answer you told me to ask for =
=

> the CommandStack problem to the runtime team. In which newsgroup have =
I =

> to post this question?
>
> Thanks, Angelo
>
>
> On Tue, 12 Sep 2006 10:59:40 +0000 (UTC), Alex Shatalin =

> <vano@borland.com> wrote:
>
>> Hello Angelo,
>>
>>> But if I delete all the diagram files and then I create a new diagra=
m
>>> file in the workspace I find three files (one is new and it is =

>>> consistence;
>>> two have the old names but they are corrupted). How can I delete the=
se =

>>> old
>>> references?"
>> AFAIU these two additional (corrupted) files will be created in a =

>> workspace as a side-effect of that bug (at least I suppose so and you=
=

>> can check it). If you update GMF with the fix to the mentioned reques=
t =

>> in this situation two unnecessary files should not be created anymore=
.. =

>> Did you tried to update to the latest build and get the same problem?=
=

>> Does mentioned fix solve the problem or are you talking about the =

>> possibility to remove references to the corresponding resources (two =
=

>> closed diagrams) from the shared ResourceSet?
>>
>> -----------------
>> Alex Shatalin
>>
>>
>
>
>



-- =

Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
Re: how to refer to the same instance of the model from different notation diagrams [message #46598 is a reply to message #46517] Tue, 12 September 2006 14:44 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Angelo,

> "document.setContent(document.getContent());" works. In fact if I
> comment this line in the DemultiplexingListener.handleNotification()
> operation, I obtain the wanted result!
This is a listener for change notifications from the underlying resources.
Once you change any of the resources loaded into the resource set associated
with openned diagram, then "document.setContent(document.getContent());"
will be called to mark editor is dirty.
I do not think you should mark only one editor as "dirty" because if you'll
try to open another diagram referencing the same model instance (this is
what are you going to do AFAIU) and make any modifications in the underlying
model - another diagram will be changed as well, so editor should be marked
as dirty. But you can try it.
Concerning CommandStack – I suggest you to wait a bit and I hope somebody
from the runtime team will post an answer to this question. Runtime is just
a part of GMF, but I’m not responsible for it and simply can not answer some
concrete questions especially concerning command processing. ;-)

-----------------
Alex Shatalin
SOLVED Re: how to refer to the same instance of the model from different notation diagrams [message #46644 is a reply to message #46598] Tue, 12 September 2006 15:12 Go to previous message
Eclipse UserFriend
Originally posted by: marguu.libero.it

Thanks a lot! Now I'll post the CommandStack problem in a new thread in =
=

order to give it a gretaer visibility!
Thanks Angelo


On Tue, 12 Sep 2006 14:44:24 +0000 (UTC), Alex Shatalin <vano@borland.co=
m> =

wrote:

> Hello Angelo,
>
>> "document.setContent(document.getContent());" works. In fact if I
>> comment this line in the DemultiplexingListener.handleNotification()
>> operation, I obtain the wanted result!
> This is a listener for change notifications from the underlying =

> resources. Once you change any of the resources loaded into the resour=
ce =

> set associated with openned diagram, then =

> "document.setContent(document.getContent());" will be called to mark =

> editor is dirty. I do not think you should mark only one editor as =
=

> "dirty" because if you'll try to open another diagram referencing the =
=

> same model instance (this is what are you going to do AFAIU) and make =
=

> any modifications in the underlying model - another diagram will be =

> changed as well, so editor should be marked as dirty. But you can try =
it.
> Concerning CommandStack =E2=80=93 I suggest you to wait a bit and I=
hope =

> somebody from the runtime team will post an answer to this question. =

> Runtime is just a part of GMF, but I=E2=80=99m not responsible for it =
and simply =

> can not answer some concrete questions especially concerning command =

> processing. ;-)
>
> -----------------
> Alex Shatalin
>
>



-- =

Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
Previous Topic:Where can I find in-depth documentation for GMF?
Next Topic:Dynamic model loading in GMF
Goto Forum:
  


Current Time: Mon Dec 30 16:34:46 GMT 2024

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

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

Back to the top