- fixed NPE
authorPatric Plitzner <p.plitzner@bgbm.org>
Tue, 19 Nov 2013 14:52:52 +0000 (14:52 +0000)
committerPatric Plitzner <p.plitzner@bgbm.org>
Tue, 19 Nov 2013 14:52:52 +0000 (14:52 +0000)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/ImportFromFileDataSourceWizardPage.java

index d4af38729c2bd5964bee54941c2ab5eecb782f1e..7b585050d5e55eeddbbca9a357907b1aa06c3aee 100644 (file)
@@ -1,9 +1,9 @@
 // $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.
 */
@@ -33,7 +33,7 @@ import org.eclipse.swt.widgets.Text;
  * @version 1.0
  */
 public class ImportFromFileDataSourceWizardPage extends WizardPage {
-       
+
        /** Constant <code>PAGE_NAME="CdmXmlDataSourceWizardPage"</code> */
        public static final String PAGE_NAME = "CdmXmlDataSourceWizardPage";
 
@@ -42,8 +42,8 @@ public class ImportFromFileDataSourceWizardPage extends WizardPage {
        private FileDialog fileDialog;
 
        private Text text_file;
-       
-       
+
+
        /**
         * <p>Constructor for ImportFromFileDataSourceWizardPage.</p>
         *
@@ -53,14 +53,14 @@ public class ImportFromFileDataSourceWizardPage extends WizardPage {
         */
        protected ImportFromFileDataSourceWizardPage(String title, String description, String[] extensions) {
                super(PAGE_NAME);
-               
+
                setTitle(title);
-               
+
                setDescription(description);
-               
+
                this.extensions = extensions;
        }
-       
+
        /**
         * <p>XML</p>
         *
@@ -76,30 +76,31 @@ public class ImportFromFileDataSourceWizardPage extends WizardPage {
         * @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)
@@ -108,12 +109,14 @@ public class ImportFromFileDataSourceWizardPage extends WizardPage {
                        @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);
        }