Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [EMF] Localized feature description in EObjectValidator messages
[EMF] Localized feature description in EObjectValidator messages [message #1385816] Wed, 11 June 2014 11:48 Go to next message
Leonid Ripeynih is currently offline Leonid RipeynihFriend
Messages: 150
Registered: February 2012
Senior Member
Hi all!

I'd like to know, how can I get localized feature descriptions in default EObjectValidator diagnistics?

For now, that's what I observe:
1. EObjectValidator uses SubstitutionLabelProvider to get feature label.
2. Diagnostician provides such an interface by itself, unfortunately delegating directly to eStructuralFeature.getName().
3. There is an existing method in org.eclipse.emf.edit.provider.ItemProviderAdapter.getFeatureText(Object) which can get a nice feature description, but unfortunately it's not API.

Since org.eclipse.emf.edit.ui.action.ValidateAction already uses .Edit framework to obtain a resource set, (and moreover, it creates it's own diagnostician), it would make sense to obtain some sort of an Adapter from it's AdapterFactory, to delegate to it to get a lozalized feature label?

For now, i did amost the same thing, except for obtaining IItemLabelProvider as an adapter, and using reflection to call to getFeatureLabel(), and it works.

I wonder,
a) if it's the best (easiest) method of doing it
b) should't such a capability being provided by framework? If so, i could provide a patch.
Re: [EMF] Localized feature description in EObjectValidator messages [message #1385861 is a reply to message #1385816] Wed, 11 June 2014 17:24 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
There's quite an old bugzilla about this:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=309019

It would be nice for there to be API for it, so I'd be interested to see
your suggestion.


On 11/06/2014 1:48 PM, Leonid Ripeynih wrote:
> Hi all!
>
> I'd like to know, how can I get localized feature descriptions in
> default EObjectValidator diagnistics?
>
> For now, that's what I observe:
> 1. EObjectValidator uses SubstitutionLabelProvider to get feature label.
> 2. Diagnostician provides such an interface by itself, unfortunately
> delegating directly to eStructuralFeature.getName(). 3. There is an
> existing method in
> org.eclipse.emf.edit.provider.ItemProviderAdapter.getFeatureText(Object)
> which can get a nice feature description, but unfortunately it's not API.
>
> Since org.eclipse.emf.edit.ui.action.ValidateAction already uses .Edit
> framework to obtain a resource set, (and moreover, it creates it's own
> diagnostician), it would make sense to obtain some sort of an Adapter
> from it's AdapterFactory, to delegate to it to get a lozalized feature
> label?
>
> For now, i did amost the same thing, except for obtaining
> IItemLabelProvider as an adapter, and using reflection to call to
> getFeatureLabel(), and it works.
>
> I wonder, a) if it's the best (easiest) method of doing it
> b) should't such a capability being provided by framework? If so, i
> could provide a patch.


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Calling eInstance on RCP fails
Next Topic:Rules for XMI serialization
Goto Forum:
  


Current Time: Thu Apr 18 10:30:55 GMT 2024

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

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

Back to the top