diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractCPropertyTab.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractCPropertyTab.java index 5b6aa42fb2e..657af281ad4 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractCPropertyTab.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractCPropertyTab.java @@ -94,6 +94,7 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab { public static final String WORKSPACE_DIR_DIALOG_MSG = NewUIMessages.getResourceString("BrowseEntryDialog.wsp.dir.dlg.msg"); //$NON-NLS-1$ public static final String WORKSPACE_FILE_DIALOG_MSG = NewUIMessages.getResourceString("BrowseEntryDialog.wsp.file.dlg.msg"); //$NON-NLS-1$ public static final String WORKSPACE_FILE_DIALOG_ERR = NewUIMessages.getResourceString("BrowseEntryDialog.wsp.file.dlg.err"); //$NON-NLS-1$ + public static final String WORKSPACE_DIR_DIALOG_ERR = NewUIMessages.getResourceString("BrowseEntryDialog.wsp.dir.dlg.err"); //$NON-NLS-1$ protected Composite usercomp; // space where user can create widgets protected Composite buttoncomp; // space for buttons on the right @@ -408,6 +409,15 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab { container = cs[0]; } dialog.setInitialSelection(container); + dialog.setValidator(new ISelectionStatusValidator() { + public IStatus validate(Object[] selection) { + if (selection != null) + if (selection.length > 0) + if ((selection[0] instanceof IFile)) + return new StatusInfo(IStatus.ERROR, WORKSPACE_DIR_DIALOG_ERR); + return new StatusInfo(); + } + }); dialog.setTitle(WORKSPACE_DIR_DIALOG_TITLE); dialog.setMessage(WORKSPACE_DIR_DIALOG_MSG); } else { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/PluginResources.properties b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/PluginResources.properties index 3e7d2a12db7..4b0abb9f176 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/PluginResources.properties +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/PluginResources.properties @@ -280,6 +280,7 @@ BrowseEntryDialog.wsp.file.dlg.title=File selection BrowseEntryDialog.wsp.dir.dlg.msg=Select a folder from workspace: BrowseEntryDialog.wsp.file.dlg.msg=Select a file from workspace: BrowseEntryDialog.wsp.file.dlg.err=The selected element is not a file. +BrowseEntryDialog.wsp.dir.dlg.err=The selected element is not a directory. BrowseEntryDialog.fs.dir.dlg.msg=Select a folder from file system: # ----------- New Configuration -----------