如何向 Eclipse 工具栏添加按钮?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/681113/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I add buttons to the Eclipse toolbar?
提问by Josh
I'm on about my sixth version of Eclipse now, but I've never been able to work out how to add a button to the toolbar.
For example, by default I have a little "open type" button in the Java perspective, and I would like to add an "open type hierarchy" button right next to it. Both functions are available right next to each other on the Navigate menu, and I would simply like to drag one of them onto a toolbar as well.
我现在正在使用 Eclipse 的第六个版本,但我一直无法弄清楚如何向工具栏添加按钮。
例如,默认情况下,我在 Java 透视图中有一个“开放类型”按钮,我想在它旁边添加一个“开放类型层次结构”按钮。这两个功能在导航菜单上并排可用,我也想将其中之一拖到工具栏上。
Doesn't seem so far fetched to me? I've tried the "customize perspective" by right-clicking the toolbars, but to no avail. I seem to be able to add stuff that I don't want. Any ideas? I happen to be using Eclipse 3.4.2 M20081224-0800
, but I've never gotten anywhere with this in multiple versions.
对我来说似乎没有那么牵强?我已经通过右键单击工具栏尝试了“自定义视角”,但无济于事。我似乎能够添加我不想要的东西。有任何想法吗?我碰巧正在使用Eclipse 3.4.2 M20081224-0800
,但我从来没有在多个版本中使用过这个。
Thank you.
谢谢你。
采纳答案by VonC
The trick with "Customize perspective" is that only reflects 'plugin.xml' org.eclipse.ui.commandscontribution points.
“自定义透视图”的技巧是只反映“plugin.xml” org.eclipse.ui.commands贡献点。
In other word, you can activate/deactivate those extension points, not change them.
换句话说,您可以激活/停用这些扩展点,而不是更改它们。
As described in this message(for another button):
正如在描述该消息(对于另一个按钮):
As far as I know, the so-called 'basic' toolbar cannot be configured by the user.
I think there are 2 ways to add the 'save all' button:
- write a plug-in that adds a new toolbar section containing the 'save all' button
- patch the plug-in '
org.eclipse.ui.ide
': in the classWorkbenchActionBuilder
insert the following line after the line # 374 (if you want it to appear between 'save' and 'print'):
据我所知,用户无法配置所谓的“基本”工具栏。
我认为有两种方法可以添加“全部保存”按钮:
- 编写一个插件,添加一个包含“全部保存”按钮的新工具栏部分
- 修补插件“
org.eclipse.ui.ide
”:在类中WorkbenchActionBuilder
的第 374 行之后插入以下行(如果您希望它出现在“保存”和“打印”之间):
fileToolBar.add(saveAllAction);
Eclipse3.5 might have changed that, though.
不过,Eclipse3.5可能已经改变了这一点。
回答by Chathura Palihakkara
There is a button called external tools button in the new eclipse Helios toolbar It is easy to customize. I use it for run ant build by single click I guess it will useful try it
新的eclipse Helios工具栏中有一个叫做外部工具按钮的按钮,很容易自定义。我用它来通过单击运行 ant build 我想它会很有用试试吧
回答by Kris
There must be a way as the old GWT plugin had both the "new web application" and the "compile" buttons on the toolbar.
必须有一种方法,因为旧的 GWT 插件在工具栏上同时具有“新 Web 应用程序”和“编译”按钮。
The latest version they are off by default.
最新版本默认关闭。