Package com._1c.g5.v8.dt.common.ui
Class BaseEnumLabelProvider
java.lang.Object
org.eclipse.core.commands.common.EventManager
org.eclipse.jface.viewers.BaseLabelProvider
org.eclipse.jface.viewers.LabelProvider
com._1c.g5.v8.dt.common.ui.BaseEnumLabelProvider
- All Implemented Interfaces:
IBaseLabelProvider
,ILabelProvider
This class serves as a label provider, which returns localized strings for
literals of
EEnum
enumerations.
It holds a reference to an NLS
instance, which, hopefully, contains
fields named enum_name_literal, and returns the value of such a field in its
getText(Object)
method.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final String
The empty value to return if the object provided togetText(Object)
method is not anEEnumLiteral
.protected static final String
Pattern for fields of anNLS
-descendant that hold strings of enumeration literals -
Constructor Summary
ConstructorsConstructorDescriptionBaseEnumLabelProvider
(Class<? extends org.eclipse.osgi.util.NLS> messagesClass) Creates a Label Provider for literals ofEEnum
enumerations. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves a localized string corresponding to the provided enumValue from the underlying NLS descendant.Treats the incoming o as an enumeration.getText
(org.eclipse.emf.ecore.EEnumLiteral literal) Retrieves a localized string corresponding to the provided literal from the underlying NLS descendant.Methods inherited from class org.eclipse.jface.viewers.LabelProvider
createImageProvider, createTextImageProvider, createTextProvider, getImage
Methods inherited from class org.eclipse.jface.viewers.BaseLabelProvider
addListener, dispose, fireLabelProviderChanged, isLabelProperty, removeListener
Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.eclipse.jface.viewers.IBaseLabelProvider
addListener, dispose, isLabelProperty, removeListener
-
Field Details
-
LOCALIZATION_KEY_TEMPLATE
Pattern for fields of anNLS
-descendant that hold strings of enumeration literals -
EMPTY
The empty value to return if the object provided togetText(Object)
method is not anEEnumLiteral
.
-
-
Constructor Details
-
BaseEnumLabelProvider
Creates a Label Provider for literals ofEEnum
enumerations.- Parameters:
messagesClass
- an NLS descendant containing fields named as defined byLOCALIZATION_KEY_TEMPLATE
-
-
Method Details
-
getText
Treats the incoming o as an enumeration. If it is, redirects togetText(EEnumLiteral)
orgetText(Enum)
. Otherwise returnsEMPTY
.- Specified by:
getText
in interfaceILabelProvider
- Overrides:
getText
in classLabelProvider
-
getText
Retrieves a localized string corresponding to the provided literal from the underlying NLS descendant. If the corresponding field is not found will return the name of the absent field.- Parameters:
literal
- the literal to find localized string for- Returns:
- a localized string for the provided literal, if it was found. Otherwise will return the key that was used to find the string in the underlying NLS-descendant.
-
getText
Retrieves a localized string corresponding to the provided enumValue from the underlying NLS descendant. If the corresponding field is not found will return the name of the absent field.- Parameters:
literal
- the literal to find localized string for- Returns:
- a localized string for the provided literal, if it was found. Otherwise will return the key that was used to find the string in the underlying NLS-descendant.
-