if calling excel import on a taxonnode this is used as parent taxon
authorKatja Luther <k.luther@bgbm.org>
Sun, 4 Sep 2016 19:02:47 +0000 (21:02 +0200)
committerKatja Luther <k.luther@bgbm.org>
Sun, 4 Sep 2016 19:03:17 +0000 (21:03 +0200)
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/ChecklistEditor.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/ExcelNormalExplicitTaxaImportWizard.java

index 6f4d65b2804533a3dcd55abf17b260e83bd79f4d..992f9d285c1976bc81f07531a1c8fcd4f00505aa 100644 (file)
@@ -73,6 +73,7 @@ import eu.etaxonomy.taxeditor.model.IContextListener;
 import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
 import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
 import eu.etaxonomy.taxeditor.model.IPartContentHasFactualData;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.preference.Resources;
 import eu.etaxonomy.taxeditor.store.CdmStore;
@@ -228,6 +229,12 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I
         viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
         labelProvider = new ChecklistLabelProvider(this.viewer);
         terms = labelProvider.getNamedAreas();
+        if (terms == null){
+                       MessagingUtils.informationDialog("No Areas to display", "Please choose the areas you want to display. "
+                                       + "Therefore go to the preferences, choose the Checklist Editor and choose the areas in the Distribution Selection Wizard.");
+                       this.dispose();
+                       return;
+               }
         filter = new ChecklistEditorFilter();
         createTopComposite(parent);
         loadDataInput();
@@ -303,6 +310,7 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I
 
        private void createToolbarItems() {
                dropListener = new ChecklistDropdownSelectionListener(toolItem, this, terms);
+               
         for (DefinedTermBase<DefinedTermBase> term : terms) {
             if(term!=null){
                 dropListener.add(term);
index f6d43baf8a87ad54781bc3133d77849036a302b3..cd6b6800381979f1683b86666eeebbc621134cd0 100644 (file)
@@ -15,11 +15,13 @@ import java.net.URI;
 
 import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreeSelection;
 import org.eclipse.ui.IWorkbench;
 
 import eu.etaxonomy.cdm.database.DbSchemaValidation;
 import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE;
 import eu.etaxonomy.cdm.io.excel.taxa.NormalExplicitImportConfigurator;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 
 
@@ -74,6 +76,11 @@ public class ExcelNormalExplicitTaxaImportWizard extends AbstractImportWizard<No
     public void init(IWorkbench workbench, IStructuredSelection selection) {
                super.init(workbench, selection);
                configurator =  CdmStore.getImportManager().NormalExplicitConfigurator();
+               if (selection instanceof TreeSelection && !selection.isEmpty()){
+                       TaxonNode node = (TaxonNode)selection.getFirstElement();
+                       configurator.setParentUUID(node.getTaxon().getUuid());
+                       configurator.setClassificationUuid(node.getClassification().getUuid());
+               }
        }
 
        /* (non-Javadoc)