Unable to incorporate Eclispe JDT codeAssist facilities outside a Plug-in
Posted
by shi kui
on Stack Overflow
See other posts from Stack Overflow
or by shi kui
Published on 2010-04-26T05:49:54Z
Indexed on
2010/04/26
5:53 UTC
Read the original article
Hit count: 344
Using Eclipse jdt facilities, you can traverse the AST of java code snippets as follows:
ASTParser ASTparser = ASTParser.newParser(AST.JLS3);
ASTparser.setSource("package x;class X{}".toCharArray());
ASTparser.createAST(null).accept(...);
But when trying to perform code complete & code selection it seems that I have to do it in a plug-in application since I have to write codes like
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(somePath));
ICodeAssist i = JavaCore.createCompilationUnitFrom(f);
i.codeComplete/codeSelect(...)
Is there anyway that I can finally get a stand-alone java application which incorporates the jdt code complete/select facilities?
thx a lot! shi kui
© Stack Overflow or respective owner