Eclipse:禁用导航器插件提供的属性选项卡

时间:2013-12-02 11:47:47

标签: eclipse eclipse-rcp

我需要隐藏由插件 org.eclipse.ui.navigator.resources

提供的名为“Resources”的属性选项卡

此标签如下所示:

enter image description here

插件中此选项卡的说明:

<extension
          point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
       <propertyContributor
             contributorId="org.eclipse.ui.navigator.ProjectExplorer"
             labelProvider="org.eclipse.ui.internal.navigator.resources.workbench.TabbedPropertySheetTitleProvider">
          <propertyCategory category="general"/>
          <propertyCategory category="core"/>
          <propertyCategory category="appearance"/>
          <propertyCategory category="resource"/>
          <propertyCategory category="advanced"/>
       </propertyContributor>
    </extension>
    <extension
          point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
       <propertyTabs contributorId="org.eclipse.ui.navigator.ProjectExplorer">
          <propertyTab
                label="%Resource"
                category="resource"
                id="CommonNavigator.tab.Resource"/>
       </propertyTabs>
    </extension>

我想要隐藏此标签,因此我的插件会显示仅显示的标签。

更新。

我尝试过这样的活动,但没有帮助:

 <activityPatternBinding
        activityId="com.company.activities.hide"
        isEqualityPattern="true"
        pattern="org.eclipse.ui.navigator.resources/CommonNavigator.tab.Resource">
     </activityPatternBinding>

1 个答案:

答案 0 :(得分:0)

可能性是remove unwanted contribution

final ActionSetRegistry reg = WorkbenchPlugin.getDefault().getActionSetRegistry();
                        final IActionSetDescriptor[] actionSets = reg.getActionSets();
                        final String[] removeActionSets =
                            new String[] { "org.eclipse.search.searchActionSet", "org.eclipse.ui.cheatsheets.actionSet",
                                    "org.eclipse.ui.actionSet.keyBindings", "org.eclipse.ui.edit.text.actionSet.navigation",
                                    "org.eclipse.ui.edit.text.actionSet.annotationNavigation",
                                    "org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo",
                                    "org.eclipse.ui.edit.text.actionSet.openExternalFile",
                                    "org.eclipse.ui.externaltools.ExternalToolsSet", "org.eclipse.ui.WorkingSetActionSet",
                                    "org.eclipse.update.ui.softwareUpdates", "org.eclipse.ui.actionSet.openFiles",
                                    "org.eclipse.mylyn.tasks.ui.navigation", };

                        for (IActionSetDescriptor actionSet : actionSets) {
                            boolean found = false;
                            for (String removeActionSet : removeActionSets) {
                                if (removeActionSet.equals(actionSet.getId())) {
                                    found = true;
                                }
                            }
                            if (!found) {
                                continue;
                            }
                            final IExtension ext = actionSet.getConfigurationElement().getDeclaringExtension();
                            reg.removeExtension(ext, new Object[] { actionSet });
                        }