From 8d7ce65414a6a84bbd553ab4411e6970746bdd85 Mon Sep 17 00:00:00 2001 From: Tobias Schwarz Date: Wed, 25 Sep 2013 09:35:40 +0200 Subject: Target Explorer: fix open dialog on not existing directory --- .../src/org/eclipse/tcf/te/ui/controls/file/FileSelectionControl.java | 3 +++ 1 file changed, 3 insertions(+) (limited to 'target_explorer') diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/file/FileSelectionControl.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/file/FileSelectionControl.java index 040f92f5c..2727f5d14 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/file/FileSelectionControl.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/file/FileSelectionControl.java @@ -135,6 +135,9 @@ public class FileSelectionControl extends BaseDialogSelectionControl { IPath filePath = new Path(selectedFile); // If the selected file points to an directory, use the directory as is IPath filterPath = filePath.toFile().isDirectory() ? filePath : filePath.removeLastSegments(1); + while (filterPath != null && filterPath.segmentCount() > 1 && !filterPath.toFile().exists()) { + filterPath = filterPath.removeLastSegments(1); + } String filterFileName = filePath.toFile().isDirectory() || !filePath.toFile().exists() ? null : filePath.lastSegment(); if (!filterPath.isEmpty()) fileDialog.setFilterPath(filterPath.toString()); -- cgit v1.2.3