mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-02 05:45:58 +02:00
Added path validation to CDirectorySourceContainerDialog.
This commit is contained in:
parent
0fedc36b90
commit
301b9f9cc3
3 changed files with 41 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2005-04-27 Mikhail Khodjaiants
|
||||||
|
Added path validation to CDirectorySourceContainerDialog.
|
||||||
|
* CDirectorySourceContainerDialog.java
|
||||||
|
* SourceLookupUIMessages.properties
|
||||||
|
|
||||||
2005-04-25 Mikhail Khodjaiants
|
2005-04-25 Mikhail Khodjaiants
|
||||||
Added the new source container type (CDirectorySourceContainer) to provide
|
Added the new source container type (CDirectorySourceContainer) to provide
|
||||||
the UI support for the subfolders search.
|
the UI support for the subfolders search.
|
||||||
|
|
|
@ -27,6 +27,7 @@ import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.graphics.Font;
|
import org.eclipse.swt.graphics.Font;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
|
import org.eclipse.swt.widgets.Button;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Control;
|
import org.eclipse.swt.widgets.Control;
|
||||||
import org.eclipse.swt.widgets.DirectoryDialog;
|
import org.eclipse.swt.widgets.DirectoryDialog;
|
||||||
|
@ -71,8 +72,7 @@ public class CDirectorySourceContainerDialog extends TitleAreaDialog {
|
||||||
new IDialogFieldListener() {
|
new IDialogFieldListener() {
|
||||||
|
|
||||||
public void dialogFieldChanged( DialogField field ) {
|
public void dialogFieldChanged( DialogField field ) {
|
||||||
// TODO Auto-generated method stub
|
update();
|
||||||
|
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
@ -155,4 +155,34 @@ public class CDirectorySourceContainerDialog extends TitleAreaDialog {
|
||||||
fDirectoryField.setText( getDirectory().getPath() );
|
fDirectoryField.setText( getDirectory().getPath() );
|
||||||
fSubfoldersField.setSelection( isSearchSubfolders() );
|
fSubfoldersField.setSelection( isSearchSubfolders() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void update() {
|
||||||
|
boolean isOk = updateErrorMessage();
|
||||||
|
Button ok = getButton( IDialogConstants.OK_ID );
|
||||||
|
if ( ok != null )
|
||||||
|
ok.setEnabled( isOk );
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean updateErrorMessage() {
|
||||||
|
setErrorMessage( null );
|
||||||
|
String text = fDirectoryField.getText().trim();
|
||||||
|
if ( text.length() == 0 ) {
|
||||||
|
setErrorMessage( SourceLookupUIMessages.getString ( "CDirectorySourceContainerDialog.5" ) ); //$NON-NLS-1$
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
File file = new File( text );
|
||||||
|
if ( !file.exists() ) {
|
||||||
|
setErrorMessage( SourceLookupUIMessages.getString ( "CDirectorySourceContainerDialog.6" ) ); //$NON-NLS-1$
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ( !file.isDirectory() ) {
|
||||||
|
setErrorMessage( SourceLookupUIMessages.getString ( "CDirectorySourceContainerDialog.7" ) ); //$NON-NLS-1$
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ( !file.isAbsolute() ) {
|
||||||
|
setErrorMessage( SourceLookupUIMessages.getString ( "CDirectorySourceContainerDialog.8" ) ); //$NON-NLS-1$
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,3 +29,7 @@ CDirectorySourceContainerDialog.1=&Browse...
|
||||||
CDirectorySourceContainerDialog.2=Search sub&folders
|
CDirectorySourceContainerDialog.2=Search sub&folders
|
||||||
CDirectorySourceContainerDialog.3=Choose directory to add:
|
CDirectorySourceContainerDialog.3=Choose directory to add:
|
||||||
CDirectorySourceContainerDialog.4=Directory Selection
|
CDirectorySourceContainerDialog.4=Directory Selection
|
||||||
|
CDirectorySourceContainerDialog.5=The directory path must not be empty
|
||||||
|
CDirectorySourceContainerDialog.6=The specified directory doesn't exist
|
||||||
|
CDirectorySourceContainerDialog.7=The specified path must be a directory
|
||||||
|
CDirectorySourceContainerDialog.8=The specified path must be absolute
|
||||||
|
|
Loading…
Add table
Reference in a new issue