Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Fluegge2011-10-30 09:38:11 +0000
committerMartin Fluegge2011-10-30 09:38:11 +0000
commit319a26b38370be25077108eb0a3097110f284c89 (patch)
tree277a74198db4e30bf688ced8d6d611a8cb9feb5c /plugins/org.eclipse.emf.cdo.dawn.ui
parentb0bbe60695ef9e3c8c79797a41de6437a725c869 (diff)
downloadcdo-319a26b38370be25077108eb0a3097110f284c89.tar.gz
cdo-319a26b38370be25077108eb0a3097110f284c89.tar.xz
cdo-319a26b38370be25077108eb0a3097110f284c89.zip
[319486] [Dawn] Implement locking mechanism for extended editors
https://bugs.eclipse.org/bugs/show_bug.cgi?id=319486
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.dawn.ui')
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/helper/EditorDescriptionHelper.java29
1 files changed, 15 insertions, 14 deletions
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/helper/EditorDescriptionHelper.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/helper/EditorDescriptionHelper.java
index 5739a257f2..014a68a223 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/helper/EditorDescriptionHelper.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/helper/EditorDescriptionHelper.java
@@ -10,15 +10,21 @@
*/
package org.eclipse.emf.cdo.dawn.ui.helper;
+import org.eclipse.emf.cdo.dawn.spi.IDawnUIElement;
+
import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IEditorDescriptor;
+import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.internal.registry.EditorDescriptor;
/**
* @author Martin Fluegge
*/
+@SuppressWarnings("restriction")
public class EditorDescriptionHelper
{
public static String getEditorIdForDawnEditor(String resourceName)
@@ -37,24 +43,19 @@ public class EditorDescriptionHelper
for (IEditorDescriptor editorDescriptor : editors)
{
- // TODO make this more stable by getting the class name more reliably
- String id = editorDescriptor.getId();
- int lastIndexOf = id.lastIndexOf('.');
- String lastSegment = id.substring(lastIndexOf + 1, id.length());
+ EditorDescriptor des = (EditorDescriptor)editorDescriptor;
- if (lastSegment.toLowerCase().startsWith("dawn"))
+ try
{
- return editorDescriptor;
+ IEditorPart editor = des.createEditor();
+ if (editor instanceof IDawnUIElement)
+ {
+ return editorDescriptor;
+ }
}
- }
- // if this fails we try to get one that contains .dawn
- for (IEditorDescriptor editorDescriptor : editors)
- {
- // TODO make this more stable by getting the class name more reliably
- String id = editorDescriptor.getId();
- if (id.toLowerCase().contains(".dawn"))
+ catch (CoreException ex)
{
- return editorDescriptor;
+ throw new RuntimeException(ex);
}
}
return null;

Back to the top