Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Pogorzelski2010-04-09 13:06:32 +0000
committerPawel Pogorzelski2010-04-09 13:06:32 +0000
commitb6aa5b7d9cd881d647d01413a1b2812a9b2c15a8 (patch)
tree0b3fee568e3d345c8e8ee7fc3d9edb8f208f8081
parent3a8eedb65e49764db7c26ec9e9e429881c406f97 (diff)
downloadeclipse.platform.team-b6aa5b7d9cd881d647d01413a1b2812a9b2c15a8.tar.gz
eclipse.platform.team-b6aa5b7d9cd881d647d01413a1b2812a9b2c15a8.tar.xz
eclipse.platform.team-b6aa5b7d9cd881d647d01413a1b2812a9b2c15a8.zip
Bug 286219 - [Edit][Actions] Can't do any team action from compare editors
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java5
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AdapterFactory.java33
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java2
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/plugin.xml10
4 files changed, 47 insertions, 3 deletions
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
index 52e62fd0b..fe7268fa4 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
@@ -38,6 +38,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.action.IStatusLineManager;
@@ -142,7 +143,7 @@ import org.eclipse.ui.texteditor.ITextEditorExtension3;
* @see CompareUI
* @see CompareEditorInput
*/
-public abstract class CompareEditorInput implements IEditorInput, IPropertyChangeNotifier, IRunnableWithProgress, ICompareContainer {
+public abstract class CompareEditorInput extends PlatformObject implements IEditorInput, IPropertyChangeNotifier, IRunnableWithProgress, ICompareContainer {
private static final boolean DEBUG= false;
@@ -327,7 +328,7 @@ public abstract class CompareEditorInput implements IEditorInput, IPropertyChang
}
}
- return null;
+ return super.getAdapter(adapter);
}
public synchronized ICompareNavigator getNavigator() {
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AdapterFactory.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AdapterFactory.java
new file mode 100644
index 000000000..e5049a378
--- /dev/null
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AdapterFactory.java
@@ -0,0 +1,33 @@
+package org.eclipse.compare.internal;
+
+import org.eclipse.compare.CompareEditorInput;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.ui.IContributorResourceAdapter;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IFileEditorInput;
+
+public class AdapterFactory implements IAdapterFactory {
+
+ public Object getAdapter(final Object adaptableObject, Class adapterType) {
+ if (IContributorResourceAdapter.class.equals(adapterType)
+ && adaptableObject instanceof CompareEditorInput) {
+ return new IContributorResourceAdapter() {
+ public IResource getAdaptedResource(IAdaptable adaptable) {
+ Object ei = ((CompareEditorInput) adaptableObject)
+ .getAdapter(IEditorInput.class);
+ if (ei instanceof IFileEditorInput) {
+ return ((IFileEditorInput) ei).getFile();
+ }
+ return null;
+ }
+ };
+ }
+ return null;
+ }
+
+ public Class[] getAdapterList() {
+ return new Class[] { IContributorResourceAdapter.class };
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java
index 1dbd9e0f4..1ebda9847 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java
@@ -112,7 +112,7 @@ public class CompareEditor extends EditorPart implements IReusableEditor, ISavea
public void registerContextMenu(MenuManager menu, ISelectionProvider provider) {
if (getSite() instanceof IEditorSite) {
IEditorSite es = (IEditorSite) getSite();
- es.registerContextMenu(menu, provider, false);
+ es.registerContextMenu(menu, provider, true);
}
}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/plugin.xml b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/plugin.xml
index fae17999c..55dd5056e 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/plugin.xml
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/plugin.xml
@@ -340,5 +340,15 @@
class="org.eclipse.compare.internal.ComparePreferenceInitializer">
</initializer>
</extension>
+ <extension
+ point="org.eclipse.core.runtime.adapters">
+ <factory
+ adaptableType="org.eclipse.compare.CompareEditorInput"
+ class="org.eclipse.compare.internal.AdapterFactory">
+ <adapter
+ type="org.eclipse.ui.IContributorResourceAdapter">
+ </adapter>
+ </factory>
+ </extension>
</plugin>

Back to the top