ElementChangedEvents on compilation unit primary copy [message #720813] |
Wed, 31 August 2011 09:34  |
Eclipse User |
|
|
|
Hello,
I'd like to have detailed notifications when a compilation unit is changed. When the Java Editor is opened, my ElementChangedListener is called with delta that give me (almost) enough information on the changes that occurred on the *working copy*.
But there are some cases when it does not work as I'd like :-/
For example, if a user removes a method from the package explorer view while the compilation unit is *not* opened in the Java Editor, I receive the kind of event below:
org.eclipse.jdt.core.ElementChangedEvent[source=Java Model[*]: {CHILDREN}
sample[*]: {CHILDREN}
src[*]: {CHILDREN}
org.sample[*]: {CHILDREN}
Test.java[*]: {CONTENT | PRIMARY RESOURCE}]
The level of detail is not fine enough to know that a method was removed (in my case), and in case of refactoring by a third party plugin, I cannot assume that the code changes will occur within a working copy..
Is there a way to retrieve the compilation unit before it was changed ?
Thank you in advance.
Best regards
/Xavier
[Updated on: Wed, 31 August 2011 09:35] by Moderator Report message to a moderator
|
|
|
Re: ElementChangedEvents on compilation unit primary copy [message #722568 is a reply to message #720813] |
Tue, 06 September 2011 08:21  |
Eclipse User |
|
|
|
Unfortunately when the element is deleted when not open in in an editor, the events are consumed by the BecomeWorkingCopyOperation followed by DiscardWorkingCopyOperation. By the time DeltaProcessor comes in to picture, we no longer have the details.
And looking at the code, looks like the refactoring works with text changes and not really element changes. I will try to spend some more time on it and will let you know if there is a way out.
|
|
|
Powered by
FUDForum. Page generated in 0.34159 seconds