Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Delete the "Open in a new window" menu(Contextual menu configuration)
Delete the "Open in a new window" menu [message #487401] Wed, 23 September 2009 02:38 Go to next message
Missing name Missing name is currently offline Missing name Missing name
Messages: 57
Registered: September 2009
Member
Hello,

I'm working on a eclipse plugin and I would like to delete the "Open in a new window" menu that appears in the contextual menu.
The id is "openNewWindow" and the commandId is "'org.eclipse.ui.window.newWindow" as the class ActionFactory indicates.
How can I delete this menu.
My project contains a view that extends ResourceNavigator. I try to display all menus in the fillContextMenu(...) method, but there is no openNewWindow menu.
Could you help me ?
thanks

Val
Re: Delete the "Open in a new window" menu [message #487487 is a reply to message #487401] Wed, 23 September 2009 08:29 Go to previous message
Missing name Missing name is currently offline Missing name Missing name
Messages: 57
Registered: September 2009
Member
A possible solution (works fine):

My view extends ResourceNavigator.
In this view, the makeActions() method creates a MainActionGroup:

ResourceNavigatorActionGroup actionGroup = new MainActionGroup(this) {
protected void makeSubGroups() {
super.makeSubGroups();
//override the default openGroup define in MainGroup class to delete "Open in new window" in context menu
openGroup = new MyOpenActionGroup(navigator);
}
}

The MyOpenActionGroup class extends OpenActionGroup classes. I only change the fillContextMenu method in order to disable the menu creation:
public void fillContextMenu(IMenuManager menu) {
IStructuredSelection selection = (IStructuredSelection) getContext()
.getSelection();

//boolean anyResourceSelected = !selection.isEmpty()
// && ResourceSelectionUtil.allResourcesAreOfType(selection,
// IResource.PROJECT | IResource.FOLDER | IResource.FILE);
boolean onlyFilesSelected = !selection.isEmpty()
&& ResourceSelectionUtil.allResourcesAreOfType(selection,
IResource.FILE);

if (onlyFilesSelected) {
openFileAction.selectionChanged(selection);
menu.add(openFileAction);
fillOpenWithMenu(menu, selection);
}

//DO NOT CREATE THE MENU
//if (anyResourceSelected) {
// addNewWindowAction(menu, selection);
//}
}
Previous Topic:Get error 'indirectly referenced from...' for IVerticalRulerColumn
Next Topic:Cannot launch application on some Linux machine after upgrade to eclipse 3.5
Goto Forum:
  


Current Time: Fri Aug 29 04:09:44 EDT 2014

Powered by FUDForum. Page generated in 0.01780 seconds