How to hide toolbar in Eclipse 4.2?

妖精的绣舞 提交于 2019-12-03 15:33:14

问题


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?


回答1:


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.




回答2:


> Window > Hide Toolbar

(I'm running 4.2.1.)




回答3:


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
    }
}



回答4:


In 4.7.2 you can use the menu items: Window -> Appearance -> Hide Toolbar & Window -> Appearance -> Show Toolbar to toggle toolbar visibility.




回答5:


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)




回答6:


WorkbenchWindow w = (WorkbenchWindow)HandlerUtil
     .getActiveSite(event)
     .getWorkbenchWindow();
w.setPerspectiveBarVisible(false);


来源:https://stackoverflow.com/questions/11454949/how-to-hide-toolbar-in-eclipse-4-2

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!