From a0fd70a09e044b451ee3d51f893600732b3e2c1a Mon Sep 17 00:00:00 2001 From: Alena Laskavaia Date: Thu, 15 Jan 2015 10:16:48 -0500 Subject: [PATCH] Bug 457590 - Workspace... button does not work in Library Path picker Change-Id: Idcb597b5d60494438b1a5f29f4efad00050acc06 Reviewed-on: https://git.eclipse.org/r/39671 Reviewed-by: Elena Laskavaia Tested-by: Elena Laskavaia --- .../cdt/utils/ui/controls/FileListControl.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/core/org.eclipse.cdt.ui/utils.ui/org/eclipse/cdt/utils/ui/controls/FileListControl.java b/core/org.eclipse.cdt.ui/utils.ui/org/eclipse/cdt/utils/ui/controls/FileListControl.java index 9b14233dd41..946dc31eccb 100644 --- a/core/org.eclipse.cdt.ui/utils.ui/org/eclipse/cdt/utils/ui/controls/FileListControl.java +++ b/core/org.eclipse.cdt.ui/utils.ui/org/eclipse/cdt/utils/ui/controls/FileListControl.java @@ -238,7 +238,7 @@ public class FileListControl { /* See if we can discover the project from the context * * and check whether the path must be resolved... */ IProject project = null; - IResource resource = null; + if(contextInfo != null) { try { // Try to find the project @@ -262,9 +262,15 @@ public class FileListControl { // ignore } } + IResource resource = null; if (!currentPathText.isEmpty()) { - IResource rs[] = ResourcesPlugin.getWorkspace().getRoot() - .findContainersForLocationURI(URIUtil.toURI(currentPathText)); + IResource rs[] = null; + try { + rs = ResourcesPlugin.getWorkspace().getRoot() + .findContainersForLocationURI(URIUtil.toURI(currentPathText)); + } catch (Exception e) { + // rs will be null here, exception is throw is path is not absolute + } if (rs == null || rs.length == 0) resource = ResourceLookup.selectFileForLocation(new Path(currentPathText), null);