Project

General

Profile

« Previous | Next » 

Revision 905236e8

Added by Katja Luther over 4 years ago

ref #8385: adapt strucutre of db prefs to local prefs

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/DynamicFeatureMenuE4.java
23 23
import org.eclipse.e4.ui.services.IServiceConstants;
24 24
import org.eclipse.jface.viewers.IStructuredSelection;
25 25

  
26
import eu.etaxonomy.cdm.api.service.IVocabularyService;
27 26
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
28 27
import eu.etaxonomy.cdm.model.common.Language;
29 28
import eu.etaxonomy.cdm.model.description.DescriptionBase;
......
33 32
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
34 33
import eu.etaxonomy.cdm.model.term.TermNode;
35 34
import eu.etaxonomy.cdm.model.term.TermTree;
36
import eu.etaxonomy.cdm.model.term.VocabularyEnum;
37 35
import eu.etaxonomy.taxeditor.editor.definedterm.input.TermEditorInput;
38 36
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
39 37
import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.CreateDescriptionElementOperation;
40 38
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
41 39
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
42
import eu.etaxonomy.taxeditor.store.CdmStore;
43 40

  
44 41
/**
45 42
 *
......
140 137
		    featureTree = TermEditorInput.getDefaultFeatureTree();
141 138
		}
142 139
		if (description instanceof TaxonNameDescription){
143
		    List<Feature> terms = CdmStore.getTermManager().getPreferredTerms(CdmStore.getService(IVocabularyService.class).load(VocabularyEnum.NameFeature.getUuid()));
144
		    terms.remove(Feature.PROTOLOGUE());
145
		    featureTree = TermTree.NewInstance(terms);
140
		    featureTree = TermEditorInput.getPreferredNameFeatureTree();
141

  
146 142
		}
147 143

  
148 144
		return featureTree;
eu.etaxonomy.taxeditor.store/plugin.xml
402 402
         id="eu.etaxonomy.taxeditor.preference.DebugPreferences"
403 403
         name="%page.name.34">
404 404
   </page>
405
   <page
406
            category="eu.etaxonomy.taxeditor.preferences.general"
407
            class="eu.etaxonomy.taxeditor.preference.AbcdImportPreference"
408
            id="eu.etaxonomy.taxeditor.store.abcdImportPreference"
409
            name="%page.name.40">
410
   </page>
411
   <page
412
         category="eu.etaxonomy.taxeditor.store.abcdImportPreference"
413
         class="eu.etaxonomy.taxeditor.preference.AbcdImportProvider"
414
         id="eu.etaxonomy.taxeditor.store.abcdImportProvider"
415
         name="%page.name.41">
416
   </page>
405 417
   <page
406 418
         class="eu.etaxonomy.taxeditor.preference.TaxonomicEditorGeneralPreferences"
407 419
         id="eu.etaxonomy.taxeditor.preferences.general"
......
474 486
         name="%page.name.8">
475 487
   </page>
476 488
   <page
477
         category="eu.etaxonomy.taxeditor.preferences.namePreferences"
489
         category="eu.etaxonomy.taxeditor.preferences.typeDesignation"
478 490
         class="eu.etaxonomy.taxeditor.preference.menu.SpecimenTypeDesignationStatusMenuPreferences"
479 491
         id="eu.etaxonomy.taxeditor.preferences.specimenTypeDesignationStatus"
480 492
         name="%page.name.9">
481 493
   </page>
482 494
   <page
483
         category="eu.etaxonomy.taxeditor.preferences.namePreferences"
495
         category="eu.etaxonomy.taxeditor.preferences.typeDesignation"
484 496
         class="eu.etaxonomy.taxeditor.preference.menu.NameTypeDesignationStatusMenuPreferences"
485 497
         id="eu.etaxonomy.taxeditor.preferences.nameTypeDesignationStatus"
486 498
         name="%page.name.13">
......
539 551
         id="eu.etaxonomy.taxeditor.preferences.matching.teamOrPerson"
540 552
         name="%page.name.18">
541 553
   </page>
542
   <page
554
   <!--  <page
543 555
         category="eu.etaxonomy.taxeditor.preferences.description"
544 556
         class="eu.etaxonomy.taxeditor.preference.menu.StageMenuPreferences"
545 557
         id="eu.etaxonomy.taxeditor.preferences.stage"
546 558
         name="%page.name.19">
547
   </page>
548
   <page
559
   </page>-->
560
  <!--  <page
549 561
         category="eu.etaxonomy.taxeditor.preferences.description"
550 562
         class="eu.etaxonomy.taxeditor.preference.menu.PreservationMethodMenuPreferences"
551 563
         id="eu.etaxonomy.taxeditor.preferences.preservationMethod"
552 564
         name="%page.name.20">
553
   </page>
565
   </page> -->
554 566
   <page
555 567
         category="eu.etaxonomy.taxeditor.preferences.description"
556 568
         class="eu.etaxonomy.taxeditor.preference.DefaultFeatureTreePreferenecs"
......
723 735
         id="eu.etaxonomy.taxeditor.store.distribution"
724 736
         name="%page.name.100">
725 737
   </page>-->
738
      <page
739
            category="eu.etaxonomy.taxeditor.preferences.general"
740
            class="eu.etaxonomy.taxeditor.preference.FactualDataPreference"
741
            id="eu.etaxonomy.taxeditor.preferences.description"
742
            name="%page.name.0">
743
      </page>
744
      <page
745
            category="eu.etaxonomy.taxeditor.preferences.description"
746
            class="eu.etaxonomy.taxeditor.preference.menu.FeatureMenuAdminPreferences"
747
            id="eu.etaxonomy.taxeditor.preferences.feature"
748
            name="%page.name.1">
749
      </page>
750
      <page
751
            category="eu.etaxonomy.taxeditor.preferences.description"
752
            class="eu.etaxonomy.taxeditor.preference.menu.NameFeatureMenuAdminPreferences"
753
            id="eu.etaxonomy.taxeditor.preferences.nameFeature"
754
            name="%page.name.59">
755
      </page>
756
      <page
757
            category="eu.etaxonomy.taxeditor.preferences.description"
758
            class="eu.etaxonomy.taxeditor.preference.menu.NamedAreaTypeMenuAdminPreferences"
759
            id="eu.etaxonomy.taxeditor.preferences.namedAreaType"
760
            name="%page.name.14">
761
      </page>
762
      <page
763
            category="eu.etaxonomy.taxeditor.preferences.description"
764
            class="eu.etaxonomy.taxeditor.preference.DefaultFeatureTreeAdminPreferenecs"
765
            id="eu.etaxonomy.taxeditor.preferences.defaultFeatureTreePreferenecs"
766
            name="%page.name.22">
767
      </page>
726 768
    <page 
727 769
         category="eu.etaxonomy.taxeditor.preferences.general"
728 770
         class="eu.etaxonomy.taxeditor.preference.DistributionGeneralPreference"
729 771
         id="eu.etaxonomy.taxeditor.store.Distribution"
730 772
         name="%page.name.104">
731 773
   </page>
774
   <page
775
         category="eu.etaxonomy.taxeditor.preferences.general"
776
         class="eu.etaxonomy.taxeditor.preference.SearchPreferences"
777
         id="eu.etaxonomy.taxeditor.preference.searchPreferences"
778
         name="%page.name.56">
779
   </page>
780
   <page
781
         category="eu.etaxonomy.taxeditor.preference.searchPreferences"
782
         class="eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.SearchDialogAdminPreferences"
783
         id="eu.etaxonomy.taxeditor.preferences.searchDialog"
784
         name="%page.name.48">
785
   </page>
786
   <page
787
         category="eu.etaxonomy.taxeditor.preferences.general"
788
         class="eu.etaxonomy.taxeditor.preference.NamePreferences"
789
         id="eu.etaxonomy.taxeditor.preferences.namePreferences"
790
         name="%page.name.51">
791
   </page>
732 792
   <page 
733 793
         category="eu.etaxonomy.taxeditor.store.Distribution"
734 794
         class="eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.ChecklistEditorGeneralAdminPreference"
......
743 803
   </page>
744 804
   <page
745 805
         category="eu.etaxonomy.taxeditor.store.abcdImportPreference"
746
         class="eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.AbcdImportProvider"
806
         class="eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.AbcdImportProviderAdminPreferencePage"
747 807
         id="eu.etaxonomy.taxeditor.store.abcdImportProvider"
748 808
         name="%page.name.41">
749 809
   </page>
......
771 831
         name="%page.name.46">
772 832
   </page>
773 833
    <page
774
        category="eu.etaxonomy.taxeditor.preferences.general"
834
          category="eu.etaxonomy.taxeditor.preferences.namePreferences"
775 835
         class="eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.RankAdminPreference"
776 836
         id="eu.etaxonomy.taxeditor.preferences.adminRankPreference"
777 837
         name="%page.name.5">
778 838
   </page>
779 839
   <page
780
        category="eu.etaxonomy.taxeditor.preferences.general"
840
         category="eu.etaxonomy.taxeditor.preferences.namePreferences"
781 841
         class="eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.NomenclaturalStatusTypeAdminPreference"
782 842
         id="eu.etaxonomy.taxeditor.preferences.adminNomenclaturalStatusTypePreference"
783 843
         name="%page.name.6">
784 844
   </page>
785 845
   <page
786
         category="eu.etaxonomy.taxeditor.preferences.general"
846
         category="eu.etaxonomy.taxeditor.preferences.namePreferences"
787 847
         class="eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.NomenclaturalCodePreferences"
788 848
         id="eu.etaxonomy.taxeditor.store.page2"
789 849
         name="%page.name.43">
790 850
   </page>
791 851
   <page
792 852
         category="eu.etaxonomy.taxeditor.preferences.general"
793
         class="eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.AbcdImportPreference"
853
         class="eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.AbcdImportAdminPreference"
794 854
         id="eu.etaxonomy.taxeditor.store.abcdImportPreference"
795 855
         name="%page.name.40">
796 856
   </page>
797 857
   <page
798
         category="eu.etaxonomy.taxeditor.preferences.general"
858
         category="eu.etaxonomy.taxeditor.preferences.namePreferences"
799 859
         class="eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.NameDetailsViewAdminConfiguration"
800 860
         id="eu.etaxonomy.taxeditor.store.scientificNameDetails"
801 861
         name="%page.name.61">
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/AbcdImportAdminPreference.java
1
/**
2
* Copyright (C) 2018 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.taxeditor.databaseAdmin.preferencePage;
10

  
11
import org.eclipse.swt.events.SelectionEvent;
12
import org.eclipse.swt.events.SelectionListener;
13

  
14
import eu.etaxonomy.cdm.api.application.ICdmRepository;
15
import eu.etaxonomy.cdm.api.service.IPreferenceService;
16
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
17
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
18
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
19
import eu.etaxonomy.cdm.model.metadata.PreferenceSubject;
20
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
21
import eu.etaxonomy.taxeditor.preference.AbcdImportPreference;
22
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
23
import eu.etaxonomy.taxeditor.store.CdmStore;
24

  
25
/**
26
 * @author k.luther
27
 * @since 23.03.2018
28
 *
29
 */
30
public class AbcdImportAdminPreference extends AbcdImportPreference implements IE4AdminPreferencePage, SelectionListener {
31

  
32
//    @Override
33
//    protected Control createContents(Composite parent) {
34
//        final Composite composite = new Composite(parent, SWT.NULL);
35
//
36
//        GridLayout gridLayout = new GridLayout();
37
//        composite.setLayout(gridLayout);
38
//        configurator = Abcd206ImportConfigurator.NewInstance(null,null);
39
//        ICdmRepository controller;
40
//        controller = CdmStore.getCurrentApplicationConfiguration();
41
//        PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.AbcdImportConfig);
42
//
43
//        if (controller == null){
44
//            return null;
45
//        }
46
//        preference = controller.getPreferenceService().find(key);
47
//
48
//        if (preference != null ){
49
//            allowOverride = preference.isAllowOverride();
50
//        }else{
51
//            preference = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AbcdImportConfig, configurator.toString());
52
//        }
53
//
54
//
55
//        //configurator = PreferencesUtil.getAbcdImportConfigurationPreference();
56
//        final CLabel description = new CLabel(composite, SWT.NULL);
57
//        description.setText(Messages.AbcdImportPreference_description);
58
//        checkBoxMediaSpecimen = new Button(composite, SWT.CHECK);
59
//        checkBoxMediaSpecimen.setSelection(configurator.isAddMediaAsMediaSpecimen());
60
//        checkBoxMediaSpecimen.setText(Messages.AbcdImportPreference_media_as_mediaSpecimen);
61
//        checkBoxMediaSpecimen
62
//                .setToolTipText(Messages.AbcdImportPreference_media_as_subUnit);
63
//        checkBoxMediaSpecimen.addSelectionListener(new SelectionAdapter() {
64
//            @Override
65
//            public void widgetSelected(SelectionEvent e) {
66
//                configurator.setAddMediaAsMediaSpecimen(!configurator.isAddMediaAsMediaSpecimen());
67
//                setApply(true);
68
//            }
69
//        });
70
//
71
//        checkBoxIgnoreExisting = new Button(composite, SWT.CHECK);
72
//        checkBoxIgnoreExisting.setSelection(configurator.isIgnoreImportOfExistingSpecimen());
73
//        checkBoxIgnoreExisting.setText(Messages.AbcdImportPreference_not_import_existing_specimen);
74
//        checkBoxIgnoreExisting
75
//        .setToolTipText(Messages.AbcdImportPreference_not_import_existing_specimen_tooltip);
76
//        checkBoxIgnoreExisting.addSelectionListener(new SelectionAdapter() {
77
//            @Override
78
//            public void widgetSelected(SelectionEvent e) {
79
//                configurator.setIgnoreImportOfExistingSpecimen(!configurator.isIgnoreImportOfExistingSpecimen());
80
//                setApply(true);
81
//            }
82
//        });
83
//
84
//        checkBoxIgnoreAuthorship = new Button(composite, SWT.CHECK);
85
//        checkBoxIgnoreAuthorship.setSelection(configurator.isIgnoreAuthorship());
86
//        checkBoxIgnoreAuthorship.setText(Messages.AbcdImportPreference_ignore_author);
87
//        checkBoxIgnoreAuthorship
88
//        .setToolTipText(Messages.AbcdImportPreference_ignore_author_tooltip);
89
//        checkBoxIgnoreAuthorship.addSelectionListener(new SelectionAdapter() {
90
//            @Override
91
//            public void widgetSelected(SelectionEvent e) {
92
//                configurator.setIgnoreAuthorship(!configurator.isIgnoreAuthorship());
93
//                setApply(true);
94
//            }
95
//        });
96
//
97
//        checkBoxMapUnitIdToCatalogNumber = new Button(composite, SWT.RADIO);
98
//        checkBoxMapUnitIdToCatalogNumber.setSelection(configurator.isMapUnitIdToCatalogNumber());
99
//        checkBoxMapUnitIdToCatalogNumber.setText(Messages.AbcdImportPreference_map_unit_nr_catalog_number);
100
//        checkBoxMapUnitIdToCatalogNumber
101
//        .setToolTipText(Messages.AbcdImportPreference_map_unit_number_catalog_number_tooltip);
102
//        checkBoxMapUnitIdToCatalogNumber.addSelectionListener(new SelectionAdapter() {
103
//            @Override
104
//            public void widgetSelected(SelectionEvent e) {
105
//                configurator.setMapUnitIdToCatalogNumber(!configurator.isMapUnitIdToCatalogNumber());
106
//                setApply(true);
107
//            }
108
//        });
109
////TODO: only one of the mappings can be checked!
110
//        checkBoxMapUnitIdToAccessionNumber = new Button(composite, SWT.RADIO);
111
//        checkBoxMapUnitIdToAccessionNumber.setSelection(configurator.isMapUnitIdToAccessionNumber());
112
//        checkBoxMapUnitIdToAccessionNumber.setText(Messages.AbcdImportPreference_map_unit_number_to_accession_number);
113
//        checkBoxMapUnitIdToAccessionNumber
114
//        .setToolTipText(Messages.AbcdImportPreference_map_unit_number_accession_number_tooltip);
115
//        checkBoxMapUnitIdToAccessionNumber.addSelectionListener(new SelectionAdapter() {
116
//            @Override
117
//            public void widgetSelected(SelectionEvent e) {
118
//                configurator.setMapUnitIdToAccessionNumber(!configurator.isMapUnitIdToAccessionNumber());
119
//                setApply(true);
120
//            }
121
//        });
122
//
123
//        checkBoxMapUnitIdToBarcode = new Button(composite, SWT.RADIO);
124
//        checkBoxMapUnitIdToBarcode.setSelection(configurator.isMapUnitIdToBarcode());
125
//        checkBoxMapUnitIdToBarcode.setText(Messages.AbcdImportPreference_map_unit_number_barcode);
126
//        checkBoxMapUnitIdToBarcode
127
//        .setToolTipText(Messages.AbcdImportPreference_map_unit_number_barcode_tooltip);
128
//        checkBoxMapUnitIdToBarcode.addSelectionListener(new SelectionAdapter() {
129
//            @Override
130
//            public void widgetSelected(SelectionEvent e) {
131
//                configurator.setMapUnitIdToBarcode(!configurator.isMapUnitIdToBarcode());
132
//                setApply(true);
133
//            }
134
//        });
135
//
136
//        checkBoxRemoveCountry = new Button(composite, SWT.CHECK);
137
//        checkBoxRemoveCountry.setSelection(configurator.isRemoveCountryFromLocalityText());
138
//        checkBoxRemoveCountry.setText(Messages.AbcdImportPreference_remove_country_from_locality);
139
//        checkBoxRemoveCountry
140
//        .setToolTipText(Messages.AbcdImportPreference_remove_country_from_locality_tooltip);
141
//        checkBoxRemoveCountry.addSelectionListener(new SelectionAdapter() {
142
//            @Override
143
//            public void widgetSelected(SelectionEvent e) {
144
//                configurator.setRemoveCountryFromLocalityText(!configurator.isRemoveCountryFromLocalityText());
145
//                setApply(true);
146
//            }
147
//        });
148
//
149
//        checkBoxMoveToDefaultClassification = new Button(composite, SWT.CHECK);
150
//        checkBoxMoveToDefaultClassification.setSelection(configurator.isMoveNewTaxaToDefaultClassification());
151
//        checkBoxMoveToDefaultClassification.setText(Messages.AbcdImportPreference_create_new_classification_new_taxa);
152
//        checkBoxMoveToDefaultClassification
153
//        .setToolTipText(Messages.AbcdImportPreference_create_new_classification_new_taxa_tooltip);
154
//        checkBoxMoveToDefaultClassification.addSelectionListener(new SelectionAdapter() {
155
//            @Override
156
//            public void widgetSelected(SelectionEvent e) {
157
//                configurator.setMoveNewTaxaToDefaultClassification(!configurator.isMoveNewTaxaToDefaultClassification());
158
//                setApply(true);
159
//            }
160
//        });
161
//
162
//        checkBoxImportSiblings = new Button(composite, SWT.CHECK);
163
//        checkBoxImportSiblings.setSelection(configurator.isGetSiblings());
164
//        checkBoxImportSiblings.setText(Messages.AbcdImportPreference_import_all_children_for_cultures_or_tissues);
165
//        checkBoxImportSiblings
166
//            .setToolTipText(Messages.AbcdImportPreference_import_all_children_for_cultures_or_tissues_tooltip);
167
//        checkBoxImportSiblings.addSelectionListener(new SelectionAdapter() {
168
//            @Override
169
//            public void widgetSelected(SelectionEvent e) {
170
//                configurator.setGetSiblings(!configurator.isGetSiblings());
171
//                setApply(true);
172
//            }
173
//        });
174
//
175
//        checkBoxAddIndividualsAssociations = new Button(composite, SWT.CHECK);
176
//        checkBoxAddIndividualsAssociations.setSelection(configurator.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
177
//        checkBoxAddIndividualsAssociations.setText(Messages.AbcdImportPreference_create_Individual_Association);
178
//        checkBoxAddIndividualsAssociations
179
//            .setToolTipText(Messages.AbcdImportPreference_create_Individual_Association_tooltip);
180
//        checkBoxAddIndividualsAssociations.addSelectionListener(new SelectionAdapter() {
181
//            @Override
182
//            public void widgetSelected(SelectionEvent e) {
183
//                configurator.setAddIndividualsAssociationsSuchAsSpecimenAndObservations(!configurator.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
184
//                setApply(true);
185
//            }
186
//        });
187
//
188
//        checkBoxReuseDescriptiveGroups = new Button(composite, SWT.CHECK);
189
//        checkBoxReuseDescriptiveGroups.setSelection(configurator.isReuseExistingDescriptiveGroups());
190
//        checkBoxReuseDescriptiveGroups.setText(Messages.AbcdImportPreference_reuse_descriptive_group);
191
//        checkBoxReuseDescriptiveGroups
192
//            .setToolTipText(Messages.AbcdImportPreference_reuse_descriptive_group_tooltip);
193
//        checkBoxReuseDescriptiveGroups.addSelectionListener(new SelectionAdapter() {
194
//            @Override
195
//            public void widgetSelected(SelectionEvent e) {
196
//                configurator.setReuseExistingDescriptiveGroups(!configurator.isReuseExistingDescriptiveGroups());
197
//                setApply(true);
198
//            }
199
//        });
200
//
201
//        checkBoxReuseExistingTaxa = new Button(composite, SWT.CHECK);
202
//        checkBoxReuseExistingTaxa.setSelection(configurator.isReuseExistingTaxaWhenPossible());
203
//        checkBoxReuseExistingTaxa.setText(Messages.AbcdImportPreference_reuse_existing_taxa);
204
//        checkBoxReuseExistingTaxa
205
//            .setToolTipText(Messages.AbcdImportPreference_reuse_existing_taxa_tooltip);
206
//        checkBoxReuseExistingTaxa.addSelectionListener(new SelectionAdapter() {
207
//            @Override
208
//            public void widgetSelected(SelectionEvent e) {
209
//                configurator.setReuseExistingTaxaWhenPossible(!configurator.isReuseExistingTaxaWhenPossible());
210
//                setApply(true);
211
//            }
212
//        });
213
//
214
//        Label labelRef = new Label(composite, SWT.NONE);
215
//        labelRef.setText("Biocase provider for associated DNA");
216
//       // new Label(composite, SWT.NONE);
217
//        textDNAProviderString = new Text(composite, SWT.NONE);
218
//        textDNAProviderString.setEnabled(true);
219
//        textDNAProviderString.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true, 1, 1));
220
//        textDNAProviderString.setText(configurator.getDnaSoure().toString());
221
//        GridData gridData = new GridData();
222
//        gridData = new GridData(GridData.BEGINNING, GridData.CENTER, true, false);
223
//        gridData.horizontalIndent = 5;
224
////      classificationSelection.setLayoutData(gridData);
225
//        Label nomenclaturalCodeLabel = new Label(composite, SWT.NONE);
226
//        nomenclaturalCodeLabel.setText("Nomenclatural Code");
227
//        nomenclaturalCodeSelectionCombo = new Combo(composite, SWT.BORDER| SWT.READ_ONLY);
228
//        nomenclaturalCodeSelectionCombo.setLayoutData(gridData);
229
//
230
//        for(NomenclaturalCode code: NomenclaturalCode.values()){
231
//            nomenclaturalCodeSelectionCombo.add(code.getKey());
232
//        }
233
//        int index = 0;
234
//        if (configurator.getNomenclaturalCode() != null){
235
//            for (String label : nomenclaturalCodeSelectionCombo.getItems()){
236
//                if (label.equals(configurator.getNomenclaturalCode().getKey())){
237
//                    nomenclaturalCodeSelectionCombo.select(index);
238
//                }
239
//                index++;
240
//            }
241
//        }
242
//
243
//        // TODO remember last selection
244
//        nomenclaturalCodeSelectionCombo.addSelectionListener(this);
245
//        if (preference != null){
246
//            allowOverride = preference.isAllowOverride();
247
//        }
248
//        checkAllowOverride = new Button(composite, SWT.CHECK);
249
//        checkAllowOverride.setSelection(allowOverride);
250
//        checkAllowOverride.setText(Messages.AbcdImportPreference_allow_override);
251
//        checkAllowOverride
252
//            .setToolTipText(Messages.AbcdImportPreference_allow_override_tooltip);
253
//        checkAllowOverride.addSelectionListener(new SelectionAdapter() {
254
//            @Override
255
//            public void widgetSelected(SelectionEvent e) {
256
//                allowOverride = !allowOverride;
257
//                setApply(true);
258
//            }
259
//        });
260
//
261
//        return composite;
262
//    }
263

  
264
    @Override
265
    public void widgetSelected(SelectionEvent e) {
266
        this.configurator.setNomenclaturalCode(NomenclaturalCode.getByKey(nomenclaturalCodeSelectionCombo.getText()));
267
        setApply(true);
268
    }
269

  
270
    @Override
271
    public boolean performOk() {
272
        if (!isApply()){
273
            return true;
274
        }
275
        ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration();
276
        if (controller == null){
277
            return false;
278
        }
279
        IPreferenceService service = controller.getPreferenceService();
280
        if (configurator != null){
281
            String configString = configurator.toString();
282
            Abcd206ImportConfigurator defaultConfig = Abcd206ImportConfigurator.NewInstance(null,null);
283
            if (configString.equals(defaultConfig.toString())){
284
                configString = null;
285
            }
286
            CdmPreference pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AbcdImportConfig, configString);
287
            pref.setAllowOverride(allowOverride);
288

  
289

  
290
            service.set(pref);
291
            PreferencesUtil.updateDBPreferences();
292

  
293
        }
294
        if (preference == null){
295
            service.remove(CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.AbcdImportConfig));
296
        }
297
        return true;
298
    }
299

  
300
    /**
301
     * {@inheritDoc}
302
     */
303
    @Override
304
    public void widgetDefaultSelected(SelectionEvent e) {
305
        // TODO Auto-generated method stub
306

  
307
    }
308

  
309
    @Override
310
    protected void performDefaults() {
311
        configurator = Abcd206ImportConfigurator.NewInstance(null,null);
312
        preference = null;
313
        super.performDefaults();
314
    }
315

  
316
    @Override
317
    public void getValues() {
318
        super.getValues();
319
        isAdminPreference = true;
320
        configurator = PreferencesUtil.getDBAbcdImportConfigurationPreference();
321

  
322
    }
323

  
324
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/AbcdImportPreference.java
1
/**
2
* Copyright (C) 2018 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.taxeditor.databaseAdmin.preferencePage;
10

  
11
import java.net.URI;
12

  
13
import org.eclipse.swt.SWT;
14
import org.eclipse.swt.custom.CLabel;
15
import org.eclipse.swt.events.SelectionAdapter;
16
import org.eclipse.swt.events.SelectionEvent;
17
import org.eclipse.swt.events.SelectionListener;
18
import org.eclipse.swt.layout.GridData;
19
import org.eclipse.swt.layout.GridLayout;
20
import org.eclipse.swt.widgets.Button;
21
import org.eclipse.swt.widgets.Combo;
22
import org.eclipse.swt.widgets.Composite;
23
import org.eclipse.swt.widgets.Control;
24
import org.eclipse.swt.widgets.Label;
25
import org.eclipse.swt.widgets.Text;
26

  
27
import eu.etaxonomy.cdm.api.application.ICdmRepository;
28
import eu.etaxonomy.cdm.api.service.IPreferenceService;
29
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
30
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
31
import eu.etaxonomy.cdm.model.metadata.CdmPreference.PrefKey;
32
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
33
import eu.etaxonomy.cdm.model.metadata.PreferenceSubject;
34
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
35
import eu.etaxonomy.taxeditor.l10n.Messages;
36
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
37
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
38
import eu.etaxonomy.taxeditor.store.CdmStore;
39

  
40
/**
41
 * @author k.luther
42
 * @since 23.03.2018
43
 *
44
 */
45
public class AbcdImportPreference extends CdmPreferencePage implements IE4AdminPreferencePage, SelectionListener {
46

  
47
    private Abcd206ImportConfigurator configurator;
48

  
49
    private Combo nomenclaturalCodeSelectionCombo;
50

  
51
    private boolean allowOverride = true;
52
    private CdmPreference preference = null;
53
    Text textDNAProviderString;
54

  
55
    @Override
56
    protected Control createContents(Composite parent) {
57
        final Composite composite = new Composite(parent, SWT.NULL);
58

  
59
        GridLayout gridLayout = new GridLayout();
60
        composite.setLayout(gridLayout);
61
        configurator = Abcd206ImportConfigurator.NewInstance(null,null);
62
        ICdmRepository controller;
63
        controller = CdmStore.getCurrentApplicationConfiguration();
64
        PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.AbcdImportConfig);
65

  
66
        if (controller == null){
67
            return null;
68
        }
69
        preference = controller.getPreferenceService().find(key);
70

  
71
        if (preference != null ){
72
            allowOverride = preference.isAllowOverride();
73
        }else{
74
            preference = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AbcdImportConfig, configurator.toString());
75
        }
76

  
77
        if (preference != null){
78

  
79
            String configString = preference.getValue();
80
            if(configString!=null){
81
                String[] configArray = configString.split(";"); //$NON-NLS-1$
82

  
83
                for (String configItem: configArray){
84
                    String[] keyValue = configItem.split(":"); //$NON-NLS-1$
85
                    if(keyValue.length==2){
86
                        String keyString = keyValue[0];
87
                        String valueString = keyValue[1];
88
                        if (keyString.equals("ignoreImportOfExistingSpecimen")){ //$NON-NLS-1$
89
                            configurator.setIgnoreImportOfExistingSpecimen(Boolean.valueOf(valueString));
90
                        }else if (keyString.equals("addIndividualsAssociationsSuchAsSpecimenAndObservations")){ //$NON-NLS-1$
91
                            configurator.setAddIndividualsAssociationsSuchAsSpecimenAndObservations(Boolean.valueOf(valueString));
92
                        }else if (keyString.equals("reuseExistingTaxaWhenPossible")){ //$NON-NLS-1$
93
                            configurator.setReuseExistingTaxaWhenPossible(Boolean.valueOf(valueString));
94
                        }else if (keyString.equals("ignoreAuthorship")){ //$NON-NLS-1$
95
                            configurator.setIgnoreAuthorship(Boolean.valueOf(valueString));
96
                        }else if (keyString.equals("addMediaAsMediaSpecimen")){ //$NON-NLS-1$
97
                            configurator.setAddMediaAsMediaSpecimen(Boolean.valueOf(valueString));
98
                        }else if (keyString.equals("reuseExistingMetaData")){ //$NON-NLS-1$
99
                            configurator.setReuseExistingMetaData(Boolean.valueOf(valueString));
100
                        }else if (keyString.equals("reuseExistingDescriptiveGroups")){ //$NON-NLS-1$
101
                            configurator.setReuseExistingDescriptiveGroups(Boolean.valueOf(valueString));
102
                        }else if (keyString.equals("allowReuseOtherClassifications")){ //$NON-NLS-1$
103
                            configurator.setAllowReuseOtherClassifications(Boolean.valueOf(valueString));
104
                        }else if (keyString.equals("deduplicateReferences")){ //$NON-NLS-1$
105
                            configurator.setDeduplicateReferences(Boolean.valueOf(valueString));
106
                        }else if (keyString.equals("deduplicateClassifications")){ //$NON-NLS-1$
107
                            configurator.setDeduplicateClassifications(Boolean.valueOf(valueString));
108
                        }else if (keyString.equals("moveNewTaxaToDefaultClassification")){ //$NON-NLS-1$
109
                            configurator.setMoveNewTaxaToDefaultClassification(Boolean.valueOf(valueString));
110
                        }else if (keyString.equals("mapUnitIdToCatalogNumber")){ //$NON-NLS-1$
111
                            configurator.setMapUnitIdToCatalogNumber(Boolean.valueOf(valueString));
112
                        }else if (keyString.equals("mapUnitIdToAccessionNumber")){ //$NON-NLS-1$
113
                            configurator.setMapUnitIdToAccessionNumber(Boolean.valueOf(valueString));
114
                        }else if (keyString.equals("mapUnitIdToBarcode")){ //$NON-NLS-1$
115
                            configurator.setMapUnitIdToBarcode(Boolean.valueOf(valueString));
116
                        }else if (keyString.equals("overwriteExistingSpecimens")){ //$NON-NLS-1$
117
                            configurator.setOverwriteExistingSpecimens(Boolean.valueOf(valueString));
118
                        }else if (keyString.equals("nomenclaturalCode")){ //$NON-NLS-1$
119
                            configurator.setNomenclaturalCode(NomenclaturalCode.fromString(valueString));
120
                        }else if (keyString.equals("getSiblings")){ //$NON-NLS-1$
121
                            configurator.setGetSiblings(Boolean.valueOf(valueString));
122
                        }else if (keyString.equals("removeCountryFromLocalityText")){ //$NON-NLS-1$
123
                            configurator.setRemoveCountryFromLocalityText(Boolean.valueOf(valueString));
124
                        }else if (keyString.equals("dnaSource")){ //$NON-NLS-1$
125
                            configurator.setDnaSoure(URI.create(valueString));
126
                        }
127

  
128
                    }
129
                }
130
            }
131
        }
132

  
133

  
134
        //configurator = PreferencesUtil.getAbcdImportConfigurationPreference();
135
        final CLabel description = new CLabel(composite, SWT.NULL);
136
        description.setText(Messages.AbcdImportPreference_description);
137
        Button checkBoxMediaSpecimen = new Button(composite, SWT.CHECK);
138
        checkBoxMediaSpecimen.setSelection(configurator.isAddMediaAsMediaSpecimen());
139
        checkBoxMediaSpecimen.setText(Messages.AbcdImportPreference_media_as_mediaSpecimen);
140
        checkBoxMediaSpecimen
141
                .setToolTipText(Messages.AbcdImportPreference_media_as_subUnit);
142
        checkBoxMediaSpecimen.addSelectionListener(new SelectionAdapter() {
143
            @Override
144
            public void widgetSelected(SelectionEvent e) {
145
                configurator.setAddMediaAsMediaSpecimen(!configurator.isAddMediaAsMediaSpecimen());
146
                setApply(true);
147
            }
148
        });
149

  
150
        Button checkBoxIgnoreExisting = new Button(composite, SWT.CHECK);
151
        checkBoxIgnoreExisting.setSelection(configurator.isIgnoreImportOfExistingSpecimen());
152
        checkBoxIgnoreExisting.setText(Messages.AbcdImportPreference_not_import_existing_specimen);
153
        checkBoxIgnoreExisting
154
        .setToolTipText(Messages.AbcdImportPreference_not_import_existing_specimen_tooltip);
155
        checkBoxIgnoreExisting.addSelectionListener(new SelectionAdapter() {
156
            @Override
157
            public void widgetSelected(SelectionEvent e) {
158
                configurator.setIgnoreImportOfExistingSpecimen(!configurator.isIgnoreImportOfExistingSpecimen());
159
                setApply(true);
160
            }
161
        });
162

  
163
        Button checkBoxIgnoreAuthorship = new Button(composite, SWT.CHECK);
164
        checkBoxIgnoreAuthorship.setSelection(configurator.isIgnoreAuthorship());
165
        checkBoxIgnoreAuthorship.setText(Messages.AbcdImportPreference_ignore_author);
166
        checkBoxIgnoreAuthorship
167
        .setToolTipText(Messages.AbcdImportPreference_ignore_author_tooltip);
168
        checkBoxIgnoreAuthorship.addSelectionListener(new SelectionAdapter() {
169
            @Override
170
            public void widgetSelected(SelectionEvent e) {
171
                configurator.setIgnoreAuthorship(!configurator.isIgnoreAuthorship());
172
                setApply(true);
173
            }
174
        });
175

  
176
        Button checkBoxMapUnitIdToCatalogNumber = new Button(composite, SWT.CHECK);
177
        checkBoxMapUnitIdToCatalogNumber.setSelection(configurator.isMapUnitIdToCatalogNumber());
178
        checkBoxMapUnitIdToCatalogNumber.setText(Messages.AbcdImportPreference_map_unit_nr_catalog_number);
179
        checkBoxMapUnitIdToCatalogNumber
180
        .setToolTipText(Messages.AbcdImportPreference_map_unit_number_catalog_number_tooltip);
181
        checkBoxMapUnitIdToCatalogNumber.addSelectionListener(new SelectionAdapter() {
182
            @Override
183
            public void widgetSelected(SelectionEvent e) {
184
                configurator.setMapUnitIdToCatalogNumber(!configurator.isMapUnitIdToCatalogNumber());
185
                setApply(true);
186
            }
187
        });
188
//TODO: only one of the mappings can be checked!
189
        Button checkBoxMapUnitIdToAccessionNumber = new Button(composite, SWT.CHECK);
190
        checkBoxMapUnitIdToAccessionNumber.setSelection(configurator.isMapUnitIdToAccessionNumber());
191
        checkBoxMapUnitIdToAccessionNumber.setText(Messages.AbcdImportPreference_map_unit_number_to_accession_number);
192
        checkBoxMapUnitIdToAccessionNumber
193
        .setToolTipText(Messages.AbcdImportPreference_map_unit_number_accession_number_tooltip);
194
        checkBoxMapUnitIdToAccessionNumber.addSelectionListener(new SelectionAdapter() {
195
            @Override
196
            public void widgetSelected(SelectionEvent e) {
197
                configurator.setMapUnitIdToAccessionNumber(!configurator.isMapUnitIdToAccessionNumber());
198
                setApply(true);
199
            }
200
        });
201

  
202
        Button checkBoxMapUnitIdToBarcode = new Button(composite, SWT.CHECK);
203
        checkBoxMapUnitIdToBarcode.setSelection(configurator.isMapUnitIdToBarcode());
204
        checkBoxMapUnitIdToBarcode.setText(Messages.AbcdImportPreference_map_unit_number_barcode);
205
        checkBoxMapUnitIdToBarcode
206
        .setToolTipText(Messages.AbcdImportPreference_map_unit_number_barcode_tooltip);
207
        checkBoxMapUnitIdToBarcode.addSelectionListener(new SelectionAdapter() {
208
            @Override
209
            public void widgetSelected(SelectionEvent e) {
210
                configurator.setMapUnitIdToBarcode(!configurator.isMapUnitIdToBarcode());
211
                setApply(true);
212
            }
213
        });
214

  
215
        Button checkBoxRemoveCountry = new Button(composite, SWT.CHECK);
216
        checkBoxRemoveCountry.setSelection(configurator.isRemoveCountryFromLocalityText());
217
        checkBoxRemoveCountry.setText(Messages.AbcdImportPreference_remove_country_from_locality);
218
        checkBoxRemoveCountry
219
        .setToolTipText(Messages.AbcdImportPreference_remove_country_from_locality_tooltip);
220
        checkBoxRemoveCountry.addSelectionListener(new SelectionAdapter() {
221
            @Override
222
            public void widgetSelected(SelectionEvent e) {
223
                configurator.setRemoveCountryFromLocalityText(!configurator.isRemoveCountryFromLocalityText());
224
                setApply(true);
225
            }
226
        });
227

  
228
        Button checkBoxMoveToDefaultClassification = new Button(composite, SWT.CHECK);
229
        checkBoxMoveToDefaultClassification.setSelection(configurator.isMoveNewTaxaToDefaultClassification());
230
        checkBoxMoveToDefaultClassification.setText(Messages.AbcdImportPreference_create_new_classification_new_taxa);
231
        checkBoxMoveToDefaultClassification
232
        .setToolTipText(Messages.AbcdImportPreference_create_new_classification_new_taxa_tooltip);
233
        checkBoxMoveToDefaultClassification.addSelectionListener(new SelectionAdapter() {
234
            @Override
235
            public void widgetSelected(SelectionEvent e) {
236
                configurator.setMoveNewTaxaToDefaultClassification(!configurator.isMoveNewTaxaToDefaultClassification());
237
                setApply(true);
238
            }
239
        });
240

  
241
        Button checkBoxImportSiblings = new Button(composite, SWT.CHECK);
242
        checkBoxImportSiblings.setSelection(configurator.isGetSiblings());
243
        checkBoxImportSiblings.setText(Messages.AbcdImportPreference_import_all_children_for_cultures_or_tissues);
244
        checkBoxImportSiblings
245
            .setToolTipText(Messages.AbcdImportPreference_import_all_children_for_cultures_or_tissues_tooltip);
246
        checkBoxImportSiblings.addSelectionListener(new SelectionAdapter() {
247
            @Override
248
            public void widgetSelected(SelectionEvent e) {
249
                configurator.setGetSiblings(!configurator.isGetSiblings());
250
                setApply(true);
251
            }
252
        });
253

  
254
        Button checkBoxAddIndividualsAssociations = new Button(composite, SWT.CHECK);
255
        checkBoxAddIndividualsAssociations.setSelection(configurator.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
256
        checkBoxAddIndividualsAssociations.setText(Messages.AbcdImportPreference_create_Individual_Association);
257
        checkBoxAddIndividualsAssociations
258
            .setToolTipText(Messages.AbcdImportPreference_create_Individual_Association_tooltip);
259
        checkBoxAddIndividualsAssociations.addSelectionListener(new SelectionAdapter() {
260
            @Override
261
            public void widgetSelected(SelectionEvent e) {
262
                configurator.setAddIndividualsAssociationsSuchAsSpecimenAndObservations(!configurator.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
263
                setApply(true);
264
            }
265
        });
266

  
267
        Button checkBoxReuseDescriptiveGroups = new Button(composite, SWT.CHECK);
268
        checkBoxReuseDescriptiveGroups.setSelection(configurator.isReuseExistingDescriptiveGroups());
269
        checkBoxReuseDescriptiveGroups.setText(Messages.AbcdImportPreference_reuse_descriptive_group);
270
        checkBoxReuseDescriptiveGroups
271
            .setToolTipText(Messages.AbcdImportPreference_reuse_descriptive_group_tooltip);
272
        checkBoxReuseDescriptiveGroups.addSelectionListener(new SelectionAdapter() {
273
            @Override
274
            public void widgetSelected(SelectionEvent e) {
275
                configurator.setReuseExistingDescriptiveGroups(!configurator.isReuseExistingDescriptiveGroups());
276
                setApply(true);
277
            }
278
        });
279

  
280
        Button checkBoxReuseExistingTaxa = new Button(composite, SWT.CHECK);
281
        checkBoxReuseExistingTaxa.setSelection(configurator.isReuseExistingTaxaWhenPossible());
282
        checkBoxReuseExistingTaxa.setText(Messages.AbcdImportPreference_reuse_existing_taxa);
283
        checkBoxReuseExistingTaxa
284
            .setToolTipText(Messages.AbcdImportPreference_reuse_existing_taxa_tooltip);
285
        checkBoxReuseExistingTaxa.addSelectionListener(new SelectionAdapter() {
286
            @Override
287
            public void widgetSelected(SelectionEvent e) {
288
                configurator.setReuseExistingTaxaWhenPossible(!configurator.isReuseExistingTaxaWhenPossible());
289
                setApply(true);
290
            }
291
        });
292

  
293
        Label labelRef = new Label(composite, SWT.NONE);
294
        labelRef.setText("Biocase provider for associated DNA");
295
        new Label(composite, SWT.NONE);
296
        textDNAProviderString = new Text(composite, SWT.NONE);
297
        textDNAProviderString.setEnabled(true);
298
        textDNAProviderString.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true, 1, 1));
299
        textDNAProviderString.setText(configurator.getDnaSoure().toString());
300
        GridData gridData = new GridData();
301
        gridData = new GridData(GridData.BEGINNING, GridData.CENTER, true, false);
302
        gridData.horizontalIndent = 5;
303
//      classificationSelection.setLayoutData(gridData);
304

  
305
        nomenclaturalCodeSelectionCombo = new Combo(composite, SWT.BORDER| SWT.READ_ONLY);
306
        nomenclaturalCodeSelectionCombo.setLayoutData(gridData);
307
        for(NomenclaturalCode code: NomenclaturalCode.values()){
308
            nomenclaturalCodeSelectionCombo.add(code.getKey());
309
        }
310
        int index = 0;
311
        if (configurator.getNomenclaturalCode() != null){
312
            for (String label : nomenclaturalCodeSelectionCombo.getItems()){
313
                if (label.equals(configurator.getNomenclaturalCode().getKey())){
314
                    nomenclaturalCodeSelectionCombo.select(index);
315

  
316
                }
317
                index++;
318
            }
319
        }
320

  
321
        // TODO remember last selection
322
        nomenclaturalCodeSelectionCombo.addSelectionListener(this);
323
        if (preference != null){
324
            allowOverride = preference.isAllowOverride();
325
        }
326
        Button checkAllowOverride = new Button(composite, SWT.CHECK);
327
        checkAllowOverride.setSelection(allowOverride);
328
        checkAllowOverride.setText(Messages.AbcdImportPreference_allow_override);
329
        checkAllowOverride
330
            .setToolTipText(Messages.AbcdImportPreference_allow_override_tooltip);
331
        checkAllowOverride.addSelectionListener(new SelectionAdapter() {
332
            @Override
333
            public void widgetSelected(SelectionEvent e) {
334
                allowOverride = !allowOverride;
335
                setApply(true);
336
            }
337
        });
338

  
339
        return composite;
340
    }
341

  
342
    @Override
343
    public void widgetSelected(SelectionEvent e) {
344
        this.configurator.setNomenclaturalCode(NomenclaturalCode.getByKey(nomenclaturalCodeSelectionCombo.getText()));
345
        setApply(true);
346
    }
347

  
348
    @Override
349
    public boolean performOk() {
350
        if (preference == null){
351
            return true;
352
        }
353
        if (configurator != null){
354
            String configString = configurator.toString();
355
            Abcd206ImportConfigurator defaultConfig = Abcd206ImportConfigurator.NewInstance(null,null);
356
            if (configString.equals(defaultConfig.toString())){
357
                configString = null;
358
            }
359
            CdmPreference pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AbcdImportConfig, configString);
360
            pref.setAllowOverride(allowOverride);
361

  
362
            ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration();
363
            if (controller == null){
364
                return false;
365
            }
366
            IPreferenceService service = controller.getPreferenceService();
367
            service.set(pref);
368
            PreferencesUtil.updateDBPreferences();
369

  
370
        }
371
        return true;
372
    }
373

  
374
    /**
375
     * {@inheritDoc}
376
     */
377
    @Override
378
    public void widgetDefaultSelected(SelectionEvent e) {
379
        // TODO Auto-generated method stub
380

  
381
    }
382

  
383
    @Override
384
    protected void performDefaults() {
385
        configurator = Abcd206ImportConfigurator.NewInstance(null,null);
386
        preference = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AbcdImportConfig, configurator.toString());
387
        preference.setAllowOverride(true);
388
        super.performDefaults();
389
    }
390

  
391
//    private void createAbcdImportConfig() {
392
//        this.configurator.setAddIndividualsAssociationsSuchAsSpecimenAndObservations(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ADD_INDIVIDUALS_ASSOCIATIONS_SUCH_AS_SPECIMEN_AND_OBSERVATIONS));
393
//        this.configurator.setAddMediaAsMediaSpecimen(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ADD_MEDIA_AS_MEDIASPECIMEN));
394
//        this.configurator.setAllowReuseOtherClassifications(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ALLOW_REUSE_OTHER_CLASSIFICATIONS));
395
//        //this.abcdImportConfigurator.setClassificationUuid(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_CLASSIFICATION_UUID));
396
//        this.configurator.setDeduplicateClassifications(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEDUPLICATE_CLASSIFICATIONS));
397
//        this.configurator.setDeduplicateReferences(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEDUPLICATE_REFERENCES));
398
//       // this.abcdImportConfigurator.setDefaultAuthor(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEFAULT_AUTHOR));
399
//        this.configurator.setGetSiblings(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DO_SIBLINGS));
400
//        this.configurator.setIgnoreAuthorship(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_IGNORE_AUTHORSHIP));
401
//        this.configurator.setIgnoreImportOfExistingSpecimen(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_IGNORE_IMPORT_OF_EXISTING_SPECIMEN));
402
//        this.configurator.setMapUnitIdToAccessionNumber(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TO_ACCESSION_NUMBER));
403
//        this.configurator.setMapUnitIdToBarcode(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TO_BARCODE));
404
//        this.configurator.setMapUnitIdToCatalogNumber(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TOCATALOG_NUMBER));
405
//        this.configurator.setMoveNewTaxaToDefaultClassification(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MOVE_NEW_TAXA_TO_DEFAULT_CLASSIFICATION));
406
//        this.configurator.setReuseExistingDescriptiveGroups(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_DESCRIPTIVE_GROUPS));
407
//        this.configurator.setReuseExistingTaxaWhenPossible(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_TAXA_WHEN_POSSIBLE));
408
//        this.configurator.setNomenclaturalCode(PreferencesUtil.getPreferredNomenclaturalCode(doGetPreferenceStore().getString(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_NOMENCLATURAL_CODE)));
409
//
410
//    }
411

  
412
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/AbcdImportProvider.java
1
/**
2
* Copyright (C) 2018 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.taxeditor.databaseAdmin.preferencePage;
10

  
11
import org.eclipse.swt.SWT;
12
import org.eclipse.swt.custom.CLabel;
13
import org.eclipse.swt.layout.GridLayout;
14
import org.eclipse.swt.widgets.Composite;
15
import org.eclipse.swt.widgets.Control;
16

  
17
import eu.etaxonomy.cdm.api.application.ICdmRepository;
18
import eu.etaxonomy.cdm.api.service.IPreferenceService;
19
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
20
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
21
import eu.etaxonomy.taxeditor.l10n.Messages;
22
import eu.etaxonomy.taxeditor.preference.ListComponent;
23
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
24
import eu.etaxonomy.taxeditor.store.CdmStore;
25

  
26
/**
27
 * @author k.luther
28
 * @since 23.03.2018
29
 *
30
 */
31
public class AbcdImportProvider extends CdmPreferencePage implements IE4AdminPreferencePage{
32

  
33
    private ListComponent biocaseProviderList;
34

  
35
    @Override
36
    protected Control createContents(Composite parent) {
37
        final Composite composite = new Composite(parent, SWT.NULL);
38
        final CLabel description = new CLabel(composite, SWT.NULL);
39
        description.setText(Messages.AbcdImportProvider_description);
40
        GridLayout gridLayout = new GridLayout();
41
        composite.setLayout(gridLayout);
42

  
43
        gridLayout.numColumns = 3;
44
        //gridLayout.horizontalSpacing= 5;
45
        //gridLayout.makeColumnsEqualWidth = true;
46

  
47
        composite.setLayout(gridLayout);
48
        biocaseProviderList = new ListComponent(composite, SWT.SCROLL_LINE, isAdminPreference);
49
        setApply(true);
50
        return composite;
51
    }
52

  
53
    @Override
54
    public boolean performOk() {
55
        String providerList = null;
56
        if (biocaseProviderList != null){
57
            providerList = biocaseProviderList.createAllProviderString();
58

  
59
            CdmPreference pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.BioCaseProvider, providerList);
60
            pref.setAllowOverride(true);
61

  
62
            ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration();
63
            if (controller == null){
64
                return false;
65
            }
66
            IPreferenceService service = controller.getPreferenceService();
67
            service.set(pref);
68
        }
69

  
70
        return true;
71
    }
72

  
73
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/AbcdImportProviderAdminPreferencePage.java
1
/**
2
* Copyright (C) 2018 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.taxeditor.databaseAdmin.preferencePage;
10

  
11
import org.eclipse.swt.SWT;
12
import org.eclipse.swt.custom.CLabel;
13
import org.eclipse.swt.layout.GridLayout;
14
import org.eclipse.swt.widgets.Composite;
15
import org.eclipse.swt.widgets.Control;
16

  
17
import eu.etaxonomy.cdm.api.application.ICdmRepository;
18
import eu.etaxonomy.cdm.api.service.IPreferenceService;
19
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
20
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
21
import eu.etaxonomy.taxeditor.l10n.Messages;
22
import eu.etaxonomy.taxeditor.preference.AbcdImportPreference;
23
import eu.etaxonomy.taxeditor.preference.ListComponent;
24
import eu.etaxonomy.taxeditor.store.CdmStore;
25

  
26
/**
27
 * @author k.luther
28
 * @since 23.03.2018
29
 *
30
 */
31
public class AbcdImportProviderAdminPreferencePage extends AbcdImportPreference implements IE4AdminPreferencePage{
32

  
33
    private ListComponent biocaseProviderList;
34

  
35
    @Override
36
    protected Control createContents(Composite parent) {
37
        final Composite composite = new Composite(parent, SWT.NULL);
38
        final CLabel description = new CLabel(composite, SWT.NULL);
39
        description.setText(Messages.AbcdImportProvider_description);
40
        GridLayout gridLayout = new GridLayout();
41
        composite.setLayout(gridLayout);
42

  
43
        gridLayout.numColumns = 3;
44
        //gridLayout.horizontalSpacing= 5;
45
        //gridLayout.makeColumnsEqualWidth = true;
46

  
47
        composite.setLayout(gridLayout);
48
        biocaseProviderList = new ListComponent(composite, SWT.SCROLL_LINE, true);
49
        setApply(true);
50
        return composite;
51
    }
52

  
53
    @Override
54
    public boolean performOk() {
55
        String providerList = null;
56
        if (biocaseProviderList != null){
57
            providerList = biocaseProviderList.createAllProviderString();
58

  
59
            CdmPreference pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.BioCaseProvider, providerList);
60
            pref.setAllowOverride(true);
61

  
62
            ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration();
63
            if (controller == null){
64
                return false;
65
            }
66
            IPreferenceService service = controller.getPreferenceService();
67
            service.set(pref);
68
        }
69

  
70
        return true;
71
    }
72

  
73
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/NameFeatureMenuAdminPreference.java
1
/**
2
* Copyright (C) 2019 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.taxeditor.databaseAdmin.preferencePage;
10

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

  
15
import org.apache.commons.lang.StringUtils;
16

  
17
import eu.etaxonomy.cdm.api.service.ITermService;
18
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
19
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
20
import eu.etaxonomy.cdm.persistence.dto.TermDto;
21
import eu.etaxonomy.taxeditor.preference.LocalOrDefaultEnum;
22
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
23
import eu.etaxonomy.taxeditor.preference.menu.NameFeatureMenuPreference;
24
import eu.etaxonomy.taxeditor.store.CdmStore;
25

  
26
/**
27
 * @author k.luther
28
 * @since 13.08.2019
29
 */
30
public class NameFeatureMenuAdminPreference extends NameFeatureMenuPreference implements IE4AdminPreferencePage {
31

  
32
    @Override
33
    public boolean performOk() {
34
        if (!isApply()){
35
            return true;
36
        }
37
        Object[] checkedElements = treeComposite.getViewer().getCheckedElements();
38
        List<UUID> listUIIDChecked = new ArrayList<>();
39
        List<DefinedTermBase> preferredTerms = new ArrayList<>();
40
        for (Object o : checkedElements) {
41
            if(o instanceof TermDto){
42
                TermDto termDto = (TermDto) o;
43
                listUIIDChecked.add(termDto.getUuid());
44
                preferredTerms.add(CdmStore.getService(ITermService.class).load(termDto.getUuid()));
45
            }
46
        }
47
        String saveCheckedElements = StringUtils.join(listUIIDChecked, ";"); //$NON-NLS-1$
48
        if (StringUtils.isBlank(saveCheckedElements)){
49
            saveCheckedElements = null;
50
        }
51
        CdmPreference savePref = CdmPreference.NewTaxEditorInstance(predicate, saveCheckedElements);
52
        String text = this.useLocalOrAdmin.getText();
53
        if (text.equals(LocalOrDefaultEnum.Database.getLabel()) ){
54
            savePref.setAllowOverride(false);
55
        }else if (text.equals(LocalOrDefaultEnum.AllowOverride.getLabel())){
56
            savePref.setAllowOverride(true);
57
        }
58

  
59
        PreferencesUtil.setPreferenceToDB(savePref);
60
        PreferencesUtil.updateDBPreferences();
61
        PreferencesUtil.firePreferencesChanged(this.getClass());
62
        return true;
63
    }
64

  
65

  
66
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/input/TermEditorInput.java
22 22
import eu.etaxonomy.cdm.model.term.TermVocabulary;
23 23
import eu.etaxonomy.cdm.model.term.VocabularyEnum;
24 24
import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
25
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
25 26
import eu.etaxonomy.taxeditor.store.CdmStore;
26 27
import eu.etaxonomy.taxeditor.store.TermStore;
27 28

  
......
115 116

  
116 117
    public static TermTree getDefaultNameFeatureTree() {
117 118
        if(defaultNameFeatureTree == null) {
119

  
118 120
            List<Feature> nameFeatures = CdmStore.getTermManager().getPreferredTerms(CdmStore.getService(IVocabularyService.class).load(VocabularyEnum.NameFeature.getUuid()), null);
121

  
119 122
            defaultNameFeatureTree = TermTree.NewInstance(nameFeatures);
120 123
        }
121 124
        return defaultNameFeatureTree;
125

  
126
    }
127

  
128
    /**
129
     * @return
130
     */
131
    public static TermTree<?> getPreferredNameFeatureTree() {
132

  
133
        return PreferencesUtil.getPreferredFeatureTreeForNameDescription();
134

  
122 135
    }
123 136
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/AbstractUtility.java
287 287
            // configure the job
288 288
            job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
289 289
            job.setUser(true);
290
            job.setName(label);
290 291
            // schedule job
291 292
            job.schedule();
292 293

  
......
654 655
            };
655 656

  
656 657
            // configure the job
658
            job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
659

  
657 660
            job.setUser(true);
658 661
            // schedule job
659 662
            job.schedule();
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/AbcdImportPreference.java
8 8
*/
9 9
package eu.etaxonomy.taxeditor.preference;
10 10

  
11
import java.net.URI;
12

  
13 11
import org.eclipse.swt.SWT;
14 12
import org.eclipse.swt.custom.CLabel;
15 13
import org.eclipse.swt.events.SelectionAdapter;
......
42 40
 */
43 41
public class AbcdImportPreference extends CdmPreferencePage implements IE4PreferencePage, SelectionListener {
44 42

  
45
    private Abcd206ImportConfigurator configurator;
43
    protected Abcd206ImportConfigurator configurator;
46 44

  
47
    private Combo nomenclaturalCodeSelectionCombo;
45
    protected Combo nomenclaturalCodeSelectionCombo;
48 46

  
49
    private boolean allowOverride = true;
50
    private boolean override = true;
51
    private CdmPreference preference = null;
47
    protected boolean allowOverride = true;
48
    protected boolean override = true;
49
    protected CdmPreference preference = null;
52 50
    Text textDNAProviderString;
53 51
    private Composite composite;
54 52
    Combo overrideCombo;
55 53

  
54
    Button checkBoxMediaSpecimen;
55
    Button checkBoxIgnoreExisting;
56
    Button checkBoxIgnoreAuthorship;
57
    Button checkBoxMapUnitIdToCatalogNumber;
58
    Button checkBoxMapUnitIdToAccessionNumber;
59
    Button checkBoxMapUnitIdToBarcode;
60
    Button checkBoxRemoveCountry;
61
    Button checkBoxMoveToDefaultClassification;
62
    Button checkBoxImportSiblings;
63
    Button checkBoxAddIndividualsAssociations;
64
    Button checkBoxReuseDescriptiveGroups;
65
    Button checkBoxReuseExistingTaxa;
66
    Button checkAllowOverride;
67

  
56 68
    @Override
57 69
    protected Control createContents(Composite parent) {
58

  
59

  
60

  
61

  
62 70
        getValues();
63 71

  
64

  
65
        //configurator = PreferencesUtil.getAbcdImportConfigurationPreference();
66
        final CLabel description = new CLabel(parent, SWT.NULL);
67
        description.setText(Messages.AbcdImportPreference_description);
68
//        final CLabel overrideDescription = new CLabel(parent, SWT.NULL);
69
//        overrideDescription.setText("");
70
//        GridData textGrid = createTextGridData();
71
//        textGrid.verticalSpan = 2;
72
//        overrideDescription.setLayoutData(textGrid);
73

  
74
        overrideCombo = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
75

  
76
        overrideCombo.add(LocalOrDefaultEnum.Default.getLabel(), 0);
77
        overrideCombo.add(LocalOrDefaultEnum.Local.getLabel(), 1);
78
        overrideCombo.addSelectionListener(this);
79
        if (override){
80
            overrideCombo.select(1);
81
        }else{
82
            overrideCombo.select(0);
72
        if (!isAdminPreference && !allowOverride){
73
            Label label = new Label(parent, SWT.NONE);
74
            label.setText("The CDM settings don't allow to set the abcd import preference locally. If you need to make local settings, please ask an administrator.");
75
            this.noDefaultAndApplyButton();
76
            return parent;
83 77
        }
84

  
85
        composite = new Composite(parent, SWT.NULL);
86

  
78
        final Composite composite = new Composite(parent, SWT.NULL);
87 79
        GridLayout gridLayout = new GridLayout();
88 80
        composite.setLayout(gridLayout);
89
        Button checkBoxMediaSpecimen = new Button(composite, SWT.CHECK);
90
        checkBoxMediaSpecimen.setSelection(configurator.isAddMediaAsMediaSpecimen());
81

  
82
        final CLabel description = new CLabel(composite, SWT.NULL);
83
        description.setText(Messages.AbcdImportPreference_description);
84
        checkBoxMediaSpecimen = new Button(composite, SWT.CHECK);
91 85
        checkBoxMediaSpecimen.setText(Messages.AbcdImportPreference_media_as_mediaSpecimen);
92 86
        checkBoxMediaSpecimen
93 87
                .setToolTipText(Messages.AbcdImportPreference_media_as_subUnit);
......
99 93
            }
100 94
        });
101 95

  
102
        Button checkBoxIgnoreExisting = new Button(composite, SWT.CHECK);
103
        checkBoxIgnoreExisting.setSelection(configurator.isIgnoreImportOfExistingSpecimen());
96
        checkBoxIgnoreExisting = new Button(composite, SWT.CHECK);
97

  
104 98
        checkBoxIgnoreExisting.setText(Messages.AbcdImportPreference_not_import_existing_specimen);
105 99
        checkBoxIgnoreExisting
106 100
        .setToolTipText(Messages.AbcdImportPreference_not_import_existing_specimen_tooltip);
......
112 106
            }
113 107
        });
114 108

  
115
        Button checkBoxIgnoreAuthorship = new Button(composite, SWT.CHECK);
116
        checkBoxIgnoreAuthorship.setSelection(configurator.isIgnoreAuthorship());
109
        checkBoxIgnoreAuthorship = new Button(composite, SWT.CHECK);
110

  
117 111
        checkBoxIgnoreAuthorship.setText(Messages.AbcdImportPreference_ignore_author);
118 112
        checkBoxIgnoreAuthorship
119 113
        .setToolTipText(Messages.AbcdImportPreference_ignore_author_tooltip);
......
125 119
            }
126 120
        });
127 121

  
128
        Button checkBoxMapUnitIdToCatalogNumber = new Button(composite, SWT.CHECK);
129
        checkBoxMapUnitIdToCatalogNumber.setSelection(configurator.isMapUnitIdToCatalogNumber());
122
        checkBoxMapUnitIdToCatalogNumber = new Button(composite, SWT.RADIO);
123

  
130 124
        checkBoxMapUnitIdToCatalogNumber.setText(Messages.AbcdImportPreference_map_unit_nr_catalog_number);
131 125
        checkBoxMapUnitIdToCatalogNumber
132 126
        .setToolTipText(Messages.AbcdImportPreference_map_unit_number_catalog_number_tooltip);
......
138 132
            }
139 133
        });
140 134
//TODO: only one of the mappings can be checked!
141
        Button checkBoxMapUnitIdToAccessionNumber = new Button(composite, SWT.CHECK);
142
        checkBoxMapUnitIdToAccessionNumber.setSelection(configurator.isMapUnitIdToAccessionNumber());
135
        checkBoxMapUnitIdToAccessionNumber = new Button(composite, SWT.RADIO);
136

  
143 137
        checkBoxMapUnitIdToAccessionNumber.setText(Messages.AbcdImportPreference_map_unit_number_to_accession_number);
144 138
        checkBoxMapUnitIdToAccessionNumber
145 139
        .setToolTipText(Messages.AbcdImportPreference_map_unit_number_accession_number_tooltip);
......
151 145
            }
152 146
        });
153 147

  
154
        Button checkBoxMapUnitIdToBarcode = new Button(composite, SWT.CHECK);
155
        checkBoxMapUnitIdToBarcode.setSelection(configurator.isMapUnitIdToBarcode());
148
        checkBoxMapUnitIdToBarcode = new Button(composite, SWT.RADIO);
149

  
156 150
        checkBoxMapUnitIdToBarcode.setText(Messages.AbcdImportPreference_map_unit_number_barcode);
157 151
        checkBoxMapUnitIdToBarcode
158 152
        .setToolTipText(Messages.AbcdImportPreference_map_unit_number_barcode_tooltip);
......
164 158
            }
165 159
        });
166 160

  
167
        Button checkBoxRemoveCountry = new Button(composite, SWT.CHECK);
168
        checkBoxRemoveCountry.setSelection(configurator.isRemoveCountryFromLocalityText());
161
        checkBoxRemoveCountry = new Button(composite, SWT.CHECK);
162

  
169 163
        checkBoxRemoveCountry.setText(Messages.AbcdImportPreference_remove_country_from_locality);
170 164
        checkBoxRemoveCountry
171 165
        .setToolTipText(Messages.AbcdImportPreference_remove_country_from_locality_tooltip);
......
177 171
            }
178 172
        });
179 173

  
180
        Button checkBoxMoveToDefaultClassification = new Button(composite, SWT.CHECK);
174
        checkBoxMoveToDefaultClassification = new Button(composite, SWT.CHECK);
181 175
        checkBoxMoveToDefaultClassification.setSelection(configurator.isMoveNewTaxaToDefaultClassification());
182 176
        checkBoxMoveToDefaultClassification.setText(Messages.AbcdImportPreference_create_new_classification_new_taxa);
183 177
        checkBoxMoveToDefaultClassification
......
190 184
            }
191 185
        });
192 186

  
193
        Button checkBoxImportSiblings = new Button(composite, SWT.CHECK);
194
        checkBoxImportSiblings.setSelection(configurator.isGetSiblings());
187
        checkBoxImportSiblings = new Button(composite, SWT.CHECK);
188

  
195 189
        checkBoxImportSiblings.setText(Messages.AbcdImportPreference_import_all_children_for_cultures_or_tissues);
196 190
        checkBoxImportSiblings
197 191
            .setToolTipText(Messages.AbcdImportPreference_import_all_children_for_cultures_or_tissues_tooltip);
......
203 197
            }
204 198
        });
205 199

  
206
        Button checkBoxAddIndividualsAssociations = new Button(composite, SWT.CHECK);
207
        checkBoxAddIndividualsAssociations.setSelection(configurator.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
200
        checkBoxAddIndividualsAssociations = new Button(composite, SWT.CHECK);
201

  
208 202
        checkBoxAddIndividualsAssociations.setText(Messages.AbcdImportPreference_create_Individual_Association);
209 203
        checkBoxAddIndividualsAssociations
210 204
            .setToolTipText(Messages.AbcdImportPreference_create_Individual_Association_tooltip);
......
216 210
            }
217 211
        });
218 212

  
219
        Button checkBoxReuseDescriptiveGroups = new Button(composite, SWT.CHECK);
220
        checkBoxReuseDescriptiveGroups.setSelection(configurator.isReuseExistingDescriptiveGroups());
213
        checkBoxReuseDescriptiveGroups = new Button(composite, SWT.CHECK);
214

  
221 215
        checkBoxReuseDescriptiveGroups.setText(Messages.AbcdImportPreference_reuse_descriptive_group);
222 216
        checkBoxReuseDescriptiveGroups
223 217
            .setToolTipText(Messages.AbcdImportPreference_reuse_descriptive_group_tooltip);
......
229 223
            }
230 224
        });
231 225

  
232
        Button checkBoxReuseExistingTaxa = new Button(composite, SWT.CHECK);
233
        checkBoxReuseExistingTaxa.setSelection(configurator.isReuseExistingTaxaWhenPossible());
226
        checkBoxReuseExistingTaxa = new Button(composite, SWT.CHECK);
227

  
234 228
        checkBoxReuseExistingTaxa.setText(Messages.AbcdImportPreference_reuse_existing_taxa);
235 229
        checkBoxReuseExistingTaxa
236 230
            .setToolTipText(Messages.AbcdImportPreference_reuse_existing_taxa_tooltip);
......
244 238

  
245 239
        Label labelRef = new Label(composite, SWT.NONE);
246 240
        labelRef.setText("Biocase provider for associated DNA");
247
        new Label(composite, SWT.NONE);
241
       // new Label(composite, SWT.NONE);
248 242
        textDNAProviderString = new Text(composite, SWT.NONE);
249 243
        textDNAProviderString.setEnabled(true);
250 244
        textDNAProviderString.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true, 1, 1));
251
        textDNAProviderString.setText(configurator.getDnaSoure().toString());
245

  
252 246
        GridData gridData = new GridData();
253 247
        gridData = new GridData(GridData.BEGINNING, GridData.CENTER, true, false);
254 248
        gridData.horizontalIndent = 5;
255 249
//      classificationSelection.setLayoutData(gridData);
256

  
250
        Label nomenclaturalCodeLabel = new Label(composite, SWT.NONE);
251
        nomenclaturalCodeLabel.setText("Nomenclatural Code");
257 252
        nomenclaturalCodeSelectionCombo = new Combo(composite, SWT.BORDER| SWT.READ_ONLY);
258 253
        nomenclaturalCodeSelectionCombo.setLayoutData(gridData);
254
        nomenclaturalCodeSelectionCombo.add(" - ");
259 255
        for(NomenclaturalCode code: NomenclaturalCode.values()){
260 256
            nomenclaturalCodeSelectionCombo.add(code.getKey());
261 257
        }
262
        int index = 0;
263
        if (configurator.getNomenclaturalCode() != null){
264
            for (String label : nomenclaturalCodeSelectionCombo.getItems()){
265
                if (label.equals(configurator.getNomenclaturalCode().getKey())){
266
                    nomenclaturalCodeSelectionCombo.select(index);
267 258

  
268
                }
269
                index++;
270
            }
271
        }
259

  
272 260

  
273 261
        // TODO remember last selection
274 262
        nomenclaturalCodeSelectionCombo.addSelectionListener(this);
......
276 264
            allowOverride = preference.isAllowOverride();
277 265
        }
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff