import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.cdm.model.metadata.PreferenceSubject;
import eu.etaxonomy.taxeditor.l10n.Messages;
+import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
import eu.etaxonomy.taxeditor.store.CdmStore;
boolean isShowLifeForm;
boolean isUseLocalPreference;
Composite composite;
+ CdmPreference isShowSpecimenPref = null;
@Override
protected Control createContents(Composite parent) {
@Override
public void widgetSelected(SelectionEvent e) {
isUseLocalPreference = useLocalPreference.getSelection();
-
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_SPECIMEN_ALLOW_OVERRIDE, isUseLocalPreference);
}
});
return composite;
ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration();
if (controller != null){
IPreferenceService service = controller.getPreferenceService();
- PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewEditorInstance(), PreferencePredicate.ShowSpecimen);
- CdmPreference isShowSpecimenPref = service.find(key);
+ PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.ShowSpecimen);
+ isShowSpecimenPref = service.find(key);
if (isShowSpecimenPref != null){
this.isShowSpecimenRelatedIssues = Boolean.valueOf(isShowSpecimenPref.getValue());
}else{
+ isShowSpecimenPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.ShowSpecimen, Boolean.toString(true));
this.isShowSpecimenRelatedIssues = true;
}
- key = CdmPreference.NewKey(PreferenceSubject.NewEditorInstance(), PreferencePredicate.ShowCollectingAreasInGeneralSection);
+ key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.ShowCollectingAreasInGeneralSection);
CdmPreference isShowCollectingAreaInGeneralSectionPref = service.find(key);
if (isShowCollectingAreaInGeneralSectionPref != null){
this.isShowCollectingAreaInGeneralSection = Boolean.valueOf(isShowCollectingAreaInGeneralSectionPref.getValue());
}
- key = CdmPreference.NewKey(PreferenceSubject.NewEditorInstance(), PreferencePredicate.DeterminationOnlyForFieldUnits);
+ key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.DeterminationOnlyForFieldUnits);
CdmPreference isDeterminationOnlyForFieldUnitsPref = service.find(key);
if (isDeterminationOnlyForFieldUnitsPref != null){
this.isDeterminationOnlyForFieldUnits = Boolean.valueOf(isDeterminationOnlyForFieldUnitsPref.getValue());
}
- key = CdmPreference.NewKey(PreferenceSubject.NewEditorInstance(), PreferencePredicate.ShowTaxonAssociations);
+ key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.ShowTaxonAssociations);
CdmPreference isShowTaxonAssociationPref = service.find(key);
if (isShowTaxonAssociationPref != null){
this.isShowTaxonAssociation = Boolean.valueOf(isShowTaxonAssociationPref.getValue());
- isUseLocalPreference = isShowTaxonAssociationPref.isAllowOverride();
+ // isUseLocalPreference = isShowTaxonAssociationPref.isAllowOverride();
}
- key = CdmPreference.NewKey(PreferenceSubject.NewEditorInstance(), PreferencePredicate.ShowLifeForm);
+ key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.ShowLifeForm);
CdmPreference isShowLifeFormPref = service.find(key);
if (isShowLifeFormPref != null){
this.isShowLifeForm = Boolean.valueOf(isShowLifeFormPref.getValue());
@Override
public boolean performOk() {
+ if (isShowSpecimenPref == null){
+ return true;
+ }
ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration();
if (controller != null){
IPreferenceService service = controller.getPreferenceService();
- CdmPreference pref = CdmPreference.NewDatabaseInstance(PreferencePredicate.ShowCollectingAreasInGeneralSection, Boolean.toString(this.isShowCollectingAreaInGeneralSection));
+ CdmPreference pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.ShowCollectingAreasInGeneralSection, Boolean.toString(this.isShowCollectingAreaInGeneralSection));
pref.setAllowOverride(isUseLocalPreference);
service.set(pref);
- pref = CdmPreference.NewDatabaseInstance(PreferencePredicate.ShowSpecimen, Boolean.toString(this.isShowSpecimenRelatedIssues));
+ pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.ShowSpecimen, Boolean.toString(this.isShowSpecimenRelatedIssues));
pref.setAllowOverride(isUseLocalPreference);
service.set(pref);
- pref = CdmPreference.NewDatabaseInstance(PreferencePredicate.DeterminationOnlyForFieldUnits, Boolean.toString(this.isDeterminationOnlyForFieldUnits));
+ pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.DeterminationOnlyForFieldUnits, Boolean.toString(this.isDeterminationOnlyForFieldUnits));
pref.setAllowOverride(isUseLocalPreference);
service.set(pref);
- pref = CdmPreference.NewDatabaseInstance(PreferencePredicate.ShowTaxonAssociations, Boolean.toString(this.isShowTaxonAssociation));
+ pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.ShowTaxonAssociations, Boolean.toString(this.isShowTaxonAssociation));
pref.setAllowOverride(isUseLocalPreference);
service.set(pref);
- pref = CdmPreference.NewDatabaseInstance(PreferencePredicate.ShowLifeForm, Boolean.toString(this.isShowLifeForm));
+ pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.ShowLifeForm, Boolean.toString(this.isShowLifeForm));
pref.setAllowOverride(isUseLocalPreference);
service.set(pref);
PreferencesUtil.updateDBPreferences();