Skip to main content



      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 05:34 Go to next message
Eclipse UserFriend
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 05:35] by Moderator

Re: ElementChangedEvents on compilation unit primary copy [message #722568 is a reply to message #720813] Tue, 06 September 2011 04:21 Go to previous message
Eclipse UserFriend
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: Wed Jul 16 01:22:31 EDT 2025

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

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

Back to the top