Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » How to do a similar function like OpenDeclaration with JDT?(not JavaModel)
How to do a similar function like OpenDeclaration with JDT? [message #1778039] Fri, 08 December 2017 13:10 Go to next message
Federer Roger  is currently offline Federer Roger Friend
Messages: 18
Registered: December 2017
Junior Member
I use creatASTs to generate AST for a batch of java files. I think I can do a similar function if I can get the whole binding information for these CompilationUnits. I see source code and find that JDT use JavaModel to implement the search engine. I am not sure is it possible to do that without using JavaModel. Can anyone give me some tips?
Re: How to do a similar function like OpenDeclaration with JDT? [message #1778207 is a reply to message #1778039] Tue, 12 December 2017 00:49 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1608
Registered: July 2009
Senior Member
Implementing a Java search engine without the JavaModel would certainly be a huge effort. I cannot recommend any one trying to do so.
If you need search functionality, you first need to define a search scope. In JDT this is defined via IJavaProject and similar.
So if you want to reuse code, try to reuse it all. Present your source code as IJavaProjects and then feel free to use any of JDT's API that suits your needs.
In particular, when implementing IDE-like functions as "OpenDeclaration" doing so in an IDE environment is the way to go :)
Finally note that JavaModel is not just about a specific representation, it is also about being light-weight, about well-balanced caching, change propagation and more.
Re: How to do a similar function like OpenDeclaration with JDT? [message #1778213 is a reply to message #1778207] Tue, 12 December 2017 02:26 Go to previous messageGo to next message
Federer Roger  is currently offline Federer Roger Friend
Messages: 18
Registered: December 2017
Junior Member
So the workload is equivalent to implement an IDE? If it is true, I have alternative method. Import target java files into database and parse them using JDT. Because I have all CompilationUnits with unit name,line number and corresponding binding information and I can search the target ASTNode's binding to get the declaration ASTNode position from database. I am not sure is that OK? I hope you can give me some tips about this solution. Thanks.
Re: How to do a similar function like OpenDeclaration with JDT? [message #1778250 is a reply to message #1778207] Tue, 12 December 2017 10:21 Go to previous message
Federer Roger  is currently offline Federer Roger Friend
Messages: 18
Registered: December 2017
Junior Member
Is it possible to serialize all ASTs and binding information into a file? I can't find real position of bindingmap and ASTs. If I can serialize these two parts, I think I can implements this function. (not real-time)
Previous Topic:Why is this code error ?
Next Topic:Why jdt has no PDOM structure like cdt?
Goto Forum:
  


Current Time: Thu Jul 19 09:48:27 GMT 2018

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

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

Back to the top