1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Select only directories inside of workspace, when it's required.

This commit is contained in:
Oleg Krasilnikov 2007-02-26 14:34:23 +00:00
parent a2982222d3
commit ac5293488b
2 changed files with 11 additions and 0 deletions

View file

@ -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 {

View file

@ -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 -----------