2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.preference
;
13 import java
.io
.FileInputStream
;
14 import java
.io
.FileOutputStream
;
15 import java
.io
.IOException
;
17 import java
.net
.URISyntaxException
;
18 import java
.util
.ArrayList
;
19 import java
.util
.Arrays
;
20 import java
.util
.HashMap
;
21 import java
.util
.List
;
23 import java
.util
.Properties
;
25 import java
.util
.StringTokenizer
;
26 import java
.util
.UUID
;
28 import org
.apache
.commons
.lang
.StringUtils
;
29 import org
.eclipse
.equinox
.internal
.p2
.ui
.model
.MetadataRepositoryElement
;
30 import org
.eclipse
.jface
.preference
.IPreferenceStore
;
31 import org
.eclipse
.jface
.window
.Window
;
32 import org
.eclipse
.swt
.widgets
.Composite
;
33 import org
.eclipse
.swt
.widgets
.Control
;
34 import org
.eclipse
.swt
.widgets
.Shell
;
35 import org
.eclipse
.ui
.PlatformUI
;
37 import eu
.etaxonomy
.cdm
.api
.facade
.DerivedUnitFacadeConfigurator
;
38 import eu
.etaxonomy
.cdm
.api
.service
.IFeatureTreeService
;
39 import eu
.etaxonomy
.cdm
.api
.service
.ITermService
;
40 import eu
.etaxonomy
.cdm
.api
.service
.config
.FindTaxaAndNamesConfiguratorImpl
;
41 import eu
.etaxonomy
.cdm
.api
.service
.config
.IFindTaxaAndNamesConfigurator
;
42 import eu
.etaxonomy
.cdm
.common
.CdmUtils
;
43 import eu
.etaxonomy
.cdm
.hibernate
.HibernateProxyHelper
;
44 import eu
.etaxonomy
.cdm
.model
.common
.ICdmBase
;
45 import eu
.etaxonomy
.cdm
.model
.common
.IDefinedTerm
;
46 import eu
.etaxonomy
.cdm
.model
.common
.ISimpleTerm
;
47 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
48 import eu
.etaxonomy
.cdm
.model
.common
.MarkerType
;
49 import eu
.etaxonomy
.cdm
.model
.common
.TermBase
;
50 import eu
.etaxonomy
.cdm
.model
.description
.FeatureTree
;
51 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalCode
;
52 import eu
.etaxonomy
.cdm
.strategy
.match
.DefaultMatchStrategy
;
53 import eu
.etaxonomy
.cdm
.strategy
.match
.IMatchStrategy
;
54 import eu
.etaxonomy
.cdm
.strategy
.match
.MatchException
;
55 import eu
.etaxonomy
.cdm
.strategy
.match
.MatchMode
;
56 import eu
.etaxonomy
.taxeditor
.model
.AbstractUtility
;
57 import eu
.etaxonomy
.taxeditor
.model
.MessagingUtils
;
58 import eu
.etaxonomy
.taxeditor
.model
.NomenclaturalCodeHelper
;
59 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
60 import eu
.etaxonomy
.taxeditor
.store
.internal
.TaxeditorStorePlugin
;
61 import eu
.etaxonomy
.taxeditor
.ui
.dialog
.DefaultLanguageDialog
;
65 * PreferencesUtil class.
73 public class PreferencesUtil
implements IPreferenceKeys
{
78 public static final String PREFERRED_TERMS_CHANGE
= "preferred_terms";
80 public static final String P2_REPOSITORIES_DELIM
= ",";
81 public static final String P2_REPOSITORY_FIELDS_DELIM
= ";";
88 * @return a {@link org.eclipse.jface.preference.IPreferenceStore} object.
90 public static IPreferenceStore
getPreferenceStore() {
91 return TaxeditorStorePlugin
.getDefault().getPreferenceStore();
96 * setPreferredNomenclaturalCode
99 * @param preferredCode
100 * a {@link eu.etaxonomy.cdm.model.name.NomenclaturalCode}
103 public static void setPreferredNomenclaturalCode(
104 NomenclaturalCode preferredCode
) {
105 getPreferenceStore().setValue(PREFERRED_NOMENCLATURAL_CODE_KEY
,
106 getPreferenceKey(preferredCode
));
111 * getPreferredNomenclaturalCode
114 * @return a {@link eu.etaxonomy.cdm.model.name.NomenclaturalCode} object.
116 public static NomenclaturalCode
getPreferredNomenclaturalCode() {
118 for (NomenclaturalCode code
: NomenclaturalCodeHelper
.getAllCodes()) {
119 String preferredCode
= getPreferenceStore().getString(
120 PREFERRED_NOMENCLATURAL_CODE_KEY
);
121 if (getPreferenceKey(code
).equals(preferredCode
)) {
128 public static String
getPreferredDefaultLangugae(){
129 String preferredLanguage
= getPreferenceStore().getString(DEFAULT_LANGUAGE_EDITOR
);
130 if(StringUtils
.isNotEmpty(preferredLanguage
) && StringUtils
.isNotBlank(preferredLanguage
)){
131 return preferredLanguage
;
137 * Get the match strategy for the given class that was stored in preferences
138 * or the default strategy if it was not stored in preferences
141 * a {@link java.lang.Class} object.
142 * @return a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object.
144 public static IMatchStrategy
getMatchStrategy(Class clazz
) {
145 String className
= clazz
.getName();
146 if (getPreferenceStore().getBoolean(MATCH_STRATEGY_PREFIX
+ className
)) {
147 IMatchStrategy matchStrategy
= getDefaultMatchStrategy(clazz
);
149 for (String fieldName
: matchStrategy
.getMatchFieldPropertyNames()) {
150 String matchModeName
= getPreferenceStore().getString(
151 getMatchStrategyFieldName(className
, fieldName
));
152 MatchMode matchMode
= MatchMode
.valueOf(matchModeName
);
154 matchStrategy
.setMatchMode(fieldName
, matchMode
);
155 } catch (MatchException e
) {
156 MessagingUtils
.error(PreferencesUtil
.class, e
);
157 throw new RuntimeException(e
);
161 return matchStrategy
;
163 return getDefaultMatchStrategy(clazz
);
167 * Stores a matchStrategy into the preference store.
169 * @param matchStrategy
170 * a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy}
173 public static void setMatchStrategy(IMatchStrategy matchStrategy
) {
174 String className
= matchStrategy
.getMatchClass().getName();
175 getPreferenceStore().setValue(MATCH_STRATEGY_PREFIX
+ className
, true);
177 Set
<String
> matchFields
= matchStrategy
.getMatchFieldPropertyNames();
179 for (String fieldName
: matchFields
) {
180 getPreferenceStore().setValue(
181 getMatchStrategyFieldName(className
, fieldName
),
182 matchStrategy
.getMatchMode(fieldName
).name());
187 * Helper method to create the preference property for a match field.
193 private static String
getMatchStrategyFieldName(String className
,
195 return MATCH_STRATEGY_PREFIX
+ className
+ "." + fieldName
;
199 * Returns the default match strategy for a given class.
202 * a {@link java.lang.Class} object.
203 * @return a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object.
205 public static IMatchStrategy
getDefaultMatchStrategy(Class clazz
) {
206 return DefaultMatchStrategy
.NewInstance(clazz
);
211 * getDateFormatPattern
214 * @return a {@link java.lang.String} object.
216 public static String
getDateFormatPattern() {
217 // TODO make this configurable in properties
218 String pattern
= "Y-M-d H:m";
224 * addTermToPreferredTerms
232 public static <T
extends TermBase
> void addTermToPreferredTerms(T term
) {
234 // VocabularyEnum vocabulary =
235 // VocabularyEnum.getVocabularyEnum(term.getClass());
237 // getPreferenceStore().setValue(getPreferenceKey(term),
238 // VocabularyStore.getTermVocabulary(vocabulary).getTerms().contains(term));
240 // firePreferencesChanged(term.getClass());
244 * Construct a unique key using the CdmBase object's uuid
249 private static String
getPreferenceKey(ICdmBase cdmBase
) {
250 cdmBase
= HibernateProxyHelper
.deproxy(cdmBase
);
252 String key
= cdmBase
.getClass().getName().concat(".")
253 .concat(cdmBase
.getUuid().toString());
254 if (key
.contains("javassist")) {
255 MessagingUtils
.info("proxy");
261 * Construct a unique key using the CdmBase object's uuid
266 public static String
getPreferenceKey(ISimpleTerm simpleTerm
) {
267 simpleTerm
= HibernateProxyHelper
.deproxy(simpleTerm
);
268 String key
= simpleTerm
.getClass().getName().concat(".")
269 .concat(simpleTerm
.getUuid().toString());
270 if (key
.contains("javassist")) {
271 MessagingUtils
.warn(PreferencesUtil
.class,
272 "Trying to persist a preference based on a proxy class.");
280 * Construct a unique key using the CdmBase object's uuid
285 public static String
getPreferenceKey(IDefinedTerm definedTerm
) {
286 definedTerm
= HibernateProxyHelper
.deproxy(definedTerm
);
287 String key
= definedTerm
.getClass().getName().concat(".")
288 .concat(definedTerm
.getUuid().toString());
289 if (key
.contains("javassist")) {
290 MessagingUtils
.warn(PreferencesUtil
.class,
291 "Trying to persist a preference based on a proxy class.");
297 * Retrieves search preferences from the preference store
299 * @return an {@link ITaxonServiceConfigurator} to pass to search methods
301 public static IFindTaxaAndNamesConfigurator
getSearchConfigurator() {
302 IFindTaxaAndNamesConfigurator configurator
= initializeSearchConfigurator();
304 configurator
.setDoTaxa(getPreferenceStore().getBoolean(
305 TAXON_SERVICE_CONFIGURATOR_TAXA
));
306 configurator
.setDoSynonyms(getPreferenceStore().getBoolean(
307 TAXON_SERVICE_CONFIGURATOR_SYNONYMS
));
308 configurator
.setDoNamesWithoutTaxa(getPreferenceStore().getBoolean(
309 TAXON_SERVICE_CONFIGURATOR_NAMES
));
310 configurator
.setDoTaxaByCommonNames(getPreferenceStore().getBoolean(
311 TAXON_SERVICE_CONFIGURATOR_COMMON_NAMES
));
317 * create new preferences, setting all search options to true
320 * {@link eu.etaxonomy.cdm.api.service.config.ITaxonServiceConfigurator}
323 public static IFindTaxaAndNamesConfigurator
initializeSearchConfigurator() {
324 IFindTaxaAndNamesConfigurator configurator
= new FindTaxaAndNamesConfiguratorImpl();
326 configurator
.setDoTaxa(true);
327 configurator
.setDoSynonyms(true);
328 configurator
.setDoNamesWithoutTaxa(true);
329 configurator
.setDoTaxaByCommonNames(true);
331 configurator
.setTaxonPropertyPath(Arrays
.asList("$", "titleCache",
332 "name", "name.$", "relationsFromThisTaxon.$"));
334 configurator
.setSynonymPropertyPath(Arrays
.asList("$", "titleCache",
335 "name", "name.$", "synonymRelations.relatedTo.*"));
338 // match mode is a simple like, actually all other match modes are kind
341 .setMatchMode(eu
.etaxonomy
.cdm
.persistence
.query
.MatchMode
.ANYWHERE
);
342 // we set page number and size here as this should always be unlimited
343 configurator
.setPageNumber(0);
344 // TODO currently limit results to 10000
345 configurator
.setPageSize(10000);
351 * Store search preferences
353 * @param configurator
355 * {@link eu.etaxonomy.cdm.api.service.config.ITaxonServiceConfigurator}
358 public static void setSearchConfigurator(
359 IFindTaxaAndNamesConfigurator configurator
) {
360 getPreferenceStore().setValue(TAXON_SERVICE_CONFIGURATOR_TAXA
,
361 configurator
.isDoTaxa());
362 getPreferenceStore().setValue(TAXON_SERVICE_CONFIGURATOR_SYNONYMS
,
363 configurator
.isDoSynonyms());
364 getPreferenceStore().setValue(TAXON_SERVICE_CONFIGURATOR_NAMES
,
365 configurator
.isDoNamesWithoutTaxa());
366 getPreferenceStore().setValue(TAXON_SERVICE_CONFIGURATOR_COMMON_NAMES
,
367 configurator
.isDoTaxaByCommonNames());
372 * firePreferencesChanged
376 * a {@link java.lang.Class} object.
378 public static void firePreferencesChanged(Class clazz
) {
379 getPreferenceStore().firePropertyChangeEvent(PREFERRED_TERMS_CHANGE
,
384 * Set default values for preferences
386 public static void setDefaults() {
387 getPreferenceStore().setDefault(TAXON_SERVICE_CONFIGURATOR_TAXA
, true);
388 getPreferenceStore().setDefault(TAXON_SERVICE_CONFIGURATOR_SYNONYMS
,
390 getPreferenceStore().setDefault(EDIT_MAP_SERVICE_ACCES_POINT
,
391 "http://edit.africamuseum.be/edit_wp5/v1.2/rest_gen.php");
392 //FIXME : changed default for SHOULD_CONNECT_AT_STARTUP to false (ticket 3828) until resolution
393 getPreferenceStore().setDefault(SHOULD_CONNECT_AT_STARTUP
, false);
394 getPreferenceStore().setDefault(OPENURL_ACCESS_POINT
,
395 "http://www.biodiversitylibrary.org/openurl");
396 getPreferenceStore().setDefault(OPENURL_IMAGE_MAX_WIDTH
, "1000");
397 getPreferenceStore().setDefault(OPENURL_IMAGE_MAX_HEIGHT
, "1000");
398 getPreferenceStore().setDefault(IPreferenceKeys
.DISTRIBUTION_AREA_PREFRENCES_ACTIVE
, false);
403 * checkNomenclaturalCode
406 public static void checkNomenclaturalCode() {
407 // First time Editor is opened, no nomenclatural code has been set
410 if (PreferencesUtil
.getPreferredNomenclaturalCode() == null) {
411 PreferencesUtil
.setPreferredNomenclaturalCode(NomenclaturalCode
.ICNAFP
);
414 StoreUtil.info("No nomencatural code set.");
416 Shell shell = StoreUtil.getShell();
418 Query user re: preferred nom. code
419 Dialog dialog = new InitNomenclaturalCodePrefDialog(shell);
422 // Short message confirming user's choice
423 NomenclaturalCode code = PreferencesUtil
424 .getPreferredNomenclaturalCode();
428 "Nomenclatural code set",
429 "The following has been set as your preferred nomenclatural code:\n\n\t"
430 + NomenclaturalCodeHelper
431 .getDescription(code)
432 + "\n\nYou can change the nomenclatural code at any time in the \"Preferences\" menu.");*/
436 public static void checkDefaultLanguage(){
437 if(PreferencesUtil
.getPreferredDefaultLangugae() == null){
438 Shell shell
= AbstractUtility
.getShell();
439 int open
= new DefaultLanguageDialog(shell
).open();
440 if(open
== Window
.OK
){
441 PlatformUI
.getWorkbench().restart();
444 //TODO:In case of a reinstall, the config.ini will be overwritten
445 // here you create config.ini with the stored key from preferences
451 * getMapServiceAccessPoint
454 * @return a {@link java.lang.String} object.
456 public static String
getMapServiceAccessPoint() {
457 return getPreferenceStore().getString(EDIT_MAP_SERVICE_ACCES_POINT
);
462 * shouldConnectAtStartUp
467 public static boolean shouldConnectAtStartUp() {
468 //FIXME : force SHOULD_CONNECT_AT_STARTUP to false (ticket 3828) until resolution
469 //return getPreferenceStore().getBoolean(SHOULD_CONNECT_AT_STARTUP);
475 * getDefaultFeatureTreeForTextualDescription
478 * @return a {@link eu.etaxonomy.cdm.model.description.FeatureTree} object.
480 public static FeatureTree
getDefaultFeatureTreeForTextualDescription() {
481 String uuidString
= getPreferenceStore().getString(
482 FEATURE_TREE_DEFAULT_TEXT
);
483 return CdmUtils
.isEmpty(uuidString
) ?
null : CdmStore
.getService(
484 IFeatureTreeService
.class).load(UUID
.fromString(uuidString
));
489 * getDefaultFeatureTreeForStructuredDescription
492 * @return a {@link eu.etaxonomy.cdm.model.description.FeatureTree} object.
494 public static FeatureTree
getDefaultFeatureTreeForStructuredDescription() {
495 String uuidString
= getPreferenceStore().getString(
496 FEATURE_TREE_DEFAULT_STRUCTURE
);
497 return CdmUtils
.isEmpty(uuidString
) ?
null : CdmStore
.getService(
498 IFeatureTreeService
.class).load(UUID
.fromString(uuidString
));
503 * setSortRanksHierarchichally
509 public static void setSortRanksHierarchichally(boolean selection
) {
510 getPreferenceStore().setValue(SORT_RANKS_HIERARCHICHALLY
, selection
);
515 * getSortRanksHierarchichally
520 public static boolean getSortRanksHierarchichally() {
521 return getPreferenceStore().getBoolean(SORT_RANKS_HIERARCHICHALLY
);
524 public static boolean isMultilanguageTextEditingCapability() {
525 return getPreferenceStore().getBoolean(
526 MULTILANGUAGE_TEXT_EDITING_CAPABILITY
);
529 public static Language
getGlobalLanguage() {
532 String languageUuidString
= getPreferenceStore().getString(
533 GLOBAL_LANGUAGE_UUID
);
535 if(!CdmStore
.isActive()) {
536 MessagingUtils
.noDataSourceWarningDialog(languageUuidString
);
540 if (CdmUtils
.isBlank(languageUuidString
)) {
541 return Language
.getDefaultLanguage();
544 UUID languageUuid
= UUID
.fromString(languageUuidString
);
545 return (Language
) CdmStore
.getService(ITermService
.class).load(
549 public static void setGlobalLanguage(Language language
) {
550 if(language
!= null) {
551 getPreferenceStore().setValue(GLOBAL_LANGUAGE_UUID
,language
.getUuid().toString());
552 CdmStore
.setDefaultLanguage(language
);
560 public static Map
<MarkerType
, Boolean
> getEditMarkerTypePreferences() {
561 List
<MarkerType
> markerTypes
= CdmStore
.getTermManager()
562 .getPreferredTerms(MarkerType
.class);
564 Map
<MarkerType
, Boolean
> result
= new HashMap
<MarkerType
, Boolean
>();
566 for (MarkerType markerType
: markerTypes
) {
567 String name
= getMarkerTypeEditingPreferenceKey(markerType
);
568 Boolean value
= getPreferenceStore().getBoolean(name
);
570 result
.put(markerType
, value
);
577 * @param markerTypeEditingMap
579 public static void setEditMarkerTypePreferences(
580 Map
<MarkerType
, Boolean
> markerTypeEditingMap
) {
581 for (MarkerType markerType
: markerTypeEditingMap
.keySet()) {
582 String name
= getMarkerTypeEditingPreferenceKey(markerType
);
583 getPreferenceStore().setValue(name
,
584 markerTypeEditingMap
.get(markerType
));
589 private static String
getMarkerTypeEditingPreferenceKey(
590 MarkerType markerType
) {
591 markerType
= HibernateProxyHelper
.deproxy(markerType
);
592 return markerType
.getClass().getName() + EDIT_MARKER_TYPE_PREFIX
;
597 * setEditMarkerTypePreference
601 * a {@link org.eclipse.ui.IEditorInput} object.
603 * a {@link eu.etaxonomy.cdm.model.common.MarkerType} object.
607 public static void setEditMarkerTypePreference(MarkerType markerType
,
609 getPreferenceStore().setValue(
610 getMarkerTypeEditingPreferenceKey(markerType
), edit
);
616 public static DerivedUnitFacadeConfigurator
getDerivedUnitConfigurator() {
617 DerivedUnitFacadeConfigurator configurator
= DerivedUnitFacadeConfigurator
619 configurator
.setMoveDerivedUnitMediaToGallery(true);
620 configurator
.setMoveFieldObjectMediaToGallery(true);
625 * This method will write language properties to the config.ini located in the configuration folder
626 * of the Taxonomic Ediitor. <b>This method is only used to set the default language for Taxonomic Editor.</b>
628 * @param setLanguage 0 is for german and 1 for english.
629 * @throws IOException
631 public void writePropertyToConfigFile(int setLanguage
) throws IOException
{
632 File file
= org
.eclipse
.core
.runtime
.preferences
.ConfigurationScope
.INSTANCE
.getLocation().toFile();
633 //give warning to user if the directory has no write access
635 throw new IOException();
637 Properties properties
= load(file
.getAbsolutePath()+"/config.ini");
640 properties
.setProperty("osgi.nl", "de");
641 PreferencesUtil
.getPreferenceStore().setValue(IPreferenceKeys
.DEFAULT_LANGUAGE_EDITOR
, "de");
644 properties
.setProperty("osgi.nl", "en");
645 PreferencesUtil
.getPreferenceStore().setValue(IPreferenceKeys
.DEFAULT_LANGUAGE_EDITOR
, "en");
650 save(file
+"/config.ini", properties
);
654 * This method loads a property from a given file and returns it.
658 * @throws IOException
660 private Properties
load(String filename
) throws IOException
{
661 FileInputStream in
= new FileInputStream(filename
);
662 Properties prop
= new Properties();
669 * This method saves a property to the specified file.
673 * @throws IOException
675 private void save(String filename
, Properties properties
) throws IOException
{
676 FileOutputStream fos
= new FileOutputStream(filename
);
677 properties
.store(fos
, "");
682 * Saves a list of P2 Metadata Repositories as string with specified delimiters
686 public static void setP2Repositories(List
<MetadataRepositoryElement
> p2Repos
) {
687 StringBuilder sb
= new StringBuilder();
688 for(MetadataRepositoryElement p2Repo
: p2Repos
) {
689 sb
.append(P2_REPOSITORIES_DELIM
);
690 if(p2Repo
.getName() == null || p2Repo
.getName().isEmpty()) {
693 sb
.append(p2Repo
.getName());
695 sb
.append(P2_REPOSITORY_FIELDS_DELIM
);
696 sb
.append(p2Repo
.getLocation().toString());
697 sb
.append(P2_REPOSITORY_FIELDS_DELIM
);
698 sb
.append(String
.valueOf(p2Repo
.isEnabled()));
700 getPreferenceStore().setValue(P2_REPOSITORY_LIST
, sb
.toString());
705 * Retrieves a list of previously saved P2 repositories
709 public static List
<MetadataRepositoryElement
> getP2Repositories() {
710 List
<MetadataRepositoryElement
> p2Repos
= new ArrayList
<MetadataRepositoryElement
>();
711 String p2ReposPref
= getPreferenceStore().getString(P2_REPOSITORY_LIST
);
712 if(p2ReposPref
!= null && !p2ReposPref
.isEmpty()) {
713 StringTokenizer p2ReposPrefST
= new StringTokenizer(p2ReposPref
,P2_REPOSITORIES_DELIM
);
715 while(p2ReposPrefST
.hasMoreTokens()) {
716 String p2RepoStr
= p2ReposPrefST
.nextToken();
717 StringTokenizer p2ReposStrST
= new StringTokenizer(p2RepoStr
,P2_REPOSITORY_FIELDS_DELIM
);
718 if(p2ReposStrST
.countTokens()==3) {
719 String nickname
= p2ReposStrST
.nextToken();
722 uri
= new URI(p2ReposStrST
.nextToken());
723 } catch (URISyntaxException e
) {
726 boolean enabled
= Boolean
.parseBoolean(p2ReposStrST
.nextToken());
727 MetadataRepositoryElement mre
= new MetadataRepositoryElement(null, uri
, true);
728 mre
.setNickname(nickname
);
729 mre
.setEnabled(enabled
);
739 * enables/disables nested composite. <br>
741 * @param ctrl - Composite to be en-/disabeld
742 * @param enabled - boolean
744 public static void recursiveSetEnabled(Control ctrl
, boolean enabled
) {
745 if (ctrl
instanceof Composite
) {
746 Composite comp
= (Composite
) ctrl
;
747 for (Control c
: comp
.getChildren()) {
748 recursiveSetEnabled(c
, enabled
);
751 ctrl
.setEnabled(enabled
);
757 * getSortRanksNaturally
762 public static boolean getSortNodesNaturally() {
763 return getPreferenceStore().getBoolean(SORT_NODES_NATURALLY
);
768 * setSortRanksNaturally
774 public static void setSortNodesNaturally(boolean selection
) {
775 getPreferenceStore().setValue(SORT_NODES_NATURALLY
, selection
);
781 * getSortRanksNaturally
786 public static boolean getSortNodesStrictlyAlphabetically() {
787 return getPreferenceStore().getBoolean(SORT_NODES_ALPHABETICALLY
);
792 * setSortRanksNaturally
798 public static void setSortNodesStrictlyAlphabetically(boolean selection
) {
799 getPreferenceStore().setValue(SORT_NODES_ALPHABETICALLY
, selection
);
804 * setStoreNavigatorState
810 public static boolean isStoreNavigatorState() {
811 return getPreferenceStore().getBoolean(RESTORE_NAVIGATOR_STATE
);
817 * setStoreNavigatorState
823 public static void setStoreNavigatorState(boolean selection
) {
824 getPreferenceStore().setValue(RESTORE_NAVIGATOR_STATE
, selection
);
831 public static boolean isShowUpWidgetIsDisposedMessages() {
832 return getPreferenceStore().getBoolean(IS_SHOW_UP_WIDGET_IS_DISPOSED
);
834 public static void setShowUpWidgetIsDisposedMessages(boolean selection
) {
835 getPreferenceStore().setValue(IS_SHOW_UP_WIDGET_IS_DISPOSED
, selection
);
841 public static boolean isRestoreNavigator() {
842 return getPreferenceStore().getBoolean(RESTORE_NAVIGATOR_STATE
);
844 public static void setRestoreNavigator(boolean selection
) {
845 getPreferenceStore().setValue(RESTORE_NAVIGATOR_STATE
, selection
);