protected Boolean sortTaxaByRankAndName;
protected Boolean filterCommonNameReferences;
- private boolean overrideShowIdInSelectionDialog;
- private boolean overrideSearchForIdentifierAsDefault;
- private boolean overrideSearchForIdentifierAndTitleCache;
- private boolean overrideSortTaxaByRankAndName;
- private boolean overrideFilterCommonNameReferences;
+ private boolean overrideShowIdInSelectionDialog = true;
+ private boolean overrideSearchForIdentifierAsDefault = true;
+ private boolean overrideSearchForIdentifierAndTitleCache = true;
+ private boolean overrideSortTaxaByRankAndName = true;
+ private boolean overrideFilterCommonNameReferences = true;
protected Combo showIdInSelectionDialogButton;
protected Button allowOverrideIsShowIdInSelectionDialogButton;
overrideSearchForIdentifierAndTitleCache = PreferencesUtil.getBooleanValue(PreferencesUtil.createOverridePreferenceString(PreferencePredicate.SearchForIdentifierAndTitleCache.getKey()));
overrideSortTaxaByRankAndName = PreferencesUtil.getBooleanValue(PreferencesUtil.createOverridePreferenceString(PreferencePredicate.SortTaxaByRankAndName.getKey()));
overrideFilterCommonNameReferences = PreferencesUtil.getBooleanValue(PreferencesUtil.createOverridePreferenceString(PreferencePredicate.CommonNameReferencesWithMarker.getKey()));
-
- showIdInSelectionDialog = PreferencesUtil.getBooleanValue(PreferencePredicate.ShowIdInSelectionDialog.getKey());
- searchForIdentifierAsDefault = PreferencesUtil.getBooleanValue(PreferencePredicate.SearchForIdentifierAsDefault.getKey());
- searchForIdentifierAndTitleCache = PreferencesUtil.getBooleanValue(PreferencePredicate.SearchForIdentifierAndTitleCache.getKey());
- sortTaxaByRankAndName = PreferencesUtil.getBooleanValue(PreferencePredicate.SortTaxaByRankAndName.getKey());
- filterCommonNameReferences = PreferencesUtil.getBooleanValue(PreferencePredicate.CommonNameReferencesWithMarker.getKey());
+ if(overrideShowIdInSelectionDialog){
+ showIdInSelectionDialog = PreferencesUtil.getBooleanValue(PreferencePredicate.ShowIdInSelectionDialog.getKey(), true);
+ }
+ if(overrideSearchForIdentifierAsDefault){
+ searchForIdentifierAsDefault = PreferencesUtil.getBooleanValue(PreferencePredicate.SearchForIdentifierAsDefault.getKey(), true);
+ }
+ if(overrideSearchForIdentifierAndTitleCache){
+ searchForIdentifierAndTitleCache = PreferencesUtil.getBooleanValue(PreferencePredicate.SearchForIdentifierAndTitleCache.getKey(), true);
+ }
+ if(overrideSortTaxaByRankAndName){
+ sortTaxaByRankAndName = PreferencesUtil.getBooleanValue(PreferencePredicate.SortTaxaByRankAndName.getKey(), true);
+ }
+ if(overrideFilterCommonNameReferences){
+ filterCommonNameReferences = PreferencesUtil.getBooleanValue(PreferencePredicate.CommonNameReferencesWithMarker.getKey(), true);
+ }
}
showIdInSelectionDialogButton = createBooleanCombo(titleComp, Messages.GeneralPreference_yes, Messages.GeneralPreference_no, PreferencePredicate.ShowIdInSelectionDialog, Messages.DatabasePreferncesPage_Show_Id_In_SelectionDialog, isAdminPreference);
showIdInSelectionDialogButton.addSelectionListener(this);
- int index = 0;
- for (String itemLabel : showIdInSelectionDialogButton.getItems()) {
- if (itemLabel.startsWith(Messages.Preference_Use_Default) && showIdInSelectionDialog == null) {
- showIdInSelectionDialogButton.select(index);
- break;
- }
- if (itemLabel.equals(Messages.GeneralPreference_yes) && showIdInSelectionDialog){
- showIdInSelectionDialogButton.select(index);
- break;
- }
- if (itemLabel.equals(Messages.GeneralPreference_no) && !showIdInSelectionDialog){
- showIdInSelectionDialogButton.select(index);
- break;
- }
- index++;
- }
+
if (!isAdminPreference && showIdInSelectionDialogPref != null){
showIdInSelectionDialogButton.setEnabled(showIdInSelectionDialogPref.isAllowOverride());
}
searchForIdentifierAsDefaultButton = createBooleanCombo(composite, Messages.GeneralPreference_yes, Messages.GeneralPreference_no, PreferencePredicate.SearchForIdentifierAsDefault, Messages.DatabasePreferncesPage_Search_for_identifier_as_default, isAdminPreference);
searchForIdentifierAsDefaultButton.addSelectionListener(this);
- index = 0;
- for (String itemLabel : searchForIdentifierAsDefaultButton.getItems()) {
- if (searchForIdentifierAsDefault == null && itemLabel.startsWith(Messages.Preference_Use_Default)) {
- searchForIdentifierAsDefaultButton.select(index);
- break;
- }
- if (searchForIdentifierAsDefault != null && itemLabel.equals(Messages.GeneralPreference_yes) && searchForIdentifierAsDefault){
- searchForIdentifierAsDefaultButton.select(index);
- break;
- }
- if (searchForIdentifierAsDefault != null && itemLabel.equals(Messages.GeneralPreference_no) && !searchForIdentifierAsDefault){
- searchForIdentifierAsDefaultButton.select(index);
- break;
- }
- index++;
- }
+
if (isAdminPreference){
allowOverrideSearchForIdentifierAsDefaultButton = createAllowOverrideButton(composite);
allowOverrideSearchForIdentifierAsDefaultButton.setSelection(searchForIdentifierAsDefaultPref != null?searchForIdentifierAsDefaultPref.isAllowOverride(): true);
searchForIdentifierAndTitleCacheButton = createBooleanCombo(composite, Messages.GeneralPreference_yes, Messages.GeneralPreference_no, PreferencePredicate.SearchForIdentifierAndTitleCache, Messages.DatabasePreferncesPage_search_for_identifier_and_titleCache, isAdminPreference);
searchForIdentifierAndTitleCacheButton.addSelectionListener(this);
- index = 0;
- for (String itemLabel : searchForIdentifierAndTitleCacheButton.getItems()) {
- if (searchForIdentifierAndTitleCache == null && itemLabel.startsWith(Messages.Preference_Use_Default)) {
- searchForIdentifierAndTitleCacheButton.select(index);
- break;
- }
- if (searchForIdentifierAndTitleCache != null && itemLabel.equals(Messages.GeneralPreference_yes) && searchForIdentifierAndTitleCache){
- searchForIdentifierAndTitleCacheButton.select(index);
- break;
- }
- if (searchForIdentifierAndTitleCache != null && itemLabel.equals(Messages.GeneralPreference_no) && !searchForIdentifierAndTitleCache){
- searchForIdentifierAndTitleCacheButton.select(index);
- break;
- }
- index++;
- }
+
if(!isAdminPreference && searchForIdentifierAndTitleCachePref != null){
searchForIdentifierAndTitleCacheButton.setEnabled(searchForIdentifierAndTitleCachePref.isAllowOverride());
}
sortTaxaByRankAndNameButton.addSelectionListener(this);
- index = 0;
- for (String itemLabel : sortTaxaByRankAndNameButton.getItems()) {
- if (sortTaxaByRankAndName == null && itemLabel.startsWith(Messages.Preference_Use_Default)) {
- sortTaxaByRankAndNameButton.select(index);
- break;
- }
- if (sortTaxaByRankAndName != null && itemLabel.equals(Messages.GeneralPreference_yes) && sortTaxaByRankAndName){
- sortTaxaByRankAndNameButton.select(index);
- break;
- }
- if (sortTaxaByRankAndName != null && itemLabel.equals(Messages.GeneralPreference_no) && !sortTaxaByRankAndName){
- sortTaxaByRankAndNameButton.select(index);
- break;
- }
- index++;
- }
+
if ( !isAdminPreference && sortTaxaByRankAndNamePref != null){
sortTaxaByRankAndNameButton.setEnabled(sortTaxaByRankAndNamePref.isAllowOverride());
}
filterCommonNameReferenceButton = createBooleanCombo(composite, Messages.GeneralPreference_yes, Messages.GeneralPreference_no, PreferencePredicate.CommonNameReferencesWithMarker, Messages.DatabasePreferncesPage_CommonNameFilter, isAdminPreference);
filterCommonNameReferenceButton.addSelectionListener(this);
- index = 0;
- for (String itemLabel: filterCommonNameReferenceButton.getItems()) {
- if (filterCommonNameReferences == null && itemLabel.startsWith(Messages.Preference_Use_Default)) {
- filterCommonNameReferenceButton.select(index);
- break;
- }
- if (filterCommonNameReferences != null && itemLabel.equals(Messages.GeneralPreference_yes) && filterCommonNameReferences){
- filterCommonNameReferenceButton.select(index);
- break;
- }
- if (filterCommonNameReferences != null && itemLabel.equals(Messages.GeneralPreference_no) && !filterCommonNameReferences){
- filterCommonNameReferenceButton.select(index);
- break;
- }
- index++;
- }
+
if (!isAdminPreference && filterCommonNameReferencesPref != null){
filterCommonNameReferenceButton.setEnabled(filterCommonNameReferencesPref.isAllowOverride());
}
});
}
-
+ setSelections();
return composite;
}
return true;
}
+ protected void setSelections(){
+
+ int index = 0;
+ for (String itemLabel : showIdInSelectionDialogButton.getItems()) {
+ if (itemLabel.startsWith(Messages.Preference_Use_Default) && (showIdInSelectionDialog == null || (!overrideShowIdInSelectionDialog && !isAdminPreference))) {
+ showIdInSelectionDialogButton.select(index);
+ break;
+ }
+ if (itemLabel.equals(Messages.GeneralPreference_yes) && showIdInSelectionDialog){
+ showIdInSelectionDialogButton.select(index);
+ break;
+ }
+ if (itemLabel.equals(Messages.GeneralPreference_no) && !showIdInSelectionDialog){
+ showIdInSelectionDialogButton.select(index);
+ break;
+ }
+ index++;
+ }
+
+ index = 0;
+ for (String itemLabel : searchForIdentifierAsDefaultButton.getItems()) {
+ if ((searchForIdentifierAsDefault == null || (!overrideSearchForIdentifierAsDefault && !isAdminPreference)) && itemLabel.startsWith(Messages.Preference_Use_Default)) {
+ searchForIdentifierAsDefaultButton.select(index);
+ break;
+ }
+ if (searchForIdentifierAsDefault != null && itemLabel.equals(Messages.GeneralPreference_yes) && searchForIdentifierAsDefault){
+ searchForIdentifierAsDefaultButton.select(index);
+ break;
+ }
+ if (searchForIdentifierAsDefault != null && itemLabel.equals(Messages.GeneralPreference_no) && !searchForIdentifierAsDefault){
+ searchForIdentifierAsDefaultButton.select(index);
+ break;
+ }
+ index++;
+ }
+
+ index = 0;
+ for (String itemLabel : searchForIdentifierAndTitleCacheButton.getItems()) {
+ if ((searchForIdentifierAndTitleCache == null || (!overrideSearchForIdentifierAndTitleCache && !isAdminPreference))&& itemLabel.startsWith(Messages.Preference_Use_Default)) {
+ searchForIdentifierAndTitleCacheButton.select(index);
+ break;
+ }
+ if (searchForIdentifierAndTitleCache != null && itemLabel.equals(Messages.GeneralPreference_yes) && searchForIdentifierAndTitleCache){
+ searchForIdentifierAndTitleCacheButton.select(index);
+ break;
+ }
+ if (searchForIdentifierAndTitleCache != null && itemLabel.equals(Messages.GeneralPreference_no) && !searchForIdentifierAndTitleCache){
+ searchForIdentifierAndTitleCacheButton.select(index);
+ break;
+ }
+ index++;
+ }
+
+ index = 0;
+ for (String itemLabel : sortTaxaByRankAndNameButton.getItems()) {
+ if ((sortTaxaByRankAndName == null || (!overrideSortTaxaByRankAndName && !isAdminPreference))&& itemLabel.startsWith(Messages.Preference_Use_Default)) {
+ sortTaxaByRankAndNameButton.select(index);
+ break;
+ }
+ if (sortTaxaByRankAndName != null && itemLabel.equals(Messages.GeneralPreference_yes) && sortTaxaByRankAndName){
+ sortTaxaByRankAndNameButton.select(index);
+ break;
+ }
+ if (sortTaxaByRankAndName != null && itemLabel.equals(Messages.GeneralPreference_no) && !sortTaxaByRankAndName){
+ sortTaxaByRankAndNameButton.select(index);
+ break;
+ }
+ index++;
+ }
+
+ index = 0;
+ for (String itemLabel: filterCommonNameReferenceButton.getItems()) {
+ if ((filterCommonNameReferences == null || (!overrideFilterCommonNameReferences && !isAdminPreference)) && itemLabel.startsWith(Messages.Preference_Use_Default)) {
+ filterCommonNameReferenceButton.select(index);
+ break;
+ }
+ if (filterCommonNameReferences != null && itemLabel.equals(Messages.GeneralPreference_yes) && filterCommonNameReferences){
+ filterCommonNameReferenceButton.select(index);
+ break;
+ }
+ if (filterCommonNameReferences != null && itemLabel.equals(Messages.GeneralPreference_no) && !filterCommonNameReferences){
+ filterCommonNameReferenceButton.select(index);
+ break;
+ }
+ index++;
+ }
+ }
+
}