随着我的 eclipse 插件启动,我得到了Root exception:java.lang.IllegalStateException: Workbench has not been created yet.
错误。
并且它似乎会导致一些捆绑异常错误的副作用。我不认为我的代码使用 egit 模块。
org.osgi.framework.BundleException: Exception in org.eclipse.egit.ui.Activator.start() of bundle org.eclipse.egit.ui.
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:734)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:300)
如何消除此错误?这是访问工作区的代码。我发现这篇文章 - 调试失败的 Eclipse 启动说它是竞争条件,但我不确定为什么我有竞争条件,如果是,如何删除它。
public void renameClassRefactor() throws CoreException {
// get the project information with ResourcesPlugin
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
// 1. The name of the project in the workspace
System.out.println(ResourcesPlugin.getWorkspace().toString());
java.io.File workspaceDirectory = root.getLocation().toFile();
System.out.println(workspaceDirectory.toString());