Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormvanmeek2004-03-10 21:42:34 +0000
committermvanmeek2004-03-10 21:42:34 +0000
commit6019566ce54f285f59f3de522b660eecfa74c3b6 (patch)
tree097476260cce8f88eca1c29d753e7656c846f5f8 /org.eclipse.ui.editors
parent95287a28c13d1bebb66fbb7d08afe092aefdc804 (diff)
downloadeclipse.platform.text-6019566ce54f285f59f3de522b660eecfa74c3b6.tar.gz
eclipse.platform.text-6019566ce54f285f59f3de522b660eecfa74c3b6.tar.xz
eclipse.platform.text-6019566ce54f285f59f3de522b660eecfa74c3b6.zip
fix for bug 51146 (no info when file not found)
Diffstat (limited to 'org.eclipse.ui.editors')
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/OpenExternalFileAction.java12
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.properties3
2 files changed, 12 insertions, 3 deletions
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/OpenExternalFileAction.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/OpenExternalFileAction.java
index 34761344b..2b47a1cdb 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/OpenExternalFileAction.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/OpenExternalFileAction.java
@@ -11,6 +11,7 @@ Contributors:
package org.eclipse.ui.internal.editors.text;
import java.io.File;
+import java.text.MessageFormat;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IWorkspace;
@@ -23,6 +24,7 @@ import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.window.Window;
@@ -94,7 +96,7 @@ public class OpenExternalFileAction extends Action implements IWorkbenchWindowAc
FileDialog dialog= new FileDialog(fWindow.getShell(), SWT.OPEN);
dialog.setText(TextEditorMessages.getString("OpenExternalFileAction.dialog.text")); //$NON-NLS-1$
String path= dialog.open();
- if (path != null)
+ if (path != null && path.length() > 0)
return new File(path);
return null;
}
@@ -113,6 +115,10 @@ public class OpenExternalFileAction extends Action implements IWorkbenchWindowAc
} catch (PartInitException e) {
e.printStackTrace();
}
+ } else if (file != null) {
+ String msgFmt = TextEditorMessages.getString("OpenExternalFileAction.FileNotFound"); //$NON-NLS-1$
+ String msg = MessageFormat.format(msgFmt, new String[] {file.getName()});
+ MessageDialog.openWarning(fWindow.getShell(), TextEditorMessages.getString("OpenExternalFileAction.dialog.text"), msg); //$NON-NLS-1$
}
}
@@ -146,8 +152,8 @@ public class OpenExternalFileAction extends Action implements IWorkbenchWindowAc
private IFile selectWorkspaceFile(IFile[] files) {
ElementListSelectionDialog dialog= new ElementListSelectionDialog(fWindow.getShell(), new FileLabelProvider());
dialog.setElements(files);
- dialog.setTitle("Select Workspace File");
- dialog.setMessage("The selected file is referenced by multiple linked resources in the workspace.\nPlease select the workspace resource you want to use to open the file.");
+ dialog.setTitle(TextEditorMessages.getString("OpenExternalFileAction.SelectWorkspaceFile")); //$NON-NLS-1$
+ dialog.setMessage(TextEditorMessages.getString("OpenExternalFileAction.FileLinkedtoMultiple")); //$NON-NLS-1$
if (dialog.open() == Window.OK)
return (IFile) dialog.getFirstResult();
return null;
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.properties b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.properties
index 2f8f97208..791596570 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.properties
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.properties
@@ -55,3 +55,6 @@ TextEditorPreferencePage.quickdiff.defaultlabel= (default)
TextEditorPreferencePage.quickDiffCharacterMode= Show changes using &characters instead of colors (on line number bar only)
OpenExternalFileAction.dialog.text=Open External File
+OpenExternalFileAction.FileNotFound={0}\nFile not found.
+OpenExternalFileAction.SelectWorkspaceFile=Select Workspace File
+OpenExternalFileAction.FileLinkedtoMultiple=The selected file is referenced by multiple linked resources in the workspace.\nPlease select the workspace resource you want to use to open the file.

Back to the top