- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
尝试通过 ResourcesPlugin 获取工作区时出现此错误:
java.lang.IllegalStateException: Workspace is closed.
at org.eclipse.core.resources.ResourcesPlugin.getWorkspace(ResourcesPlugin.java:339)
生成此代码的代码是:
IWorkspace ws = ResourcesPlugin.getWorkspace();
您能帮忙解决这个问题吗?
最佳答案
您的 Manifest.MF
中的 Require-bundle
部分是否包含 org.eclipse.core.resources
?
您是否将测试作为插件启动? (不是作为“Java 应用程序”)
另请参阅this thread .
如“Resources and the file system”帮助页面中所述,
<小时/>You can access the workspace from the resources plug-in class (defined in
org.eclipse.core.resources
).When the resources plug-in is not running, the workspace exists solely in the file system and is viewed or manipulated by the user via standard file-based tools. Let's look at what a workspace looks like on disk as we explain the resources plug-in API.
来自this book :
The workspace directory, regardless of the name defined with the
-data
invocation option, has two roles:
- it acts as the parent for the
.metadata
directory- and as the default location for projects
the workspace can contains projects only when:
- the
org.eclipse.core.resources
plugin is included in the configuration and- and appropriately started from the workbench
this is automatic from an IDE configuration based on the
org.eclipse.ui.ide.workbench
application.
另请参阅this thread并记住:
the workspace is a different workspace from the runtime-workspace that's used for testing plugins. When you do Run on an Eclipse PDE environment, it creates a new workspace which is completely empty.
测试workspace root can be specified through the "-data"启动选项。
If you want to access a file, your best bet is to include it in the plugin itself, and then use
getClass().getResourceAsStream("/myfile.txt")
to get anInputStream
that you can read the contents for.
关于eclipse - 尝试通过ResourcesPlugin获取工作区时出现"Workspace is closed"异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/962364/
为什么 Eclipse 在构建 Android 项目时会陷入无限循环,用于构建工作区...和(重新)构建工作区...和(重新)构建工作区... 这是一个已知的错误吗? 摆脱这个循环的正确方法是什么?
当我排队构建时,我遇到了这个问题。构建因错误而死亡 The path C:\[Path]\Sources is already mapped in workspace [Server Name]. s
本文整理了Java中org.brixcms.workspace.Workspace.getId()方法的一些代码示例,展示了Workspace.getId()的具体用法。这些代码示例主要来源于Gith
本文整理了Java中org.brixcms.workspace.Workspace.setAttribute()方法的一些代码示例,展示了Workspace.setAttribute()的具体用法。这
本文整理了Java中org.brixcms.workspace.Workspace.getAttribute()方法的一些代码示例,展示了Workspace.getAttribute()的具体用法。这
我有一个工作区 A,其中在计算机 A 上 checkout 了文件。现在我想继续在计算机 B 上进行开发。我从计算机 A 复制文件,并创建一个新的工作区 B 并映射到复制的文件。 现在 Visual
我正在用 gatsby 创建一个新项目gatsby new YourProjectName2 https://github.com/Vagr9K/gatsby-advanced-starter并得到一
我想切换构建节点并将整个工作区转移到新节点。 node('node1') { ... stash 'my_workspace' } node('node2') { ...
本文整理了Java中org.protege.editor.core.ui.workspace.Workspace.getEditorKit()方法的一些代码示例,展示了Workspace.getEdi
本文整理了Java中org.protege.editor.core.ui.workspace.Workspace.getViewManager()方法的一些代码示例,展示了Workspace.getV
本文整理了Java中org.protege.editor.core.ui.workspace.Workspace.getStatusArea()方法的一些代码示例,展示了Workspace.getSt
本文整理了Java中org.protege.editor.core.ui.workspace.Workspace.save()方法的一些代码示例,展示了Workspace.save()的具体用法。这些
本文整理了Java中org.protege.editor.core.ui.workspace.Workspace.installLookAndFeelMenu()方法的一些代码示例,展示了Worksp
本文整理了Java中org.protege.editor.core.ui.workspace.Workspace.setLayout()方法的一些代码示例,展示了Workspace.setLayout
本文整理了Java中org.protege.editor.core.ui.workspace.Workspace.changeFontSize()方法的一些代码示例,展示了Workspace.chan
本文整理了Java中org.protege.editor.core.ui.workspace.Workspace.getTitle()方法的一些代码示例,展示了Workspace.getTitle()
本文整理了Java中org.protege.editor.core.ui.workspace.Workspace.initialiseExtraMenuItems()方法的一些代码示例,展示了Work
本文整理了Java中org.protege.editor.core.ui.workspace.Workspace.add()方法的一些代码示例,展示了Workspace.add()的具体用法。这些代码
本文整理了Java中org.protege.editor.core.ui.workspace.Workspace.showResultsView()方法的一些代码示例,展示了Workspace.sho
本文整理了Java中org.protege.editor.core.ui.workspace.Workspace.adjustBorder()方法的一些代码示例,展示了Workspace.adjust
我是一名优秀的程序员,十分优秀!