问题
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