Results 1 to 1 of 1
- 10-08-2008, 07:15 PM #1Member
- Join Date
- Oct 2008
- Rep Power
Need help with AST usage on Eclipse! Thanks!
As of now, my colleagues and I working on our project for refactoring opportunity detection have been able to parse java code to be used with AST only in the icompilationunit level. We would like to know how we would be able to parse code from the ijavaproject level. Any sample codes would be helpful. We have tried looking around for answers/codes and the code given in the AST tutorial of eclipse.
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IProject project = root.getProject("someJavaProject"); project.open(null /* IProgressMonitor */); IJavaProject javaProject = JavaCore.create(project); IType lwType = javaProject.findType("net.sourceforge.earticleast.app.Activator"); ICompilationUnit lwCompilationUnit = lwType.getCompilationUnit();
after looking for answers on the net, we have found the following but do not know of how to implement them (the replies are not really easy to understand/follow):
-This means you are not running under Eclipse but instead under just a standard java application.
-I had org.eclipse.core.resources in the build path rather than having it as a dependent plugin in the plugin manifest.mf file. So the ResourcePlugin was not being instantiated by eclipse although the I could still make calls to the ResourcePlugin class with the code.
Does this mean that we can only code the project as a plugin in order for parsing at an ijavaproject level to work?
Any clear or step by step explanations to solve some problems/misunderstandings would be gladly appreciated. Thank you very much in advance!
- By JavaEmpires in forum New To JavaReplies: 5Last Post: 03-16-2011, 04:49 AM
- By lardum in forum New To JavaReplies: 7Last Post: 06-26-2008, 03:30 AM
- By sandeeprao.techno in forum New To JavaReplies: 5Last Post: 01-24-2008, 07:16 PM
- By bluegreen7hi in forum New To JavaReplies: 11Last Post: 01-24-2008, 08:54 AM
- By hobbyist in forum New To JavaReplies: 0Last Post: 11-16-2007, 04:59 PM