|Use JDT Api in Java Project (not plug-in project) [message #836852]
||Thu, 05 April 2012 01:04
| Benjamin Mechling
Registered: April 2012
My is to be able to |
* take source code,
* add instructions to instrument the code for testing purposes, and
* compile and use the instrumented code at runtime.
From what I have been reading in the JDT Programmers Guide, it appears that JDT can do much of job. The problem I am running into at this point is how to create a usable instance of ICompilationUnit. Documentation includes example lines such as the following:
ICompilationUnit unit = ..; // get some compilation unit
From what I understand of the JavaModel structure, an ICompilationUnit is an element of the workspace hierarchy, but attempts to access that hierarchy such as the following seems fail.
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
The answer I have found on the internet so far is that the project must be a plug-in project. Currently the project is not designed as a plug-in but as a standard Java Project.
So finally the question:
Is is possible to get, and/or create, an ICompilationUnit object, or other object useful for purpose, in a standard Java Project?
My level of expertise:
* General OO Programming: Solid understanding of basics
* Java Programming: Fairly inexperienced. More familiar with C#. Some experience with other other c-ish languages as well.
* Eclipse program structure, api, and plugins: Little to none.
Powered by FUDForum
. Page generated in 0.02820 seconds