diff options
author | Thomas Schindl | 2011-02-08 18:27:00 +0000 |
---|---|---|
committer | Thomas Schindl | 2011-02-08 18:27:00 +0000 |
commit | da39233933784647bf97c9e93828f20d1cc6c199 (patch) | |
tree | 2e6cb397b701ba59ee8e0d6f3cbbf341c39af539 /bundles/org.eclipse.e4.ui.model.workbench | |
parent | 10e709de14094b378de2d74cff9b53efc1919630 (diff) | |
download | eclipse.platform.ui-da39233933784647bf97c9e93828f20d1cc6c199.tar.gz eclipse.platform.ui-da39233933784647bf97c9e93828f20d1cc6c199.tar.xz eclipse.platform.ui-da39233933784647bf97c9e93828f20d1cc6c199.zip |
Bug 335768 - UIElement#accessibilityPhrase has no getLocalizedAccessibilityPhrase
Diffstat (limited to 'bundles/org.eclipse.e4.ui.model.workbench')
5 files changed, 35 insertions, 0 deletions
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/model/UIElements.ecore b/bundles/org.eclipse.e4.ui.model.workbench/model/UIElements.ecore index 82c8c30b5aa..d0c17b399df 100644 --- a/bundles/org.eclipse.e4.ui.model.workbench/model/UIElements.ecore +++ b/bundles/org.eclipse.e4.ui.model.workbench/model/UIElements.ecore @@ -129,6 +129,7 @@ <eStructuralFeatures xsi:type="ecore:EAttribute" name="inputURI" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="UIElement" abstract="true" eSuperTypes="#//ApplicationElement"> + <eOperations name="getLocalizedAccessibilityPhrase" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="widget" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject" transient="true"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="renderer" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject" diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/LocalizationHelper.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/LocalizationHelper.java index 5e70871a3d0..8dd66a592c1 100644 --- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/LocalizationHelper.java +++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/LocalizationHelper.java @@ -28,6 +28,19 @@ final public class LocalizationHelper { } /** + * Returns localized accessibilityPhrase for the specified element using locale information + * from its context. + * @param element the element + * @return localized element's accessibilityPhrase, or <code>null</code> if no label can be found + */ + public static String getLocalizedAccessibilityPhrase(MUIElement element) { + String key = element.getAccessibilityPhrase(); + if (key == null) + return null; + return getLocalized(key, element); + } + + /** * Returns localized label for the specified element using locale information * from its context. * @param element the element diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/MUIElement.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/MUIElement.java index 577d6dce980..9c44e4f742c 100644 --- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/MUIElement.java +++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/MUIElement.java @@ -292,4 +292,12 @@ public interface MUIElement extends MApplicationElement { */ void setAccessibilityPhrase(String value); + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @model kind="operation" + * @generated + */ + String getLocalizedAccessibilityPhrase(); + } // MUIElement diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/impl/UIElementImpl.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/impl/UIElementImpl.java index 9bd91ec5a3b..47653b76841 100644 --- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/impl/UIElementImpl.java +++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/impl/UIElementImpl.java @@ -10,6 +10,8 @@ */ package org.eclipse.e4.ui.model.application.ui.impl; +import org.eclipse.e4.ui.model.LocalizationHelper; + import org.eclipse.e4.ui.model.application.impl.ApplicationElementImpl; import org.eclipse.e4.ui.model.application.ui.MElementContainer; import org.eclipse.e4.ui.model.application.ui.MExpression; @@ -500,6 +502,15 @@ public abstract class UIElementImpl extends ApplicationElementImpl implements MU * <!-- end-user-doc --> * @generated */ + public String getLocalizedAccessibilityPhrase() { + return LocalizationHelper.getLocalizedAccessibilityPhrase(this); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ @SuppressWarnings("unchecked") @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/impl/UiPackageImpl.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/impl/UiPackageImpl.java index f39f772a9a2..0c055d5f291 100644 --- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/impl/UiPackageImpl.java +++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/impl/UiPackageImpl.java @@ -1928,6 +1928,8 @@ public class UiPackageImpl extends EPackageImpl { initEReference(getUIElement_VisibleWhen(), this.getExpression(), null, "visibleWhen", null, 0, 1, MUIElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ initEAttribute(getUIElement_AccessibilityPhrase(), ecorePackage.getEString(), "accessibilityPhrase", null, 0, 1, MUIElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + addEOperation(uiElementEClass, ecorePackage.getEString(), "getLocalizedAccessibilityPhrase", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ + initEClass(uiLabelEClass, MUILabel.class, "UILabel", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ initEAttribute(getUILabel_Label(), ecorePackage.getEString(), "label", null, 0, 1, MUILabel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ initEAttribute(getUILabel_IconURI(), ecorePackage.getEString(), "iconURI", null, 0, 1, MUILabel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ |