From: Katja Luther Date: Fri, 27 Nov 2020 11:44:41 +0000 (+0100) Subject: ref #8774: show which terms are duplicates in dialog X-Git-Tag: 5.18.0~1^2~46 X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/commitdiff_plain/a3e8d11d9d9ded26045ebf13f8106c1ab68ce525 ref #8774: show which terms are duplicates in dialog --- diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/handler/AbstractAddFeatureHandler.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/handler/AbstractAddFeatureHandler.java index 7ee4c35d1..a74ff040e 100755 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/handler/AbstractAddFeatureHandler.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/handler/AbstractAddFeatureHandler.java @@ -8,7 +8,9 @@ */ package eu.etaxonomy.taxeditor.featuretree.e4.handler; +import java.util.ArrayList; import java.util.Collection; +import java.util.List; import javax.inject.Named; @@ -63,16 +65,19 @@ public abstract class AbstractAddFeatureHandler { if (dialog.open() == IStatus.OK) { Collection additionalTerms = wizard.getAdditionalFeatures(); + List duplicates = new ArrayList<>(); for (DefinedTermBase term : additionalTerms) { + boolean isDuplicate = false; if (!parent.getTree().isAllowDuplicate()){ - boolean isDuplicate = editor.checkDuplicates(term.getUuid(), parent.getTree().getUuid()); + isDuplicate = editor.checkDuplicates(term.getUuid(), parent.getTree().getUuid()); if (isDuplicate){ - MessagingUtils.informationDialog(Messages.AddFeatureHandler_Duplicates_not_allowed, Messages.AddFeatureHandler_Duplicates_not_allowed_message); - return; + duplicates.add(term); } } - + if (isDuplicate){ + continue; + } AddFeatureOperation operation = new AddFeatureOperation(term.getUuid(), parent, editor, editor); // AbstractUtility.executeOperation(operation, sync); editor.addOperation(operation); @@ -93,6 +98,13 @@ public abstract class AbstractAddFeatureHandler { ((AbstractTermTreeEditor)editor).getViewer().setExpandedElements(expandedElements); } } + if (!duplicates.isEmpty()){ + String termsTitles = ""; + for (DefinedTermBase term: duplicates){ + termsTitles = termsTitles + term.getTitleCache() +"\n"; + } + MessagingUtils.informationDialog(Messages.AddFeatureHandler_Duplicates_not_allowed, Messages.AddFeatureHandler_Duplicates_not_allowed_message + "\n"+termsTitles); + } } } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages.properties b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages.properties index 77da7a25f..40cc31d61 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages.properties +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages.properties @@ -307,7 +307,7 @@ FeatureTreeSelectionDialog_NEW_TREE=New Term tree FeatureTreeSelectionDialog_TREE_LABEL=Term tree label AddFeatureHandler_Duplicates_not_allowed=No duplicates allowed -AddFeatureHandler_Duplicates_not_allowed_message=This term tree does not allow duplicates and there exist a node with this term already. +AddFeatureHandler_Duplicates_not_allowed_message=This term tree does not allow duplicates and there exist nodes with following terms: NonViralNameDetails_confirmDeleteOfZoologicalNameParts=The publication and original publication year needs to be removed NonViralNameDetails_descriptionDeleteZoologicalNameParts=If you click Yes, the original publication and publication year is removed and the nomenclatural code is changed. diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages_de.properties b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages_de.properties index 3a0679513..c480aeba3 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages_de.properties +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages_de.properties @@ -307,7 +307,7 @@ FeatureTreeSelectionDialog_NEW_TREE=Neuer Termbaum FeatureTreeSelectionDialog_TREE_LABEL=Termbaumname AddFeatureHandler_Duplicates_not_allowed=Keine Duplikate erlaubt -AddFeatureHandler_Duplicates_not_allowed_message=Der Termbaum erlaubt keine Duplikate und für diesen Term existiert bereits ein Knoten. +AddFeatureHandler_Duplicates_not_allowed_message=Der Termbaum erlaubt keine Duplikate und für folgende Terme existieren bereits Knoten: NonViralNameDetails_confirmDeleteOfZoologicalNameParts=Breed, Publication Date und Original Publication Date müssen entfernt werden. NonViralNameDetails_descriptionDeleteZoologicalNameParts=Bestätigen Sie, wenn Sie Breed, Publication Date und Original Publication Date löschen und den Nomenklatorischen Code des Namens ändern wollen.