Hello everyone!

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.

Java Code:
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();
only gives us the error message "workspace is closed".

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!