diff options
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 34761344be8..2b47a1cdbed 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 2f8f972082c..791596570e5 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. |