Eclipse 插件试图从已删除的插件项目中加载图标

Eclipse plugin trying to load icon from a deleted plugin project

起初我使用 Eclipse 新建项目向导创建了 Helloworld 插件。我能够成功 运行 it.Then 我删除了那个项目(也选中了“删除磁盘上的内容”)。

之后,我使用 4.x API 插件项目创建了一个 View contribution。 运行安装插件时,显示以下消息

!MESSAGE Removing PartDescriptorImpl with the "viewplugin.views.SampleView" id and the "Sample View" label.It points to the non available "bundleclass://org.eclipse.ui.workbench/org.eclipse.ui.internal.e4.compatibility.CompatibilityView" class. Bundle might have been uninstalled

但是打开了一个新的eclipse window,当我尝试打开视图时,抛出异常,视图的内容没有显示。

!ENTRY org.eclipse.core.runtime 4 0 2021-04-02 16:08:38.367
!MESSAGE Invalid input url:platform:/plugin/Helloworld/icons/Sample.png
!STACK 0
java.io.IOException: Unable to resolve plug-in "Helloworld".
    at org.eclipse.core.internal.runtime.PlatformURLPluginConnection.parse(PlatformURLPluginConnection.java:64)
    at org.eclipse.core.internal.runtime.FindSupport.find(FindSupport.java:293)
    at org.eclipse.core.runtime.FileLocator.find(FileLocator.java:206)

!MESSAGE The image could not be loaded: URLImageDescriptor(platform:/plugin/Helloworld/icons/Sample.png)
!STACK 0
org.eclipse.jface.resource.DeviceResourceException: Unable to create resource URLImageDescriptor(platform:/plugin/Helloworld/icons/Sample.png)
    at org.eclipse.jface.resource.ImageDescriptor.createResource(ImageDescriptor.java:229)
    at org.eclipse.jface.resource.DeviceResourceManager.allocate(DeviceResourceManager.java:55)
    at org.eclipse.jface.resource.AbstractResourceManager.create(AbstractResourceManager.java:88)

(尚未粘贴完整的堆栈跟踪)

堆栈跟踪中提到的位置是已删除的 Helloworld 项目的位置。为什么 eclipse 试图从以前的项目中加载图标?

我试过重新启动工作区,也试过创建一个新的工作区。但是还是报错。

注意 : 我没有对模板插件进行任何更改。此外,hello world 模板项目没有问题

默认情况下,工作区数据下指定的位置是${workspace_loc}/../runtime-EclipseApplication。这不知何故导致以前的项目也被加载。

我按照以下步骤解决了这个问题:

  1. 单击启动配置中“工作区数据”下的 Workspace 选项。
  2. Select 合适的插件项目。
  3. 申请并Run/Debug。