Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Parse java source code out of workspace
Parse java source code out of workspace [message #187760] Tue, 30 November 2004 08:57 Go to next message
Eclipse UserFriend
Originally posted by: outiejun.hotmail.com

Hello everyone:

I have a question about parsing a java source code out of workspace.
The existing method in JDT provided is base on the Java Project in the
workspace, and my problem is that I want to read a single java source
without compilation, and parse it in order to get the information(such as
method, class name, and package name, etc.) from that .java file.
Is there any way to reach this in JDT or any other solution.

Any help would be appreciated.
Re: Parse java source code out of workspace [message #187802 is a reply to message #187760] Tue, 30 November 2004 15:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

Look up ASTParser class.

--
Thanks,
Rich Kulp
Re: Parse java source code out of workspace [message #187969 is a reply to message #187802] Wed, 01 December 2004 03:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: outiejun.hotmail.com

Thanks.
Could you give me some examples to do this?
I can't quite understand this method.

"Rich Kulp" <richkulp@us.NO_SPAM.ibm.com>
news:coi26t$is4$1@www.eclipse.org...
> Look up ASTParser class.
>
> --
> Thanks,
> Rich Kulp
Re: Parse java source code out of workspace [message #188012 is a reply to message #187969] Wed, 01 December 2004 15:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

The header comment for ASTParser has the example. The resulting
CompilationUnit is a logical tree structure of the parsed java class.
Using accessors on the CompilationUnit will give you the info you need.


--
Thanks,
Rich Kulp
Re: Parse java source code out of workspace [message #188019 is a reply to message #188012] Wed, 01 December 2004 15:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

A little clarification about the CompilationUnit. Everytime I go to it I
think it should list the methods and such. But then I realize, again
:-), that the compilation unit is the entire java file, not the class.
So what you get directly from the CU is the imports, package, and list
of types. It is within each type that you see methods, fields, etc. A CU
can contain more than one type, but in general that is not a good idea.
It makes maintanance harder.

Rich Kulp wrote:
> The header comment for ASTParser has the example. The resulting
> CompilationUnit is a logical tree structure of the parsed java class.
> Using accessors on the CompilationUnit will give you the info you need.
>
>

--
Thanks,
Rich Kulp
Re: Parse java source code out of workspace [message #188326 is a reply to message #188012] Fri, 03 December 2004 02:05 Go to previous message
Eclipse UserFriend
Originally posted by: outiejun.hotmail.com

Thank you very much!!!! Now it is working... :)

"Rich Kulp" <richkulp@us.NO_SPAM.ibm.com>
news:cokngq$1a7$3@www.eclipse.org...
> The header comment for ASTParser has the example. The resulting
> CompilationUnit is a logical tree structure of the parsed java class.
> Using accessors on the CompilationUnit will give you the info you need.
>
>
> --
> Thanks,
> Rich Kulp
Previous Topic:Hot code changes while in debug mode
Next Topic:Retrieving Source from Editor
Goto Forum:
  


Current Time: Mon Sep 16 23:28:53 GMT 2024

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

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

Back to the top