Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java')
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java
index 7c295b544..2563b90dc 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java
@@ -55,11 +55,28 @@ import org.eclipse.ui.*;
import org.eclipse.ui.ide.IContributorResourceAdapter2;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.internal.ErrorEditorPart;
+import org.eclipse.ui.internal.registry.EditorDescriptor;
import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
+import org.eclipse.ui.texteditor.AbstractDecoratedTextEditor;
public class Utils {
/**
+ * Constant used to indicate that tests are being run. This field
+ * should be the same as the corresponding field on
+ * org.eclipse.compare.internal.Utilities
+ */
+ public static boolean RUNNING_TESTS = false;
+
+ /**
+ * Constant used while testing the indicate that changes should be flushed
+ * when the compare input changes and a viewer is dirty. This field
+ * should be the same as the corresponding field on
+ * org.eclipse.compare.internal.Utilities
+ */
+ public static boolean TESTING_FLUSH_ON_COMPARE_INPUT_CHANGE = false;
+
+ /**
* The SortOperation takes a collection of objects and returns a sorted
* collection of these objects. Concrete instances of this class provide
* the criteria for the sorting of the objects based on the type of the
@@ -963,6 +980,25 @@ public class Utils {
return traversal.asTraversals();
}
+ /**
+ * Return whether the editor associated with a descriptor is a text editor
+ * (i.e. an instance of AbstractDecoratedTextEditor).
+ * See bug 99568 for a request to move the createEditor method to IEditorDescriptor.
+ * @param descriptor
+ * @return whether the editor associated with a descriptor is a text editor
+ * @throws CoreException
+ */
+ public static boolean isTextEditor(IEditorDescriptor descriptor)
+ throws CoreException {
+ if (descriptor instanceof EditorDescriptor) {
+ EditorDescriptor desc = (EditorDescriptor) descriptor;
+ IEditorPart editor= desc.createEditor();
+ editor.dispose();
+ return editor instanceof AbstractDecoratedTextEditor;
+ }
+ return false;
+ }
+
public static IEditorPart openEditor(IWorkbenchPage page, IFileRevision revision, IProgressMonitor monitor) throws CoreException {
IStorage file = revision.getStorage(monitor);
if (file instanceof IFile) {
@@ -981,6 +1017,7 @@ public class Utils {
String id = getEditorId(editorInput);
try {
IEditorPart part = page.openEditor(editorInput, id);
+ // See bug 90582 for the reasons behind this discouraged access
if (part instanceof ErrorEditorPart) {
page.closeEditor(part, false);
part = null;

Back to the top