Project

General

Profile

« Previous | Next » 

Revision a3e8d11d

Added by Katja Luther over 3 years ago

ref #8774: show which terms are duplicates in dialog

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/handler/AbstractAddFeatureHandler.java
8 8
*/
9 9
package eu.etaxonomy.taxeditor.featuretree.e4.handler;
10 10

  
11
import java.util.ArrayList;
11 12
import java.util.Collection;
13
import java.util.List;
12 14

  
13 15
import javax.inject.Named;
14 16

  
......
63 65

  
64 66
        if (dialog.open() == IStatus.OK) {
65 67
            Collection<DefinedTermBase> additionalTerms = wizard.getAdditionalFeatures();
68
            List<DefinedTermBase> duplicates = new ArrayList<>();
66 69
            for (DefinedTermBase term : additionalTerms) {
67 70

  
71
                boolean isDuplicate = false;
68 72
                if (!parent.getTree().isAllowDuplicate()){
69
                    boolean isDuplicate = editor.checkDuplicates(term.getUuid(), parent.getTree().getUuid());
73
                    isDuplicate = editor.checkDuplicates(term.getUuid(), parent.getTree().getUuid());
70 74
                    if (isDuplicate){
71
                        MessagingUtils.informationDialog(Messages.AddFeatureHandler_Duplicates_not_allowed, Messages.AddFeatureHandler_Duplicates_not_allowed_message);
72
                        return;
75
                        duplicates.add(term);
73 76
                    }
74 77
                }
75

  
78
                if (isDuplicate){
79
                    continue;
80
                }
76 81
                AddFeatureOperation operation = new AddFeatureOperation(term.getUuid(), parent, editor, editor);
77 82
//                AbstractUtility.executeOperation(operation, sync);
78 83
                editor.addOperation(operation);
......
93 98
                    ((AbstractTermTreeEditor)editor).getViewer().setExpandedElements(expandedElements);
94 99
                }
95 100
            }
101
            if (!duplicates.isEmpty()){
102
                String termsTitles = "";
103
                for (DefinedTermBase term: duplicates){
104
                    termsTitles = termsTitles + term.getTitleCache() +"\n";
105
                }
106
                MessagingUtils.informationDialog(Messages.AddFeatureHandler_Duplicates_not_allowed, Messages.AddFeatureHandler_Duplicates_not_allowed_message +  "\n"+termsTitles);
107
            }
96 108
        }
97 109
    }
98 110

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages.properties
307 307
FeatureTreeSelectionDialog_TREE_LABEL=Term tree label
308 308

  
309 309
AddFeatureHandler_Duplicates_not_allowed=No duplicates allowed
310
AddFeatureHandler_Duplicates_not_allowed_message=This term tree does not allow duplicates and there exist a node with this term already.
310
AddFeatureHandler_Duplicates_not_allowed_message=This term tree does not allow duplicates and there exist nodes with following terms:
311 311

  
312 312
NonViralNameDetails_confirmDeleteOfZoologicalNameParts=The publication and original publication year needs to be removed
313 313
NonViralNameDetails_descriptionDeleteZoologicalNameParts=If you click Yes, the original publication and publication year is removed and the nomenclatural code is changed.
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages_de.properties
307 307
FeatureTreeSelectionDialog_TREE_LABEL=Termbaumname
308 308

  
309 309
AddFeatureHandler_Duplicates_not_allowed=Keine Duplikate erlaubt
310
AddFeatureHandler_Duplicates_not_allowed_message=Der Termbaum erlaubt keine Duplikate und f?r diesen Term existiert bereits ein Knoten.
310
AddFeatureHandler_Duplicates_not_allowed_message=Der Termbaum erlaubt keine Duplikate und f?r folgende Terme existieren bereits Knoten:
311 311

  
312 312
NonViralNameDetails_confirmDeleteOfZoologicalNameParts=Breed, Publication Date und Original Publication Date m?ssen entfernt werden.
313 313
NonViralNameDetails_descriptionDeleteZoologicalNameParts=Best?tigen Sie, wenn Sie Breed, Publication Date und Original Publication Date l?schen und den Nomenklatorischen Code des Namens ?ndern wollen.

Also available in: Unified diff