[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.jdt] How to get context information

I am trying to get the class of an identifier directly before the invocation offset of the completion. For example,

File newFile = new File("fileName");
String stuff = newFile.|    //the '|' is the invocation offset

OR

File newFile = new File("fileName");
newFile.|    //the '|' is the invocation offset

In this case, I want to know about the token "newFile". I would like to know it's qualified type, at the very least. I have looked in the CompletionContext class, the JavaContentAssistInvocationContext class, and in the AST API, but I cannot find a way to get that information. The AST's handling of incomplete statements is such that it merges them with the following statement, resulting in this code:

File newFile = new File("fileName");
String stuff = newFile.
otherVariable = someValue;


becoming

String stuff = newFile.otherVariable = someValue;

in the AST.

If someone could please help me out on finding the value of newFile within the AST or within JDT's context API, that'd be wonderful.

Thanks,

Mathew Mooty
Computer Science
Carnegie Mellon University