From b39c96b5b9ef219a62925929107ad06c6b1e8c74 Mon Sep 17 00:00:00 2001 From: Andrey Loskutov Date: Wed, 13 Jan 2016 14:14:12 +0100 Subject: Bug 485746 - "Save As" for external files does not work as expected Filter path for the FileDialog must be a directory, not the file path. Change-Id: Ia78fe8e561bdc672b7f3115b11a2130f98582625 Signed-off-by: Andrey Loskutov --- .../src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java index d08346b7163..0545ac4de17 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2016 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -1502,9 +1502,9 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor { if (input instanceof IURIEditorInput && !(input instanceof IFileEditorInput)) { FileDialog dialog= new FileDialog(shell, SWT.SAVE); IPath oldPath= URIUtil.toPath(((IURIEditorInput)input).getURI()); - if (oldPath != null) { + if (oldPath != null && !oldPath.isEmpty()) { dialog.setFileName(oldPath.lastSegment()); - dialog.setFilterPath(oldPath.toOSString()); + dialog.setFilterPath(oldPath.removeLastSegments(1).toOSString()); } String path= dialog.open(); -- cgit v1.2.3