// $Id$
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
* @version 1.0
*/
public class ImportFromFileDataSourceWizardPage extends WizardPage {
-
+
/** Constant <code>PAGE_NAME="CdmXmlDataSourceWizardPage"</code> */
public static final String PAGE_NAME = "CdmXmlDataSourceWizardPage";
private FileDialog fileDialog;
private Text text_file;
-
-
+
+
/**
* <p>Constructor for ImportFromFileDataSourceWizardPage.</p>
*
*/
protected ImportFromFileDataSourceWizardPage(String title, String description, String[] extensions) {
super(PAGE_NAME);
-
+
setTitle(title);
-
+
setDescription(description);
-
+
this.extensions = extensions;
}
-
+
/**
* <p>XML</p>
*
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
*/
/** {@inheritDoc} */
- public void createControl(Composite parent) {
+ @Override
+ public void createControl(Composite parent) {
final Composite composite = new Composite(parent, SWT.NULL);
-
+
setPageComplete(false);
-
+
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 3;
composite.setLayout(gridLayout);
-
+
Label folderLabel = new Label(composite, SWT.NONE);
folderLabel.setText("File");
-
+
fileDialog = new FileDialog(parent.getShell());
-
+
fileDialog.setFilterExtensions(extensions);
-
+
text_file = new Text(composite, SWT.BORDER);
text_file.setEditable(false);
text_file.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-
+
Button button = new Button(composite, SWT.PUSH);
button.setText("Browse...");
-
+
button.addSelectionListener(new SelectionAdapter(){
/* (non-Javadoc)
@Override
public void widgetSelected(SelectionEvent e) {
String path = fileDialog.open();
- text_file.setText(path);
- setPageComplete(true);
+ if(path!=null){
+ text_file.setText(path);
+ setPageComplete(true);
+ }
}
-
+
});
-
+
setControl(composite);
}