Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » ElementChangedEvents on compilation unit primary copy
ElementChangedEvents on compilation unit primary copy [message #720813] Wed, 31 August 2011 09:34 Go to next message
Xavier Coulon is currently offline Xavier CoulonFriend
Messages: 58
Registered: July 2009
Member
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]

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 Go to previous message
Jay Arthanareeswaran is currently offline Jay ArthanareeswaranFriend
Messages: 134
Registered: July 2009
Senior Member
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.
Previous Topic:Running Eclipse IDE on cortex platform (ARM processor)
Next Topic:Can't get "Fold empty packages" to work
Goto Forum:
  


Current Time: Thu Sep 19 10:11:21 GMT 2024

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

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

Back to the top