发现有一些令人讨厌的菜单存在自己的RCP程序,我想到的是应该能拿到MenuManager类,然后遍历一下,去掉Search 菜单,可惜实在脑袋木了,就google了一下,找到解决的代码:
最近越来越懒了,自我批评一下: 平时不练功,关键的时候就只能靠Google这根救命草了。
http://www.richclient2.eu/2006_03_20/getting-rid-of-convert-line-delimiters-to/
20. March 2006
If you're having dependencies to org.eclipse.ui.ide and you launch your RCP you'll automatically get an entry in the menu-bar that is called "Convert Line Delimiters to" and also "Last Edit Location", although you don't need it. To remove this entries place the following lines in your ApplicationActionBarAdvisor
JAVA:
    - 
    
ActionSetRegistry reg = WorkbenchPlugin.getDefault().getActionSetRegistry();
     - 
    
IActionSetDescriptor[] actionSets = reg.getActionSets();
     - 
    
// removing annoying gotoLastPosition Message.
     - 
    
String actionSetId = 
"org.eclipse.ui.edit.text.actionSet.navigation"; 
//$NON-NLS-1$ 
     - 
    
for (int i = 0; i <actionSets.length; i++)
     - 
    
{
     - 
    
    if (!actionSets[i].getId().equals(actionSetId))
     - 
    
        continue;
     - 
    
        IExtension ext = actionSets[i].getConfigurationElement()
     - 
    
            .getDeclaringExtension();
     - 
    
        reg.
removeExtension(ext, 
new Object[] { actionSets
[i
] });
 
     - 
    
}
     - 
    
// Removing convert line delimiters menu.
     - 
    
actionSetId = "org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo"; //$NON-NLS-1$
     - 
    
for (int i = 0; i <actionSets.length; i++)
     - 
    
{
     - 
    
    if (!actionSets[i].getId().equals(actionSetId))
     - 
    
        continue;
     - 
    
    IExtension ext = actionSets[i].getConfigurationElement()
     - 
    
            .getDeclaringExtension();
     - 
    
   reg.
removeExtension(ext, 
new Object[] { actionSets
[i
] });
 
     - 
    
}