From: Patric Plitzner Date: Tue, 19 Nov 2013 14:52:52 +0000 (+0000) Subject: - fixed NPE X-Git-Tag: 3.6.0~870 X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/commitdiff_plain/650cafb4ef730f5307d658729cdae4d5a0602868 - fixed NPE --- diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/ImportFromFileDataSourceWizardPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/ImportFromFileDataSourceWizardPage.java index d4af38729..7b585050d 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/ImportFromFileDataSourceWizardPage.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/ImportFromFileDataSourceWizardPage.java @@ -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 PAGE_NAME="CdmXmlDataSourceWizardPage" */ public static final String PAGE_NAME = "CdmXmlDataSourceWizardPage"; @@ -42,8 +42,8 @@ public class ImportFromFileDataSourceWizardPage extends WizardPage { private FileDialog fileDialog; private Text text_file; - - + + /** *

Constructor for ImportFromFileDataSourceWizardPage.

* @@ -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; } - + /** *

XML

* @@ -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); }