fixing #5324 and #5325
authorKatja Luther <k.luther@bgbm.org>
Tue, 13 Oct 2015 10:47:39 +0000 (12:47 +0200)
committerKatja Luther <k.luther@bgbm.org>
Tue, 13 Oct 2015 10:47:39 +0000 (12:47 +0200)
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientClassificationService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/MoveDescriptionElementsHandler.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/AbstractFilteredCdmResourceSelectionDialog.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/TaxonNodeSelectionDialog.java

index 585aab3fa0422aaf9dd12d88c1d613379a55428e..f9051e871d833b20795f36ed3fd5557b6fba29d0 100644 (file)
@@ -647,8 +647,8 @@ public class TransientClassificationService implements IClassificationService {
      * @see eu.etaxonomy.cdm.api.service.IClassificationService#getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(eu.etaxonomy.cdm.model.taxon.Classification)
      */
     @Override
-    public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(Classification classification) {
-        return defaultService.getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(classification);
+    public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(Classification classification, List<UUID> excludeTaxa) {
+        return defaultService.getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(classification, excludeTaxa);
     }
 
     /**
index fb450935f7bbb1e057eef5fb21bbec7756c249c1..459cd29bba13a3a685e091e2a81ab968f240ca69 100644 (file)
@@ -94,16 +94,19 @@ public class MoveDescriptionElementsHandler extends AbstractHandler implements I
                                excludeTaxa.add(actualTaxon.getUuid());
                        }
                        Classification classification = null;
+                       TaxonNode actualNode = null;
                        if (actualTaxon != null){
                            if (!actualTaxon.getTaxonNodes().isEmpty() && actualTaxon.getTaxonNodes().size() ==1){
-                               classification = actualTaxon.getTaxonNodes().iterator().next().getClassification();
+                               actualNode = actualTaxon.getTaxonNodes().iterator().next();
+                               classification = actualNode.getClassification();
+
                            }
                        }
                        TaxonNode newAcceptedTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event),
                                        editor.getConversationHolder(),
                                        "Choose the accepted taxon",
                                        excludeTaxa,
-                                       null,classification
+                                       null, classification
                                        );
                        if (newAcceptedTaxonNode != null){
                        Taxon targetTaxon = newAcceptedTaxonNode.getTaxon();
index 8bfa50dd67f542f256411f7858a241e01b48bfef..fba0ce6c3ee5ad90283aaea259c60e6070a82ad0 100644 (file)
@@ -91,7 +91,7 @@ public abstract class AbstractFilteredCdmResourceSelectionDialog<T extends ICdmB
                this.settings = settings;
 
                this.conversation = conversation;
-
+               this.cdmBaseToBeFiltered = cdmObject;
                Cursor cursor = shell.getCursor();
                shell.setCursor(shell.getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
                init();
@@ -223,7 +223,7 @@ public abstract class AbstractFilteredCdmResourceSelectionDialog<T extends ICdmB
        /** {@inheritDoc} */
        @Override
        public void refresh() {
-               //initModel();
+               initModel();
                filterExcludedObjects();
                super.refresh();
        }
index 24f6125eb59ee0f239bb50680f3930db4c7b9634..821fc8c5bd8377e720cf0f043061a73f9a1e1d0d 100644 (file)
@@ -49,6 +49,7 @@ public class TaxonNodeSelectionDialog extends AbstractFilteredCdmResourceSelecti
        private List<Classification> classifications;
 
        private Classification selectedClassification;
+       private final List<UUID> excludeTaxa;
 
        protected TaxonNodeSelectionDialog(Shell shell, ConversationHolder conversation, String title, List<UUID> excludeTaxa, boolean multi, TaxonNode node, Classification classification) {
                super(shell, conversation, title, multi, TaxonNodeSelectionDialog.class.getCanonicalName(), node);
@@ -57,10 +58,11 @@ public class TaxonNodeSelectionDialog extends AbstractFilteredCdmResourceSelecti
 
                setListLabelProvider(labelProvider);
                setDetailsLabelProvider(labelProvider);
-
+               this.excludeTaxa = excludeTaxa;
                if(classification != null){
                        selectedClassification = classification;
                }
+               initModel();
        }
 
        /** {@inheritDoc} */
@@ -134,10 +136,14 @@ public class TaxonNodeSelectionDialog extends AbstractFilteredCdmResourceSelecti
                     return o1.getTitleCache().compareTo(o2.getTitleCache());
                 }
             });
-                       selectedClassification = classifications.iterator().next();
+                       if (this.cdmBaseToBeFiltered == null){
+                           selectedClassification = classifications.iterator().next();
+                       } else {
+                           selectedClassification = this.cdmBaseToBeFiltered.getClassification();
+                       }
                }
 
-               model = CdmStore.getService(IClassificationService.class).getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(selectedClassification);
+               model = CdmStore.getService(IClassificationService.class).getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(selectedClassification, excludeTaxa);
        }
 
        /** {@inheritDoc} */