[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[List Home]
|
[imp-commit] r22865 - trunk/org.eclipse.imp.runtime/src/org/eclipse/imp/editor
|
- From: genie@xxxxxxxxxxx
- Date: Fri, 18 Feb 2011 18:16:47 -0500 (EST)
- Delivered-to: imp-commit@eclipse.org
Author: rfuhrer
Date: 2011-02-18 18:16:46 -0500 (Fri, 18 Feb 2011)
New Revision: 22865
Modified:
trunk/org.eclipse.imp.runtime/src/org/eclipse/imp/editor/UniversalEditor.java
Log:
doSetInput() now catches CoreExceptions, since it's possible that things like IOExceptions occur while retrieving the input's contents, e.g., if the given input doesn't exist.
Modified: trunk/org.eclipse.imp.runtime/src/org/eclipse/imp/editor/UniversalEditor.java
===================================================================
--- trunk/org.eclipse.imp.runtime/src/org/eclipse/imp/editor/UniversalEditor.java 2011-02-16 07:45:09 UTC (rev 22864)
+++ trunk/org.eclipse.imp.runtime/src/org/eclipse/imp/editor/UniversalEditor.java 2011-02-18 23:16:46 UTC (rev 22865)
@@ -11,6 +11,7 @@
package org.eclipse.imp.editor;
+import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
@@ -32,11 +33,12 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
import org.eclipse.debug.ui.actions.ToggleBreakpointAction;
import org.eclipse.help.IContextProvider;
-import org.eclipse.imp.actions.OpenAction;
import org.eclipse.imp.actions.QuickMenuAction;
import org.eclipse.imp.actions.RulerEnableDisableBreakpointAction;
import org.eclipse.imp.core.ErrorHandler;
@@ -282,7 +284,8 @@
return fLangSpecificPrefs;
}
- @SuppressWarnings("unchecked")
+
+ @SuppressWarnings("rawtypes")
public Object getAdapter(Class required) {
if (IContentOutlinePage.class.equals(required)) {
return fServiceControllerManager == null ? null : fServiceControllerManager.getOutlineController();
@@ -302,6 +305,9 @@
if (IContextProvider.class.equals(required)) {
return IMPHelp.getHelpContextProvider(this, fLanguageServiceManager, IMP_EDITOR_CONTEXT);
}
+ if (IAnnotationModel.class.equals(required)) {
+ return fAnnotationModel;
+ }
return super.getAdapter(required);
}
@@ -1634,11 +1640,14 @@
}
protected void doSetInput(IEditorInput input) throws CoreException {
- // SMS 22 May 2007: added try/catch around doSetInput(..)
+ // Catch CoreExceptions here, since it's possible that things like IOExceptions occur
+ // while retrieving the input's contents, e.g., if the given input doesn't exist.
try {
super.doSetInput(input);
- } catch (NullPointerException e) {
- return;
+ } catch (CoreException e) {
+ if (e.getCause() instanceof IOException) {
+ throw new CoreException(new Status(IStatus.ERROR, RuntimePlugin.IMP_RUNTIME, 0, "Unable to read source text", e.getStatus().getException()));
+ }
}
setInsertMode(SMART_INSERT);