RCP开发:多出工具条一扫光

private static final String[] ACTIONSETID = new String[] { "org.eclipse.ant.ui.actionSet.presentation", //$NON-NLS-1$
         "org.eclipse.debug.ui.breakpointActionSet",//$NON-NLS-1$
         "org.eclipse.debug.ui.debugActionSet",//$NON-NLS-1$
         "org.eclipse.debug.ui.launchActionSet",//$NON-NLS-1$
         "org.eclipse.debug.ui.profileActionSet",//$NON-NLS-1$
         "org.eclipse.jdt.ui.actions.GoToPackage",//$NON-NLS-1$
         "org.eclipse.jdt.ui.actions.GoToType", //$NON-NLS-1$
         "org.eclipse.jdt.ui.actions.OpenExternalJavaDoc",//$NON-NLS-1$
         "org.eclipse.jdt.ui.actions.OpenSuperImplementation", //$NON-NLS-1$
         "org.eclipse.jdt.ui.actions.CopyQualifiedName",//$NON-NLS-1$
         "org.eclipse.jdt.ui.actions.Open", //$NON-NLS-1$
         "org.eclipse.jdt.ui.actions.OpenTypeHierarchy", //$NON-NLS-1$
         "org.eclipse.jdt.ui.actions.OpenCallHierarchy",//$NON-NLS-1$
         "org.eclipse.jdt.ui.JavaElementCreationActionSet",//$NON-NLS-1$
         "org.eclipse.jdt.ui.JavaActionSet",//$NON-NLS-1$
         "org.eclipse.jdt.ui.A_OpenActionSet",//$NON-NLS-1$
         "org.eclipse.jdt.ui.CodingActionSet",//$NON-NLS-1$
         "org.eclipse.jdt.ui.SearchActionSet",//$NON-NLS-1$
         "org.eclipse.jdt.ui.text.java.actionSet.presentation",//$NON-NLS-1$
         "org.eclipse.search.searchActionSet",//$NON-NLS-1$
         "org.eclipse.team.ui.actionSet",//$NON-NLS-1$
         "org.eclipse.ui.NavigateActionSet", //$NON-NLS-1$
         "org.eclipse.ui.edit.text.actionSet.openExternalFile", //$NON-NLS-1$
         "org.eclipse.ui.edit.text.actionSet.presentation",//$NON-NLS-1$
         "org.eclipse.ui.edit.text.actionSet.annotationNavigation",//$NON-NLS-1$
         "org.eclipse.ui.edit.text.actionSet.navigation",//$NON-NLS-1$
         "org.eclipse.ui.externaltools.ExternalToolsSet",//$NON-NLS-1$
         "org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo", //$NON-NLS-1$
         "org.eclipse.ui.actionSet.keyBindings",//$NON-NLS-1$
         "org.eclipse.ui.actionSet.openFiles",//$NON-NLS-1$
         "org.eclipse.ui.WorkingSetActionSet",//$NON-NLS-1$
         "org.eclipse.ui.WorkingSetModificationActionSet",//$NON-NLS-1$
         "org.eclipse.ui.WorkingSetActionSet.toolbar",//$NON-NLS-1$
         "org.eclipse.update.ui.softwareUpdates",//$NON-NLS-1$
 };

 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.ui.application.ActionBarAdvisor#fillCoolBar(org.eclipse.jface.action.ICoolBarManager)
  */
 protected void fillCoolBar(ICoolBarManager coolBar) {
     IToolBarManager toolbar = new ToolBarManager(SWT.FLAT | SWT.RIGHT);

     coolBar.add(new ToolBarContributionItem(toolbar, "save")); //$NON-NLS-1$
    

     // toolbar = new ToolBarManager(SWT.FLAT | SWT.RIGHT);
     // coolBar.add(new ToolBarContributionItem(toolbar, "ads")); //$NON-NLS-1$
     // AnnouncementContributionItem announcementItem = new AnnouncementContributionItem(Messages
     // .getString("ApplicationActionBarAdvisor.message"));
     // toolbar.add(announcementItem); //$NON-NLS-1$

     ActionSetRegistry reg = WorkbenchPlugin.getDefault().getActionSetRegistry();
     IActionSetDescriptor[] actionSets = reg.getActionSets();
     List list = Arrays.asList(ACTIONSETID);
     for (int i = 0; i < actionSets.length; i++) {
         if (list.contains(actionSets[i].getId())) {
             removeAction(reg, actionSets[i]);
         }
     }
 }

 private void removeAction(final ActionSetRegistry reg, final IActionSetDescriptor actionSet) {
     IExtension ext = actionSet.getConfigurationElement().getDeclaringExtension();
     reg.removeExtension(ext, new Object[] { actionSet });
 }
 
 
来自dengues。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值