如何在 Eclipse 4.2 中隐藏工具栏?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11454949/
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 to hide toolbar in Eclipse 4.2?
提问by Mike
The toolbar is of no use for me, it occupies space, I use shortcuts to achieve all functions the toolbar provide. In Eclipse 3.7 we can right click the toolbar and hit "hide toolbar", but how to do that in Eclipse 4?
工具栏对我来说没有用,它占空间,我使用快捷方式来实现工具栏提供的所有功能。在 Eclipse 3.7 中,我们可以右键单击工具栏并点击“隐藏工具栏”,但如何在 Eclipse 4 中做到这一点?
采纳答案by atlanto
Menu was gone but the command seems to be available still now.
Preferences > General > Keys
Type "toggle t" in filter text, then "Toggle Toolbar Visibility" will appear. It seems to work when some key is assigned.
菜单不见了,但命令现在似乎仍然可用。
Preferences > General > Keys
在过滤器文本中输入“toggle t”,然后会出现“Toggle Toolbar Visibility”。当分配了某个键时,它似乎可以工作。
回答by Luke Usherwood
> Window > Hide Toolbar
> Window > Hide Toolbar
(I'm running 4.2.1.)
(我正在运行 4.2.1。)
回答by Stefano Mozart
In 4.7.2 you can use the menu items: Window -> Appearance -> Hide Toolbar
& Window -> Appearance -> Show Toolbar
to toggle toolbar visibility.
在 4.7.2 中,您可以使用菜单项:Window -> Appearance -> Hide Toolbar
&Window -> Appearance -> Show Toolbar
来切换工具栏的可见性。
回答by Phaedrus
You can do it programatically like this:
您可以像这样以编程方式执行此操作:
@Override
public void postWindowOpen() {
hideCoolbar();
super.postWindowOpen();
}
private void hideCoolbar() {
try {
IHandlerService service = (IHandlerService) PlatformUI
.getWorkbench().getActiveWorkbenchWindow()
.getService(IHandlerService.class);
if (service != null)
service.executeCommand("org.eclipse.ui.ToggleCoolbarAction",
null);
} catch (Exception e) {
//handle error
}
}
回答by Eric Sauer
Not sure if this will work, but why dont you take a look at this.
不确定这是否有效,但你为什么不看看这个。
Hide Coolbar/Toolbar items/Preference pages in Eclipse RCP application (Eclipse e4)
回答by Naveen
WorkbenchWindow w = (WorkbenchWindow)HandlerUtil
.getActiveSite(event)
.getWorkbenchWindow();
w.setPerspectiveBarVisible(false);