Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF Model: Listen to changes when modified by other Eclipse
EMF Model: Listen to changes when modified by other Eclipse [message #1387140] Tue, 24 June 2014 11:37 Go to next message
Marc Z is currently offline Marc ZFriend
Messages: 20
Registered: July 2012
Junior Member
Hi all,

does anyone know if it is possible to get a notification, in case an EMF model is modified outside of Eclipse (e.g. by another Eclipse application)?


Regards,

Marc
Re: EMF Model: Listen to changes when modified by other Eclipse [message #1387154 is a reply to message #1387140] Tue, 24 June 2014 13:10 Go to previous messageGo to next message
Mauro Condarelli is currently offline Mauro CondarelliFriend
Messages: 428
Registered: September 2009
Senior Member
Il 24/06/2014 13:37, Marc Z ha scritto:
> Hi all,
>
> does anyone know if it is possible to get a notification, in case an EMF
> model is modified outside of Eclipse (e.g. by another Eclipse application)?

EMF models are a bunch of interlinked classes built at runtime.
None but the running application can modify them.

Most likely You refer to "the serialized representation of the model on
disk" or something similar.
This has nothing to do with EMF and is strictly dependent on the OS.

Many Operating systems have means to "watch" certain files or
directories and to get a notification when something has changed; this
is how You get the "file modified on disk, do you want to reload?"
question on many text editors.

EMF models work in exactly the same way:
Model is the internal runtime representation.
On disk there's a serialized representation of the model.
You can get a notification from OS and reload the model, but it's very
likely you will have to do some kind of merge, if your application
already independently changed the model.

NOTE: situation is a bit different with CDO.

HiH
Mauro
Re: EMF Model: Listen to changes when modified by other Eclipse [message #1387155 is a reply to message #1387154] Tue, 24 June 2014 13:22 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30461
Registered: July 2009
Senior Member
Note that generated editors have a resource delta listener so they
update the EMF Resource when the underlying Eclipse workspace IFile is
changed. Also, Eclipse has preferences to poll or be notified by the OS
when the workspace resources change, so the combination of those should
help update the editor when the resources are changed outside of Eclipse
directly in the file system.

On 24/06/2014 3:10 PM, Mauro Condarelli wrote:
> Il 24/06/2014 13:37, Marc Z ha scritto:
>> Hi all,
>>
>> does anyone know if it is possible to get a notification, in case an EMF
>> model is modified outside of Eclipse (e.g. by another Eclipse
>> application)?
>
> EMF models are a bunch of interlinked classes built at runtime.
> None but the running application can modify them.
>
> Most likely You refer to "the serialized representation of the model
> on disk" or something similar.
> This has nothing to do with EMF and is strictly dependent on the OS.
>
> Many Operating systems have means to "watch" certain files or
> directories and to get a notification when something has changed; this
> is how You get the "file modified on disk, do you want to reload?"
> question on many text editors.
>
> EMF models work in exactly the same way:
> Model is the internal runtime representation.
> On disk there's a serialized representation of the model.
> You can get a notification from OS and reload the model, but it's very
> likely you will have to do some kind of merge, if your application
> already independently changed the model.
>
> NOTE: situation is a bit different with CDO.
>
> HiH
> Mauro
Re: EMF Model: Listen to changes when modified by other Eclipse [message #1387658 is a reply to message #1387155] Wed, 25 June 2014 11:51 Go to previous message
Marc Z is currently offline Marc ZFriend
Messages: 20
Registered: July 2012
Junior Member
Dear Ed,

thanks a lot for this answer!

Regards,

Marc
Previous Topic:[CDO] Info about lock owner and breaking lock
Next Topic:Add GenModel option for platform scheme-aware URIs in XXXEditor.doSave()
Goto Forum:
  


Current Time: Sun Sep 22 14:53:26 GMT 2019

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

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

Back to the top