在plugin.xml中使用eclipse构建图标
在插件中,我在plugin.xml 文件中定义了一个命令。我想将工具栏中“打开透视图”按钮的 Eclipse 默认图像/图标添加到此命令。
在 Eclipse 中,我尝试激活图标上的插件间谍 (Shift+Alt+F1),它为我提供以下信息:
The contributing plug-in:
org.eclipse.pde.ui (3.6.1.v20110210_r362)
但我找不到用于该指定按钮的图像上的任何信息在那个插件中。我看到其他图像是使用以下方式指定的:
$nl$/icons/obj16/plugin_javasearch.gif
我该怎么做:
1) 找到用于“打开视角”按钮的图标?
2) 指定我想在我自己的plugin.xml 文件中为我自己的命令使用该图标?
以下是我当前对命令的定义:
<menuContribution
allPopups="false"
locationURI="base.application.menuContribution1">
<toolbar
id="base.application.perspective">
<command
commandId="openPerspective"
icon=" IWorkbenchGraphicConstants.IMG_ETOOL_NEW_PAGE"
style="push">
</command>
</toolbar>
</menuContribution>
In a plugin I have defined a command in the plugin.xml file. I would like to add the Eclipse default image/icon for the "Open Perspective" button in the toolbar to this command.
In eclipse I have tried to activate the Plugin-in Spy (Shift+Alt+F1) on the icon which gives me the following info:
The contributing plug-in:
org.eclipse.pde.ui (3.6.1.v20110210_r362)
but I cannot find any info on the image used for that specify button in that plugin. I see that other images are specified using:
$nl$/icons/obj16/plugin_javasearch.gif
How to do I:
1) Find the icon used for the "Open Perspective" button?
2) Specify that I want to use that icon for my own command in my own plugin.xml file?
Below is my current definition of my command:
<menuContribution
allPopups="false"
locationURI="base.application.menuContribution1">
<toolbar
id="base.application.perspective">
<command
commandId="openPerspective"
icon=" IWorkbenchGraphicConstants.IMG_ETOOL_NEW_PAGE"
style="push">
</command>
</toolbar>
</menuContribution>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要找到该图标,您可能必须使用暴力方法。使用
File>Import...>Plug-ins and Fragments
并导入一些插件。我没想到 Open Perspective 是在 pde 中(也许可以尝试org.eclipse.ui
或org.eclipse.ui.ide
),但您也可以尝试 PDE。至于使用它,您可以使用 platform:/plugin 协议来引用其他人插件中的图标。但这些文件名被视为“实现细节”。虽然它们可能不会改变,但插件没有义务在每次发布时都保持相同。
To find the icon you might have to use the brute force approach. Use
File>Import...>Plug-ins and Fragments
and import some plugins. I wouldn't have thought Open Perspective was in pde (maybe tryorg.eclipse.ui
ororg.eclipse.ui.ide
) but you can try PDE as well.As for using it, you can use the platform:/plugin protocol to reference an icon in someone else's plugin. But those filenames are considered "implementation details". While they probably won't change, the plugins have no obligation to keep them the same from release to release.