为什么这个 Eclipse RCP 插件缺少一个视图?
Why is this Eclipse RCP plugin missing a view?
我正在试验 Eclipse RCP 应用程序处理其插件的方式。在 Eclipse IDE 中,我创建了一个 Eclipse RCP 3.x 项目,其视图生成了所有必要的文件并且工作正常。
假设我可以通过删除 plugin.xml 文件的相应部分将这个应用程序转换成一个只有空视角的应用程序,我注释掉了所有处理视图的行,如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
id="application"
point="org.eclipse.core.runtime.applications">
<application>
<run
class="pluginwithview.Application">
</run>
</application>
</extension>
<extension
point="org.eclipse.ui.perspectives">
<perspective
name="Perspective"
class="pluginwithview.Perspective"
id="PluginWithView.perspective">
</perspective>
</extension>
<!--
even without these lines
there's an Exception thrown saying:
"Could not create the view: PluginWithView.view
-->
<!-- <extension
point="org.eclipse.ui.views">
<view
name="View"
inject="true"
class="pluginwithview.View"
id="PluginWithView.view">
</view>
</extension>
<extension
point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension
targetID="*">
<view
standalone="true"
minimized="false"
relative="org.eclipse.ui.editorss"
relationship="left"
id="PluginWithView.view">
</view>
</perspectiveExtension>
</extension> -->
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="menu:org.eclipse.ui.main.menu">
<menu
label="File">
<command
commandId="org.eclipse.ui.file.exit"
label="Exit">
</command>
</menu>
</menuContribution>
</extension>
</plugin>
但是应用现在看起来像这样:
我必须怎么做才能让应用程序不搜索视图?是否有我缺少的配置文件? (我知道没有视图有几个原因,但现在我主要对 Eclipse RCP 应用程序的内部工作感兴趣)
透视会记住它们包含的视图。如果更改透视定义,则必须重置透视 ('Window > Perspective > Reset Perspective') 才能读取更新后的定义。
为了进行测试,您还可以在 RCP 'Program Arguments' 部分中指定 -clean
和 -clearPersistedState
选项 运行 配置以丢弃所有保存的信息。
我正在试验 Eclipse RCP 应用程序处理其插件的方式。在 Eclipse IDE 中,我创建了一个 Eclipse RCP 3.x 项目,其视图生成了所有必要的文件并且工作正常。
假设我可以通过删除 plugin.xml 文件的相应部分将这个应用程序转换成一个只有空视角的应用程序,我注释掉了所有处理视图的行,如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
id="application"
point="org.eclipse.core.runtime.applications">
<application>
<run
class="pluginwithview.Application">
</run>
</application>
</extension>
<extension
point="org.eclipse.ui.perspectives">
<perspective
name="Perspective"
class="pluginwithview.Perspective"
id="PluginWithView.perspective">
</perspective>
</extension>
<!--
even without these lines
there's an Exception thrown saying:
"Could not create the view: PluginWithView.view
-->
<!-- <extension
point="org.eclipse.ui.views">
<view
name="View"
inject="true"
class="pluginwithview.View"
id="PluginWithView.view">
</view>
</extension>
<extension
point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension
targetID="*">
<view
standalone="true"
minimized="false"
relative="org.eclipse.ui.editorss"
relationship="left"
id="PluginWithView.view">
</view>
</perspectiveExtension>
</extension> -->
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="menu:org.eclipse.ui.main.menu">
<menu
label="File">
<command
commandId="org.eclipse.ui.file.exit"
label="Exit">
</command>
</menu>
</menuContribution>
</extension>
</plugin>
但是应用现在看起来像这样:
我必须怎么做才能让应用程序不搜索视图?是否有我缺少的配置文件? (我知道没有视图有几个原因,但现在我主要对 Eclipse RCP 应用程序的内部工作感兴趣)
透视会记住它们包含的视图。如果更改透视定义,则必须重置透视 ('Window > Perspective > Reset Perspective') 才能读取更新后的定义。
为了进行测试,您还可以在 RCP 'Program Arguments' 部分中指定 -clean
和 -clearPersistedState
选项 运行 配置以丢弃所有保存的信息。