final Button showCollectingAreaInGeneralSectionButton = new Button(composite, SWT.CHECK);
CdmPreference isShowCollectingAreaInGeneralSection = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowCollectingAreasInGeneralSection);
-
+ if (isShowCollectingAreaInGeneralSection == null){
+ isShowCollectingAreaInGeneralSection = CdmPreference.NewDatabaseInstance(PreferencePredicate.ShowCollectingAreasInGeneralSection, Boolean.toString(false));
+ }
showCollectingAreaInGeneralSectionButton.setText(Messages.DatabasePreferncesPage_Show_Collecting_Areas_in_general_section);
showCollectingAreaInGeneralSectionButton.setSelection(Boolean.valueOf(isShowCollectingAreaInGeneralSection.getValue()));
final Button determinationOnlyForFieldUnitsButton = new Button(composite, SWT.CHECK);
// boolean isDeterminationOnlyForFieldUnits = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS);
CdmPreference isDeterminationOnlyForFieldUnits = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.DeterminationOnlyForFieldUnits);
-
+ if (isDeterminationOnlyForFieldUnits == null){
+ isDeterminationOnlyForFieldUnits = CdmPreference.NewDatabaseInstance(PreferencePredicate.DeterminationOnlyForFieldUnits, Boolean.toString(false));
+ }
determinationOnlyForFieldUnitsButton.setText(Messages.DatabasePreferncesPage_Determination_only_for_field_unnits);
determinationOnlyForFieldUnitsButton.setSelection(Boolean.valueOf(isDeterminationOnlyForFieldUnits.getValue()));
final Button showTaxonAssociationButton = new Button(composite, SWT.CHECK);
CdmPreference isShowTaxonAssociation = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowTaxonAssociations);
+ if (isShowTaxonAssociation == null){
+ isShowTaxonAssociation = CdmPreference.NewDatabaseInstance(PreferencePredicate.ShowTaxonAssociations, Boolean.toString(false));
+ }
showTaxonAssociationButton.setText(Messages.DatabasePreferncesPage_Taxon_Associations);
showTaxonAssociationButton.setSelection(Boolean.valueOf(isShowTaxonAssociation.getValue()));
});
final Button showLifeFormButton = new Button(composite, SWT.CHECK);
- boolean isShowLifeForm = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_LIFE_FORM);
+ CdmPreference isShowLifeForm = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowLifeForm);
+ if (isShowLifeForm == null){
+ isShowLifeForm = CdmPreference.NewDatabaseInstance(PreferencePredicate.ShowLifeForm, Boolean.toString(false));
+ }
+
showLifeFormButton.setText(Messages.DatabasePreferncesPage_Life_Form);
- showLifeFormButton.setSelection(isShowLifeForm);
+ showLifeFormButton.setSelection(Boolean.valueOf(isShowLifeForm.getValue()));
showLifeFormButton.addSelectionListener(new SelectionAdapter(){
@Override
public void widgetSelected(SelectionEvent e) {
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
+import eu.etaxonomy.cdm.model.metadata.CdmPreference;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.taxeditor.l10n.Messages;
Composite composite = new Composite(parent, SWT.NULL);
composite.setLayout(new GridLayout());
-
- boolean isAllowOverride = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.NameDetailsView).isAllowOverride();
+ CdmPreference nameDetailsPref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.NameDetailsView);
+ boolean isAllowOverride = false;
+ if (nameDetailsPref != null){
+ isAllowOverride = nameDetailsPref.isAllowOverride();
+ }
if (isAllowOverride){
*/
public class SpecimenOrObservationPreferences extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
+ public SpecimenOrObservationPreferences(){
+ super();
+ setPreferenceStore(PreferencesUtil.getPreferenceStore());
+ if (getPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY)){
+ setDescription("Set the preferences for the display of specimen and obeservations.");
+ }else{
+ setDescription("The CDM settings don't allow to set the preferences for the display of specimen and obeservations locally. If you need to make local settings, please ask an administrator.");
+ }
+ }
+
+
@Override
public void init(IWorkbench workbench) {
- setPreferenceStore(PreferencesUtil.getPreferenceStore());
+// setPreferenceStore(PreferencesUtil.getPreferenceStore());
ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration();
if (controller != null){
IPreferenceService service = controller.getPreferenceService();