问题
I added the Search Plugin to my RCP application. On addition of this plugin it adds the search menu in main menu bar.
I observed that there is some pixels gap between search menu and its previous menu. Please see the image.
Does anyone know how this is coming and how I can remove it?
回答1:
I fixed this issue by modifying postWindowCreate method of ApplicationWorkbenchWindowAdvisor class of RCP application.
IWorkbenchPage page = this.getWindowConfigurer().getWindow().getActivePage();
MenuManager menuBarManager = ((ApplicationWindow)page.getWorkbenchWindow()).getMenuBarManager();
menuBarManager.remove("navigate");
回答2:
Insert a "navigate" path in your ActionBarAdvisor implementation:
protected void fillMenuBar(IMenuManager menuBar) {
menuBar.add(createFileMenu());
menuBar.add(createEditMenu());
menuBar.add(new GroupMarker(IWorkbenchActionConstants.M_NAVIGATE));
menuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
menuBar.add(createHelpMenu());
}
来源:https://stackoverflow.com/questions/14396517/gap-between-search-menu-and-its-previous-menu-on-addition-of-search-plugin