Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Edit an existing ResourceSet in a GMF editor
Edit an existing ResourceSet in a GMF editor [message #160848] Fri, 16 November 2007 09:48 Go to next message
Fabrice Dubach is currently offline Fabrice DubachFriend
Messages: 43
Registered: July 2009
Member
Hi,

I try to have a same resourceSet editing by two editors : an "EMF one", and
a "GMF one". Each editor is attempted to edit a different part of my
semantic model.

The resourceSet is created by the EMF editor, and is past to the GMF editor
which create its EditingDomain using the method
createEditingDomain(myEMFResourceSet) instead of the method
createEditingDomain() (wich create a resourceSet form scratch).

Doing this, I have some trouble with the TransationChangeRecorder in two
cases :

- When a modification occurs in the EMF editor, the
TransactionChangeRecorder is notified and called assertWrite wich fail
because this adapter accept changes from the GMF editor and forbid external
changes (ie without active transaction). This behavior seems to be logic
(forbid to modify model's objects outside the GMF editor for keeping the
diagram representation up to date) but the semantic of my model assum that
modifications sets by the EMF editor do not interact with the diagram
representation. I made a sort of "hack" for suppressing the assertWrite
method, but is there a better way ???

- When I open my GMF editor, the TransationChangeRecorder is created and
added to the adapters to be notified to each object of my model. When I
close this editor, this adapter is not removed from the "to be notified"
list, than, when I reopen my GMF editor, I have twice occurence of
TracnsactionChangeRecorder. So, the assertWrite fail for one. For me this is
a strange behavior of the GMF framework, and it's look like a bug...?

Thanks for any help.
Regards,
Fabrice Dubach
Re: Edit an existing ResourceSet in a GMF editor [message #160941 is a reply to message #160848] Fri, 16 November 2007 13:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Fabrice,

Find some replies in-line, below.

HTH,

Christian


Fabrice Dubach wrote:

> Hi,
>
> I try to have a same resourceSet editing by two editors : an "EMF one",
> and a "GMF one". Each editor is attempted to edit a different part of my
> semantic model.
>
> The resourceSet is created by the EMF editor, and is past to the GMF
> editor which create its EditingDomain using the method
> createEditingDomain(myEMFResourceSet) instead of the method
> createEditingDomain() (wich create a resourceSet form scratch).
>
> Doing this, I have some trouble with the TransationChangeRecorder in two
> cases :
>
> - When a modification occurs in the EMF editor, the
> TransactionChangeRecorder is notified and called assertWrite wich fail
> because this adapter accept changes from the GMF editor and forbid
> external changes (ie without active transaction). This behavior seems to
> be logic (forbid to modify model's objects outside the GMF editor for
> keeping the diagram representation up to date) but the semantic of my
> model assum that modifications sets by the EMF editor do not interact with
> the diagram representation. I made a sort of "hack" for suppressing the
> assertWrite method, but is there a better way ???

You might want to have a look at the
org.eclipse.emf.workspace.examples.extlibrary.editor plug-in for an example
of how to change your EMF editor to be transaction-aware. This has the
advantage of ensuring that the Undo/Redo menus in your EMF and GMF editors
are coordinated. You would need to ensure that your EMF and GMF editors
use the same TransactionalEditingDomain (by using the registry extension
point).

To install the example plug-in (if you have the GMF or Transaction SDK),
use the "New -> Example..." wizard and look for the EMF Workspace
Integration example.


> - When I open my GMF editor, the TransationChangeRecorder is created and
> added to the adapters to be notified to each object of my model. When I
> close this editor, this adapter is not removed from the "to be notified"
> list, than, when I reopen my GMF editor, I have twice occurence of
> TracnsactionChangeRecorder. So, the assertWrite fail for one. For me this
> is a strange behavior of the GMF framework, and it's look like a bug...?

When you no longer need the transactional control on a resource set, you
should dispose the editing domain using
TransactionalEditingDomain::dispose(). Probably you can customize your GMF
editor's dispose() method to dispose its editing domain. This will free
the resource set from its transactional bonds. Although, you actually
wouldn't want to do this if your EMF and GMF editors share an editing
domain.


> Thanks for any help.
> Regards,
> Fabrice Dubach
Re: Edit an existing ResourceSet in a GMF editor [message #161890 is a reply to message #160941] Wed, 21 November 2007 17:20 Go to previous message
Fabrice Dubach is currently offline Fabrice DubachFriend
Messages: 43
Registered: July 2009
Member
Christian,

Thanks ! Your link to this exemple was very helpful for me. Now I understand
a bit more the editing domain's functionalities. So, with this help, I could
use a same TransactionalEditingDomain for my several EMF/GMF editors and all
is doing well !

About the second point (TransactionChangeRecorder not disposed), I was
talking about bug because my editor is generated and the generated code does
not dispose this adapter. I also forgot to specify that I generate RCP
version of my editors.

Fabrice.
Previous Topic:Figure with two Anchors
Next Topic:How to add tooltips to decorators?
Goto Forum:
  


Current Time: Fri Mar 29 10:01:11 GMT 2024

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

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

Back to the top