How to hide toolbar in Eclipse 4.2?

为君一笑 提交于 2019-12-03 05:05:17

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.

> Window > Hide Toolbar

(I'm running 4.2.1.)

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

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

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)

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