Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » How to get fine grained notifications after a resource save?
How to get fine grained notifications after a resource save? [message #333175] Thu, 27 November 2008 18:08 Go to next message
Adam Neal is currently offline Adam NealFriend
Messages: 40
Registered: July 2009
Member
Hi,

I'm looking for a way to be notified when an IFile has been saved and to be
told about the specific regions of the file that changed. For example, if I
added a space on line 5 and line 10 and than saved, is there a way for me to
be notified after the save and to be given the deltas that say what exactly
was changed? My file is a CDT or JDT file if that makes a difference.

I have looked at using:
ResourceSetListener - This doesn't provide any specific context about
what area's of the resource have changed
DocumentListener - This is notified after every key change, not
after a save
IElementChangeListener - This doesn't provide any fine grained delta
information either (at least the CDT one doesn't)
IMarkerUpdater - changing one space at the beginning of the
file seems to change all the markers positions so this doesn't help identify
explictly which markers' regions were changed.

Please let me know if anyone knows of another way to accomplish this.
Thanks in advance,
Adam
Re: How to get fine grained notifications after a resource save? [message #333179 is a reply to message #333175] Thu, 27 November 2008 23:30 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33209
Registered: July 2009
Senior Member
Adam,

Comments below.

Adam wrote:
> Hi,
>
> I'm looking for a way to be notified when an IFile has been saved and to be
> told about the specific regions of the file that changed.
You can know it's saved via IResourceDelta on the workspace, and if
history is being tracked you could find out the old contents to compare
the two.
> For example, if I
> added a space on line 5 and line 10 and than saved, is there a way for me to
> be notified after the save and to be given the deltas that say what exactly
> was changed?
I don't think so. If you can listen to the document itself, you could
record the changes so that when a save happens you'll remember what's
changed.
> My file is a CDT or JDT file if that makes a difference.
>
> I have looked at using:
> ResourceSetListener - This doesn't provide any specific context about
> what area's of the resource have changed
> DocumentListener - This is notified after every key change, not
> after a save
> IElementChangeListener - This doesn't provide any fine grained delta
> information either (at least the CDT one doesn't)
> IMarkerUpdater - changing one space at the beginning of the
> file seems to change all the markers positions so this doesn't help identify
> explictly which markers' regions were changed.
>
> Please let me know if anyone knows of another way to accomplish this.
> Thanks in advance,
> Adam
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Ant incremental build
Next Topic:How to get all java file from an JavaProject
Goto Forum:
  


Current Time: Sun Sep 08 03:31:37 GMT 2024

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

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

Back to the top