Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » How get internationalized enumeration literal
How get internationalized enumeration literal [message #814313] Tue, 06 March 2012 09:55 Go to next message
Markus Jo is currently offline Markus JoFriend
Messages: 83
Registered: January 2012
Member
Hi,
I have an EMF Editor Client with am form and a dropdownbox in there.....the source of the dropdownbox is an emf generated enumeration.

How can I get the LabelProvider for the box get working internationalized ?

I tried this

return EMFEditPlugin.INSTANCE.getString("_UI_" + enumerator.getClass().getSimpleName() + "_" + enumerator.getName() + "_literal", true );


The key built uo is _UI_ExactServiceType_seat_literal and altough it is exactly written like in the plugin.properties file ("_UI_ExactServiceType_seat_literal = seat") I get a

java.util.MissingResourceException: The string resource '_UI_ExactServiceType_seat_literal' could not be located
	at org.eclipse.emf.common.util.DelegatingResourceLocator.delegatedGetString(DelegatingResourceLocator.java:487)


What am I doing wrong ?
Re: How get internationalized enumeration literal [message #814341 is a reply to message #814313] Tue, 06 March 2012 10:27 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Markus,

Comments below.

On 06/03/2012 10:55 AM, Markus Jo wrote:
> Hi,
> I have an EMF Editor Client with am form and a dropdownbox in
> there.....the source of the dropdownbox is an emf generated enumeration.
>
> How can I get the LabelProvider for the box get working
> internationalized ?
>
> I tried this
>
>
> return EMFEditPlugin.INSTANCE.getString("_UI_" +
> enumerator.getClass().getSimpleName() + "_" + enumerator.getName() +
> "_literal", true );
You have to use the EditPlugin of the generated item providers for that
model.
>
>
> The key built uo is _UI_ExactServiceType_seat_literal and altough it
> is exactly written like in the plugin.properties file
> ("_UI_ExactServiceType_seat_literal = seat") I get a
>
> java.util.MissingResourceException: The string resource
> '_UI_ExactServiceType_seat_literal' could not be located
> at
> org.eclipse.emf.common.util.DelegatingResourceLocator.delegatedGetString(DelegatingResourceLocator.java:487)
The properties view should already be correctly using that translated
property. You'll see it uses the generated item provider adapter
factory which specializes the resource locator to use the edit plugin
for that model.
>
>
> What am I doing wrong ?


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: How get internationalized enumeration literal [message #814398 is a reply to message #814341] Tue, 06 March 2012 11:56 Go to previous messageGo to next message
Markus Jo is currently offline Markus JoFriend
Messages: 83
Registered: January 2012
Member
Hi Ed,
you write "You have to use the EditPlugin of the generated item providers for that model."....but my snippet uses it, doesnt it ? "EMFEditPlugin.INSTANCE.getString(...".


You mean the ResourceItemProviderAdapterFactory ? It is created and added to other factories but I havent found where it is used yet.

Are these two different ways you described ? The EditPugin.getString and the ResourceItemProviderAdapterFactory one ?
Re: How get internationalized enumeration literal [message #814421 is a reply to message #814398] Tue, 06 March 2012 12:29 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Markus,

Comments below.

On 06/03/2012 12:56 PM, Markus Jo wrote:
> Hi Ed,
> you write "You have to use the EditPlugin of the generated item
> providers for that model."....but my snippet uses it, doesnt it ?
> "EMFEditPlugin.INSTANCE.getString(...".
Yes, that's the point. The EMFEditPlugin isn't the plugin for you
generated item providers (e.g., XyzEditPlugin) and EMF Edit doesn't know
where the plugin.properties file is for your model. It looks in
org.eclipse.emf.edit/plugin.properties and your string isn't there.
>
> You mean the ResourceItemProviderAdapterFactory ?
No.
> It is created and added to other factories but I havent found where it
> is used yet.
It will be used whenever your view hows a resource or resource set. The
generated editor has a resource set as input to the main tree, so it's
used there to get the resources of the resource set and the contents of
the resource.
>
> Are these two different ways you described ? The EditPugin.getString
> and the ResourceItemProviderAdapterFactory one ?
No. All this works in generated item providers because they have a
getResourceLocator override that returns the XyzEditPlugin instance.


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[Teneo] Reference basic understanding issue
Next Topic:org.eclipse.emf.ocl
Goto Forum:
  


Current Time: Fri Apr 26 16:13:11 GMT 2024

Powered by FUDForum. Page generated in 0.03068 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top