例如: 我创建Hello,World Command项目( File> New> Others ...> Plug-in Development> Plug-in Project> Hello,World template )并将其作为Eclipse应用程序运行:{{3 }}
接下来,我将命令中的名称值(第12行在 plugin.xml 中)更改为" HelpMe"并作为Eclipse应用程序再次运行它,但结果我得到了完全相同的应用程序。
之后我将(第14行)ID从example.commands.sampleCommand
更改为example.commands.foo
(显然在其他地方更改了它,使用它)并运行它:
现在它奏效了!
plugin.xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.ui.commands">
<category
name="Sample Category"
id="example.commands.category">
</category>
<command
name="Sample Command"
categoryId="example.commands.category"
id="example.commands.sampleCommand">
</command>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
commandId="example.commands.sampleCommand"
class="example.handlers.SampleHandler">
</handler>
</extension>
<extension
point="org.eclipse.ui.bindings">
<key
commandId="example.commands.sampleCommand"
contextId="org.eclipse.ui.contexts.window"
sequence="M1+6"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
</key>
</extension>
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="menu:org.eclipse.ui.main.menu?after=additions">
<menu
label="Sample Menu"
mnemonic="M"
id="example.menus.sampleMenu">
<command
commandId="example.commands.sampleCommand"
mnemonic="S"
id="example.menus.sampleCommand">
</command>
</menu>
</menuContribution>
<menuContribution
locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
<toolbar
id="example.toolbars.sampleToolbar">
<command
commandId="example.commands.sampleCommand"
icon="icons/sample.gif"
tooltip="Say hello world"
id="example.toolbars.sampleCommand">
</command>
</toolbar>
</menuContribution>
</extension>
</plugin>
那么,为什么它有帮助,如果id的价值不应该是&#39;问题?
另外,请注意,这只是一个示例,但我遇到了非常类似的问题,例如:eclipse正在启动旧的插件,而不是&#39;即使在工作区也是如此;或推出以前版本的项目。 这是一个错误或配置问题?
我正在使用Eclipse Mars.1版本(4.5.1)