Fixed problem with Unit display for Unit that do not support SI prefix.
Change-Id: Ib6648704628bbe7ae5536f95444c104cd262fdf7
diff --git a/bundles/common/org.eclipse.apogy.common.emf.ui.emfforms/src/org/eclipse/apogy/common/emf/ui/emfforms/composites/TypedElementSimpleUnitsComposite.java b/bundles/common/org.eclipse.apogy.common.emf.ui.emfforms/src/org/eclipse/apogy/common/emf/ui/emfforms/composites/TypedElementSimpleUnitsComposite.java
index 19a76e0..42d4e01 100644
--- a/bundles/common/org.eclipse.apogy.common.emf.ui.emfforms/src/org/eclipse/apogy/common/emf/ui/emfforms/composites/TypedElementSimpleUnitsComposite.java
+++ b/bundles/common/org.eclipse.apogy.common.emf.ui.emfforms/src/org/eclipse/apogy/common/emf/ui/emfforms/composites/TypedElementSimpleUnitsComposite.java
@@ -667,7 +667,17 @@
return null;
}
}
-
+
+ /**
+ * Return the string representation of a Unit.
+ * @param units The Unit.
+ * @return The string representation of the unit.
+ */
+ protected String getUnitsAsString(Unit<?> units)
+ {
+ return ApogyCommonEMFUIFacade.INSTANCE.getUnitAsString(units);
+ }
+
/**
* Gets the DecimalFormat to use to format the displayed value.
*
@@ -711,9 +721,9 @@
Unit<?> displayUnits = ApogyCommonEMFUIFacade.INSTANCE.getDisplayUnits(getEStructuralFeature());
if (nativeUnits != null)
- description += "Native Units : " + nativeUnits.toString() + "\n";
+ description += "Native Units : " + getUnitsAsString(nativeUnits) + "\n";
if (displayUnits != null)
- description += "Displayed Units : " + displayUnits.toString();
+ description += "Displayed Units : " + getUnitsAsString(displayUnits);
Number minAlarmValue = ApogyCommonEMFFacade.INSTANCE.getAlarmMinValue(getEStructuralFeature());
if (minAlarmValue != null) {
@@ -722,10 +732,10 @@
if (displayUnits != null) {
description += getDecimalFormat()
.format(nativeUnits.getConverterTo(displayUnits).convert(minAlarmValue.doubleValue()))
- + " " + displayUnits.toString();
+ + " " + getUnitsAsString(displayUnits);
} else {
description += getDecimalFormat().format(minAlarmValue.doubleValue()) + " "
- + nativeUnits.toString();
+ + getUnitsAsString(nativeUnits);
}
} else {
description += getDecimalFormat().format(minAlarmValue.doubleValue());
@@ -739,10 +749,10 @@
if (displayUnits != null) {
description += getDecimalFormat()
.format(nativeUnits.getConverterTo(displayUnits).convert(minWarningValue.doubleValue()))
- + " " + displayUnits.toString();
+ + " " + getUnitsAsString(displayUnits);
} else {
description += getDecimalFormat().format(minWarningValue.doubleValue()) + " "
- + nativeUnits.toString();
+ + getUnitsAsString(nativeUnits);
}
} else {
description += getDecimalFormat().format(minWarningValue.doubleValue());
@@ -756,10 +766,10 @@
if (displayUnits != null) {
description += getDecimalFormat()
.format(nativeUnits.getConverterTo(displayUnits).convert(maxWarningValue.doubleValue()))
- + " " + displayUnits.toString();
+ + " " + getUnitsAsString(displayUnits);
} else {
description += getDecimalFormat().format(maxWarningValue.doubleValue()) + " "
- + nativeUnits.toString();
+ + getUnitsAsString(nativeUnits);
}
} else {
description += getDecimalFormat().format(maxWarningValue.doubleValue());
@@ -773,10 +783,10 @@
if (displayUnits != null) {
description += getDecimalFormat()
.format(nativeUnits.getConverterTo(displayUnits).convert(maxAlarmValue.doubleValue()))
- + " " + displayUnits.toString();
+ + " " + getUnitsAsString(displayUnits);
} else {
description += getDecimalFormat().format(maxAlarmValue.doubleValue()) + " "
- + nativeUnits.toString();
+ + getUnitsAsString(nativeUnits);
}
} else {
description += getDecimalFormat().format(maxAlarmValue.doubleValue());
@@ -790,10 +800,10 @@
if (displayUnits != null) {
description += getDecimalFormat()
.format(nativeUnits.getConverterTo(displayUnits).convert(outsideMinValue.doubleValue()))
- + " " + displayUnits.toString();
+ + " " + getUnitsAsString(displayUnits);
} else {
description += getDecimalFormat().format(outsideMinValue.doubleValue()) + " "
- + nativeUnits.toString();
+ + getUnitsAsString(nativeUnits);
}
} else {
description += getDecimalFormat().format(outsideMinValue.doubleValue());
@@ -807,10 +817,10 @@
if (displayUnits != null) {
description += getDecimalFormat()
.format(nativeUnits.getConverterTo(displayUnits).convert(outsideMaxValue.doubleValue()))
- + " " + displayUnits.toString();
+ + " " + getUnitsAsString(displayUnits);
} else {
description += getDecimalFormat().format(outsideMaxValue.doubleValue()) + " "
- + nativeUnits.toString();
+ + getUnitsAsString(nativeUnits);
}
} else {
description += getDecimalFormat().format(outsideMaxValue.doubleValue());
@@ -994,16 +1004,22 @@
if (this.unitsButton != null && !this.unitsButton.isDisposed()) {
try {
Unit<?> units = getDisplayUnits();
- if (units != null) {
- this.unitsButton.setText(units.toString());
+ if (units != null)
+ {
+ String unitString = getUnitsAsString(units);
+ this.unitsButton.setText(unitString);
+
GC gc = new GC(this);
- int width = (int) (gc.getFontMetrics().getLeading()
- + gc.getFontMetrics().getAverageCharacterWidth() * units.toString().length() + 20);
- GridData gd_buttonUnits = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
+ //int width = (int) (gc.getFontMetrics().getAverageCharacterWidth() * unitString.length() * 1.5);
+ int width = (int) (gc.getFontMetrics().getLeading() + gc.getFontMetrics().getAverageCharacterWidth() * unitString.length() + 20);
+
+ GridData gd_buttonUnits = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
gd_buttonUnits.widthHint = width;
gd_buttonUnits.minimumWidth = width;
this.unitsButton.setLayoutData(gd_buttonUnits);
- } else {
+ }
+ else
+ {
this.unitsButton.setText("Units");
}
@@ -1020,18 +1036,23 @@
}
}
- private void updateUnitsLabel() {
- if (this.unitsLabel != null && !this.unitsLabel.isDisposed()) {
+ private void updateUnitsLabel()
+ {
+ if (this.unitsLabel != null && !this.unitsLabel.isDisposed())
+ {
Unit<?> units = getDisplayUnits();
- if (units != null) {
- this.unitsLabel.setText(units.toString());
+ if (units != null)
+ {
+ String unitString = getUnitsAsString(units);
+ this.unitsLabel.setText(unitString);
GC gc = new GC(this);
- int width = (int) (gc.getFontMetrics().getLeading()
- + gc.getFontMetrics().getAverageCharacterWidth() * units.toString().length() + 10);
+ int width = (int) (gc.getFontMetrics().getLeading() + gc.getFontMetrics().getAverageCharacterWidth() * unitString.length() + 10);
GridData gd_buttonUnits = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
gd_buttonUnits.widthHint = width;
this.unitsLabel.setLayoutData(gd_buttonUnits);
- } else {
+ }
+ else
+ {
this.unitsLabel.setText("?");
}
@@ -1039,7 +1060,8 @@
this.requestLayout();
}
}
-
+
+
/**
* Gets the value formatted with the right decimalFormat and units.
*/
diff --git a/bundles/common/org.eclipse.apogy.common.emf.ui/model/apogy_common_emf_ui.xcore b/bundles/common/org.eclipse.apogy.common.emf.ui/model/apogy_common_emf_ui.xcore
index e7aac5c..6e5bb02 100644
--- a/bundles/common/org.eclipse.apogy.common.emf.ui/model/apogy_common_emf_ui.xcore
+++ b/bundles/common/org.eclipse.apogy.common.emf.ui/model/apogy_common_emf_ui.xcore
@@ -163,6 +163,13 @@
op Unit getDisplayUnits(ETypedElement eTypedElement)
/**
+ * Converts a Unit to its string representation.
+ * @param units The units to convert to string.
+ * @return The String representation of the unit.
+ */
+ op String getUnitAsString(Unit units)
+
+ /**
* Converts a Number value of a specified eTypedElement to its display value.
* @param number The number to convert.
* @param eTypedElement Reference to the ETypedElement, used to resolve native and display units.
diff --git a/bundles/common/org.eclipse.apogy.common.emf.ui/src-gen-custom/org/eclipse/apogy/common/emf/ui/impl/ApogyCommonEMFUIFacadeCustomImpl.java b/bundles/common/org.eclipse.apogy.common.emf.ui/src-gen-custom/org/eclipse/apogy/common/emf/ui/impl/ApogyCommonEMFUIFacadeCustomImpl.java
index d13a6b4..dcf40f6 100644
--- a/bundles/common/org.eclipse.apogy.common.emf.ui/src-gen-custom/org/eclipse/apogy/common/emf/ui/impl/ApogyCommonEMFUIFacadeCustomImpl.java
+++ b/bundles/common/org.eclipse.apogy.common.emf.ui/src-gen-custom/org/eclipse/apogy/common/emf/ui/impl/ApogyCommonEMFUIFacadeCustomImpl.java
@@ -244,6 +244,76 @@
}
@Override
+ public String getUnitAsString(Unit<?> units)
+ {
+ if(units != null)
+ {
+ String unitAsString = units.toString();
+
+ /**
+ * The following is to handle a few exceptions where Unit does not support SI prefixes
+ */
+ String unitString = null;
+ String factorString = null;
+ String unitsString = null;
+ double factor = 0;
+
+ if(unitAsString.contains(")"))
+ {
+ factorString = unitAsString.substring(unitAsString.indexOf(")") + 1).trim();
+ unitsString = unitAsString.substring(unitAsString.indexOf("(") + 1, unitAsString.indexOf(")")).trim();
+ }
+ else
+ {
+ if(unitAsString.indexOf("*") >= 0)
+ {
+ unitsString = unitAsString.substring(0, unitAsString.indexOf("*")).trim();
+ factorString = unitAsString.substring(unitAsString.indexOf("*")).trim();
+ }
+ else if(unitAsString.indexOf("/") >= 0)
+ {
+ unitsString = unitAsString.substring(0, unitAsString.indexOf("/")).trim();
+ factorString = unitAsString.substring(unitAsString.indexOf("/")).trim();
+ }
+ }
+
+ try
+ {
+ if(factorString.startsWith("*"))
+ {
+ String tmp = factorString.substring(factorString.indexOf("*") + 1);
+ factor = Double.parseDouble(tmp);
+ }
+ else if(factorString.startsWith("/"))
+ {
+ String tmp = factorString.substring(factorString.indexOf("/") + 1);
+ factor = 1.0 / Double.parseDouble(tmp);
+ }
+ }
+ catch (Exception e)
+ {
+ }
+
+ String prefix = null;
+ if(factor != 0)
+ {
+ prefix = getSIPrefix(factor);
+ if(prefix != null) unitString = prefix + unitsString;
+ }
+ else
+ {
+ unitString = units.toString();
+ }
+
+ return unitString.trim();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ @Override
public Number convertToDisplayUnits(Number number, ETypedElement eTypedElement)
{
Unit<?> displayUnits = ApogyCommonEMFUIFacade.INSTANCE.getDisplayUnits(eTypedElement);
@@ -608,4 +678,68 @@
return mPart.getElementId() + "-" + persistedStateKey;
}
+ private String getSIPrefix(double factor)
+ {
+ String prefix = null;
+
+ if(factor == 10)
+ {
+ prefix = "da";
+ }
+ else if(factor == 1E2)
+ {
+ prefix = "h";
+ }
+ else if(factor == 1E3)
+ {
+ prefix = "k";
+ }
+ else if(factor == 1E6)
+ {
+ prefix = "M";
+ }
+ else if(factor == 1E9)
+ {
+ prefix = "G";
+ }
+ else if(factor == 1E12)
+ {
+ prefix = "T";
+ }
+ else if(factor == 1E15)
+ {
+ prefix = "P";
+ }
+ else if(factor == 1E-1)
+ {
+ prefix = "d";
+ }
+ else if(factor == 1E-2)
+ {
+ prefix = "c";
+ }
+ else if(factor == 1E-3)
+ {
+ prefix = "m";
+ }
+ else if(factor == 1E-6)
+ {
+ prefix = "µ";
+ }
+ else if(factor == 1E-9)
+ {
+ prefix = "n";
+ }
+ else if(factor == 1E-12)
+ {
+ prefix = "p";
+ }
+ else if(factor == 1E-15)
+ {
+ prefix = "f";
+ }
+
+ return prefix;
+ }
+
} // ApogyCommonEMFUIFacadeImpl
\ No newline at end of file
diff --git a/bundles/common/org.eclipse.apogy.common.emf.ui/src-gen/org/eclipse/apogy/common/emf/ui/ApogyCommonEMFUIFacade.java b/bundles/common/org.eclipse.apogy.common.emf.ui/src-gen/org/eclipse/apogy/common/emf/ui/ApogyCommonEMFUIFacade.java
index 0fb9360..e927e56 100644
--- a/bundles/common/org.eclipse.apogy.common.emf.ui/src-gen/org/eclipse/apogy/common/emf/ui/ApogyCommonEMFUIFacade.java
+++ b/bundles/common/org.eclipse.apogy.common.emf.ui/src-gen/org/eclipse/apogy/common/emf/ui/ApogyCommonEMFUIFacade.java
@@ -214,6 +214,20 @@
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* *
+ * Converts a Unit to its string representation.
+ * @param units The units to convert to string.
+ * @return The String representation of the unit.
+ * <!-- end-model-doc -->
+ * @model unique="false" unitsDataType="org.eclipse.apogy.common.emf.Unit" unitsUnique="false"
+ * @generated
+ */
+ String getUnitAsString(Unit<?> units);
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * <!-- begin-model-doc -->
+ * *
* Converts a Number value of a specified eTypedElement to its display value.
* @param number The number to convert.
* @param eTypedElement Reference to the ETypedElement, used to resolve native and display units.
diff --git a/bundles/common/org.eclipse.apogy.common.emf.ui/src-gen/org/eclipse/apogy/common/emf/ui/ApogyCommonEMFUIPackage.java b/bundles/common/org.eclipse.apogy.common.emf.ui/src-gen/org/eclipse/apogy/common/emf/ui/ApogyCommonEMFUIPackage.java
index 4c12d53..0a23d92 100644
--- a/bundles/common/org.eclipse.apogy.common.emf.ui/src-gen/org/eclipse/apogy/common/emf/ui/ApogyCommonEMFUIPackage.java
+++ b/bundles/common/org.eclipse.apogy.common.emf.ui/src-gen/org/eclipse/apogy/common/emf/ui/ApogyCommonEMFUIPackage.java
@@ -177,13 +177,22 @@
int APOGY_COMMON_EMFUI_FACADE___GET_DISPLAY_UNITS__ETYPEDELEMENT = 4;
/**
+ * The operation id for the '<em>Get Unit As String</em>' operation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int APOGY_COMMON_EMFUI_FACADE___GET_UNIT_AS_STRING__UNIT = 5;
+
+ /**
* The operation id for the '<em>Convert To Display Units</em>' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- int APOGY_COMMON_EMFUI_FACADE___CONVERT_TO_DISPLAY_UNITS__NUMBER_ETYPEDELEMENT = 5;
+ int APOGY_COMMON_EMFUI_FACADE___CONVERT_TO_DISPLAY_UNITS__NUMBER_ETYPEDELEMENT = 6;
/**
* The operation id for the '<em>Get Display Units</em>' operation.
@@ -192,7 +201,7 @@
* @generated
* @ordered
*/
- int APOGY_COMMON_EMFUI_FACADE___GET_DISPLAY_UNITS__EOPERATION_EOPERATIONEPARAMETERSUNITSPROVIDERPARAMETERS = 6;
+ int APOGY_COMMON_EMFUI_FACADE___GET_DISPLAY_UNITS__EOPERATION_EOPERATIONEPARAMETERSUNITSPROVIDERPARAMETERS = 7;
/**
* The operation id for the '<em>Add Units Provider To Registry</em>' operation.
@@ -201,7 +210,7 @@
* @generated
* @ordered
*/
- int APOGY_COMMON_EMFUI_FACADE___ADD_UNITS_PROVIDER_TO_REGISTRY__ETYPEDELEMENT_UNITSPROVIDER = 7;
+ int APOGY_COMMON_EMFUI_FACADE___ADD_UNITS_PROVIDER_TO_REGISTRY__ETYPEDELEMENT_UNITSPROVIDER = 8;
/**
* The operation id for the '<em>Convert To Native Units</em>' operation.
@@ -210,7 +219,7 @@
* @generated
* @ordered
*/
- int APOGY_COMMON_EMFUI_FACADE___CONVERT_TO_NATIVE_UNITS__NUMBER_UNIT_UNIT_ECLASSIFIER = 8;
+ int APOGY_COMMON_EMFUI_FACADE___CONVERT_TO_NATIVE_UNITS__NUMBER_UNIT_UNIT_ECLASSIFIER = 9;
/**
* The operation id for the '<em>Get Display Format</em>' operation.
@@ -219,7 +228,7 @@
* @generated
* @ordered
*/
- int APOGY_COMMON_EMFUI_FACADE___GET_DISPLAY_FORMAT__ETYPEDELEMENT = 9;
+ int APOGY_COMMON_EMFUI_FACADE___GET_DISPLAY_FORMAT__ETYPEDELEMENT = 10;
/**
* The operation id for the '<em>Get Display Format</em>' operation.
@@ -228,7 +237,7 @@
* @generated
* @ordered
*/
- int APOGY_COMMON_EMFUI_FACADE___GET_DISPLAY_FORMAT__EOPERATION_EOPERATIONEPARAMETERSFORMATPROVIDERPARAMETERS = 10;
+ int APOGY_COMMON_EMFUI_FACADE___GET_DISPLAY_FORMAT__EOPERATION_EOPERATIONEPARAMETERSFORMATPROVIDERPARAMETERS = 11;
/**
* The operation id for the '<em>Get Displayed String</em>' operation.
@@ -237,7 +246,7 @@
* @generated
* @ordered
*/
- int APOGY_COMMON_EMFUI_FACADE___GET_DISPLAYED_STRING__NUMBER_ETYPEDELEMENT = 11;
+ int APOGY_COMMON_EMFUI_FACADE___GET_DISPLAYED_STRING__NUMBER_ETYPEDELEMENT = 12;
/**
* The operation id for the '<em>Add Format Provider To Registry</em>' operation.
@@ -246,7 +255,7 @@
* @generated
* @ordered
*/
- int APOGY_COMMON_EMFUI_FACADE___ADD_FORMAT_PROVIDER_TO_REGISTRY__ETYPEDELEMENT_FORMATPROVIDER = 12;
+ int APOGY_COMMON_EMFUI_FACADE___ADD_FORMAT_PROVIDER_TO_REGISTRY__ETYPEDELEMENT_FORMATPROVIDER = 13;
/**
* The operation id for the '<em>Open Delete Named Dialog</em>' operation.
@@ -255,7 +264,7 @@
* @generated
* @ordered
*/
- int APOGY_COMMON_EMFUI_FACADE___OPEN_DELETE_NAMED_DIALOG__NAMED = 13;
+ int APOGY_COMMON_EMFUI_FACADE___OPEN_DELETE_NAMED_DIALOG__NAMED = 14;
/**
* The operation id for the '<em>Open Delete Named Dialog</em>' operation.
@@ -264,7 +273,7 @@
* @generated
* @ordered
*/
- int APOGY_COMMON_EMFUI_FACADE___OPEN_DELETE_NAMED_DIALOG__LIST = 14;
+ int APOGY_COMMON_EMFUI_FACADE___OPEN_DELETE_NAMED_DIALOG__LIST = 15;
/**
* The operation id for the '<em>Save To Persisted State</em>' operation.
@@ -273,7 +282,7 @@
* @generated
* @ordered
*/
- int APOGY_COMMON_EMFUI_FACADE___SAVE_TO_PERSISTED_STATE__MPART_STRING_EOBJECT_RESOURCESET = 15;
+ int APOGY_COMMON_EMFUI_FACADE___SAVE_TO_PERSISTED_STATE__MPART_STRING_EOBJECT_RESOURCESET = 16;
/**
* The operation id for the '<em>Read From Persisted State</em>' operation.
@@ -282,7 +291,7 @@
* @generated
* @ordered
*/
- int APOGY_COMMON_EMFUI_FACADE___READ_FROM_PERSISTED_STATE__MPART_STRING_RESOURCESET = 16;
+ int APOGY_COMMON_EMFUI_FACADE___READ_FROM_PERSISTED_STATE__MPART_STRING_RESOURCESET = 17;
/**
* The operation id for the '<em>Get Image</em>' operation.
@@ -291,7 +300,7 @@
* @generated
* @ordered
*/
- int APOGY_COMMON_EMFUI_FACADE___GET_IMAGE__ECLASS = 17;
+ int APOGY_COMMON_EMFUI_FACADE___GET_IMAGE__ECLASS = 18;
/**
* The operation id for the '<em>Add Hide Show Column Menu</em>' operation.
@@ -300,7 +309,7 @@
* @generated
* @ordered
*/
- int APOGY_COMMON_EMFUI_FACADE___ADD_HIDE_SHOW_COLUMN_MENU__TREEVIEWER = 18;
+ int APOGY_COMMON_EMFUI_FACADE___ADD_HIDE_SHOW_COLUMN_MENU__TREEVIEWER = 19;
/**
* The operation id for the '<em>Create Viewer Selection Control Enabled Binding</em>' operation.
@@ -309,7 +318,7 @@
* @generated
* @ordered
*/
- int APOGY_COMMON_EMFUI_FACADE___CREATE_VIEWER_SELECTION_CONTROL_ENABLED_BINDING__DATABINDINGCONTEXT_STRUCTUREDVIEWER_CONTROL_FUNCTION = 19;
+ int APOGY_COMMON_EMFUI_FACADE___CREATE_VIEWER_SELECTION_CONTROL_ENABLED_BINDING__DATABINDINGCONTEXT_STRUCTUREDVIEWER_CONTROL_FUNCTION = 20;
/**
* The number of operations of the '<em>Facade</em>' class.
@@ -318,7 +327,7 @@
* @generated
* @ordered
*/
- int APOGY_COMMON_EMFUI_FACADE_OPERATION_COUNT = 20;
+ int APOGY_COMMON_EMFUI_FACADE_OPERATION_COUNT = 21;
/**
* The meta object id for the '{@link org.eclipse.apogy.common.emf.ui.impl.ApogyCommonEMFUIPreferencesImpl <em>Preferences</em>}' class.
@@ -2041,6 +2050,16 @@
EOperation getApogyCommonEMFUIFacade__GetDisplayUnits__ETypedElement();
/**
+ * Returns the meta object for the '{@link org.eclipse.apogy.common.emf.ui.ApogyCommonEMFUIFacade#getUnitAsString(javax.measure.unit.Unit) <em>Get Unit As String</em>}' operation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the '<em>Get Unit As String</em>' operation.
+ * @see org.eclipse.apogy.common.emf.ui.ApogyCommonEMFUIFacade#getUnitAsString(javax.measure.unit.Unit)
+ * @generated
+ */
+ EOperation getApogyCommonEMFUIFacade__GetUnitAsString__Unit();
+
+ /**
* Returns the meta object for the '{@link org.eclipse.apogy.common.emf.ui.ApogyCommonEMFUIFacade#convertToDisplayUnits(java.lang.Number, org.eclipse.emf.ecore.ETypedElement) <em>Convert To Display Units</em>}' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -3330,6 +3349,14 @@
EOperation APOGY_COMMON_EMFUI_FACADE___GET_DISPLAY_UNITS__ETYPEDELEMENT = eINSTANCE.getApogyCommonEMFUIFacade__GetDisplayUnits__ETypedElement();
/**
+ * The meta object literal for the '<em><b>Get Unit As String</b></em>' operation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EOperation APOGY_COMMON_EMFUI_FACADE___GET_UNIT_AS_STRING__UNIT = eINSTANCE.getApogyCommonEMFUIFacade__GetUnitAsString__Unit();
+
+ /**
* The meta object literal for the '<em><b>Convert To Display Units</b></em>' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
diff --git a/bundles/common/org.eclipse.apogy.common.emf.ui/src-gen/org/eclipse/apogy/common/emf/ui/impl/ApogyCommonEMFUIFacadeImpl.java b/bundles/common/org.eclipse.apogy.common.emf.ui/src-gen/org/eclipse/apogy/common/emf/ui/impl/ApogyCommonEMFUIFacadeImpl.java
index ec88c0c..dd307b6 100644
--- a/bundles/common/org.eclipse.apogy.common.emf.ui/src-gen/org/eclipse/apogy/common/emf/ui/impl/ApogyCommonEMFUIFacadeImpl.java
+++ b/bundles/common/org.eclipse.apogy.common.emf.ui/src-gen/org/eclipse/apogy/common/emf/ui/impl/ApogyCommonEMFUIFacadeImpl.java
@@ -318,6 +318,18 @@
* @generated
*/
@Override
+ public String getUnitAsString(Unit<?> units) {
+ // TODO: implement this method
+ // Ensure that you remove @generated or mark it @generated NOT
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
public Number convertToDisplayUnits(Number number, ETypedElement eTypedElement) {
// TODO: implement this method
// Ensure that you remove @generated or mark it @generated NOT
@@ -585,6 +597,8 @@
return convertToRGBA((RGB)arguments.get(0));
case ApogyCommonEMFUIPackage.APOGY_COMMON_EMFUI_FACADE___GET_DISPLAY_UNITS__ETYPEDELEMENT:
return getDisplayUnits((ETypedElement)arguments.get(0));
+ case ApogyCommonEMFUIPackage.APOGY_COMMON_EMFUI_FACADE___GET_UNIT_AS_STRING__UNIT:
+ return getUnitAsString((Unit<?>)arguments.get(0));
case ApogyCommonEMFUIPackage.APOGY_COMMON_EMFUI_FACADE___CONVERT_TO_DISPLAY_UNITS__NUMBER_ETYPEDELEMENT:
return convertToDisplayUnits((Number)arguments.get(0), (ETypedElement)arguments.get(1));
case ApogyCommonEMFUIPackage.APOGY_COMMON_EMFUI_FACADE___GET_DISPLAY_UNITS__EOPERATION_EOPERATIONEPARAMETERSUNITSPROVIDERPARAMETERS:
diff --git a/bundles/common/org.eclipse.apogy.common.emf.ui/src-gen/org/eclipse/apogy/common/emf/ui/impl/ApogyCommonEMFUIPackageImpl.java b/bundles/common/org.eclipse.apogy.common.emf.ui/src-gen/org/eclipse/apogy/common/emf/ui/impl/ApogyCommonEMFUIPackageImpl.java
index 10ce2dc..7cd8790 100644
--- a/bundles/common/org.eclipse.apogy.common.emf.ui/src-gen/org/eclipse/apogy/common/emf/ui/impl/ApogyCommonEMFUIPackageImpl.java
+++ b/bundles/common/org.eclipse.apogy.common.emf.ui/src-gen/org/eclipse/apogy/common/emf/ui/impl/ApogyCommonEMFUIPackageImpl.java
@@ -619,7 +619,7 @@
* @generated
*/
@Override
- public EOperation getApogyCommonEMFUIFacade__ConvertToDisplayUnits__Number_ETypedElement() {
+ public EOperation getApogyCommonEMFUIFacade__GetUnitAsString__Unit() {
return apogyCommonEMFUIFacadeEClass.getEOperations().get(5);
}
@@ -629,7 +629,7 @@
* @generated
*/
@Override
- public EOperation getApogyCommonEMFUIFacade__GetDisplayUnits__EOperation_EOperationEParametersUnitsProviderParameters() {
+ public EOperation getApogyCommonEMFUIFacade__ConvertToDisplayUnits__Number_ETypedElement() {
return apogyCommonEMFUIFacadeEClass.getEOperations().get(6);
}
@@ -639,7 +639,7 @@
* @generated
*/
@Override
- public EOperation getApogyCommonEMFUIFacade__AddUnitsProviderToRegistry__ETypedElement_UnitsProvider() {
+ public EOperation getApogyCommonEMFUIFacade__GetDisplayUnits__EOperation_EOperationEParametersUnitsProviderParameters() {
return apogyCommonEMFUIFacadeEClass.getEOperations().get(7);
}
@@ -649,7 +649,7 @@
* @generated
*/
@Override
- public EOperation getApogyCommonEMFUIFacade__ConvertToNativeUnits__Number_Unit_Unit_EClassifier() {
+ public EOperation getApogyCommonEMFUIFacade__AddUnitsProviderToRegistry__ETypedElement_UnitsProvider() {
return apogyCommonEMFUIFacadeEClass.getEOperations().get(8);
}
@@ -659,7 +659,7 @@
* @generated
*/
@Override
- public EOperation getApogyCommonEMFUIFacade__GetDisplayFormat__ETypedElement() {
+ public EOperation getApogyCommonEMFUIFacade__ConvertToNativeUnits__Number_Unit_Unit_EClassifier() {
return apogyCommonEMFUIFacadeEClass.getEOperations().get(9);
}
@@ -669,7 +669,7 @@
* @generated
*/
@Override
- public EOperation getApogyCommonEMFUIFacade__GetDisplayFormat__EOperation_EOperationEParametersFormatProviderParameters() {
+ public EOperation getApogyCommonEMFUIFacade__GetDisplayFormat__ETypedElement() {
return apogyCommonEMFUIFacadeEClass.getEOperations().get(10);
}
@@ -679,7 +679,7 @@
* @generated
*/
@Override
- public EOperation getApogyCommonEMFUIFacade__GetDisplayedString__Number_ETypedElement() {
+ public EOperation getApogyCommonEMFUIFacade__GetDisplayFormat__EOperation_EOperationEParametersFormatProviderParameters() {
return apogyCommonEMFUIFacadeEClass.getEOperations().get(11);
}
@@ -689,7 +689,7 @@
* @generated
*/
@Override
- public EOperation getApogyCommonEMFUIFacade__AddFormatProviderToRegistry__ETypedElement_FormatProvider() {
+ public EOperation getApogyCommonEMFUIFacade__GetDisplayedString__Number_ETypedElement() {
return apogyCommonEMFUIFacadeEClass.getEOperations().get(12);
}
@@ -699,7 +699,7 @@
* @generated
*/
@Override
- public EOperation getApogyCommonEMFUIFacade__OpenDeleteNamedDialog__Named() {
+ public EOperation getApogyCommonEMFUIFacade__AddFormatProviderToRegistry__ETypedElement_FormatProvider() {
return apogyCommonEMFUIFacadeEClass.getEOperations().get(13);
}
@@ -709,7 +709,7 @@
* @generated
*/
@Override
- public EOperation getApogyCommonEMFUIFacade__OpenDeleteNamedDialog__List() {
+ public EOperation getApogyCommonEMFUIFacade__OpenDeleteNamedDialog__Named() {
return apogyCommonEMFUIFacadeEClass.getEOperations().get(14);
}
@@ -719,7 +719,7 @@
* @generated
*/
@Override
- public EOperation getApogyCommonEMFUIFacade__SaveToPersistedState__MPart_String_EObject_ResourceSet() {
+ public EOperation getApogyCommonEMFUIFacade__OpenDeleteNamedDialog__List() {
return apogyCommonEMFUIFacadeEClass.getEOperations().get(15);
}
@@ -729,7 +729,7 @@
* @generated
*/
@Override
- public EOperation getApogyCommonEMFUIFacade__ReadFromPersistedState__MPart_String_ResourceSet() {
+ public EOperation getApogyCommonEMFUIFacade__SaveToPersistedState__MPart_String_EObject_ResourceSet() {
return apogyCommonEMFUIFacadeEClass.getEOperations().get(16);
}
@@ -739,7 +739,7 @@
* @generated
*/
@Override
- public EOperation getApogyCommonEMFUIFacade__GetImage__EClass() {
+ public EOperation getApogyCommonEMFUIFacade__ReadFromPersistedState__MPart_String_ResourceSet() {
return apogyCommonEMFUIFacadeEClass.getEOperations().get(17);
}
@@ -749,7 +749,7 @@
* @generated
*/
@Override
- public EOperation getApogyCommonEMFUIFacade__AddHideShowColumnMenu__TreeViewer() {
+ public EOperation getApogyCommonEMFUIFacade__GetImage__EClass() {
return apogyCommonEMFUIFacadeEClass.getEOperations().get(18);
}
@@ -759,7 +759,7 @@
* @generated
*/
@Override
- public EOperation getApogyCommonEMFUIFacade__CreateViewerSelectionControlEnabledBinding__DataBindingContext_StructuredViewer_Control_Function() {
+ public EOperation getApogyCommonEMFUIFacade__AddHideShowColumnMenu__TreeViewer() {
return apogyCommonEMFUIFacadeEClass.getEOperations().get(19);
}
@@ -769,6 +769,16 @@
* @generated
*/
@Override
+ public EOperation getApogyCommonEMFUIFacade__CreateViewerSelectionControlEnabledBinding__DataBindingContext_StructuredViewer_Control_Function() {
+ return apogyCommonEMFUIFacadeEClass.getEOperations().get(20);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
public EClass getApogyCommonEMFUIPreferences() {
return apogyCommonEMFUIPreferencesEClass;
}
@@ -1772,6 +1782,7 @@
createEOperation(apogyCommonEMFUIFacadeEClass, APOGY_COMMON_EMFUI_FACADE___CONVERT_TO_RGB__RGBA);
createEOperation(apogyCommonEMFUIFacadeEClass, APOGY_COMMON_EMFUI_FACADE___CONVERT_TO_RGBA__RGB);
createEOperation(apogyCommonEMFUIFacadeEClass, APOGY_COMMON_EMFUI_FACADE___GET_DISPLAY_UNITS__ETYPEDELEMENT);
+ createEOperation(apogyCommonEMFUIFacadeEClass, APOGY_COMMON_EMFUI_FACADE___GET_UNIT_AS_STRING__UNIT);
createEOperation(apogyCommonEMFUIFacadeEClass, APOGY_COMMON_EMFUI_FACADE___CONVERT_TO_DISPLAY_UNITS__NUMBER_ETYPEDELEMENT);
createEOperation(apogyCommonEMFUIFacadeEClass, APOGY_COMMON_EMFUI_FACADE___GET_DISPLAY_UNITS__EOPERATION_EOPERATIONEPARAMETERSUNITSPROVIDERPARAMETERS);
createEOperation(apogyCommonEMFUIFacadeEClass, APOGY_COMMON_EMFUI_FACADE___ADD_UNITS_PROVIDER_TO_REGISTRY__ETYPEDELEMENT_UNITSPROVIDER);
@@ -1989,6 +2000,9 @@
op = initEOperation(getApogyCommonEMFUIFacade__GetDisplayUnits__ETypedElement(), theApogyCommonEMFPackage.getUnit(), "getDisplayUnits", 0, 1, !IS_UNIQUE, IS_ORDERED);
addEParameter(op, theEcorePackage.getETypedElement(), "eTypedElement", 0, 1, !IS_UNIQUE, IS_ORDERED);
+ op = initEOperation(getApogyCommonEMFUIFacade__GetUnitAsString__Unit(), theEcorePackage.getEString(), "getUnitAsString", 0, 1, !IS_UNIQUE, IS_ORDERED);
+ addEParameter(op, theApogyCommonEMFPackage.getUnit(), "units", 0, 1, !IS_UNIQUE, IS_ORDERED);
+
op = initEOperation(getApogyCommonEMFUIFacade__ConvertToDisplayUnits__Number_ETypedElement(), theApogyCommonEMFPackage.getNumber(), "convertToDisplayUnits", 0, 1, !IS_UNIQUE, IS_ORDERED);
addEParameter(op, theApogyCommonEMFPackage.getNumber(), "number", 0, 1, !IS_UNIQUE, IS_ORDERED);
addEParameter(op, theEcorePackage.getETypedElement(), "eTypedElement", 0, 1, !IS_UNIQUE, IS_ORDERED);
@@ -2286,6 +2300,12 @@
"documentation", "*\nReturns the {@link Unit} to be used for display for a specified {@link ETypedElement}.\n@param eTypedElement reference to the ETypedElement.\n@return the display {@link Unit}, or the native {@link Unit} if none found."
});
addAnnotation
+ (getApogyCommonEMFUIFacade__GetUnitAsString__Unit(),
+ source,
+ new String[] {
+ "documentation", "*\nConverts a Unit to its string representation.\n@param units The units to convert to string.\n@return The String representation of the unit."
+ });
+ addAnnotation
(getApogyCommonEMFUIFacade__ConvertToDisplayUnits__Number_ETypedElement(),
source,
new String[] {