Eclipse 如何在同步视图中删除颠覆性操作?

Eclipse 如何在同步视图中删除颠覆性操作?,eclipse,eclipse-rcp,eclipse-3.4,subversive,Eclipse,Eclipse Rcp,Eclipse 3.4,Subversive,我正在将Subversive 0.7.8集成到Eclipse平台3.4.2 RCP应用程序中。 我想删除(或禁用)“同步”视图弹出菜单中的SVN“提交”操作。 我怎么做 谢谢你的帮助。 JM.D你为什么要这么做? 难道你不能简单地让你的用户没有使用svn权限提交的权利吗?你为什么要这样做? 你不能简单地让你的用户无权使用svn权限提交吗?有两种方法:要么从subversion更改插件中的plugin.xml文件以删除贡献(这意味着你必须保留自己版本的插件),要么从平台中删除特定贡献 删除通常在启

我正在将Subversive 0.7.8集成到Eclipse平台3.4.2 RCP应用程序中。 我想删除(或禁用)“同步”视图弹出菜单中的SVN“提交”操作。 我怎么做

谢谢你的帮助。
JM.D

你为什么要这么做?
难道你不能简单地让你的用户没有使用svn权限提交的权利吗?

你为什么要这样做?
你不能简单地让你的用户无权使用svn权限提交吗?

有两种方法:要么从subversion更改插件中的plugin.xml文件以删除贡献(这意味着你必须保留自己版本的插件),要么从平台中删除特定贡献

删除通常在启动实际平台之前,在扩展IAApplication接口的类中进行

这基本上是一种黑客行为,但它允许您在不接触subversion插件的情况下做您想做的事情。我不知道贡献的名称(您必须从插件的源代码中查找它们),但代码如下所示:

IExtensionRegistry extensionRegistry = InternalPlatform.getDefault().getRegistry();

List uiExtensionsToRemove = Arrays.toList(new String[] {"org.eclipse.ui.views.ProgressView" });  // Removing the progress view in this example


String[] tmpNamespaces = extensionRegistry.getNamespaces();
    for (int i = 0; i < tmpNamespaces.length; i++) {
        String tmpNamespace = tmpNamespaces[i];
            try {
                IExtension[] tmpExtensions = extensionRegistry.getExtensions(tmpNamespace);
                for (int j = 0; j < tmpExtensions.length; j++) {
                    IExtension tmpExtension = tmpExtensions[j];
                    ExtensionHandle tmpEHandle = (ExtensionHandle)tmpExtension;
                    String tmpEPUID = tmpEHandle.getExtensionPointUniqueIdentifier();

                    if ("org.eclipse.search.searchPages".equals(tmpEPUID) || "org.eclipse.ui.preferencePages".equals(tmpEPUID) || "org.eclipse.ui.popupMenus".equals(tmpEPUID) || "org.eclipse.ui.actionSets".equals(tmpEPUID)
                            || "org.eclipse.ui.views".equals(tmpEPUID) || "org.eclipse.ui.perspectives".equals(tmpEPUID)) {
                        // only remove part of ui extensions
                        if (tmpEHandle.getNamespace().startsWith("org.eclipse.ui")) {
                            String idOfFirstExtension = tmpEHandle.getConfigurationElements()[0].getAttribute("id");
                            if (!uiExtensionsToRemove.contains(idOfFirstExtension)) {
                                continue;
                            }
                        }
                        removeExtension(tmpEHandle);
                }
            } catch (InvalidRegistryObjectException iroe) {

            }
            //System.out.println("Namespace: " + tmpNamespace);
        }

private void removeExtension(ExtensionHandle extensionHandle) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException {
    if (removeExtensionMethod == null) {
        removeExtensionMethod = extensionRegistry.getClass().getDeclaredMethod("removeExtension", new Class[] { int.class });
        removeExtensionMethod.setAccessible(true);
    }
    // well, this is some magic:
    int tmpExtId = extensionHandle.hashCode();
    removeExtensionMethod.invoke(extensionRegistry, new Object[] { new Integer(tmpExtId) });
}
IExtensionRegistry extensionRegistry=InternalPlatform.getDefault().getRegistry();
List UIExtensionsStoreMove=Arrays.toList(新字符串[]{“org.eclipse.ui.views.ProgressView”});//删除本例中的进度视图
字符串[]tmpNamespaces=extensionRegistry.getNamespaces();
for(int i=0;i
两种方法:要么从subversion更改插件中的plugin.xml文件以删除贡献(这意味着您必须保留自己版本的插件),要么从平台中删除特定贡献

删除通常在启动实际平台之前,在扩展IAApplication接口的类中进行

这基本上是一种黑客行为,但它允许您在不接触subversion插件的情况下做您想做的事情。我不知道贡献的名称(您必须从插件的源代码中查找它们),但代码如下所示:

IExtensionRegistry extensionRegistry = InternalPlatform.getDefault().getRegistry();

List uiExtensionsToRemove = Arrays.toList(new String[] {"org.eclipse.ui.views.ProgressView" });  // Removing the progress view in this example


String[] tmpNamespaces = extensionRegistry.getNamespaces();
    for (int i = 0; i < tmpNamespaces.length; i++) {
        String tmpNamespace = tmpNamespaces[i];
            try {
                IExtension[] tmpExtensions = extensionRegistry.getExtensions(tmpNamespace);
                for (int j = 0; j < tmpExtensions.length; j++) {
                    IExtension tmpExtension = tmpExtensions[j];
                    ExtensionHandle tmpEHandle = (ExtensionHandle)tmpExtension;
                    String tmpEPUID = tmpEHandle.getExtensionPointUniqueIdentifier();

                    if ("org.eclipse.search.searchPages".equals(tmpEPUID) || "org.eclipse.ui.preferencePages".equals(tmpEPUID) || "org.eclipse.ui.popupMenus".equals(tmpEPUID) || "org.eclipse.ui.actionSets".equals(tmpEPUID)
                            || "org.eclipse.ui.views".equals(tmpEPUID) || "org.eclipse.ui.perspectives".equals(tmpEPUID)) {
                        // only remove part of ui extensions
                        if (tmpEHandle.getNamespace().startsWith("org.eclipse.ui")) {
                            String idOfFirstExtension = tmpEHandle.getConfigurationElements()[0].getAttribute("id");
                            if (!uiExtensionsToRemove.contains(idOfFirstExtension)) {
                                continue;
                            }
                        }
                        removeExtension(tmpEHandle);
                }
            } catch (InvalidRegistryObjectException iroe) {

            }
            //System.out.println("Namespace: " + tmpNamespace);
        }

private void removeExtension(ExtensionHandle extensionHandle) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException {
    if (removeExtensionMethod == null) {
        removeExtensionMethod = extensionRegistry.getClass().getDeclaredMethod("removeExtension", new Class[] { int.class });
        removeExtensionMethod.setAccessible(true);
    }
    // well, this is some magic:
    int tmpExtId = extensionHandle.hashCode();
    removeExtensionMethod.invoke(extensionRegistry, new Object[] { new Integer(tmpExtId) });
}
IExtensionRegistry extensionRegistry=InternalPlatform.getDefault().getRegistry();
List uiExtensionsToRemove=Arrays.toList(新字符串[]{“org.eclipse.ui.views.ProgressView”});//删除本例中的进度视图
字符串[]tmpNamespaces=extensionRegistry.getNamespaces();
for(int i=0;i