private static final String[] actionSetId = new String[] { "org.eclipse.ui.WorkingSetActionSet", //$NON-NLS-1$
"org.eclipse.ui.edit.text.actionSet.navigation", //$NON-NLS-1$
"org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo", //$NON-NLS-1$
"org.eclipse.ui.actionSet.openFiles", //$NON-NLS-1$
"org.eclipse.ui.edit.text.actionSet.annotationNavigation", //$NON-NLS-1$
"org.eclipse.ui.NavigateActionSet", //$NON-NLS-1$
"org.eclipse.search.searchActionSet"}; //$NON-NLS-1$
private void removeUnWantedActions() {
ActionSetRegistry asr = WorkbenchPlugin.getDefault().getActionSetRegistry();
IActionSetDescriptor[] actionSets = asr.getActionSets();
IExtension ext = null;
for (IActionSetDescriptor actionSet : actionSets) {
for (String element : actionSetId) {
System.out.println(element);
if (element.equals(actionSet.getId())) {
ext = actionSet.getConfigurationElement().getDeclaringExtension();
asr.removeExtension(ext, new Object[] { actionSet });
}
}
}
}
转载于:https://my.oschina.net/zhenghuazhi/blog/832451