1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

- Prevent NPE opening Workspace resource selection dialog when path text doesn't resolve to workspace.

- Initial path shouldn't be null.
This commit is contained in:
James Blackburn 2009-11-11 14:45:17 +00:00
parent 8370802243
commit 6bfe13ffa0

View file

@ -220,8 +220,8 @@ public class FileListControl {
if (!"".equals(value)) { //$NON-NLS-1$ if (!"".equals(value)) { //$NON-NLS-1$
IResource rs[] = ResourcesPlugin.getWorkspace().getRoot().findContainersForLocationURI(URIUtil.toURI(value)); IResource rs[] = ResourcesPlugin.getWorkspace().getRoot().findContainersForLocationURI(URIUtil.toURI(value));
if (rs == null || rs.length == 0) if (rs == null || rs.length == 0)
resource = ResourceLookup.selectFileForLocation(path, null); resource = ResourceLookup.selectFileForLocation(new Path(value), null);
if (rs != null && rs.length > 0) else
resource = rs[0]; resource = rs[0];
} }
} catch (CdtVariableException e) { } catch (CdtVariableException e) {
@ -467,7 +467,7 @@ public class FileListControl {
// The type of browse support that is required // The type of browse support that is required
private int browseType; private int browseType;
/** The base path that should be used when adding new resources */ /** The base path that should be used when adding new resources */
private IPath path; private IPath path = new Path(""); //$NON-NLS-1$
/* Workspace support */ /* Workspace support */
private boolean fWorkspaceSupport = false; private boolean fWorkspaceSupport = false;
@ -987,18 +987,18 @@ public class FileListControl {
private String[] getNewInputObject() { private String[] getNewInputObject() {
// Create a dialog to prompt for a new list item // Create a dialog to prompt for a new list item
String[] input = new String[0]; String[] input = new String[0];
String title = new String(); String title = ""; //$NON-NLS-1$
String message = new String(); String message = ""; //$NON-NLS-1$
String initVal = new String(); String initVal = ""; //$NON-NLS-1$
if (browseType == BROWSE_DIR) { if (browseType == BROWSE_DIR) {
title = DIR_TITLE_ADD; title = DIR_TITLE_ADD;
message = DIR_MSG; message = DIR_MSG;
initVal = (path == null ? initVal : path.toString()); initVal = path.toString();
} else if (browseType == BROWSE_FILE) { } else if (browseType == BROWSE_FILE) {
title = FILE_TITLE_ADD; title = FILE_TITLE_ADD;
message = FILE_MSG; message = FILE_MSG;
initVal = (path == null ? initVal : path.toString()); initVal = path.toString();
} else { } else {
title = TITLE; title = TITLE;
message = compTitle; message = compTitle;