Bug 577289 - don't fail during editor detection
Let "default" open workflow continue, even if the editor input points to
non existing file.
Change-Id: I2b0726f3abd0cafb121fbf6694bdb761cf249302
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Reviewed-on: https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/189804
Reviewed-by: Simeon Andreev <simeon.danailov.andreev@gmail.com>
Tested-by: Platform Bot <platform-bot@eclipse.org>
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LargeFileLimitsPreferenceHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LargeFileLimitsPreferenceHandler.java
index ba1fb9a..2ee599d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LargeFileLimitsPreferenceHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LargeFileLimitsPreferenceHandler.java
@@ -22,6 +22,7 @@
import java.util.Map;
import java.util.Optional;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.DialogSettings;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.preference.IPreferenceStore;
@@ -213,8 +214,15 @@
Optional<String> getEditorForInput(IEditorInput editorInput) {
if (editorInput instanceof IPathEditorInput) {
IPathEditorInput pathEditorInput = (IPathEditorInput) editorInput;
- IPath inputPath = pathEditorInput.getPath();
- return getEditorForPath(inputPath);
+ try {
+ IPath inputPath = pathEditorInput.getPath();
+ return getEditorForPath(inputPath);
+ } catch (Exception e) {
+ // Path does not exist?
+ Status warning = Status
+ .warning("Exception occurred while checking large file editor for " + editorInput, e); //$NON-NLS-1$
+ WorkbenchPlugin.log(warning);
+ }
}
return Optional.empty();
}