Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [jdt-core-dev] Independent JDT plugin

Hi, Mathew.  Welcome!  It's always great to have people interested in working with the JDT.
 
You'll probably get better responses to your question if you post to the eclipse.tools.jdt newsgroup on eclipse.org, rather than sending mail to the jdt-core-dev alias.  The mailing lists (like jdt-core-dev) are used mainly for announcements, and occasionally for discussion by the developers actually working on Eclipse.  The newsgroups reach a much wider, and more receptive and responsive, audience.
 
I'm afraid I don't know the answer to your specific questions, except for the last one.  The Java Model (e.g., interfaces like org.eclipse.jdt.core.IMethod) describes the Java typesystem, that is, the "external" appearance of types - essentially the view that one type has of another one, that is, the information about a type that you need in order to *refer* to it.  To get access to the internals of a class, such as local variables, javadoc comments, imports, and so forth, you need to parse the source code, and get an abstract syntax tree (AST).  The AST is a representation of the source code, rather than of a type.  It gives you interfaces like org.eclipse.jdt.core.dom.VariableDeclaration.
 
The AST and the Java Model interoperate to some extent, but they are conceptually rather different, so it's good to think carefully about what you want.  As an example of the difference, you can't in general get an AST for something that exists only in a .class or .jar file.  ASTs are also a lot more computationally expensive.  But, if you want to modify source code (for instance, to write a refactoring operation), the AST is definitely the right way to do it.
 
Hope that helps!


From: jdt-core-dev-bounces@xxxxxxxxxxx [mailto:jdt-core-dev-bounces@xxxxxxxxxxx] On Behalf Of mathew mooty
Sent: Monday, June 29, 2009 2:01 PM
To: jdt-core-dev@xxxxxxxxxxx
Subject: [jdt-core-dev] Independent JDT plugin

Hello,

This is my first post to this discussion forum, so please tell me if my etiquette is off in some way. I've been researching the JDT plugin for the past month, specifically related to the content-assist function. I discovered how most of it works through debugging, searching through source code, and the like. However, I do have a couple questions which I believe at least several people on this forum can probably very easily answer, and save me further headache. 

I've noticed that the vanilla CompletionProposal comes with an additionalInfo field, which is used. However, when constructing a JavaCompletionProposal, there is no parameter to enter the additionalinfo information into. Should I create a CompletionProposal, then cast it as a JavaCompletionProposal?  Or, should I use the CompletionProposal within every JavaCompletionProposal, assuming then that it is accessed at some point in the completion process? Any advice on where this is usually used would be amazing.

Also, what is the commentary tag format of the additionalInfo? I've gotten <b> and </b> to work, but others that I've tried don't. If there is a website with info on this, that'd be great.

Finally, while I found the parsed representation of packages, fields, methods, and imports, I could not find a way to access the representation of a local variable within a method. There seems to be no method within the Method class which returns it's local variables. Could you point me in the right direction for finding the representation of the local variables of a class?

Thank you for your attention,

 Mathew Mooty
 Computer Science
 Carnegie Mellon University

Back to the top