Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Detecting a Reource Save Notification
Detecting a Reource Save Notification [message #422402] Thu, 04 September 2008 16:14 Go to next message
Eclipse UserFriend
Originally posted by: john.campaner.s1.com

Hi All,

I have a case where I need to invoke some work on an external API when
changes are saved for an EMF model which is being edited in via the
generated default editor or a GMF based editor. There are probably a few
different ways to accomplish the mission. The approach I am currently using
is that I attach an Adapter to the model's resource when it is created by
the resource factory and invoke the API in the Adapter code.

I'm not sure if this is the most appropriate and elegant approach. I do
indeed get norifications of changes to the resource (including when a save
event happens). However, its difficult to distinguish from the data in the
Notification object received which is a "resource saved to filesystem"
notification vs. other types of notifications received. Is this the most
appropriate approach for my situation and if so, are there particular
critieria I should be looking for in the Notification object?

Thanks,

John
Re: Detecting a Reource Save Notification [message #422409 is a reply to message #422402] Thu, 04 September 2008 17:42 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33217
Registered: July 2009
Senior Member
John,

Comments below.

John Campaner wrote:
> Hi All,
>
> I have a case where I need to invoke some work on an external API when
> changes are saved for an EMF model which is being edited in via the
> generated default editor or a GMF based editor. There are probably a few
> different ways to accomplish the mission. The approach I am currently using
> is that I attach an Adapter to the model's resource when it is created by
> the resource factory and invoke the API in the Adapter code.
>
Save doesn't produce specific notifications though because it doesn't
generally change the state of the resource.
> I'm not sure if this is the most appropriate and elegant approach. I do
> indeed get norifications of changes to the resource (including when a save
> event happens).
Resource.setModified(false) is called and with EMF 2.4 setTimeStamp as
well...
> However, its difficult to distinguish from the data in the
> Notification object received which is a "resource saved to filesystem"
> notification vs. other types of notifications received.
Yes, none of these notifications is an absolute indication that the
resource was saved.
> Is this the most
> appropriate approach for my situation and if so, are there particular
> critieria I should be looking for in the Notification object?
>
Maybe you should be listening to the workspace for resource deltas (like
the generated editor itself does)?
> Thanks,
>
> John
>
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Detecting a Reource Save Notification [message #422410 is a reply to message #422409] Thu, 04 September 2008 18:04 Go to previous message
Eclipse UserFriend
Originally posted by: john.campaner.s1.com

Agreed. Based on your feedback, it seems like the platform level workspace
listener would be the better choice. Thanks for the guidance.

John


"Ed Merks" <Ed.Merks@gmail.com> wrote in message
news:g9p6n9$jvg$1@build.eclipse.org...
> John,
>
> Comments below.
>
> John Campaner wrote:
>> Hi All,
>>
>> I have a case where I need to invoke some work on an external API when
>> changes are saved for an EMF model which is being edited in via the
>> generated default editor or a GMF based editor. There are probably a few
>> different ways to accomplish the mission. The approach I am currently
>> using is that I attach an Adapter to the model's resource when it is
>> created by the resource factory and invoke the API in the Adapter code.
>>
> Save doesn't produce specific notifications though because it doesn't
> generally change the state of the resource.
>> I'm not sure if this is the most appropriate and elegant approach. I do
>> indeed get norifications of changes to the resource (including when a
>> save event happens).
> Resource.setModified(false) is called and with EMF 2.4 setTimeStamp as
> well...
>> However, its difficult to distinguish from the data in the Notification
>> object received which is a "resource saved to filesystem" notification
>> vs. other types of notifications received.
> Yes, none of these notifications is an absolute indication that the
> resource was saved.
>> Is this the most appropriate approach for my situation and if so, are
>> there particular critieria I should be looking for in the Notification
>> object?
>>
> Maybe you should be listening to the workspace for resource deltas (like
> the generated editor itself does)?
>> Thanks,
>>
>> John
>>
>>
>>
>>
Previous Topic:howto to do objects with serial numbers
Next Topic:Re: [Teneo] Insert / Delete instead of Update
Goto Forum:
  


Current Time: Tue Sep 24 10:18:53 GMT 2024

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

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

Back to the top