Package com.e1c.langtool.history.prefs
Class HistoryTransPrefs
java.lang.Object
com.e1c.langtool.history.prefs.HistoryTransPrefs
Utility class that provides an access to
IEclipsePreferences
of core History plug-in.
Note that the all preferences have instance scope.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Method Summary
Modifier and TypeMethodDescriptionstatic voidclearAll()Clears all preferences.getColorPrefKeyByScopeId(String scopeId) Returns preference key for scope color that is associated with the given scope id.Returns the default order of scope id's.getEnabledPrefKeyByScopeId(String scopeId) Returns preference key that is associated with the given scope id for describing enabled status of scope.static intReturns the max number of translations returning by translation provider.static Optional<org.eclipse.swt.graphics.RGB>getScopeColor(String scopeColorPrefKey) static Optional<org.eclipse.swt.graphics.RGB>getScopeColorByScopeId(String scopeId) getScopeEnabledByScopeId(String scopeId) Returns the enabled status of the scope that associated with the given scope id.Returns the current order of scope id's stored in preferences.isScopeEnabled(String scopeEnabledPredKey) Returns the value associated with the given preference key that describing scope enabled status.static voidsetMaxTranslations(int maxNum) Sets the max number of translations returning by translation provider.static voidsetScopeColor(String scopeColorPrefKey, org.eclipse.swt.graphics.RGB rgb) static voidsetScopeColorByScopeId(String scopeId, org.eclipse.swt.graphics.RGB color) static voidsetScopeEnabled(String scopeEnabledPrefKey, boolean isEnabled) Sets value at the given preference key that describes enabled scope status.static voidsetScopeEnabledByScopeId(String scopeId, boolean isEnabled) Sets enabled status for the given scope id.static voidsetScopeIds(List<String> scopeIds) Stores the orders of scope id's in preferences.
-
Field Details
-
MAX_TRANSLATIONS_KEY
- See Also:
-
DEFAULT_MAX_TRANSLATIONS
public static final int DEFAULT_MAX_TRANSLATIONS- See Also:
-
SCOPE_FULL_MATCH_COLOR
- See Also:
-
SCOPE_FULL_MATCH_IN_ALL_RESOURCES_COLOR
- See Also:
-
SCOPE_FULL_MATCH_IN_ALL_FEATURE_NAMES_COLOR
- See Also:
-
SCOPE_FULL_MATCH_IN_OPPOSITE_CONTEXT_COLOR
- See Also:
-
SCOPE_FT_WITH_CONTEXT_COLOR
- See Also:
-
SCOPE_FT_IN_ALL_RESOURCES_COLOR
- See Also:
-
SCOPE_FT_EVERYWHERE_COLOR
- See Also:
-
SCOPE_FULL_MATCH_ENABLED
- See Also:
-
SCOPE_FULL_MATCH_IN_ALL_RESOURCES_ENABLED
- See Also:
-
SCOPE_FULL_MATCH_IN_ALL_FEATURE_NAMES_ENABLED
- See Also:
-
SCOPE_FULL_MATCH_IN_OPPOSITE_CONTEXT_ENABLED
- See Also:
-
SCOPE_FT_WITH_CONTEXT_ENABLED
- See Also:
-
SCOPE_FT_IN_ALL_RESOURCES_ENABLED
- See Also:
-
SCOPE_FT_EVERYWHERE_ENABLED
- See Also:
-
SCOPE_ORDER
- See Also:
-
-
Method Details
-
getMaxTranslations
public static int getMaxTranslations()Returns the max number of translations returning by translation provider.- Returns:
- the max number of translations
- Throws:
NumberFormatException- if the value from preferences cannot be parsed as an integer- See Also:
-
setMaxTranslations
public static void setMaxTranslations(int maxNum) Sets the max number of translations returning by translation provider.- Parameters:
maxNum- the max number of translations (must be > 0)- Throws:
IllegalArgumentException- if the given argument is not positiveRuntimeException- if this operation cannot be completed due to a failure in the preference store, or inability to communicate with it- See Also:
-
getColorPrefKeyByScopeId
Returns preference key for scope color that is associated with the given scope id.- Parameters:
scopeId- the scope id to find associated preference key for scope color- Returns:
- an
Optionaldescribing preference key for color of scope, or an emptyOptionalif there is not any associated preference key with the given scope id
-
getEnabledPrefKeyByScopeId
Returns preference key that is associated with the given scope id for describing enabled status of scope.- Parameters:
scopeId- the scope id to find associated preference key- Returns:
- an
Optionaldescribing preference key for scope enabled status, or an emptyOptionalif there is not any associated preference key with the given scope id
-
getDefaultScopeIds
Returns the default order of scope id's.This method ensures that order of id's returning by this method is idempotent.
- Returns:
- the default order of scope id's
-
getScopeIds
Returns the current order of scope id's stored in preferences.- Returns:
- the current order of scope id's
-
setScopeIds
Stores the orders of scope id's in preferences.- Parameters:
scopeIds- a new order of scope id's- Throws:
RuntimeException- if this operation cannot be completed due to a failure in the preference store, or inability to communicate with it
-
isScopeEnabled
Returns the value associated with the given preference key that describing scope enabled status.- Parameters:
scopeEnabledPredKey- enabled scope preference key- Returns:
- an
Optionaldescribing value of scope enabled status, or an emptyOptionalif there is not any value with the given preference key - Throws:
NumberFormatException- if the value from preferences cannot be parsed as an boolean
-
setScopeEnabled
Sets value at the given preference key that describes enabled scope status.- Parameters:
scopeEnabledPrefKey- scope enabled preference keyisEnabled- an enabled status- Throws:
RuntimeException- if this operation cannot be completed due to a failure in the preference store, or inability to communicate with it
-
setScopeEnabledByScopeId
Sets enabled status for the given scope id.This method does nothing if there are not any associated preference keys with the given scope id for enabled status.
- Parameters:
scopeId- the scope id to set enabled statusisEnabled- an enabled status- Throws:
RuntimeException- if this operation cannot be completed due to a failure in the preference store, or inability to communicate with it
-
getScopeEnabledByScopeId
Returns the enabled status of the scope that associated with the given scope id.- Parameters:
scopeId- the id of scope which enabled status to get- Returns:
- an
Optionaldescribing value of scope enabled status, or an emptyOptionalif there is not any value for the given scope id - Throws:
NumberFormatException- if the value from preferences cannot be parsed as an boolean
-
getScopeColor
-
setScopeColor
-
getScopeColorByScopeId
-
setScopeColorByScopeId
-
clearAll
public static void clearAll()Clears all preferences.
-