summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorDaniel Rolka2013-04-16 11:49:59 (EDT)
committer Gerrit Code Review @ Eclipse.org2013-04-17 08:19:10 (EDT)
commit6a39b7ac76552bd160c621dc8f263e7935fb44b4 (patch)
tree4515a1e6e1be7fbe82d80c606516c51b7d9b6999
parentc46a23e9fbcdb7cc180e23e6f668d943d752514c (diff)
downloadeclipse.platform.ui-6a39b7ac76552bd160c621dc8f263e7935fb44b4.zip
eclipse.platform.ui-6a39b7ac76552bd160c621dc8f263e7935fb44b4.tar.gz
eclipse.platform.ui-6a39b7ac76552bd160c621dc8f263e7935fb44b4.tar.bz2
Bug 405800 - The NPE when the editor with invalid resource gets activerefs/changes/47/11947/2
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorReference.java10
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java1
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/messages.properties1
3 files changed, 11 insertions, 1 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorReference.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorReference.java
index cc9c776..d66a91c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorReference.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorReference.java
@@ -308,6 +308,10 @@ public class EditorReference extends WorkbenchPartReference implements IEditorRe
try {
if (descriptor == null) {
return createErrorPart();
+ } else if (getEditorInput() == null || !getEditorInput().exists()) {
+ return createErrorPart(NLS.bind(
+ WorkbenchMessages.EditorManager_unableToCreateEditor,
+ WorkbenchMessages.EditorManager_resourceNotFound));
} else if (descriptor.getId().equals(IEditorRegistry.SYSTEM_INPLACE_EDITOR_ID)) {
IEditorPart part = ComponentSupport.getSystemInPlaceEditor();
if (part == null) {
@@ -325,8 +329,12 @@ public class EditorReference extends WorkbenchPartReference implements IEditorRe
@Override
IWorkbenchPart createErrorPart() {
+ return createErrorPart(WorkbenchMessages.EditorManager_missing_editor_descriptor);
+ }
+
+ private IWorkbenchPart createErrorPart(String errorMessage) {
IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, NLS.bind(
- WorkbenchMessages.EditorManager_missing_editor_descriptor, descriptorId));
+ errorMessage, descriptorId));
IEditorRegistry registry = getPage().getWorkbenchWindow().getWorkbench()
.getEditorRegistry();
descriptor = (EditorDescriptor) registry.findEditor(EditorRegistry.EMPTY_EDITOR_ID);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java
index 325a986..4d22a0a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java
@@ -638,6 +638,7 @@ public class WorkbenchMessages extends NLS {
public static String EditorManager_create_element_returned_null;
public static String EditorManager_wrong_createElement_result;
public static String EditorManager_backgroundSaveJobName;
+ public static String EditorManager_resourceNotFound;
public static String EditorPane_pinEditor;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/messages.properties b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/messages.properties
index cba0c7d..cb226a8 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/messages.properties
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/messages.properties
@@ -593,6 +593,7 @@ EditorManager_invalid_editor_descriptor=Invalid editor descriptor for id {0}
EditorManager_problemsSavingEditors=Problems occurred saving editors.
EditorManager_unableToSaveEditor=Unable to save editor: {0}.
EditorManager_backgroundSaveJobName=Saving {0}
+EditorManager_resourceNotFound= The file does not exist.
EditorPane_pinEditor=&Pin Editor