如何从插件中引用图标? [英] How can I reference an icon from a plugin?
问题描述
该插件称为 com.example.plugin.workspace
,图标的路径为 icons / workspace.png
。
我会喜欢在我的应用程序的plugin.xml中引用它,在那里我想将命令添加到工具栏中:
< toolbarid =com.example.application.displays.toolbar>
< command
commandId =com.example.application.system.command.OpenWorkspace
icon =PATH TO ICON IN PLUGIN
label =Open Workspace
style =push>
< / command>
< / toolbar>
< / menuContribution>
我可以引用插件的图标,如果是,怎么样?
可以在XML中引用包含插件的图标,前缀为:
平台:/plugin/Bundle-SymbolicName/path/filename.extension
请参阅 http://www.vogella.com/tutorials/EclipseRCP/article.html#runtime_uri
所以,在问题的例子中,这将是:
code>平台:/plugin/com.example.plugin.workspace/icons/workspace.png
对于工具栏贡献:
< menuContribution
allPopups =false
locationURI =工具栏:org.eclipse.ui.main.toolbar后=添加>?
< toolbar
id =com.example.application.displays.toolbar>
< command
commandId =com.example.application.system.command.OpenWorkspace
icon =platform:/plugin/com.example.plugin.workspace/icons/workspace。 png
label =打开工作区
style =push>
< / command>
< / toolbar>
< / menuContribution>
I have an Eclipse RCP application with some plugins and some commands. For one of the commands I want to use an icon from one of the included plugins.
The plugin is called com.example.plugin.workspace
and the path to the icon is icons/workspace.png
.
I would like to reference it in my application's plugin.xml, where I want to add the command to a toolbar:
<menuContribution
allPopups="false"
locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
<toolbar
id="com.example.application.displays.toolbar">
<command
commandId="com.example.application.system.command.OpenWorkspace"
icon="PATH TO ICON IN PLUGIN"
label="Open Workspace"
style="push">
</command>
</toolbar>
</menuContribution>
Can I reference the icon of the plugin there, and if yes, how?
An icon from an included plugin can be referenced in the XML with the prefix:
platform:/plugin/Bundle-SymbolicName/path/filename.extension
See http://www.vogella.com/tutorials/EclipseRCP/article.html#runtime_uri
So, in the example of the question, that would be:
platform:/plugin/com.example.plugin.workspace/icons/workspace.png
For the toolbar contribution:
<menuContribution
allPopups="false"
locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
<toolbar
id="com.example.application.displays.toolbar">
<command
commandId="com.example.application.system.command.OpenWorkspace"
icon="platform:/plugin/com.example.plugin.workspace/icons/workspace.png"
label="Open Workspace"
style="push">
</command>
</toolbar>
</menuContribution>
这篇关于如何从插件中引用图标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!