Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Remove search and Run menu for menu bar
Remove search and Run menu for menu bar [message #552138] Wed, 11 August 2010 04:25 Go to next message
ash is currently offline ashFriend
Messages: 142
Registered: July 2010
Senior Member
HI,

Run and search menu is included automatically to my main menu.
when i have not set any thing to include it.

can any one tell how to remove it...

Thanks
ashok
Re: Remove search and Run menu for menu bar [message #553166 is a reply to message #552138] Mon, 16 August 2010 15:16 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Which plugins are you including in your RCP app that is adding them?
org.eclipse.debug.ui? org.eclipse.search?

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Remove search and Run menu for menu bar [message #554206 is a reply to message #553166] Fri, 20 August 2010 14:03 Go to previous messageGo to next message
Mihael Schmidt is currently offline Mihael SchmidtFriend
Messages: 81
Registered: August 2010
Member
I have the same problem. My run configuration has neither org.eclipse.debug.ui nor org.eclipse.search in it but the menus Run and Search are there.
Re: Remove search and Run menu for menu bar [message #554776 is a reply to message #552138] Tue, 24 August 2010 11:56 Go to previous messageGo to next message
ash is currently offline ashFriend
Messages: 142
Registered: July 2010
Senior Member
even i have not included these plugin can any one tell how to remove them.
Re: Remove search and Run menu for menu bar [message #554833 is a reply to message #554776] Tue, 24 August 2010 13:50 Go to previous messageGo to next message
eshvar60  is currently offline eshvar60 Friend
Messages: 51
Registered: March 2010
Member
Someone has answered this in the forum but the topoc has been removed. Here is the answer(not mine) via Google Cache:

Hi,

when you use the plug-in for ide and others (I am not sure)... this will add the menus and tool buttons provided by those plug-in...

you can remove the unwanted menus from your application as shown below...
class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor
{
void postWindowCreate()
{
IContributionItem[] mItems, mSubItems;
IMenuManager mm = getWindowConfigurer ().getActionBarConfigurer ().getMenuManager ();
mItems = mm.getItems ();
for (int i = 0; i < mItems.length; i++)
{
if (mItems[i] instanceof MenuManager)
{
mSubItems = ((MenuManager) mItems[i]).getItems ();
for (int j = 0; j < mSubItems.length; j++)
{
if (mItems[i].getId ().equals ("file"))
((MenuManager) mItems[i]).remove ("org.eclipse.ui.openLocalFile");
else if (mItems[i].getId ().equals ("help"))
{
((MenuManager) mItems[i]).remove ("group.updates");
((MenuManager) mItems[i]).remove ("org.eclipse.update.ui.updateMenu");
((MenuManager) mItems[i]).remove ("org.eclipse.ui.actions.showKeyAssistHandler");
}
}
}
}
}
}


All the Best!
S.Prabhu
Re: Remove search and Run menu for menu bar [message #554937 is a reply to message #554833] Tue, 24 August 2010 19:50 Go to previous messageGo to next message
Mihael Schmidt is currently offline Mihael SchmidtFriend
Messages: 81
Registered: August 2010
Member
I tried the following code and it removed single entries from the menus but not the menus itself (like the Run or Search menu).

    @Override
    public void postWindowCreate() {
        // remove unwanted menu entries
	List<String> unwantedItems = Arrays.asList(
		"org.eclipse.ui.openLocalFile", 
		"converstLineDelimitersTo", 
		"org.eclipse.ui.cheatsheets.actions.CheatSheetHelpMenuAction",
		"org.eclipse.debug.ui.actions.BreakpointTypesContribution" ,
		"ExternalToolsGroup" ,
		"org.eclipse.ui.externaltools.ExternalToolMenuDelegateMenu" ,
		"navigate" ,
		"org.eclipse.search.menu", 
		"org.eclipse.ui.run"
	);
	
        IMenuManager menuManager = getWindowConfigurer().getActionBarConfigurer().getMenuManager();
        removeUnwantedItems(unwantedItems, menuManager);
        
    }
    
    private void removeUnwantedItems(final List<String> unwantedItems, final IMenuManager menuManager) {
	IContributionItem[] items = menuManager.getItems();
	
	for (IContributionItem item : items) {
	    if (item instanceof IMenuManager) {
		removeUnwantedItems(unwantedItems, (IMenuManager) item);
	    }
	    
	    if (unwantedItems.contains(item.getId())) {
		menuManager.remove(item);
	    }
	}
    }


Any ideas why Run and Search are not removed?
Re: Remove search and Run menu for menu bar [message #555098 is a reply to message #554833] Wed, 25 August 2010 12:46 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

eshvar60 wrote:

Just a note. This kind of down-casting classifies as using internals.
There is not programmatic access to the WorkbenchWindow MenuManager,
except for during the WW creation when the ActionBarAdvisor gets to fill
it in.

It is 100% incompatible with the e4 initiative and eclipse 4.0 as the
MenuManager has been replaced.

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Previous Topic:3.3 org.eclipse.ide Is it safe to use in RCP?
Next Topic:Remembering the last directory from which a user opened a file
Goto Forum:
  


Current Time: Thu Apr 25 16:41:06 GMT 2024

Powered by FUDForum. Page generated in 0.03963 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top