Bug 309019 - Need an Utility method to get translated feature name from just an EStructuralFeature
Summary: Need an Utility method to get translated feature name from just an EStructura...
Status: NEW
Alias: None
Product: EMF
Classification: Modeling
Component: Edit (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Ed Merks CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-13 12:00 EDT by Thomas Kowatsch CLA
Modified: 2018-01-22 12:17 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Kowatsch CLA 2010-04-13 12:00:59 EDT
Build Identifier: CDO from HEAD on April, 13th

I need to get the translated feature name of a feature from the related edit plugin.

Unfortunately, I have no instance of any object with such a feature available. I only have the feature and an AdapterFactory (a ComposedAdapterFactory).

I have a custom Diagnostician that overrides the getObjectLabel(EObject) and the getFeatureLabel(EStructuralFeature) methods. This is needed to customize the ValidationStatus messages to use translated object and feature labels. It is absolutely no problem to get the object label in getObjectLabel(EObject):

public String getObjectLabel (EObject eObject) {
  if (_adapterFactory != null && !eObject.eIsProxy()) {
    IItemLabelProvider itemLabelProvider=
      (IItemLabelProvider) _adapterFactory.adapt(eObject,
          IItemLabelProvider.class);
    if (itemLabelProvider != null) {
      return itemLabelProvider.getText(eObject);
    }
  }
  return super.getObjectLabel(eObject);
}

But what to do in the getFeatureLabel(EStructuralFeature) method???
As I mentioned before, the Diagnostician only has an instance of a ComposedAdapterFactory....


Reproducible: Always