Project

General

Profile

Revision ceadb607

IDceadb60716d9f2960e8265d31c8be9a425802491
Parent d0e6bf3b
Child bde14373

Added by Katja Luther almost 4 years ago

add the possibility to add default biocase providers and the abcd import config to preferences

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/DatabasePreferencesPage.java
26 26
import org.eclipse.swt.widgets.TabFolder;
27 27
import org.eclipse.swt.widgets.TabItem;
28 28

  
29
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
29 30
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
30 31
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
31 32
import eu.etaxonomy.taxeditor.l10n.Messages;
......
54 55
    IPreferenceStore preferenceStore;
55 56
    Composite composite;
56 57
    boolean isSimpleDetailsViewActivated;
58

  
57 59
    Composite child ;
60
    NameDetailsViewComposite nameDetailsConfig;
61
    protected NameDetailsViewComposite getNameDetailsConfig() {
62
        return nameDetailsConfig;
63
    }
64

  
65
    String selectedPreferenceKey = null;
66

  
67
    ListComponent biocaseProviderList;
68
    Abcd206ImportConfigurator abcdImportConfigurator;
58 69

  
59
    private Combo nomenclaturalCodeCombo;
60
    private Label nomenclaturalCodeLabel;
61 70

  
62 71
//    private UriWithLabelElement nomenclaturalCodeCombo;
63 72
//    private Label nomenclaturalCodeLabel;
......
71 80
        super(pageName);
72 81
        this.preferedNomenclaturalCode = PreferencesUtil.setPreferredNomenclaturalCode(null, false);
73 82
        this.config = PreferencesUtil.setPreferredNameDetailsConfiguration( false);
83
        if (config == null){
84
            config = new NameDetailsConfigurator(false);
85
        }
74 86
        setPreferenceStore(PreferencesUtil.getPreferenceStore());
75 87

  
76 88
    }
......
103 115
        GridLayout layout = new GridLayout();
104 116
        currentTab.setLayout(layout);
105 117
        currentTab.setFont(composite.getFont());
106
        currentTab.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
118
       // currentTab.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
107 119

  
108 120
        item.setControl(currentTab);
109 121
        return currentTab;
110
    }
111

  
112
    /**
113
     * @param tabFolder
114
     */
115
    private void createNameDetailsConfiguration(Composite parent) {
116
        if (composite == null){
117
            composite = parent;
118
        }
119
       composite = addTab(Messages.DatabasePreferencesPage_details_view_configuration);
120
//        TabItem tbtmNameDetailsConfiguration = new TabItem(tabFolder, SWT.NONE);
121
//        Composite c2 = new Composite(tabFolder, SWT.BORDER);
122
//        c2.setLayout(new GridLayout(1, true));
123
//        tbtmNameDetailsConfiguration.setControl(c2);
124
       // composite.setLayout(new GridLayout(1, true));
125
       config = new NameDetailsConfigurator(true);
126

  
127
      // Composite composite = new Composite(parent, SWT.NULL);
128
       composite.setLayout(new GridLayout());
129

  
130
       isSimpleDetailsViewActivated= PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION);
131
       final Button activateCheckButton = new Button(composite, SWT.CHECK);
132
       activateCheckButton.setText(Messages.DatabasePreferencesPage_show_only_simple_details_view);
133
       activateCheckButton.setSelection(isSimpleDetailsViewActivated);
134
       activateCheckButton.addSelectionListener(new SelectionAdapter(){
135
       @Override
136
       public void widgetSelected(SelectionEvent e) {
137
           isSimpleDetailsViewActivated = activateCheckButton.getSelection();
138
           PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION, isSimpleDetailsViewActivated);
139
           if(isSimpleDetailsViewActivated){
140
               child.setVisible(true);
141
               child.setEnabled(true);
142
           }else{
143
               child.setVisible(false);
144
               child.setEnabled(false);
145
           }
146
        }
147
        });
148

  
149
       child = new Composite(composite, SWT.NULL);
150
       child.setLayout(new GridLayout());
151
       child.setVisible(isSimpleDetailsViewActivated);
152

  
153
       final Button showTaxon = new Button(child, SWT.CHECK);
154
       boolean isShowTaxon = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON);
155
       showTaxon.setText(Messages.DatabasePreferencesPage_show_taxon);
156
       showTaxon.setSelection(isShowTaxon);
157
       showTaxon.addSelectionListener(new SelectionAdapter(){
158
            @Override
159
            public void widgetSelected(SelectionEvent e) {
160
                boolean isShowTaxon = showTaxon.getSelection();
161
                PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON, isShowTaxon);
162
             }
163
        });
164

  
165
       final Button showLsid = new Button(child, SWT.CHECK);
166
       boolean isShowLSID = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID);
167
       showLsid.setText(Messages.DatabasePreferencesPage_show_lsid);
168
       showLsid.setSelection(isShowLSID);
169
       showLsid.addSelectionListener(new SelectionAdapter(){
170
            @Override
171
            public void widgetSelected(SelectionEvent e) {
172
                boolean isShowLSID = showLsid.getSelection();
173
                PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID, isShowLSID);
174
             }
175
        });
176

  
177
       final Button showNomenclaturalCode = new Button(child, SWT.CHECK);
178
       boolean isShowNomenclaturalCode = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE);
179
       showNomenclaturalCode.setText(Messages.DatabasePreferencesPage_show_nomenclatural_code);
180
       showNomenclaturalCode.setSelection(isShowNomenclaturalCode);
181
       showNomenclaturalCode.addSelectionListener(new SelectionAdapter(){
182
            @Override
183
            public void widgetSelected(SelectionEvent e) {
184
                boolean isShowNomenclaturalCode = showNomenclaturalCode.getSelection();
185
                PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE, isShowNomenclaturalCode);
186
             }
187
        });
188

  
189
       final Button showNameCache = new Button(child, SWT.CHECK);
190
       boolean isShowNameCache = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE);
191
       showNameCache.setText(Messages.DatabasePreferencesPage_show_namecache);
192
       showNameCache.setSelection(isShowNomenclaturalCode);
193
       showNameCache.addSelectionListener(new SelectionAdapter(){
194
            @Override
195
            public void widgetSelected(SelectionEvent e) {
196
                boolean isShowNameCache = showNameCache.getSelection();
197
                PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE, isShowNameCache);
198
             }
199
        });
200
       final Button showAppendedPhrase = new Button(child, SWT.CHECK);
201
       boolean isShowAppendedPhrase = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE);
202
       showAppendedPhrase.setText(Messages.DatabasePreferencesPage_show_appended_phrase);
203
       showAppendedPhrase.setSelection(isShowAppendedPhrase);
204
       showAppendedPhrase.addSelectionListener(new SelectionAdapter(){
205
            @Override
206
            public void widgetSelected(SelectionEvent e) {
207
                boolean isShowAppendedPhrase = showAppendedPhrase.getSelection();
208
                PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE, isShowAppendedPhrase);
209
             }
210
        });
211

  
212
       final Button showRank = new Button(child, SWT.CHECK);
213
       boolean isShowRank = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK);
214
       showRank.setText(Messages.DatabasePreferencesPage_show_rank);
215
       showRank.setSelection(isShowRank);
216
       showRank.addSelectionListener(new SelectionAdapter(){
217
            @Override
218
            public void widgetSelected(SelectionEvent e) {
219
                boolean isShowRank = showRank.getSelection();
220
                PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK, isShowRank);
221
             }
222
        });
223
       final Button showEpithets = new Button(child, SWT.CHECK);
224
       boolean isShowEpithets = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS);
225
       showEpithets.setText(Messages.DatabasePreferencesPage_show_atomised_epithets);
226
       showEpithets.setSelection(isShowEpithets);
227
       showEpithets.addSelectionListener(new SelectionAdapter(){
228
            @Override
229
            public void widgetSelected(SelectionEvent e) {
230
                boolean isShowEpithets = showEpithets.getSelection();
231
                PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS, isShowEpithets);
232
             }
233
        });
234
       final Button showAuthorshipCache = new Button(child, SWT.CHECK);
235
       boolean isShowAuthorshipCache = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP_CACHE);
236
       showAuthorshipCache.setText(Messages.DatabasePreferencesPage_show_authorship_cache);
237
       showAuthorshipCache.setSelection(isShowAuthorshipCache);
238
       showAuthorshipCache.addSelectionListener(new SelectionAdapter(){
239
            @Override
240
            public void widgetSelected(SelectionEvent e) {
241
                boolean isShowAuthorshipCache = showAuthorshipCache.getSelection();
242
                PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP_CACHE, isShowAuthorshipCache);
243
             }
244
        });
245

  
246
       final Button showAuthorship = new Button(child, SWT.CHECK);
247
       boolean isShowAuthorship = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP);
248
       showAuthorship.setText(Messages.DatabasePreferencesPage_show_author_section);
249
       showAuthorship.setSelection(isShowAuthorship);
250
       showAuthorship.addSelectionListener(new SelectionAdapter(){
251
            @Override
252
            public void widgetSelected(SelectionEvent e) {
253
                boolean isShowAuthorship = showAuthorship.getSelection();
254
                PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP, isShowAuthorship);
255
             }
256
        });
257

  
258
       final Button showNomenclaturalRef = new Button(child, SWT.CHECK);
259
       boolean isShowNomenclaturalRef = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE);
260
       showNomenclaturalRef.setText(Messages.DatabasePreferencesPage_Show_nomenclatural_Ref);
261
       showNomenclaturalRef.setSelection(isShowNomenclaturalRef);
262
       showNomenclaturalRef.addSelectionListener(new SelectionAdapter(){
263
            @Override
264
            public void widgetSelected(SelectionEvent e) {
265
                boolean isShowNomenclaturalRef = showNomenclaturalRef.getSelection();
266
                PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE, isShowNomenclaturalRef);
267
             }
268
        });
269

  
270
       final Button showNomenclaturalStatus = new Button(child, SWT.CHECK);
271
       boolean isShowNomenclaturalStatus = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS);
272
       showNomenclaturalStatus.setText(Messages.DatabasePreferencesPage_Show_nomenclaturalStatus);
273
       showNomenclaturalStatus.setSelection(isShowNomenclaturalStatus);
274
       showNomenclaturalStatus.addSelectionListener(new SelectionAdapter(){
275
            @Override
276
            public void widgetSelected(SelectionEvent e) {
277
                boolean isShowNomenclaturalStatus = showNomenclaturalStatus.getSelection();
278
                PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS, isShowNomenclaturalStatus);
279
             }
280
        });
281

  
282
       final Button showProtologue = new Button(child, SWT.CHECK);
283
       boolean isShowProtologue = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE);
284
       showProtologue.setText(Messages.DatabasePreferencesPage_Show_Protologue);
285
       showProtologue.setSelection(isShowProtologue);
286
       showProtologue.addSelectionListener(new SelectionAdapter(){
287
            @Override
288
            public void widgetSelected(SelectionEvent e) {
289
                boolean isShowProtologue = showProtologue.getSelection();
290
                PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE, isShowProtologue);
291
             }
292
        });
293

  
294
       final Button showTypeDesignation = new Button(child, SWT.CHECK);
295
       boolean isShowTypeDesignation = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION);
296
       showTypeDesignation.setText(Messages.DatabasePreferencesPage_Show_Type_designation);
297
       showTypeDesignation.setSelection(isShowTypeDesignation);
298
       showTypeDesignation.addSelectionListener(new SelectionAdapter(){
299
            @Override
300
            public void widgetSelected(SelectionEvent e) {
301
                boolean isShowTypeDesignation = showTypeDesignation.getSelection();
302
                PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION, isShowTypeDesignation);
303
             }
304
        });
305

  
306

  
307
       final Button showNameRelationship = new Button(child, SWT.CHECK);
308
       boolean isShowNameRelationship = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP);
309
       showNameRelationship.setText(Messages.DatabasePreferencesPage_Show_NameRelations);
310
       showNameRelationship.setSelection(isShowNameRelationship);
311
       showNameRelationship.addSelectionListener(new SelectionAdapter(){
312
            @Override
313
            public void widgetSelected(SelectionEvent e) {
314
                boolean isShowNameRelationship = showNameRelationship.getSelection();
315
                PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP, isShowNameRelationship);
316
             }
317
        });
318

  
319
       if(isSimpleDetailsViewActivated){
320
           child.setEnabled(true);
321
       }else{
322
           child.setEnabled(false);
323
       }
324

  
325

  
326

  
327
       // Label emptyLabel = new Label(getFieldEditorParent(), 0);
328

  
329

  
330

  
331 122

  
332 123
    }
333 124

  
334 125

  
335 126

  
127

  
336 128
    protected IPreferenceStore doGetPreferenceStore() {
337 129
        return PreferencesUtil.getPreferenceStore();
338 130
    }
......
354 146
    }
355 147

  
356 148

  
357
/**
358
     *
359
     */
360
    void createNameDetailsViewConfig() {
361
       config.setSimpleDetailsViewActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION));
362
       config.setAppendedPhraseActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE));
363
       config.setAtomisedEpithetsActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS));
364
       config.setAuthorshipSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP));
365
       config.setLSIDActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID));
366
       config.setNameCacheActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_CACHE));
367
       config.setNameRelationsSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP));
368
       config.setNomenclaturalCodeActived(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE));
369
       config.setNomenclaturalStatusSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS));
370
       config.setNomenclaturalReferenceSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE));
371
       config.setProtologueActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE));
372
       config.setRankActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK));
373
       config.setSimpleDetailsViewActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION));
374
       config.setTaxonSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON));
375
       config.setTypeDesignationSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION));
376
    }
149

  
377 150

  
378 151
    public void createNomenclaturalCodeTab(Composite parent){
379
       composite = addTab(Messages.DatabasePreferencesPage_Define_Default_NomenclaturalCode);
380
       nomenclaturalCodeCombo = new Combo(composite, SWT.READ_ONLY);
381
      List<NomenclaturalCode> supportedCodes = NomenclaturalCodeHelper
152

  
153
        Combo nomenclaturalCodeCombo;
154
        Label nomenclaturalCodeLabel;
155

  
156
        composite = addTab(Messages.DatabasePreferencesPage_Define_Default_NomenclaturalCode);
157
        nomenclaturalCodeCombo = new Combo(composite, SWT.READ_ONLY);
158
        List<NomenclaturalCode> supportedCodes = NomenclaturalCodeHelper
382 159
              .getSupportedCodes();
383
       for (NomenclaturalCode code: supportedCodes) {
160
        for (NomenclaturalCode code: supportedCodes) {
384 161
           nomenclaturalCodeCombo.add(NomenclaturalCodeHelper
385 162
                   .getDescription(code));
386 163

  
......
392 169
        public void widgetSelected(SelectionEvent evt) {
393 170

  
394 171
               String name = nomenclaturalCodeCombo.getText();
395
               String selectedPreferenceKey = null;
172

  
396 173
               for (String[] labelAndValue: labelAndValues){
397 174
                   if (labelAndValue[0].equals(name)){
398 175
                       selectedPreferenceKey = labelAndValue[1];
......
426 203

  
427 204
    public void createBiocaseProviderTab(Composite parent){
428 205
        composite = addTab(Messages.DatabasePreferencesPage_Biocase_Provider);
429
        nomenclaturalCodeCombo = new Combo(composite, SWT.READ_ONLY);
430
       List<NomenclaturalCode> supportedCodes = NomenclaturalCodeHelper
431
               .getSupportedCodes();
432
        for (NomenclaturalCode code: supportedCodes) {
433
            nomenclaturalCodeCombo.add(NomenclaturalCodeHelper
434
                    .getDescription(code));
435

  
436
        }
437
        getLabelAndValues();
438
        //get the actual nomenclatural code and set it as selection: doGetPreferenceStore().getString(IPreferenceKeys.CDM_NOMENCLATURAL_CODE_KEY);
439
        nomenclaturalCodeCombo.addSelectionListener(new SelectionAdapter() {
440
            @Override
441
         public void widgetSelected(SelectionEvent evt) {
442

  
443
                String name = nomenclaturalCodeCombo.getText();
444
                String selectedPreferenceKey = null;
445
                for (String[] labelAndValue: labelAndValues){
446
                    if (labelAndValue[0].equals(name)){
447
                        selectedPreferenceKey = labelAndValue[1];
448
                    }
449
                }
450

  
451

  
452
                PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.CDM_NOMENCLATURAL_CODE_KEY, selectedPreferenceKey);
453

  
454
            }
455
        });
456
        nomenclaturalCodeLabel = new Label(composite, SWT.READ_ONLY);
457

  
458

  
459
         final Button useLocalPreference = new Button(composite, SWT.CHECK);
460
         boolean isUseLocalPreference = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY);
461
         useLocalPreference.setText(Messages.DatabasePreferencesPage_UseLocalPreferences);
462
         useLocalPreference.setSelection(isUseLocalPreference);
463
         useLocalPreference.addSelectionListener(new SelectionAdapter(){
464
              @Override
465
              public void widgetSelected(SelectionEvent e) {
466
                  boolean isUseLocalPreference = useLocalPreference.getSelection();
467
                  PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY, isUseLocalPreference);
468
               }
469
          });
470

  
206
        GridLayout gridLayout = new GridLayout();
207
        gridLayout.numColumns = 2;
208
        composite.setLayout(gridLayout);
209
        biocaseProviderList = new ListComponent(composite, SWT.SCROLL_LINE);
471 210

  
211
 }
472 212

  
213
    public ListComponent getBiocaseProviderList() {
214
        return biocaseProviderList;
215
    }
473 216

  
474
 }
217
    public void createNameDetailsViewConfigurationTab(Composite parent, NameDetailsConfigurator config){
218
        composite = parent;
219
        composite = addTab(Messages.DatabasePreferencesPage_details_view_configuration);
220
        GridLayout gridLayout = new GridLayout();
221
        gridLayout.numColumns = 2;
222
        composite.setLayout(gridLayout);
223
        nameDetailsConfig = new NameDetailsViewComposite(composite, SWT.SCROLL_LINE, config);
224
    }
475 225

  
476 226

  
477 227
    public void createSpecimenOrObservationTab(Composite parent){
......
608 358
 */
609 359
@Override
610 360
public void createControl(Composite parent) {
611
    createNameDetailsConfiguration(parent);
361
    createNameDetailsViewConfigurationTab(parent, config);
612 362
    createNomenclaturalCodeTab(parent);
613 363

  
614 364
    createSpecimenOrObservationTab(parent);
365
    createBiocaseProviderTab(parent);
615 366
    setControl(parent);
616 367
}
617 368

  
......
619 370
 * @return
620 371
 */
621 372
public NameDetailsConfigurator getConfig() {
622

  
623 373
    return config;
624 374
}
625 375

  
376
/**
377
 *
378
 */
379
public Abcd206ImportConfigurator getAbcdImportConfig() {
380
    return abcdImportConfigurator;
381

  
382
}
383

  
384
/**
385
 * @return
386
 */
387
public void createAbcdImportConfig() {
388
    this.abcdImportConfigurator.setAddIndividualsAssociationsSuchAsSpecimenAndObservations(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ADD_INDIVIDUALS_ASSOCIATIONS_SUCH_AS_SPECIMEN_AND_OBSERVATIONS));
389
    this.abcdImportConfigurator.setAddMediaAsMediaSpecimen(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ADD_MEDIA_AS_MEDIASPECIMEN));
390
    this.abcdImportConfigurator.setAllowReuseOtherClassifications(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ALLOW_REUSE_OTHER_CLASSIFICATIONS));
391
    //this.abcdImportConfigurator.setClassificationUuid(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_CLASSIFICATION_UUID));
392
    this.abcdImportConfigurator.setDeduplicateClassifications(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEDUPLICATE_CLASSIFICATIONS));
393
    this.abcdImportConfigurator.setDeduplicateReferences(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEDUPLICATE_REFERENCES));
394
   // this.abcdImportConfigurator.setDefaultAuthor(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEFAULT_AUTHOR));
395
    this.abcdImportConfigurator.setGetSiblings(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DO_SIBLINGS));
396
    this.abcdImportConfigurator.setIgnoreAuthorship(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_IGNORE_AUTHORSHIP));
397
    this.abcdImportConfigurator.setIgnoreImportOfExistingSpecimen(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_IGNORE_IMPORT_OF_EXISTING_SPECIMEN));
398
    this.abcdImportConfigurator.setMapUnitIdToAccessionNumber(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TO_ACCESSION_NUMBER));
399
    this.abcdImportConfigurator.setMapUnitIdToBarcode(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TO_BARCODE));
400
    this.abcdImportConfigurator.setMapUnitIdToCatalogNumber(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TOCATALOG_NUMBER));
401
    this.abcdImportConfigurator.setMoveNewTaxaToDefaultClassification(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MOVE_NEW_TAXA_TO_DEFAULT_CLASSIFICATION));
402
    this.abcdImportConfigurator.setReuseExistingDescriptiveGroups(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_DESCRIPTIVE_GROUPS));
403
    this.abcdImportConfigurator.setReuseExistingTaxaWhenPossible(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_TAXA_WHEN_POSSIBLE));
404

  
405
}
406

  
626 407

  
627 408

  
628 409

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/DatabasePreferencesWizard.java
8 8
*/
9 9
package eu.etaxonomy.taxeditor.databaseAdmin.wizard;
10 10

  
11
import org.eclipse.jface.wizard.IWizardPage;
11 12
import org.eclipse.jface.wizard.Wizard;
12 13

  
13 14
import eu.etaxonomy.cdm.api.application.ICdmRepository;
14 15
import eu.etaxonomy.cdm.api.service.IPreferenceService;
16
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
15 17
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
16 18
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
19
import eu.etaxonomy.taxeditor.io.wizard.AbcdImportConfiguratorWizardPage;
17 20
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
18 21
import eu.etaxonomy.taxeditor.store.CdmStore;
19 22

  
......
26 29

  
27 30

  
28 31
    public DatabasePreferencesPage preferencePage;
32
    public AbcdImportConfiguratorWizardPage configAbcdImport;
29 33

  
30 34

  
31 35
    public DatabasePreferencesWizard() {
32 36
        setWindowTitle("Database Preferences Wizard");
33 37

  
34 38
        preferencePage = new DatabasePreferencesPage("Database Preferences");
35
       // preferencePage.setDescription("Choose which nomenclatural code you would like to use for scientific names unless otherwise specified.");
36
       // preferencePage.init(PlatformUI.getWorkbench());
39
        configAbcdImport = AbcdImportConfiguratorWizardPage.createPage(Abcd206ImportConfigurator.NewInstance(null, null));
40

  
37 41
    }
38 42

  
39 43

  
......
64 68
        IPreferenceService service = controller.getPreferenceService();
65 69
        service.set(pref);
66 70

  
67
        getPreferencePage().createNameDetailsViewConfig();
68
        value = getPreferencePage().getConfig().toString();
71
        value = getPreferencePage().getNameDetailsConfig().createNameDetailsViewConfig().toString();
69 72
        allowOverride = getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NAMEDETAILS);
70 73
        pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.NameDetailsView, value);
71 74
        pref.setAllowOverride(allowOverride);
......
87 90
        pref.setAllowOverride(false);
88 91
        service.set(pref);
89 92

  
93
        String biocaseProviderList = this.getPreferencePage().getBiocaseProviderList().createAllProviderString();
94
        if (biocaseProviderList == null){
95
            getPreferencePage().doGetPreferenceStore().setValue(IPreferenceKeys.BIOCASE_PROVIDER_LIST,"");
96
        }else{
97
            getPreferencePage().doGetPreferenceStore().setValue(IPreferenceKeys.BIOCASE_PROVIDER_LIST, biocaseProviderList);
98

  
99
        }
100
        pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.BioCaseProvider, String.valueOf(biocaseProviderList));
101
        pref.setAllowOverride(false);
102
        service.set(pref);
103
//        getPreferencePage().createAbcdImportConfig();
104
//        value = getPreferencePage().getAbcdImportConfig().toString();
105
//        allowOverride = getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_ABCD_IMPORT_CONFIG);
106
//        pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.AbcdImportConfig, value);
107
//        pref.setAllowOverride(allowOverride);
108
//        service.set(pref);
109

  
90 110
        return true;
91 111
    }
92 112

  
......
95 115
    @Override
96 116
    public void addPages() {
97 117
        addPage(preferencePage);
118
        addPage(configAbcdImport);
98 119
    }
99 120

  
121
    @Override
122
    public IWizardPage getNextPage(IWizardPage currentPage) {
123
       if (currentPage.equals(preferencePage)){
124
           return configAbcdImport;
125
       }
126
       return null;
127
    }
100 128

  
101 129

  
102 130
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/ImportPreferencesWizard.java
1
/**
2
* Copyright (C) 2017 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.wizard;
10

  
11
import org.eclipse.jface.wizard.Wizard;
12

  
13
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
14
import eu.etaxonomy.taxeditor.io.wizard.AbcdImportConfiguratorWizardPage;
15

  
16
/**
17
 * @author k.luther
18
 * @date 19.04.2017
19
 *
20
 */
21
public class ImportPreferencesWizard extends Wizard {
22

  
23
    public AbcdImportConfiguratorWizardPage configPage;
24

  
25
    public ImportPreferencesWizard() {
26
        setWindowTitle("Abcd Import Configuration Wizard");
27
        configPage = AbcdImportConfiguratorWizardPage.createPreferencePage(Abcd206ImportConfigurator.NewInstance(null, null));
28

  
29
    }
30

  
31
    /**
32
     * {@inheritDoc}
33
     */
34
    @Override
35
    public boolean performFinish() {
36

  
37
        return false;
38
    }
39
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/ListComponent.java
1
/**
2
* Copyright (C) 2017 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.wizard;
10

  
11

  
12
import java.awt.Toolkit;
13
import java.util.ArrayList;
14

  
15
import javax.swing.event.DocumentEvent;
16

  
17
import org.eclipse.swt.SWT;
18
import org.eclipse.swt.events.MouseEvent;
19
import org.eclipse.swt.events.MouseListener;
20
import org.eclipse.swt.layout.GridData;
21
import org.eclipse.swt.widgets.Button;
22
import org.eclipse.swt.widgets.Composite;
23
import org.eclipse.swt.widgets.List;
24
import org.eclipse.swt.widgets.Text;
25

  
26
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
27
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
28

  
29

  
30
/**
31
 * @author k.luther
32
 * @date 20.04.2017
33
 *
34
 */
35
public class ListComponent
36
                      {
37
    private List list;
38

  
39
    private static final String addString = "Add";
40
    private static final String removeString = "Remove";
41
    private Button removeButton;
42
    private Text providerURI;
43

  
44
    public ListComponent(Composite parent, int style) {
45
        list = new List(parent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
46

  
47
        java.util.List<String> providerList = new ArrayList<String>();
48
        String allProviderString = PreferencesUtil.getPreferenceStore().getString(IPreferenceKeys.BIOCASE_PROVIDER_LIST);
49
        //the string is structured like this: http://ww3.bgbm.org/biocase/pywrapper.cgi?dsa=DNA_Bank;http:...;
50
        String[] providerArray = allProviderString.split(";");
51

  
52
        for (String providerString : providerArray){
53
            list.add(providerString);
54
        }
55

  
56
        list.setSelection(0);
57
        GridData dataList = new GridData();
58
        dataList.horizontalAlignment = GridData.FILL;
59
        dataList.horizontalSpan = 2;
60
        dataList.verticalSpan= 4;
61

  
62
        list.setLayoutData(dataList);
63

  
64

  
65
        providerURI = new Text(parent, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
66
        GridData dataProviderUri = new GridData();
67
        dataProviderUri.horizontalAlignment = GridData.FILL;
68
        dataProviderUri.horizontalSpan = 2;
69
        providerURI.setLayoutData(dataProviderUri);
70

  
71
        Button addButton = new Button(parent, SWT.NULL);
72
        AddListener addListener = new AddListener(addButton);
73
        addButton.setText(addString);
74
        addButton.addMouseListener(addListener);
75

  
76
        removeButton = new Button(parent, SWT.NULL);
77
        removeButton.setText(removeString);
78
        removeButton.addMouseListener(new RemoveListener());
79
    }
80

  
81
    class RemoveListener implements MouseListener {
82
        @Override
83
        public void mouseUp(MouseEvent e)  {
84
            //This method can be called only if
85
            //there's a valid selection
86
            //so go ahead and remove whatever's selected.
87
            int index = list.getSelectionIndex();
88
            list.remove(index);
89

  
90
            int size = list.getItemCount();
91

  
92
            if (size == 0) { //Nothing's left, disable removing.
93
                removeButton.setEnabled(false);
94

  
95
            } else { //Select an index.
96
                if (index == size) {
97
                    //removed item in last position
98
                    index--;
99
                }
100

  
101
                list.setSelection(index-1);
102

  
103

  
104
            }
105
        }
106
        /**
107
         * {@inheritDoc}
108
         */
109
        @Override
110
        public void mouseDoubleClick(MouseEvent e) {
111
            // TODO Auto-generated method stub
112

  
113
        }
114

  
115

  
116
        /**
117
         * {@inheritDoc}
118
         */
119
        @Override
120
        public void mouseDown(MouseEvent e) {
121
            // TODO Auto-generated method stub
122

  
123
        }
124
    }
125

  
126
    //This listener is shared by the text field and the add button.
127
    class AddListener implements MouseListener {
128
        private boolean alreadyEnabled = false;
129
        private Button button;
130

  
131
        public AddListener(Button button) {
132
            this.button = button;
133
        }
134

  
135

  
136
        protected boolean alreadyInList(String name) {
137
            return list.getData(name) != null;
138
        }
139

  
140

  
141
        private void enableButton() {
142
            if (!alreadyEnabled) {
143
                button.setEnabled(true);
144
            }
145
        }
146

  
147
        private boolean handleEmptyTextField(DocumentEvent e) {
148
            if (e.getDocument().getLength() <= 0) {
149
                button.setEnabled(false);
150
                alreadyEnabled = false;
151
                return true;
152
            }
153
            return false;
154
        }
155

  
156

  
157

  
158
        /**
159
         * {@inheritDoc}
160
         */
161
        @Override
162
        public void mouseDoubleClick(MouseEvent e) {
163
            // TODO Auto-generated method stub
164

  
165
        }
166

  
167
        /**
168
         * {@inheritDoc}
169
         */
170
        @Override
171
        public void mouseDown(MouseEvent e) {
172
            // TODO Auto-generated method stub
173

  
174
        }
175

  
176
        /**
177
         * {@inheritDoc}
178
         */
179
        @Override
180
        public void mouseUp(MouseEvent e) {
181
            String name = providerURI.getText();
182

  
183
            //User didn't type in a unique name...
184
            if (name.equals("") || alreadyInList(name)) {
185
                Toolkit.getDefaultToolkit().beep();
186
                providerURI.selectAll();
187
                return;
188
            }
189

  
190
            int index = list.getSelectionIndex(); //get selected index
191
            if (index == -1) { //no selection, so insert at beginning
192
                index = 0;
193
            } else {           //add after the selected item
194
                index++;
195
            }
196

  
197
            list.add(providerURI.getText(), index);
198

  
199
            //Select the new item
200
            list.setSelection(index);
201
            list.redraw();
202

  
203
        }
204
    }
205

  
206
    protected String createAllProviderString(){
207
        String allProviderString = null;
208
        boolean first = true;
209
        for (String item: list.getItems()){
210
            if (first || allProviderString == null || allProviderString == ""){
211
                allProviderString = item.trim();
212
                first = false;
213
            }else{
214
                allProviderString +=";"+ item.trim();
215
            }
216
        }
217

  
218
        return allProviderString;
219

  
220
    }
221

  
222

  
223

  
224
}
225

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/NameDetailsViewComposite.java
1
/**
2
* Copyright (C) 2017 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.wizard;
10

  
11
import org.eclipse.jface.preference.IPreferenceStore;
12
import org.eclipse.swt.SWT;
13
import org.eclipse.swt.events.SelectionAdapter;
14
import org.eclipse.swt.events.SelectionEvent;
15
import org.eclipse.swt.layout.GridLayout;
16
import org.eclipse.swt.widgets.Button;
17
import org.eclipse.swt.widgets.Composite;
18

  
19
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
20
import eu.etaxonomy.taxeditor.preference.NameDetailsConfigurator;
21
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
22

  
23
/**
24
 * @author k.luther
25
 * @date 22.02.2017
26
 *
27
 */
28
public class NameDetailsViewComposite extends Composite {
29

  
30
    NameDetailsConfigurator config;
31
    boolean isSimpleDetailsViewActivated;
32
    boolean isShowTaxon;
33
    boolean isShowLSID;
34
    boolean isShowNomenclaturalCode;
35
    boolean isShowNameCache;
36
    boolean isShowAppendedPhrase;
37
    boolean isShowRank;
38
    boolean isShowEpithets;
39
    boolean isShowAuthorshipCache;
40
    boolean isShowAuthorship;
41
    boolean isShowNomenclaturalRef;
42
    boolean isShowNomenclaturalStatus;
43
    boolean isShowProtologue;
44
    boolean isShowTypeDesignation;
45
    boolean isShowNameRelationship;
46
    Composite child;
47

  
48
    public NameDetailsViewComposite(Composite parent, int style, NameDetailsConfigurator config){
49

  
50
        super(parent, style);
51
//        TabItem tbtmNameDetailsConfiguration = new TabItem(tabFolder, SWT.NONE);
52
//        Composite c2 = new Composite(tabFolder, SWT.BORDER);
53
//        c2.setLayout(new GridLayout(1, true));
54
//        tbtmNameDetailsConfiguration.setControl(c2);
55
       // composite.setLayout(new GridLayout(1, true));
56
       this.config = config;
57

  
58
      // Composite composite = new Composite(parent, SWT.NULL);
59
       this.setLayout(new GridLayout());
60

  
61
       isSimpleDetailsViewActivated= PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION);
62
       final Button activateCheckButton = new Button(this, SWT.CHECK);
63
       activateCheckButton.setText("Show only a simple name details view");
64
       activateCheckButton.setSelection(isSimpleDetailsViewActivated);
65
       activateCheckButton.addSelectionListener(new SelectionAdapter(){
66
       @Override
67
       public void widgetSelected(SelectionEvent e) {
68
           isSimpleDetailsViewActivated = activateCheckButton.getSelection();
69
          //
70
           if(isSimpleDetailsViewActivated){
71
               child.setVisible(true);
72
               child.setEnabled(true);
73
           }else{
74
               child.setVisible(false);
75
               child.setEnabled(false);
76
           }
77
        }
78
        });
79

  
80
       child = new Composite(this, SWT.NULL);
81
       child.setLayout(new GridLayout());
82
       child.setVisible(isSimpleDetailsViewActivated);
83

  
84
       final Button showTaxon = new Button(child, SWT.CHECK);
85
       isShowTaxon = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON);
86
       showTaxon.setText("Show taxon of the name");
87
       showTaxon.setSelection(isShowTaxon);
88
       showTaxon.addSelectionListener(new SelectionAdapter(){
89
            @Override
90
            public void widgetSelected(SelectionEvent e) {
91
               isShowTaxon = showTaxon.getSelection();
92

  
93
             }
94
        });
95

  
96
       final Button showLsid = new Button(child, SWT.CHECK);
97
       isShowLSID = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID);
98
       showLsid.setText("Show Lsid of the name");
99
       showLsid.setSelection(isShowLSID);
100
       showLsid.addSelectionListener(new SelectionAdapter(){
101
            @Override
102
            public void widgetSelected(SelectionEvent e) {
103
                isShowLSID = showLsid.getSelection();
104

  
105
             }
106
        });
107

  
108
       final Button showNomenclaturalCode = new Button(child, SWT.CHECK);
109
       isShowNomenclaturalCode = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE);
110
       showNomenclaturalCode.setText("Show the nomenclatural code");
111
       showNomenclaturalCode.setSelection(isShowNomenclaturalCode);
112
       showNomenclaturalCode.addSelectionListener(new SelectionAdapter(){
113
            @Override
114
            public void widgetSelected(SelectionEvent e) {
115
                isShowNomenclaturalCode = showNomenclaturalCode.getSelection();
116

  
117
             }
118
        });
119

  
120
       final Button showNameCache = new Button(child, SWT.CHECK);
121
       isShowNameCache= PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE);
122
       showNameCache.setText("Show nameCache of the name (only the scientific name without the author and year)");
123
       showNameCache.setSelection(isShowNomenclaturalCode);
124
       showNameCache.addSelectionListener(new SelectionAdapter(){
125
            @Override
126
            public void widgetSelected(SelectionEvent e) {
127
                isShowNameCache = showNameCache.getSelection();
128

  
129
             }
130
        });
131
       final Button showAppendedPhrase = new Button(child, SWT.CHECK);
132
       isShowAppendedPhrase= PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE);
133
       showAppendedPhrase.setText("Show appended phrase");
134
       showAppendedPhrase.setSelection(isShowAppendedPhrase);
135
       showAppendedPhrase.addSelectionListener(new SelectionAdapter(){
136
            @Override
137
            public void widgetSelected(SelectionEvent e) {
138
                isShowAppendedPhrase = showAppendedPhrase.getSelection();
139

  
140
             }
141
        });
142

  
143
       final Button showRank = new Button(child, SWT.CHECK);
144
       isShowRank = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK);
145
       showRank.setText("Show rank of the name");
146
       showRank.setSelection(isShowRank);
147
       showRank.addSelectionListener(new SelectionAdapter(){
148
            @Override
149
            public void widgetSelected(SelectionEvent e) {
150
                isShowRank = showRank.getSelection();
151

  
152
             }
153
        });
154
       final Button showEpithets = new Button(child, SWT.CHECK);
155
       isShowEpithets = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS);
156
       showEpithets.setText("Show atomised epithets");
157
       showEpithets.setSelection(isShowEpithets);
158
       showEpithets.addSelectionListener(new SelectionAdapter(){
159
            @Override
160
            public void widgetSelected(SelectionEvent e) {
161
                isShowEpithets = showEpithets.getSelection();
162

  
163
             }
164
        });
165
       final Button showAuthorshipCache = new Button(child, SWT.CHECK);
166
       isShowAuthorshipCache= PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP_CACHE);
167
       showAuthorshipCache.setText("Show authorship cache");
168
       showAuthorshipCache.setSelection(isShowAuthorshipCache);
169
       showAuthorshipCache.addSelectionListener(new SelectionAdapter(){
170
            @Override
171
            public void widgetSelected(SelectionEvent e) {
172
                isShowAuthorshipCache = showAuthorshipCache.getSelection();
173

  
174
             }
175
        });
176

  
177
       final Button showAuthorship = new Button(child, SWT.CHECK);
178
       isShowAuthorship = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP);
179
       showAuthorship.setText("Show authorship section");
180
       showAuthorship.setSelection(isShowAuthorship);
181
       showAuthorship.addSelectionListener(new SelectionAdapter(){
182
            @Override
183
            public void widgetSelected(SelectionEvent e) {
184
                isShowAuthorship = showAuthorship.getSelection();
185

  
186
             }
187
        });
188

  
189
       final Button showNomenclaturalRef = new Button(child, SWT.CHECK);
190
       isShowNomenclaturalRef = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE);
191
       showNomenclaturalRef.setText("Show nomenclatural reference section");
192
       showNomenclaturalRef.setSelection(isShowNomenclaturalRef);
193
       showNomenclaturalRef.addSelectionListener(new SelectionAdapter(){
194
            @Override
195
            public void widgetSelected(SelectionEvent e) {
196
                isShowNomenclaturalRef = showNomenclaturalRef.getSelection();
197

  
198
             }
199
        });
200

  
201
       final Button showNomenclaturalStatus = new Button(child, SWT.CHECK);
202
       isShowNomenclaturalStatus = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS);
203
       showNomenclaturalStatus.setText("Show nomenclatural status section");
204
       showNomenclaturalStatus.setSelection(isShowNomenclaturalStatus);
205
       showNomenclaturalStatus.addSelectionListener(new SelectionAdapter(){
206
            @Override
207
            public void widgetSelected(SelectionEvent e) {
208
                isShowNomenclaturalStatus = showNomenclaturalStatus.getSelection();
209

  
210
             }
211
        });
212

  
213
       final Button showProtologue = new Button(child, SWT.CHECK);
214
       isShowProtologue  = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE);
215
       showProtologue.setText("Show protologue section");
216
       showProtologue.setSelection(isShowProtologue);
217
       showProtologue.addSelectionListener(new SelectionAdapter(){
218
            @Override
219
            public void widgetSelected(SelectionEvent e) {
220
                isShowProtologue = showProtologue.getSelection();
221

  
222
             }
223
        });
224

  
225
       final Button showTypeDesignation = new Button(child, SWT.CHECK);
226
       isShowTypeDesignation = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION);
227
       showTypeDesignation.setText("Show name type designation section");
228
       showTypeDesignation.setSelection(isShowTypeDesignation);
229
       showTypeDesignation.addSelectionListener(new SelectionAdapter(){
230
            @Override
231
            public void widgetSelected(SelectionEvent e) {
232
                isShowTypeDesignation = showTypeDesignation.getSelection();
233

  
234
             }
235
        });
236

  
237

  
238
       final Button showNameRelationship = new Button(child, SWT.CHECK);
239
       isShowNameRelationship = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP);
240
       showNameRelationship.setText("Show name relationship section");
241
       showNameRelationship.setSelection(isShowNameRelationship);
242
       showNameRelationship.addSelectionListener(new SelectionAdapter(){
243
            @Override
244
            public void widgetSelected(SelectionEvent e) {
245
                isShowNameRelationship = showNameRelationship.getSelection();
246

  
247
             }
248
        });
249

  
250
       if(isSimpleDetailsViewActivated){
251
           child.setEnabled(true);
252
       }else{
253
           child.setEnabled(false);
254
       }
255

  
256
    }
257

  
258
    /**
259
    *
260
    */
261
   protected NameDetailsConfigurator createNameDetailsViewConfig() {
262
      saveConfigToPrefernceStore();
263

  
264
      config.setSimpleDetailsViewActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION));
265
      config.setAppendedPhraseActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE));
266
      config.setAtomisedEpithetsActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS));
267
      config.setAuthorshipSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP));
268
      config.setLSIDActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID));
269
      config.setNameCacheActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_CACHE));
270
      config.setNameRelationsSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP));
271
      config.setNomenclaturalCodeActived(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE));
272
      config.setNomenclaturalStatusSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS));
273
      config.setNomenclaturalReferenceSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE));
274
      config.setProtologueActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE));
275
      config.setRankActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK));
276
      config.setSimpleDetailsViewActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION));
277
      config.setTaxonSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON));
278
      config.setTypeDesignationSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION));
279
      return config;
280
   }
281

  
282
    /**
283
     *
284
     */
285
    private void saveConfigToPrefernceStore() {
286
        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION,
287
                isSimpleDetailsViewActivated);
288
        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON, isShowTaxon);
289
        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID, isShowLSID);
290
        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE,
291
                isShowNomenclaturalCode);
292
        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE,
293
                isShowNameCache);
294
        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE,
295
                isShowAppendedPhrase);
296
        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK, isShowRank);
297
        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS,
298
                isShowEpithets);
299
        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP_CACHE,
300
                isShowAuthorshipCache);
301
        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP,
302
                isShowAuthorship);
303
        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE,
304
                isShowNomenclaturalRef);
305
        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS,
306
                isShowNomenclaturalStatus);
307
        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE,
308
                isShowProtologue);
309
        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION,
310
                isShowTypeDesignation);
311
        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP,
312
                isShowNameRelationship);
313

  
314
    }
315

  
316
    protected IPreferenceStore doGetPreferenceStore() {
317
        return PreferencesUtil.getPreferenceStore();
318
    }
319

  
320
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/OpenImportPreferenceHandler.java
1
/**
2
* Copyright (C) 2017 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.handler;
10

  
11
import org.eclipse.e4.core.di.annotations.Execute;
12
import org.eclipse.jface.wizard.WizardDialog;
13

  
14
import eu.etaxonomy.taxeditor.databaseAdmin.wizard.ImportPreferences;
15
import eu.etaxonomy.taxeditor.model.AbstractUtility;
16

  
17
/**
18
 * @author k.luther
19
 * @date 19.04.2017
20
 *
21
 */
22
public class OpenImportPreferenceHandler {
23
    @Execute
24
    public Object execute(){
25
        ImportPreferences importPreferencesWizard = new ImportPreferences();
26
        WizardDialog dialog = new WizardDialog(AbstractUtility.getShell(),
27
                importPreferencesWizard);
28

  
29
        dialog.open();
30

  
31
        return null;
32
    }
33

  
34
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)