Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » sharing objects between models
sharing objects between models [message #177149] Tue, 12 April 2005 20:51 Go to next message
Eclipse UserFriend
Originally posted by: flsobral.yahoo.com.br

Hello.

I'm working on a case tool using GEF and EMF. I want it to be able to
create as many models as I want and share anything created in one model
with any other model in the same project, giving a different view of the
same object in each model.
For instance:
I have UMLmodel1 and I created the classes Class1 and Class2 with a
association between them. In another model UMLmodel2 located in the same
project as UMLmodel1, I want to be able to use the same Class1 and Class2
with the same features without rewriting it and also be able to choose if
I want to choose the association between them. Any changes mades on a
class in any model should reflect in all models.
Basically something close to Rational Rose, where everything can be shared
between models of the same project.
Can it be done? Any example I should look?

Thanks in advance.
Re: sharing objects between models [message #177275 is a reply to message #177149] Wed, 13 April 2005 13:48 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
"Fabio Sobral" <flsobral@yahoo.com.br> wrote in message
news:fbefc0632155d5f114de00d653e69935$1@www.eclipse.org...
> Hello.
>
> I'm working on a case tool using GEF and EMF. I want it to be able to
> create as many models as I want and share anything created in one model
> with any other model in the same project, giving a different view of the
> same object in each model.
> For instance:
> I have UMLmodel1 and I created the classes Class1 and Class2 with a
> association between them. In another model UMLmodel2 located in the same
> project as UMLmodel1, I want to be able to use the same Class1 and Class2
> with the same features without rewriting it and also be able to choose if
> I want to choose the association between them. Any changes mades on a
> class in any model should reflect in all models.
> Basically something close to Rational Rose, where everything can be shared
> between models of the same project.
> Can it be done? Any example I should look?

Sure. GEF is model-agnostic, so it doesn't care about how you set-up your
model. You can look at the EDiagram example (available from the CVS
repository), which allows you to graphically create ecore files. EMF allows
one ecore file to refer to packages, classes in other ecore files, and the
example provides that support as well.

>
> Thanks in advance.
>
Re: sharing objects between models [message #177345 is a reply to message #177275] Wed, 13 April 2005 19:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: flsobral.yahoo.com.br

"Sure. GEF is model-agnostic, so it doesn't care about how you set-up your
model. You can look at the EDiagram example (available from the CVS
repository), which allows you to graphically create ecore files. EMF
allows
one ecore file to refer to packages, classes in other ecore files, and the
example provides that support as well."

I tought about that, but it leads to consistency problems if the user
tries to edit 2 ediagrams at same time.
Is there another way to do this that doesn't have this problem or to
disallow the user to open more than one edit window for the same type of
file? Maybe save and close the current before openning a new one.

Thanks.
Re: sharing objects between models [message #177392 is a reply to message #177345] Wed, 13 April 2005 21:07 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
If all open editors refer to the same instance of the model, you won't have
any consistency problems. As soon as one editor triggers a change, it will
be updated in all other editors as well.

"Fabio Sobral" <flsobral@yahoo.com.br> wrote in message
news:a9a11d6266c19fee70c0222411635371$1@www.eclipse.org...
> "Sure. GEF is model-agnostic, so it doesn't care about how you set-up
your
> model. You can look at the EDiagram example (available from the CVS
> repository), which allows you to graphically create ecore files. EMF
> allows
> one ecore file to refer to packages, classes in other ecore files, and the
> example provides that support as well."
>
> I tought about that, but it leads to consistency problems if the user
> tries to edit 2 ediagrams at same time.
> Is there another way to do this that doesn't have this problem or to
> disallow the user to open more than one edit window for the same type of
> file? Maybe save and close the current before openning a new one.
>
> Thanks.
>
Re: sharing objects between models [message #177655 is a reply to message #177392] Thu, 14 April 2005 19:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: flsobral.yahoo.com.br

"If all open editors refer to the same instance of the model, you won't
have
any consistency problems. As soon as one editor triggers a change, it will
be updated in all other editors as well."

But that's not what happens in the EDiagram example. If I open 2 ediagram
editors that share the same ecore, any changes made in the first one are
not updated in the second ediagram editor. Besides that, if I save new
changes in the second another editor, the previous changes made on the
first one will be lost. After this point, every time I save one ediagram I
will be losing the changes made in the other ediagram.

Thanks again.
Re: sharing objects between models [message #177692 is a reply to message #177655] Thu, 14 April 2005 21:03 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
That's simply because the EDiagram editors didn't share the in-memory model.
If you do, you'll be fine. In fact, I've just updated EDiagram editor to do
that. Catch up.

"Fabio Sobral" <flsobral@yahoo.com.br> wrote in message
news:9134a2a6136fa9d799b62fb543ff09ea$1@www.eclipse.org...
> "If all open editors refer to the same instance of the model, you won't
> have
> any consistency problems. As soon as one editor triggers a change, it
will
> be updated in all other editors as well."
>
> But that's not what happens in the EDiagram example. If I open 2 ediagram
> editors that share the same ecore, any changes made in the first one are
> not updated in the second ediagram editor. Besides that, if I save new
> changes in the second another editor, the previous changes made on the
> first one will be lost. After this point, every time I save one ediagram I
> will be losing the changes made in the other ediagram.
>
> Thanks again.
>
Re: sharing objects between models [message #177711 is a reply to message #177655] Thu, 14 April 2005 21:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: flsobral.yahoo.com.br

Still about the EDiagram example...
The DiagramImpl has a reference to the ecore file, but I didn't find where
this reference is used and the information in the ecore file retrieved to
be used with the information stored in the ediagram file.
I also didn't understand where the variable rsrcSet is changed, because
when it is created in setInput it has only a reference to the ediagram
file, but when the method doSave is used it also has a reference to ecore
file.

Thanks.
Re: sharing objects between models [message #177725 is a reply to message #177711] Thu, 14 April 2005 21:33 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
"Fabio Sobral" <flsobral@yahoo.com.br> wrote in message
news:eced3976ab800964e50b2b546162a6c2$1@www.eclipse.org...
> Still about the EDiagram example...
> The DiagramImpl has a reference to the ecore file, but I didn't find where
> this reference is used and the information in the ecore file retrieved to
> be used with the information stored in the ediagram file.

No, it doesn't. It has a reference to the packages defined in the ecore
files. It gets initialized with these as part of setInput().

> I also didn't understand where the variable rsrcSet is changed, because
> when it is created in setInput it has only a reference to the ediagram
> file, but when the method doSave is used it also has a reference to ecore
> file.

The ediagram file refers to the ecore files it requires. The resource set
dynamically resolves this reference and loads the ecore files when they are
needed.

>
> Thanks.
>
Re: sharing objects between models [message #177980 is a reply to message #177692] Fri, 15 April 2005 21:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: flsobral.yahoo.com.br

"That's simply because the EDiagram editors didn't share the in-memory
model.
If you do, you'll be fine. In fact, I've just updated EDiagram editor to
do
that. Catch up."

You forgot to implement the method isDirty.
Re: sharing objects between models [message #177988 is a reply to message #177980] Fri, 15 April 2005 22:12 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
It moved to GraphicalEditor around 3.1 M4 or M5. You'll have to catch up
with that too.

"Fabio Sobral" <flsobral@yahoo.com.br> wrote in message
news:12fc5e2c7843d23e3d01e4c1dde21aae$1@www.eclipse.org...
> "That's simply because the EDiagram editors didn't share the in-memory
> model.
> If you do, you'll be fine. In fact, I've just updated EDiagram editor to
> do
> that. Catch up."
>
> You forgot to implement the method isDirty.
>
>
Re: sharing objects between models [message #178325 is a reply to message #177988] Tue, 19 April 2005 20:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: flsobral.yahoo.com.br

I found something that may be a bug.
When you delete a ediagram from a project and create a new ediagram with
the same name as the one deleted and in the same project, it will come
with the same elements as the one deleted.
Should it work that way?
Re: sharing objects between models [message #178347 is a reply to message #178325] Tue, 19 April 2005 21:22 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
Can you elaborate? When you created the new file, did you associate it with
the same ECore file as the one before it was? Also, what "elements" are you
talking about? The ones in the editor or the outline?

"Fabio Sobral" <flsobral@yahoo.com.br> wrote in message
news:e47e492f4d805da11ffb16695ca0a74d$1@www.eclipse.org...
> I found something that may be a bug.
> When you delete a ediagram from a project and create a new ediagram with
> the same name as the one deleted and in the same project, it will come
> with the same elements as the one deleted.
> Should it work that way?
>
Re: sharing objects between models [message #180534 is a reply to message #178347] Fri, 06 May 2005 21:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: flsobral.yahoo.com.br

Create a new ediagram named "a" associated with a new ecore named "a",
make a new class in this ediagram and save.
Now close both windows and delete both files.
Create a new ediagram named "a" associated with a new ecore named "b" and
the same class will still be there on the ediagram, but not in the new
ecore.
If you create a new ediagram named "b" associated with a new ecore named
"a" this won't happen. Both will be empty.

This seems to be a bug for me, I expected a new ediagram editor always to
be empty.
Re: sharing objects between models [message #180630 is a reply to message #180534] Mon, 09 May 2005 15:21 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
Hmm, I think this is a side-effect of having a shared resource set. Once
you've loaded a.ediagram, it's not going to reload it again....just give you
what was in the memory.

"F
Re: sharing objects between models [message #180664 is a reply to message #180534] Mon, 09 May 2005 16:50 Go to previous message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
You can handle this the same way that you would handle other resource deltas
while your editor is up. Unload the resource that has changed, thus forcing
it to be reloaded.

Since, our example doesn't bother with resource changes and such, this would
be a bug. I will revert the example to not share the resource set (which
also led to the problem of undo not always working because of conflicting
changes, for instance).

"F
Previous Topic:How to make a delete menu enabled?
Next Topic:50% "Shading" figures
Goto Forum:
  


Current Time: Tue Apr 16 09:10:22 GMT 2024

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

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

Back to the top