Subversive 0.7.8 を Eclipse Platform 3.4.2 RCP アプリに統合しています。「同期」ビューのポップアップ メニューで、SVN の「コミット」アクションを削除 (または無効化) したいと考えています。どのようにできるのか ... ?
ご協力ありがとうございました。JMD
Subversive 0.7.8 を Eclipse Platform 3.4.2 RCP アプリに統合しています。「同期」ビューのポップアップ メニューで、SVN の「コミット」アクションを削除 (または無効化) したいと考えています。どのようにできるのか ... ?
ご協力ありがとうございました。JMD
なぜあなたはそれをする必要があるのですか?ユーザーがsvnrightsを使用してコミットする権利を持たないようにすることはできませんか?
あなたは確かに活動をチェックする必要があります。
2 つの方法: プラグイン内の plugin.xml ファイルを subversion から変更してコントリビューションを削除する (つまり、独自のバージョンのプラグインを保持する必要がある) か、プラットフォームから特定のコントリビューションを削除することができます。
削除は通常、実際のプラットフォームを起動する前に、IApplication インターフェイスを拡張するクラスで行われます。
これは基本的にハックですが、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) });
}