EditorUtility,getEditorInput(Object input) doesn't throw exception
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dnd/EditorInputTransferDragAdapter.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dnd/EditorInputTransferDragAdapter.java
index a9fcbaa..9c0a01c 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dnd/EditorInputTransferDragAdapter.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dnd/EditorInputTransferDragAdapter.java
@@ -14,8 +14,6 @@
import java.util.Iterator;
import org.eclipse.core.runtime.Assert;
-import org.eclipse.dltk.core.DLTKCore;
-import org.eclipse.dltk.core.ModelException;
import org.eclipse.dltk.internal.ui.editor.EditorUtility;
import org.eclipse.jface.util.TransferDragSourceListener;
import org.eclipse.jface.viewers.ISelection;
@@ -61,14 +59,8 @@
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
for (Iterator iter = structuredSelection.iterator(); iter.hasNext();) {
Object element = iter.next();
- IEditorInput editorInput = null;
- try {
- editorInput = EditorUtility.getEditorInput(element);
- } catch (ModelException e1) {
- if (DLTKCore.DEBUG) {
- e1.printStackTrace();
- }
- }
+ IEditorInput editorInput = EditorUtility
+ .getEditorInput(element);
if (editorInput != null && editorInput.getPersistable() != null) {
String editorId = EditorUtility.getEditorID(editorInput,
element);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/EditorUtility.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/EditorUtility.java
index 016a74e..580f294 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/EditorUtility.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/EditorUtility.java
@@ -227,8 +227,7 @@
return null;
}
- private static IEditorInput getEditorInput(IModelElement element)
- throws ModelException {
+ private static IEditorInput getEditorInput(IModelElement element) {
while (element != null) {
if (element instanceof IExternalSourceModule) {
ISourceModule unit = ((ISourceModule) element).getPrimary();
@@ -247,8 +246,7 @@
return null;
}
- public static IEditorInput getEditorInput(Object input)
- throws ModelException {
+ public static IEditorInput getEditorInput(Object input) {
if (input instanceof IModelElement)
return getEditorInput((IModelElement) input);
if (input instanceof IFile)
@@ -463,13 +461,7 @@
* editor
*/
public static IEditorPart isOpenInEditor(Object inputElement) {
- IEditorInput input = null;
-
- try {
- input = getEditorInput(inputElement);
- } catch (ModelException x) {
- DLTKUIPlugin.log(x.getStatus());
- }
+ IEditorInput input = getEditorInput(inputElement);
if (input != null) {
IWorkbenchPage p = DLTKUIPlugin.getActivePage();
@@ -728,8 +720,7 @@
}
}
- return regions.toArray(new IRegion[regions
- .size()]);
+ return regions.toArray(new IRegion[regions.size()]);
}
});
} finally {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/ScriptExplorerPart.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/ScriptExplorerPart.java
index acce4d2..8412af7 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/ScriptExplorerPart.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/ScriptExplorerPart.java
@@ -1295,16 +1295,8 @@
return false;
}
- IEditorInput selectionAsInput;
- try {
- selectionAsInput = EditorUtility.getEditorInput(selection
- .getFirstElement());
- } catch (ModelException e) {
- if (DLTKCore.DEBUG) {
- e.printStackTrace();
- }
- return false;
- }
+ IEditorInput selectionAsInput = EditorUtility.getEditorInput(selection
+ .getFirstElement());
return input.equals(selectionAsInput);
}