I have a project in eclipse workspace.
When I open this project as IJavaProject using the following code, I have the project "not open".
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IProject orig = root.getProject(this.projectName);
orig.open(null /* IProgressMonitor */);
orig.refreshLocal(IResource.DEPTH_ZERO, null);
this.javaProject = JavaCore.create(orig);
I opened the IProject with open()
method, and refreshed manually using refreshLocal
following avoiding "resource is out of sync with the filesystem"
I have other resources not opened.
I tried "F5" to refresh the project, but it doesn't work.
What might be wrong? How can I open the resources?
ADDED
I tried to open the resource with new NullProgressMonitor(), but it didn't work.
orig.open(new NullProgressMonitor());
orig.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
ADDED2
With this code that uses javaModel, I got the information that all of the projects in my workspace is closed. Does this mean my workspace is broken? When I opened the workspace using eclipse IDE, I could open and compile the Java code.
IJavaModel javaModel = JavaCore.create(root);
this.javaProject = javaModel.getJavaProject(this.projectName);