Project

General

Profile

Revision c11a2278

IDc11a2278e218c7109b9d238ce63409f403bd5e5a
Parent 4736d50c
Child f0fed63a

Added by Katja Luther almost 2 years ago

fix delete of not persisted data in bulk editor

View differences:

eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorE4.java
126 126
        }
127 127
    }
128 128

  
129
    public void save(IProgressMonitor monitor, boolean resetMerge, boolean rememberSelection) {
130
        if (!input.getCdmEntitySession().isActive()){
131
            input.getCdmEntitySession().bind();
132
        }
133
        input.saveModel(resetMerge);
134

  
135
        IStructuredSelection selection = getSelection();
136

  
137
        dirty.setDirty(false);
138
        input.dispose();
139
        input.bind();
140
        conversation.commit(true);
141

  
142
        if (lastQuery != null && rememberSelection){
143
            bulkEditorComposite.performSearch(lastQuery, selection);
144
        }
145
    }
146

  
147

  
129 148
	@Focus
130 149
	public void setFocus() {
131 150
        //make sure to bind again if maybe in another view the conversation was unbound
......
189 208
        setDirty(true);
190 209
    }
191 210

  
211
    @Override
192 212
    public boolean isDirty() {
193 213
        return dirty.isDirty();
194 214
    }
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/handler/DeleteHandlerE4.java
11 11

  
12 12

  
13 13
import java.util.ArrayList;
14
import java.util.HashSet;
14 15
import java.util.Iterator;
15 16
import java.util.List;
17
import java.util.Set;
16 18

  
17 19
import javax.inject.Named;
18 20

  
......
93 95
        BulkEditorE4 editor= (BulkEditorE4) activePart.getObject();
94 96
        IStructuredSelection selection = editor.getSelection();
95 97

  
98
        Iterator iterator = selection.iterator();
99
        int selectionCount = selection.size();
100
        Set<CdmBase> removeFromSelection = new HashSet();
101
        for(selection.iterator();iterator.hasNext();){
102
            CdmBase cdmBase = (CdmBase) iterator.next();
103
            if (!cdmBase.isPersited()){
104
                editor.getEditorInput().getModel().remove(cdmBase);
105
                editor.getEditorInput().getSaveCandidates().remove(cdmBase);
106
                removeFromSelection.add(cdmBase);
107
                selectionCount--;
108
            }
109
        }
110

  
111

  
112
        if (selectionCount == 0){
113
            if (editor.getEditorInput().getMergeCandidates().size() == 0 && editor.getEditorInput().getSaveCandidates().size() == 0 && editor.getEditorInput().getToDelete().size() == 0){
114
                editor.setDirty(false);
115
            }
116
            return;
117
        }
118

  
96 119
        if (editor.isDirty()){
97 120
            boolean proceed = MessageDialog.openQuestion(null,
98 121
                    "Save changes", "You have made changes that must be saved before this query can be executed. Would you like to proceed?");
......
103 126
            }
104 127
        }
105 128

  
106
        Iterator iterator = selection.iterator();
129
        iterator = selection.iterator();
107 130
        for(selection.iterator();iterator.hasNext();){
108 131
            CdmBase cdmBase = (CdmBase) iterator.next();
109
            delete(cdmBase, shell, editor);
132
            if (cdmBase.isPersited()){
133
                delete(cdmBase, shell, editor);
134
            }
110 135
        }
111 136
    }
112 137

  
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AbstractBulkEditorInput.java
68 68
	private BasicEventList<T> model = new BasicEventList<>();
69 69

  
70 70
	private Map<T, DeleteConfiguratorBase> toDelete = new HashMap<>();
71
	private Set<T> saveCandidates = new HashSet<>();
71
	public Map<T, DeleteConfiguratorBase> getToDelete() {
72
        return toDelete;
73
    }
74

  
75
    private Set<T> saveCandidates = new HashSet<>();
72 76

  
73 77

  
74 78
	private Set<T> markedMergeCandidates = new HashSet<>();
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/GroupCreator.java
12 12
import java.util.HashMap;
13 13
import java.util.List;
14 14
import java.util.Map;
15
import java.util.UUID;
16 15

  
17 16
import eu.etaxonomy.cdm.api.service.IGroupService;
18 17
import eu.etaxonomy.cdm.model.common.Group;
......
49 48

  
50 49
        if (groupList.isEmpty()){
51 50
            Group group = Group.NewInstance(text);
52
            UUID groupUuid = CdmStore.getService(IGroupService.class).saveGroup(group);
53
            group = CdmStore.getService(IGroupService.class).loadWithUpdate(groupUuid);
51
//            UUID groupUuid = CdmStore.getService(IGroupService.class).saveGroup(group);
52
//            group = CdmStore.getService(IGroupService.class).loadWithUpdate(groupUuid);
54 53
            return group;
55 54
        } else{
56 55
            MessagingUtils.messageDialog(Messages.GROUP_CREATOR_group_exists_title, text, Messages.GROUP_CREATOR_group_exists);
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/AbcdImportProvider.java
17 17
import eu.etaxonomy.cdm.api.application.ICdmRepository;
18 18
import eu.etaxonomy.cdm.api.service.IPreferenceService;
19 19
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
20
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
21 20
import eu.etaxonomy.taxeditor.l10n.Messages;
21
import eu.etaxonomy.taxeditor.preference.EditorPreferencePredicate;
22 22
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
23 23
import eu.etaxonomy.taxeditor.store.CdmStore;
24 24

  
......
55 55
        if (biocaseProviderList != null){
56 56
            providerList = biocaseProviderList.createAllProviderString();
57 57

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

  
61 61
            ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration();
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/GeneralAdminPreferencePage.java
12 12
import eu.etaxonomy.cdm.api.service.IPreferenceService;
13 13
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
14 14
import eu.etaxonomy.cdm.model.metadata.CdmPreference.PrefKey;
15
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
16 15
import eu.etaxonomy.cdm.model.metadata.PreferenceSubject;
17 16
import eu.etaxonomy.taxeditor.preference.EditorPreferencePredicate;
18 17
import eu.etaxonomy.taxeditor.preference.GeneralPreferencePage;
......
40 39
       if (controller != null){
41 40
           IPreferenceService service = controller.getPreferenceService();
42 41

  
43
           CdmPreference pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.ShowImportExportMenu, Boolean.toString(this.isShowIOMenu));
42
           CdmPreference pref = CdmPreference.NewTaxEditorInstance(EditorPreferencePredicate.ShowImportExportMenu, Boolean.toString(this.isShowIOMenu));
44 43
           pref.setAllowOverride(isAllowOverrideShowIOMenu);
45 44
           service.set(pref);
46 45
//           pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.ShowMediaView, Boolean.toString(this.isShowMediaView));
47 46
//           pref.setAllowOverride(isAllowOverrideShowMediaView);
48 47
//           service.set(pref);
49
           pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.ShowChecklistPerspective, Boolean.toString(this.isShowCheckListPerspective));
48
           pref = CdmPreference.NewTaxEditorInstance(EditorPreferencePredicate.ShowChecklistPerspective, Boolean.toString(this.isShowCheckListPerspective));
50 49
           pref.setAllowOverride(isAllowOverrideShowCheckListPerspective);
51 50
           service.set(pref);
52
           pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.ShowTaxonNodeWizard, Boolean.toString(this.isShowTaxonNodeWizard));
51
           pref = CdmPreference.NewTaxEditorInstance(EditorPreferencePredicate.ShowTaxonNodeWizard, Boolean.toString(this.isShowTaxonNodeWizard));
53 52
           pref.setAllowOverride(isAllowOverrideShowTaxonNodeWizard);
54 53
           service.set(pref);
55 54
           PreferencesUtil.updateDBPreferences();
......
65 64
        controller = CdmStore.getCurrentApplicationConfiguration();
66 65
        if (controller != null){
67 66
          IPreferenceService service = controller.getPreferenceService();
68
          PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.ShowImportExportMenu);
67
          PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), EditorPreferencePredicate.ShowImportExportMenu);
69 68
          CdmPreference pref = service.find(key);
70 69
          if (pref != null){
71 70
              isShowIOMenu = Boolean.valueOf(pref.getValue());
......
85 84
//              isAllowOverrideShowMediaView = true;
86 85
//          }
87 86

  
88
          key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.ShowChecklistPerspective);
87
          key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), EditorPreferencePredicate.ShowChecklistPerspective);
89 88
          pref = service.find(key);
90 89
          if (pref != null){
91 90
              isShowCheckListPerspective = Boolean.valueOf(pref.getValue());
......
95 94
              isAllowOverrideShowCheckListPerspective = true;
96 95
          }
97 96

  
98
          key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.ShowTaxonNodeWizard);
97
          key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), EditorPreferencePredicate.ShowTaxonNodeWizard);
99 98
          pref = service.find(key);
100 99
          if (pref != null){
101 100
              isShowTaxonNodeWizard = Boolean.valueOf(pref.getValue());
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/ListComponent.java
25 25
import org.eclipse.swt.widgets.Text;
26 26

  
27 27
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
28
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
29 28
import eu.etaxonomy.taxeditor.l10n.Messages;
29
import eu.etaxonomy.taxeditor.preference.EditorPreferencePredicate;
30 30
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
31 31

  
32 32

  
......
55 55
        Rectangle clientArea = parent.getShell().getClientArea ();
56 56
        list.setBounds (clientArea.x, clientArea.y, 100, 500);
57 57

  
58
        CdmPreference providerListPreference = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.BioCaseProvider);
58
        CdmPreference providerListPreference = PreferencesUtil.getPreferenceFromDB(EditorPreferencePredicate.BioCaseProvider);
59 59
        String allProviderString = ""; //$NON-NLS-1$
60 60
        if (providerListPreference != null){
61 61
            allProviderString  = providerListPreference.getValue();
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/NameDetailsViewAdminConfiguration.java
5 5
import eu.etaxonomy.cdm.api.service.IPreferenceService;
6 6
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
7 7
import eu.etaxonomy.cdm.model.metadata.CdmPreference.PrefKey;
8
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
9 8
import eu.etaxonomy.cdm.model.metadata.PreferenceSubject;
10 9
import eu.etaxonomy.taxeditor.preference.CdmPreferenceCache;
11 10
import eu.etaxonomy.taxeditor.preference.EditorPreferencePredicate;
......
58 57
        String value = config.toString();
59 58

  
60 59

  
61
        CdmPreference pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.NameDetailsView, value);
60
        CdmPreference pref = CdmPreference.NewTaxEditorInstance(EditorPreferencePredicate.NameDetailsView, value);
62 61
        pref.setAllowOverride(isAllowOverride);
63 62
        service.set(pref);
64 63
        PreferencesUtil.saveConfigToPrefernceStore(config);
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/SpecimenAdminPreferences.java
14 14
import eu.etaxonomy.cdm.api.service.IPreferenceService;
15 15
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
16 16
import eu.etaxonomy.cdm.model.metadata.CdmPreference.PrefKey;
17
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
18 17
import eu.etaxonomy.cdm.model.metadata.PreferenceSubject;
18
import eu.etaxonomy.taxeditor.preference.EditorPreferencePredicate;
19 19
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
20 20
import eu.etaxonomy.taxeditor.preference.SpecimenOrObservationPreferences;
21 21
import eu.etaxonomy.taxeditor.store.CdmStore;
......
146 146
        ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration();
147 147
        if (controller != null){
148 148
            IPreferenceService service = controller.getPreferenceService();
149
            PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.ShowSpecimen);
149
            PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), EditorPreferencePredicate.ShowSpecimen);
150 150
            showSpecimenPref = service.find(key);
151 151
            if (showSpecimenPref != null){
152 152
                this.isShowSpecimenRelatedIssues = Boolean.valueOf(showSpecimenPref.getValue());
153 153
                this.allowOverrideShowSpecimenRelatedIssues = showSpecimenPref.isAllowOverride();
154 154
            }else{
155
                showSpecimenPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.ShowSpecimen, Boolean.toString(true));
155
                showSpecimenPref = CdmPreference.NewTaxEditorInstance(EditorPreferencePredicate.ShowSpecimen, Boolean.toString(true));
156 156
                this.isShowSpecimenRelatedIssues = true;
157 157
                this.allowOverrideShowSpecimenRelatedIssues = true;
158 158
            }
159 159

  
160
            key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.ShowCollectingAreasInGeneralSection);
160
            key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), EditorPreferencePredicate.ShowCollectingAreasInGeneralSection);
161 161
            CdmPreference isShowCollectingAreaInGeneralSectionPref = service.find(key);
162 162
            if (isShowCollectingAreaInGeneralSectionPref != null){
163 163
                this.isShowCollectingAreaInGeneralSection = Boolean.valueOf(isShowCollectingAreaInGeneralSectionPref.getValue());
164 164
                this.allowOverrideShowCollectingAreaInGeneralSection = isShowCollectingAreaInGeneralSectionPref.isAllowOverride();
165 165
            }
166 166

  
167
            key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.DeterminationOnlyForFieldUnits);
167
            key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), EditorPreferencePredicate.DeterminationOnlyForFieldUnits);
168 168
            CdmPreference isDeterminationOnlyForFieldUnitsPref = service.find(key);
169 169
            if (isDeterminationOnlyForFieldUnitsPref != null){
170 170
                this.isDeterminationOnlyForFieldUnits = Boolean.valueOf(isDeterminationOnlyForFieldUnitsPref.getValue());
171 171
                this.allowOverrideDeterminationOnlyForFieldUnits = isDeterminationOnlyForFieldUnitsPref.isAllowOverride();
172 172
            }
173
            key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.ShowTaxonAssociations);
173
            key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), EditorPreferencePredicate.ShowTaxonAssociations);
174 174
            CdmPreference isShowTaxonAssociationPref = service.find(key);
175 175
            if (isShowTaxonAssociationPref != null){
176 176
                this.isShowTaxonAssociation = Boolean.valueOf(isShowTaxonAssociationPref.getValue());
177 177
                this.allowOverrideShowTaxonAssociation = isShowTaxonAssociationPref.isAllowOverride();
178 178
            }
179 179

  
180
            key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.ShowLifeForm);
180
            key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), EditorPreferencePredicate.ShowLifeForm);
181 181
            CdmPreference isShowLifeFormPref = service.find(key);
182 182
            if (isShowLifeFormPref != null){
183 183
                this.isShowLifeForm = Boolean.valueOf(isShowLifeFormPref.getValue());
......
196 196
        if (controller != null){
197 197
            IPreferenceService service = controller.getPreferenceService();
198 198

  
199
            CdmPreference pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.ShowCollectingAreasInGeneralSection, Boolean.toString(this.isShowCollectingAreaInGeneralSection));
199
            CdmPreference pref = CdmPreference.NewTaxEditorInstance(EditorPreferencePredicate.ShowCollectingAreasInGeneralSection, Boolean.toString(this.isShowCollectingAreaInGeneralSection));
200 200
            pref.setAllowOverride(allowOverrideShowCollectingAreaInGeneralSection);
201 201
            service.set(pref);
202
            pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.ShowSpecimen, Boolean.toString(this.isShowSpecimenRelatedIssues));
202
            pref = CdmPreference.NewTaxEditorInstance(EditorPreferencePredicate.ShowSpecimen, Boolean.toString(this.isShowSpecimenRelatedIssues));
203 203
            pref.setAllowOverride(allowOverrideShowSpecimenRelatedIssues);
204 204
            service.set(pref);
205 205

  
206
            pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.DeterminationOnlyForFieldUnits, Boolean.toString(this.isDeterminationOnlyForFieldUnits));
206
            pref = CdmPreference.NewTaxEditorInstance(EditorPreferencePredicate.DeterminationOnlyForFieldUnits, Boolean.toString(this.isDeterminationOnlyForFieldUnits));
207 207
            pref.setAllowOverride(allowOverrideDeterminationOnlyForFieldUnits);
208 208
            service.set(pref);
209 209

  
210
            pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.ShowTaxonAssociations, Boolean.toString(this.isShowTaxonAssociation));
210
            pref = CdmPreference.NewTaxEditorInstance(EditorPreferencePredicate.ShowTaxonAssociations, Boolean.toString(this.isShowTaxonAssociation));
211 211
            pref.setAllowOverride(allowOverrideShowTaxonAssociation);
212 212
            service.set(pref);
213 213

  
214
            pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.ShowLifeForm, Boolean.toString(this.isShowLifeForm));
214
            pref = CdmPreference.NewTaxEditorInstance(EditorPreferencePredicate.ShowLifeForm, Boolean.toString(this.isShowLifeForm));
215 215
            pref.setAllowOverride(allowOverrideShowLifeForm);
216 216
            service.set(pref);
217 217
            PreferencesUtil.updateDBPreferences();
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/DatabasePreferencesPage__.java
1
/**
2
* Copyright (C) 2016 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 java.util.List;
12

  
13
import org.eclipse.jface.preference.IPreferenceStore;
14
import org.eclipse.jface.wizard.IWizard;
15
import org.eclipse.jface.wizard.IWizardPage;
16
import org.eclipse.swt.SWT;
17
import org.eclipse.swt.events.SelectionAdapter;
18
import org.eclipse.swt.events.SelectionEvent;
19
import org.eclipse.swt.layout.GridData;
20
import org.eclipse.swt.layout.GridLayout;
21
import org.eclipse.swt.widgets.Button;
22
import org.eclipse.swt.widgets.Combo;
23
import org.eclipse.swt.widgets.Composite;
24
import org.eclipse.swt.widgets.Label;
25

  
26
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
27
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
28
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
29
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
30
import eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.ListComponent;
31
import eu.etaxonomy.taxeditor.l10n.Messages;
32
import eu.etaxonomy.taxeditor.model.NomenclaturalCodeHelper;
33
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
34
import eu.etaxonomy.taxeditor.preference.NameDetailsConfigurator;
35
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
36

  
37
/**
38
 * @author k.luther
39
 * @date 01.11.2016
40
 *
41
 */
42
public class DatabasePreferencesPage__ extends AbstractPreferenceWizard implements IWizardPage{
43

  
44
    CdmPreference preferedNomenclaturalCode;
45
    NameDetailsConfigurator config ;
46
    CdmPreference isRedListPreference;
47
    CdmPreference determinationOnlyForFieldUnitsPreference;
48
    CdmPreference showCollectingAreaInGeneralSectionPreference;
49
    CdmPreference showTaxonAssociationsPreference;
50
    CdmPreference setPublishFlagAsDefault;
51

  
52
    boolean isSimpleDetailsViewActivated;
53

  
54
    Composite child ;
55
    NameDetailsViewComposite nameDetailsConfig;
56
    protected NameDetailsViewComposite getNameDetailsConfig() {
57
        return nameDetailsConfig;
58
    }
59

  
60
    String selectedPreferenceKey = null;
61

  
62
    ListComponent biocaseProviderList;
63
    Abcd206ImportConfigurator abcdImportConfigurator;
64

  
65
    String[][] labelAndValues;
66

  
67
    /*
68
     *
69
     */
70
    public DatabasePreferencesPage__(String pageName) {
71
        super(pageName);
72
        this.preferedNomenclaturalCode = PreferencesUtil.setPreferredNomenclaturalCode(null, false);
73
        this.config = PreferencesUtil.getPreferredNameDetailsConfiguration( false);
74
        if (config == null){
75
            config = new NameDetailsConfigurator(false);
76
        }
77

  
78

  
79
    }
80

  
81

  
82
    protected IPreferenceStore doGetPreferenceStore() {
83
        return PreferencesUtil.getPreferenceStore();
84
    }
85

  
86
    /**
87
     * @return
88
     */
89
    private String[][] getLabelAndValues() {
90
        List<NomenclaturalCode> supportedCodes = NomenclaturalCodeHelper
91
                .getSupportedCodes();
92
        labelAndValues = new String[supportedCodes.size()][2];
93
        for (int i = 0; i < supportedCodes.size(); i++) {
94
            labelAndValues[i][0] = NomenclaturalCodeHelper
95
                    .getDescription(supportedCodes.get(i));
96
            labelAndValues[i][1] = PreferencesUtil
97
                    .getPreferenceKey(supportedCodes.get(i));
98
        }
99
        return labelAndValues;
100
    }
101

  
102

  
103

  
104

  
105
    public void createNomenclaturalCodeTab(Composite parent){
106

  
107
        Combo nomenclaturalCodeCombo;
108
        Label nomenclaturalCodeLabel;
109

  
110
        composite = addTab(Messages.DatabasePreferencesPage_Define_Default_NomenclaturalCode);
111
        nomenclaturalCodeCombo = new Combo(composite, SWT.DROP_DOWN);
112

  
113
        List<NomenclaturalCode> supportedCodes = NomenclaturalCodeHelper
114
              .getSupportedCodes();
115
        for (NomenclaturalCode code: supportedCodes) {
116
           nomenclaturalCodeCombo.add(NomenclaturalCodeHelper
117
                   .getDescription(code));
118

  
119
       }
120
       nomenclaturalCodeCombo.select(0);
121
       getLabelAndValues();
122
       //get the actual nomenclatural code and set it as selection: doGetPreferenceStore().getString(IPreferenceKeys.CDM_NOMENCLATURAL_CODE_KEY);
123
       nomenclaturalCodeCombo.addSelectionListener(new SelectionAdapter() {
124
           @Override
125
        public void widgetSelected(SelectionEvent evt) {
126

  
127
               String name = nomenclaturalCodeCombo.getText();
128

  
129
               for (String[] labelAndValue: labelAndValues){
130
                   if (labelAndValue[0].equals(name)){
131
                       selectedPreferenceKey = labelAndValue[1];
132
                   }
133
               }
134

  
135

  
136
               PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.PREFERRED_NOMENCLATURAL_CODE_KEY, selectedPreferenceKey);
137

  
138
           }
139
       });
140
       nomenclaturalCodeLabel = new Label(composite, SWT.READ_ONLY);
141

  
142

  
143
//        final Button useLocalPreference = new Button(composite, SWT.CHECK);
144
//        boolean isUseLocalPreference = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY);
145
//        useLocalPreference.setText(Messages.DatabasePreferencesPage_UseLocalPreferences);
146
//        useLocalPreference.setSelection(isUseLocalPreference);
147
//        useLocalPreference.addSelectionListener(new SelectionAdapter(){
148
//             @Override
149
//             public void widgetSelected(SelectionEvent e) {
150
//                 boolean isUseLocalPreference = useLocalPreference.getSelection();
151
//                 PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY, isUseLocalPreference);
152
//              }
153
//         });
154

  
155

  
156

  
157

  
158
    }
159
    public void createSetPublishFlagTab(Composite parent){
160
        composite = addTab(Messages.DatabasePreferencesPage_SetPublishFlag);
161
        GridLayout gridLayout = new GridLayout();
162
        gridLayout.numColumns = 2;
163
        composite.setLayout(gridLayout);
164
        //radio buttons for set publish as default, set not publish as default and inherit from parent
165

  
166
    }
167

  
168

  
169
    public void createBiocaseProviderTab(Composite parent){
170
        composite = addTab(Messages.DatabasePreferencesPage_Biocase_Provider);
171
        GridLayout gridLayout = new GridLayout();
172
        gridLayout.numColumns = 2;
173
        composite.setLayout(gridLayout);
174
        biocaseProviderList = new ListComponent(composite, SWT.SCROLL_LINE);
175

  
176
    }
177

  
178
    public ListComponent getBiocaseProviderList() {
179
        return biocaseProviderList;
180
    }
181

  
182
    public void createNameDetailsViewConfigurationTab(Composite parent, NameDetailsConfigurator config){
183
    	composite = parent;
184
        composite = addTab(Messages.DatabasePreferencesPage_details_view_configuration);
185
        GridLayout gridLayout = new GridLayout();
186
        gridLayout.numColumns = 1;
187

  
188
        composite.setLayout(gridLayout);
189
        nameDetailsConfig = new NameDetailsViewComposite(composite, SWT.SCROLL_LINE, config);
190

  
191

  
192
    }
193

  
194

  
195
    public void createSpecimenOrObservationTab(Composite parent){
196
       composite = addTab(Messages.DatabasePreferencesPage_Specimen_Or_Observation);
197

  
198
        final Button showCollectingAreaInGeneralSectionButton = new Button(composite, SWT.CHECK);
199
        CdmPreference isShowCollectingAreaInGeneralSection = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowCollectingAreasInGeneralSection);
200
        if (isShowCollectingAreaInGeneralSection == null){
201
            isShowCollectingAreaInGeneralSection = CdmPreference.NewDatabaseInstance(PreferencePredicate.ShowCollectingAreasInGeneralSection, Boolean.toString(false));
202
        }
203
        showCollectingAreaInGeneralSectionButton.setText(Messages.DatabasePreferncesPage_Show_Collecting_Areas_in_general_section);
204

  
205
        showCollectingAreaInGeneralSectionButton.setSelection(Boolean.valueOf(isShowCollectingAreaInGeneralSection.getValue()));
206
        showCollectingAreaInGeneralSectionButton.addSelectionListener(new SelectionAdapter(){
207
             @Override
208
             public void widgetSelected(SelectionEvent e) {
209
                 boolean isShowCollectingAreaInGeneralSection = showCollectingAreaInGeneralSectionButton.getSelection();
210
                 PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION, isShowCollectingAreaInGeneralSection);
211
              }
212
         });
213

  
214
        final Button determinationOnlyForFieldUnitsButton = new Button(composite, SWT.CHECK);
215
//        boolean isDeterminationOnlyForFieldUnits = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS);
216
        CdmPreference isDeterminationOnlyForFieldUnits = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.DeterminationOnlyForFieldUnits);
217
        if (isDeterminationOnlyForFieldUnits == null){
218
            isDeterminationOnlyForFieldUnits = CdmPreference.NewDatabaseInstance(PreferencePredicate.DeterminationOnlyForFieldUnits, Boolean.toString(false));
219
        }
220
        determinationOnlyForFieldUnitsButton.setText(Messages.DatabasePreferncesPage_Determination_only_for_field_unnits);
221

  
222
        determinationOnlyForFieldUnitsButton.setSelection(Boolean.valueOf(isDeterminationOnlyForFieldUnits.getValue()));
223
        determinationOnlyForFieldUnitsButton.addSelectionListener(new SelectionAdapter(){
224
             @Override
225
             public void widgetSelected(SelectionEvent e) {
226
                 boolean isDeterminationOnlyForFieldUnits = determinationOnlyForFieldUnitsButton.getSelection();
227
                 PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS, isDeterminationOnlyForFieldUnits);
228
              }
229
         });
230

  
231
        final Button showTaxonAssociationButton = new Button(composite, SWT.CHECK);
232
        CdmPreference isShowTaxonAssociation = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowTaxonAssociations);
233
        if (isShowTaxonAssociation == null){
234
            isShowTaxonAssociation = CdmPreference.NewDatabaseInstance(PreferencePredicate.ShowTaxonAssociations, Boolean.toString(false));
235
        }
236
        showTaxonAssociationButton.setText(Messages.DatabasePreferncesPage_Taxon_Associations);
237

  
238
        showTaxonAssociationButton.setSelection(Boolean.valueOf(isShowTaxonAssociation.getValue()));
239
        showTaxonAssociationButton.addSelectionListener(new SelectionAdapter(){
240
             @Override
241
             public void widgetSelected(SelectionEvent e) {
242
                 boolean isShowTaxonAssociation = showTaxonAssociationButton.getSelection();
243
                 PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS, isShowTaxonAssociation);
244
              }
245
         });
246

  
247
        final Button showLifeFormButton = new Button(composite, SWT.CHECK);
248
        CdmPreference  isShowLifeForm = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowLifeForm);
249
        if (isShowLifeForm == null){
250
            isShowLifeForm = CdmPreference.NewDatabaseInstance(PreferencePredicate.ShowLifeForm, Boolean.toString(false));
251
        }
252

  
253
        showLifeFormButton.setText(Messages.DatabasePreferncesPage_Life_Form);
254
        showLifeFormButton.setSelection(Boolean.valueOf(isShowLifeForm.getValue()));
255
        showLifeFormButton.addSelectionListener(new SelectionAdapter(){
256
             @Override
257
             public void widgetSelected(SelectionEvent e) {
258
                 boolean isShowLifeForm = showLifeFormButton.getSelection();
259
                 PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_LIFE_FORM, isShowLifeForm);
260
              }
261
         });
262

  
263
//        Composite useLocalComp = new Composite(composite, SWT.NONE);
264

  
265

  
266
        final Button useLocalPreference = new Button(composite, SWT.CHECK);
267
        boolean isUseLocalPreference = isShowTaxonAssociation.isAllowOverride();
268
        useLocalPreference.setText(Messages.DatabasePreferencesPage_UseLocalPreferences);
269
        GridData gridData = new GridData(SWT.FILL, SWT.BOTTOM, false, false);
270
        gridData.verticalIndent = 10;
271
        useLocalPreference.setLayoutData(gridData);
272

  
273
        useLocalPreference.setSelection(isUseLocalPreference);
274
        useLocalPreference.addSelectionListener(new SelectionAdapter(){
275
             @Override
276
             public void widgetSelected(SelectionEvent e) {
277
                 boolean isUseLocalPreference = useLocalPreference.getSelection();
278
               //  PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ALLOW_OVERRIDE_SPECIMEN_PREF, isUseLocalPreference);
279
              }
280
         });
281

  
282

  
283

  
284
 }
285

  
286
/**
287
 * {@inheritDoc}
288
 */
289
@Override
290
public boolean canFlipToNextPage() {
291
    // TODO Auto-generated method stub
292
    return false;
293
}
294

  
295

  
296

  
297
/**
298
 * {@inheritDoc}
299
 */
300
@Override
301
public String getName() {
302
    // TODO Auto-generated method stub
303
    return null;
304
}
305

  
306

  
307

  
308
/**
309
 * {@inheritDoc}
310
 */
311
@Override
312
public IWizardPage getNextPage() {
313
    // TODO Auto-generated method stub
314
    return null;
315
}
316

  
317

  
318

  
319
/**
320
 * {@inheritDoc}
321
 */
322
@Override
323
public IWizardPage getPreviousPage() {
324
    // TODO Auto-generated method stub
325
    return null;
326
}
327

  
328

  
329

  
330
/**
331
 * {@inheritDoc}
332
 */
333
@Override
334
public IWizard getWizard() {
335
    // TODO Auto-generated method stub
336
    return null;
337
}
338

  
339

  
340

  
341
/**
342
 * {@inheritDoc}
343
 */
344
@Override
345
public boolean isPageComplete() {
346

  
347
    return true;
348
}
349

  
350

  
351

  
352
/**
353
 * {@inheritDoc}
354
 */
355
@Override
356
public void setPreviousPage(IWizardPage page) {
357
    // TODO Auto-generated method stub
358

  
359
}
360

  
361

  
362

  
363
/**
364
 * {@inheritDoc}
365
 */
366
@Override
367
public void setWizard(IWizard newWizard) {
368
    // TODO Auto-generated method stub
369

  
370
}
371

  
372
/**
373
 * {@inheritDoc}
374
 */
375
@Override
376
public void createControl(Composite parent) {
377
    createNameDetailsViewConfigurationTab(parent, config);
378
    createNomenclaturalCodeTab(parent);
379

  
380
    createSpecimenOrObservationTab(parent);
381
    createBiocaseProviderTab(parent);
382
    setControl(parent);
383
}
384

  
385
/**
386
 * @return
387
 */
388
public NameDetailsConfigurator getConfig() {
389
    return config;
390
}
391

  
392
/**
393
 *
394
 */
395
public Abcd206ImportConfigurator getAbcdImportConfig() {
396
    return abcdImportConfigurator;
397

  
398
}
399

  
400
/**
401
 * @return
402
 */
403
public void createAbcdImportConfig() {
404
    this.abcdImportConfigurator.setAddIndividualsAssociationsSuchAsSpecimenAndObservations(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ADD_INDIVIDUALS_ASSOCIATIONS_SUCH_AS_SPECIMEN_AND_OBSERVATIONS));
405
    this.abcdImportConfigurator.setAddMediaAsMediaSpecimen(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ADD_MEDIA_AS_MEDIASPECIMEN));
406
    this.abcdImportConfigurator.setAllowReuseOtherClassifications(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ALLOW_REUSE_OTHER_CLASSIFICATIONS));
407
    //this.abcdImportConfigurator.setClassificationUuid(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_CLASSIFICATION_UUID));
408
    this.abcdImportConfigurator.setDeduplicateClassifications(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEDUPLICATE_CLASSIFICATIONS));
409
    this.abcdImportConfigurator.setDeduplicateReferences(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEDUPLICATE_REFERENCES));
410
   // this.abcdImportConfigurator.setDefaultAuthor(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEFAULT_AUTHOR));
411
    this.abcdImportConfigurator.setGetSiblings(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DO_SIBLINGS));
412
    this.abcdImportConfigurator.setIgnoreAuthorship(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_IGNORE_AUTHORSHIP));
413
    this.abcdImportConfigurator.setIgnoreImportOfExistingSpecimen(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_IGNORE_IMPORT_OF_EXISTING_SPECIMEN));
414
    this.abcdImportConfigurator.setMapUnitIdToAccessionNumber(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TO_ACCESSION_NUMBER));
415
    this.abcdImportConfigurator.setMapUnitIdToBarcode(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TO_BARCODE));
416
    this.abcdImportConfigurator.setMapUnitIdToCatalogNumber(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TOCATALOG_NUMBER));
417
    this.abcdImportConfigurator.setMoveNewTaxaToDefaultClassification(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MOVE_NEW_TAXA_TO_DEFAULT_CLASSIFICATION));
418
    this.abcdImportConfigurator.setReuseExistingDescriptiveGroups(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_DESCRIPTIVE_GROUPS));
419
    this.abcdImportConfigurator.setReuseExistingTaxaWhenPossible(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_TAXA_WHEN_POSSIBLE));
420

  
421
}
422

  
423

  
424

  
425

  
426

  
427

  
428

  
429
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/DatabasePreferencesWizard__.java
1
/**
2
* Copyright (C) 2016 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.IWizardPage;
12
import org.eclipse.jface.wizard.Wizard;
13

  
14
/**
15
 * @author k.luther
16
 * @date 18.11.2016
17
 *
18
 */
19
public class DatabasePreferencesWizard__ extends Wizard {
20

  
21

  
22
    public DatabasePreferencesPage__ preferencePage;
23

  
24

  
25

  
26
    public DatabasePreferencesWizard__() {
27
        setWindowTitle("Database Preferences Wizard");
28

  
29
        preferencePage = new DatabasePreferencesPage__("Database Preferences");
30

  
31

  
32
    }
33

  
34

  
35

  
36
    /**
37
     * @return the preferencePage
38
     */
39
    public DatabasePreferencesPage__ getPreferencePage() {
40
        return preferencePage;
41
    }
42
    /**
43
     * {@inheritDoc}
44
     */
45
    @Override
46
    public boolean performFinish() {
47
//
48
////       getPreferencePage().performOk();
49
//
50
//        String value =PreferencesUtil.getStringValue(IPreferenceKeys.PREFERRED_NOMENCLATURAL_CODE_KEY);
51
//
52
//       // boolean allowOverride =  PreferencesUtil.getBooleanValue(IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY);
53
//        CdmPreference pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.NomenclaturalCode, value);
54
////        pref.setAllowOverride(allowOverride);
55
////
56
////        ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration();
57
////        if (controller == null){
58
////            return false;
59
////        }
60
////        IPreferenceService service = controller.getPreferenceService();
61
////        service.set(pref);
62
////        NameDetailsConfigurator config = getPreferencePage().getNameDetailsConfig().createNameDetailsViewConfig();
63
////        value = config.toString();
64
////        allowOverride = getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NAME_DETAILS);
65
////
66
////        pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.NameDetailsView, value);
67
////        pref.setAllowOverride(allowOverride);
68
////        service.set(pref);
69
////        if (!allowOverride || (allowOverride && !PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.OVERRIDE_NAME_DETAILS))){
70
////            PreferencesUtil.saveConfigToPrefernceStore(config);
71
////        }
72
////
73
////
74
////        boolean isDeterminationOnlyForFieldUnit= getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS );
75
////        pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.DeterminationOnlyForFieldUnits, String.valueOf(isDeterminationOnlyForFieldUnit));
76
////       // allowOverride = getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_SPECIMEN_PREF);
77
////        pref.setAllowOverride(allowOverride);
78
////        service.set(pref);
79
////
80
////        boolean isShowCollectingAreasInGeneralsecion= getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION );
81
////        pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.ShowCollectingAreasInGeneralSection, String.valueOf(isShowCollectingAreasInGeneralsecion));
82
////        pref.setAllowOverride(allowOverride);
83
////        service.set(pref);
84
////
85
////        boolean isShowTaxonAssociations= getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS);
86
////        pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.ShowTaxonAssociations, String.valueOf(isShowTaxonAssociations));
87
////        pref.setAllowOverride(allowOverride);
88
////        service.set(pref);
89
////
90
////        boolean isShowLifeForm= getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_LIFE_FORM);
91
////        pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.ShowLifeForm, String.valueOf(isShowLifeForm));
92
////        pref.setAllowOverride(allowOverride);
93
////        service.set(pref);
94
////
95
////        String biocaseProviderList = this.getPreferencePage().getBiocaseProviderList().createAllProviderString();
96
////        if (biocaseProviderList == null){
97
////            getPreferencePage().doGetPreferenceStore().setValue(IPreferenceKeys.BIOCASE_PROVIDER_LIST,"");
98
////        }else{
99
////            getPreferencePage().doGetPreferenceStore().setValue(IPreferenceKeys.BIOCASE_PROVIDER_LIST, biocaseProviderList);
100
//
101
//        }
102
//        pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.BioCaseProvider, String.valueOf(biocaseProviderList));
103
//        pref.setAllowOverride(false);
104
//        service.set(pref);
105
////        getPreferencePage().createAbcdImportConfig();
106
////        value = getPreferencePage().getAbcdImportConfig().toString();
107
////        allowOverride = getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_ABCD_IMPORT_CONFIG);
108
////        pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.AbcdImportConfig, value);
109
////        pref.setAllowOverride(allowOverride);
110
////        service.set(pref);
111

  
112
        return true;
113
    }
114

  
115

  
116

  
117
    @Override
118
    public void addPages() {
119
        addPage(preferencePage);
120

  
121
    }
122

  
123
    @Override
124
    public IWizardPage getNextPage(IWizardPage currentPage) {
125

  
126
       return null;
127
    }
128

  
129

  
130
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/CdmPreferenceCache.java
148 148
        loadAndPutPreference(controller, key);
149 149

  
150 150
        //sources
151
        key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.ShowIdInSource);
151
        key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), EditorPreferencePredicate.ShowIdInSource);
152 152
        loadAndPutPreference(controller, key);
153 153

  
154
        key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.ShowNamespaceInSource);
154
        key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), EditorPreferencePredicate.ShowNamespaceInSource);
155 155
        loadAndPutPreference(controller, key);
156 156

  
157 157
        //multiple classifications / taxon navigator
158 158

  
159
        key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.DisableMultiClassification);
159
        key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), EditorPreferencePredicate.DisableMultiClassification);
160 160
        loadAndPutPreference(controller, key);
161 161

  
162 162

  
163
        key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.ShowTaxonNodeWizard);
163
        key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), EditorPreferencePredicate.ShowTaxonNodeWizard);
164 164
        loadAndPutPreference(controller, key);
165 165

  
166 166

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/NameDetailsViewConfiguration.java
13 13
import org.eclipse.swt.widgets.Label;
14 14

  
15 15
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
16
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
17 16
import eu.etaxonomy.taxeditor.l10n.Messages;
18 17
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
19 18

  
......
358 357

  
359 358
    @Override
360 359
    public void init(){
361
        CdmPreference nameDetailsPref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.NameDetailsView);
360
        CdmPreference nameDetailsPref = PreferencesUtil.getPreferenceFromDB(EditorPreferencePredicate.NameDetailsView);
362 361
        isAdminPreference = false;
363 362
        isAllowOverride = false;
364 363
        if (nameDetailsPref != null){
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java
852 852

  
853 853
		getPreferenceStore().setDefault(createPreferenceString(SORT_TAXA_BY_RANK_AND_NAME), true);
854 854
		//override db preferences
855
		getPreferenceStore().setDefault(createPreferenceString(prefOverrideKey(PreferencePredicate.AbcdImportConfig.getKey())), false);
855
		getPreferenceStore().setDefault(createPreferenceString(prefOverrideKey(EditorPreferencePredicate.AbcdImportConfig.getKey())), false);
856 856
		getPreferenceStore().setDefault(createPreferenceString(prefOverrideKey(EditorPreferencePredicate.ShowSpecimen.getKey())), false);
857 857
		getPreferenceStore().setDefault(createPreferenceString(prefOverrideKey(EditorPreferencePredicate.NameDetailsView.getKey())), false);
858 858
		getPreferenceStore().setDefault(createPreferenceString(prefOverrideKey(EditorPreferencePredicate.DistributionEditorActivated.getKey())), false);
......
1374 1374
        CdmPreference preference = null;
1375 1375

  
1376 1376
        if (!local) {
1377
            preference = cache.get(PreferencePredicate.NameDetailsView.getKey());
1377
            preference = cache.get(EditorPreferencePredicate.NameDetailsView.getKey());
1378 1378
            if (preference == null){
1379 1379
                return null;
1380 1380
            }
......
1481 1481
        CdmPreference preference = null;
1482 1482

  
1483 1483
        if (!local) {
1484
            preference = CdmPreference.NewInstance(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.NameDetailsView, config.toString());
1484
            preference = CdmPreference.NewInstance(PreferenceSubject.NewDatabaseInstance(), EditorPreferencePredicate.NameDetailsView, config.toString());
1485 1485

  
1486 1486
            setPreferenceToDB(preference);
1487 1487
        }
......
1530 1530
        Abcd206ImportConfigurator config = Abcd206ImportConfigurator.NewInstance(null,null);
1531 1531
        ICdmRepository controller;
1532 1532
        controller = CdmStore.getCurrentApplicationConfiguration();
1533
        PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.AbcdImportConfig);
1533
        PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), EditorPreferencePredicate.AbcdImportConfig);
1534 1534
        CdmPreference preference = null;
1535 1535
        if (controller == null){
1536 1536
            return null;
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/specimenSearch/SpecimenProviderSelectionComposite.java
21 21
import org.eclipse.ui.forms.widgets.TableWrapLayout;
22 22

  
23 23
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
24
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
24
import eu.etaxonomy.taxeditor.preference.EditorPreferencePredicate;
25 25
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
26 26

  
27 27
/**
......
67 67
        toolkit.adapt(btnBioCaseProvider, true, true);
68 68
        btnBioCaseProvider.setText("BioCASE Provider");
69 69
        txtAccessPoint = new Combo(this, SWT.BORDER);
70
        CdmPreference biocaseProvider = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.BioCaseProvider);
70
        CdmPreference biocaseProvider = PreferencesUtil.getPreferenceFromDB(EditorPreferencePredicate.BioCaseProvider);
71 71
        if (biocaseProvider != null){
72 72
            String items[] = biocaseProvider.getValue().split(";");
73 73
            txtAccessPoint.setItems(items);

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)