eclipse eclipse插件编程中“Workbench尚未创建”错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13773582/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
"Workbench has not been created yet" error in eclipse plugin programming
提问by prosseek
With my eclipse plugin launching, I got Root exception:java.lang.IllegalStateException: Workbench has not been created yet.
error.
启动 eclipse 插件后,出现Root exception:java.lang.IllegalStateException: Workbench has not been created yet.
错误。
And it seems to cause side effect to make some bundle exception error. I don't think my code uses egit module.
并且它似乎会导致产生一些捆绑异常错误的副作用。我不认为我的代码使用 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)
How can I remove this error? This is the code that accesses the workspace. I found this article - Debugging a failed Eclipse launchsaying that it's race condition, but I'm not sure why I have race condition, and if so, how to remove it.
我怎样才能消除这个错误?这是访问工作区的代码。我发现这篇文章 - 调试失败的 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());
回答by Shivam
I struggled a lot for “Workbench has not been created yet” the complete day.
我一整天都在为“工作台尚未创建”而苦苦挣扎。
But I got the solution by the following steps.-
但我通过以下步骤得到了解决方案。-
- Go to the Run configuration-> Remove all the target platform jars.
- Click on add required bundles.
- Check the
org.apache.felix.gogo.runtime
,org.apache.felix.gogo.shell
,org.eclipse.equinox.console
,org.eclipse.osgi
and your jar file. - The last and important step. Go to Setting-> checkthe checkbox of "Clear the configuration area before launching".
- Run the OSGi application now.
- Enjoy if it works for you as it worked for me.
- 转到运行配置-> 删除所有目标平台 jar。
- 单击添加所需的捆绑包。
- 检查
org.apache.felix.gogo.runtime
,org.apache.felix.gogo.shell
,org.eclipse.equinox.console
,org.eclipse.osgi
和你的jar文件。 - 最后一步也是重要的一步。进入设置->检查“的复选框启动之前清除配置区域”。
- 现在运行 OSGi 应用程序。
- 如果它对你有用,就像对我有用一样,那就享受吧。
Thanks
谢谢