Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Diff computation or change events for AST?
Diff computation or change events for AST? [message #259215] Tue, 24 March 2009 22:05 Go to next message
Stefan is currently offline StefanFriend
Messages: 2
Registered: July 2009
Junior Member
Hi,

I am working on a project which combines a Java source file with a
UML2 diagram in Eclipse 3.4. changes in the Java source file shall be
taken over to the UML2 diagram and likewise changes in the UML2
diagram shall be taken over to the Java source file.

If changes are made in the diagram, I can edit the AST to take over
the changes to the Java source file, but every time the Java source
file changes, Eclipse creates a complete new AST.

Because of that I decided to make a copy of the AST that has pointer
to every elements of the UML2 diagram and also to the original AST.
Every time the Java source file changes and, consequently, I re-parse
and get a new AST, I have to set the pointer from the copy of the
previous AST to the new AST and I have to look for differences between
the ASTs.

My problem is to find out the differences effectively. The only way I
see is to search both trees for differences recursively.

Is there a way I can get change events from the AST, when the Java
source file changes, with explicit informations which element in the
tree has changed and how? I know there are some change events when
using org.eclipse.jdt.core but not every change in the source code
causes a change event, for example changes in method bodies and the
JDT core model doesn't contain all the information we want to obtain
anyway.

If there is no way I can get such change events, does anybody know a
good tool to compare two ASTs and compute the differences?

Thanks in advance,
Stefan
Re: Diff computation or change events for AST? [message #259219 is a reply to message #259215] Wed, 25 March 2009 08:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.domain.invalid

Stefan a écrit :
> Hi,
>
> I am working on a project which combines a Java source file with a UML2
> diagram in Eclipse 3.4. changes in the Java source file shall be taken
> over to the UML2 diagram and likewise changes in the UML2 diagram shall
> be taken over to the Java source file.
>
> If changes are made in the diagram, I can edit the AST to take over the
> changes to the Java source file, but every time the Java source file
> changes, Eclipse creates a complete new AST.
>
> Because of that I decided to make a copy of the AST that has pointer to
> every elements of the UML2 diagram and also to the original AST. Every
> time the Java source file changes and, consequently, I re-parse and get
> a new AST, I have to set the pointer from the copy of the previous AST
> to the new AST and I have to look for differences between the ASTs.
>
> My problem is to find out the differences effectively. The only way I
> see is to search both trees for differences recursively.
>
> Is there a way I can get change events from the AST, when the Java
> source file changes, with explicit informations which element in the
> tree has changed and how? I know there are some change events when
> using org.eclipse.jdt.core but not every change in the source code
> causes a change event, for example changes in method bodies and the JDT
> core model doesn't contain all the information we want to obtain anyway.
>
> If there is no way I can get such change events, does anybody know a
> good tool to compare two ASTs and compute the differences?
>
> Thanks in advance,
> Stefan

Damned, this is hard. Even if you get all the changes, you must then
give a meaning to them. How are you going to do that ?
Re: Diff computation or change events for AST? [message #259234 is a reply to message #259219] Wed, 25 March 2009 23:29 Go to previous message
Stefan is currently offline StefanFriend
Messages: 2
Registered: July 2009
Junior Member
That is my problem.
I donŽt know how I get change events.
And if I can get some I need change events with explicit informations
which element have changed and how it changed.
Previous Topic:How to check if IType is abstract or not
Next Topic:Java build path problem
Goto Forum:
  


Current Time: Wed Jan 15 06:52:05 GMT 2025

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

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

Back to the top