Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Finding out changes to methods?
Finding out changes to methods? [message #517999] Tue, 02 March 2010 17:43 Go to next message
Gary Bryan is currently offline Gary BryanFriend
Messages: 1
Registered: March 2010
Junior Member
Hi,

I'm trying to find which methods of a Java file have been changed when the file is saved or reconciled.

I'm trying to do it using IElementChangedListener and IJavaElementDelta. This gives information on which methods have been added or removed; however when the contents of methods are changed, the delta tree contains no deeper information than the compilation unit that's been changed. I need to be able to get information about which methods inside that compilation unit have changed.

I saw a topic posted a few years ago where the poster seemed to be trying to accomplish the same thing. No replies though.
http://www.eclipse.org/forums/index.php?t=msg&th=72444&a mp;S=2671329d0b1568124794128794d0d04e

Firstly I'm wondering if this is possible; however, if it isn't (which it doesn't appear to be from looking at the API), I'm wondering if there's a way to access the old version of the code (from before the reconcile operation) in order to do a manual comparison? The IJavaElementDelta contains the AST of the new version of the code; accessing the old version as well would be useful.

Thanks in advance,
Gary
Re: Finding out changes to methods? [message #518941 is a reply to message #517999] Fri, 05 March 2010 14:11 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
Gary Bryan wrote:
> Hi,
>
> I'm trying to find which methods of a Java file have been changed when
> the file is saved or reconciled.
>
> I'm trying to do it using IElementChangedListener and
> IJavaElementDelta. This gives information on which methods have been
> added or removed; however when the contents of methods are changed,
> the delta tree contains no deeper information than the compilation
> unit that's been changed. I need to be able to get information about
> which methods inside that compilation unit have changed.
>
> I saw a topic posted a few years ago where the poster seemed to be
> trying to accomplish the same thing. No replies though.
> http://www.eclipse.org/forums/index.php?t=msg&th=72444&a mp;S=2671329d0b1568124794128794d0d04e
>
>
> Firstly I'm wondering if this is possible; however, if it isn't (which
> it doesn't appear to be from looking at the API), I'm wondering if
> there's a way to access the old version of the code (from before the
> reconcile operation) in order to do a manual comparison?
No, you would have to keep your on document copies around in order to
compare. One exception is the first change: there you could compare with
the file on disk.

Dani
> The IJavaElementDelta contains the AST of the new version of the code;
> accessing the old version as well would be useful.
>
> Thanks in advance,
> Gary
Re: Finding out changes to methods? [message #630175 is a reply to message #517999] Thu, 30 September 2010 21:37 Go to previous messageGo to next message
Raffi Khatchadourian is currently offline Raffi KhatchadourianFriend
Messages: 10
Registered: July 2009
Junior Member
Gary Bryan wrote on Tue, 02 March 2010 12:43
Hi,

I'm trying to find which methods of a Java file have been changed when the file is saved or reconciled.

I'm trying to do it using IElementChangedListener and IJavaElementDelta. This gives information on which methods have been added or removed; however when the contents of methods are changed, the delta tree contains no deeper information than the compilation unit that's been changed. I need to be able to get information about which methods inside that compilation unit have changed.

I saw a topic posted a few years ago where the poster seemed to be trying to accomplish the same thing. No replies though.
http://www.eclipse.org/forums/index.php?t=msg&th=72444&a mp;a mp;S=2671329d0b1568124794128794d0d04e

Firstly I'm wondering if this is possible; however, if it isn't (which it doesn't appear to be from looking at the API), I'm wondering if there's a way to access the old version of the code (from before the reconcile operation) in order to do a manual comparison? The IJavaElementDelta contains the AST of the new version of the code; accessing the old version as well would be useful.

Thanks in advance,
Gary


I'm also in the same boat here. How do you go about doing the AST comparison to find the differences? Thanks!
Re: Finding out changes to methods? [message #639573 is a reply to message #518941] Tue, 16 November 2010 23:15 Go to previous message
Raffi Khatchadourian is currently offline Raffi KhatchadourianFriend
Messages: 10
Registered: July 2009
Junior Member
Dani Megert wrote on Fri, 05 March 2010 09:11
Gary Bryan wrote:
> Firstly I'm wondering if this is possible; however, if it isn't (which
> it doesn't appear to be from looking at the API), I'm wondering if
> there's a way to access the old version of the code (from before the
> reconcile operation) in order to do a manual comparison?
No, you would have to keep your on document copies around in order to
compare. One exception is the first change: there you could compare with
the file on disk.


I am wondering exactly how to go about getting the AST prior to the first reconcile operation. Do I need to implement some sort of listener?
Previous Topic:[Help] About ASTNode
Next Topic:Starting with MySQL Connector J - JDBC driver
Goto Forum:
  


Current Time: Sat Sep 21 06:44:32 GMT 2024

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

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

Back to the top