How can I link to the icon from the plugin?
I have an RCP Eclipse 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 icons/workspace.png
.
I would like to reference it in my plugin.xml application where I want to add a command to the 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 the plugin icon be referenced there, and if so, how?
+3
source to share
1 answer
The icon from the included plugin can be specified in 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 question, it would be:
platform:/plugin/com.example.plugin.workspace/icons/workspace.png
To contribute 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="platform:/plugin/com.example.plugin.workspace/icons/workspace.png"
label="Open Workspace"
style="push">
</command>
</toolbar>
</menuContribution>
+8
source to share