Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jdt-dev] JDT delta on rename?

Hello, all!

	The question is this. We register ourselves with
JavaCore.addElementChangedListener and listen to the JDT delta. A member
(say, a field or a method) rename in a text editor for some class
results in the following delta (only relevant delta leaves are given):

newName - ADDED
oldName - REMOVED

	The same delta comes in when the "Rename" refactoring is
performed. Now, if we rename two members quickly enough, we get the
following delta:
newName1 - ADDED
newName2 - ADDED
oldName1 - REMOVED
oldName2 - REMOVED
(the delta has been dumped to find that out).

	Obviously, the order of the delta elements does not enable one
to obtain the old and new names of the elements. It is crucial for us,
though, to know the source and target elements for each of the renames.
In each case, we cannot tell whether it was a rename (we do not consider
participation in refactoring now, only JDT delta processing) or a
remove-add (or an add-remove) couple of separate actions.
	Is there any sure-fire way to tell which of the events has taken
place? If no, it would be great if the added and removed delta elements
were accompanied by the F_MOVED_FROM and F_MOVED_TO flags and
corresponding getMovedFromElement() and getMovedToElement() (the
original, presently absent element, and the newly created element,
respectively).
	Thanks for your help!

Best Regards, 
    Alexander Pavlov
 


Back to the top