I get this error when trying to get the workspace through ResourcesPlugin:
java.lang.IllegalStateException: Workspace is closed.
at org.eclipse.core.resources.ResourcesPlugin.getWorkspace(ResourcesPlugin.java:339)
The code generating this is:
IWorkspace ws = ResourcesPlugin.getWorkspace();
Can you please help with this problem?
Try calling
Plugin.getStateLocation()
in the plugin, it should cause the workspace to be created for you. Without this, you can't save any preferences either. http://dev.eclipse.org/newslists/news.eclipse.platform/msg45020.htmlhttp://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/core/runtime/Plugin.html#getStateLocation%28%29
Err, sorry -- I just completed necroed this question by accident :)
Does your
Manifest.MF
contain theorg.eclipse.core.resources
in theRequire-bundle
section ?And do you launch your test as a plugin ? (not as a 'Java Application')
See also this thread.
As mentioned in the "Resources and the file system" help page,
From this book:
See also this thread and remember that:
The testing workspace root can be specified through the "-data" launching option.