Java Reference
In-Depth Information
«
DEFINE
i18nAccessors
FOR
gmfgen::GenDiagram-»
«
EXPAND
xpt::Externalizer::accessorField(
"AppearancePreferencePage_archetypeColorGroup_label")-»
«
EXPAND
xpt::Externalizer::accessorField(
"AppearancePreferencePage_pinkArchetypeColor_label")-»
«
EXPAND
xpt::Externalizer::accessorField(
"AppearancePreferencePage_yellowArchetypeColor_label")-»
«
EXPAND
xpt::Externalizer::accessorField(
"AppearancePreferencePage_greenArchetypeColor_label")-»
«
EXPAND
xpt::Externalizer::accessorField(
"AppearancePreferencePage_blueArchetypeColor_label")-»
«
EXPAND
xpt::Externalizer::accessorField(
"AppearancePreferencePage_grayArchetypeColor_label")-»
«ENDDEFINE»
When the Messages class and
messages.properties
files are being gener-
ated, each template that requires messages is invoked and the strings are added
to these files. You need to go to the
i18nValues
blocks for declaring the default
localized string values when using GMF Xpand templates. Two callback expan-
sions are made from the template to
messageEntry
and
accessorField
in the
Externalizer.xpt
template, as shown here. The first creates a public static
String entry in the generated
Messages
class file; the second creates a
key=value
entry in the
messages.properties
file.
«
DEFINE
accessorField(String key)
FOR
Object»
«
EXPAND
xpt::Common::generatedMemberComment»
public static String «escapeIllegalKeySymbols(key)»;
«ENDDEFINE»
«
DEFINE
messageEntry(String key, String message)
FOR
Object-»
«escapeIllegalKeySymbols(key)»=«escapeIllegalMessageSymbols(message)»
«ENDDEFINE»
Having provided a means by which to produce messages, we now need to
access them in our generated code; this means examining another aspect of
GMF's
Externalizer.xpt
template. When a message is accessed in the code
generated, it needs to resolve the Messages class, which means calling back again
to the
Externalizer.xpt
template so that the fully qualified path can be pro-
vided. Following is the
accessorCall
definition, used for just this purpose.
Search WWH ::
Custom Search