Reputation: 351
Changes to a java file can be known by method org.eclipse.jdt.core.JavaCore.addElementChangedListener(IElementChangedListener)
.
There's this scenario:
public class X {
}
a
public class X {
int a ;
}
Receives an event POST_RECONCILE
saying that a new element a
has been added.
Add a new field b
public class X {
int a ;
int b ;
}
Receives an event POST_RECONCILE
saying that a new element b
has been added.
Remove the field b
public class X {
int a ;
}
Receives an event POST_RECONCILE
saying that a new element b
has been removed.
Save this file.
Receives an event POST_CHANGE
saying that the element X
has been changed.
My intention is to know what has changed in that file between two save
operations, as in the above scenario where element a
is added, not necessary to know that element b
.
However, this doesn't seem to be possible if I'm only listening to the POST_CHANGE
event, and if I'm also listening to the POST_RECONCILE
event, it seems to require a lot of checking and judging on my part.
Is there a simpler way to do this?
Upvotes: 0
Views: 26