diff options
author | Francois Le Fevre - CEA | 2015-10-14 10:07:11 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2015-10-15 10:02:27 +0000 |
commit | 921454fb8472a123fa7bf96d0ccc1cdd7a90b4e3 (patch) | |
tree | 46da4aa407e07c7d7d88f77ea4f178ab47222686 /plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org | |
parent | 0cda80f083938ef07514e8e97633e76ae0a6f3c0 (diff) | |
download | org.eclipse.papyrus-921454fb8472a123fa7bf96d0ccc1cdd7a90b4e3.tar.gz org.eclipse.papyrus-921454fb8472a123fa7bf96d0ccc1cdd7a90b4e3.tar.xz org.eclipse.papyrus-921454fb8472a123fa7bf96d0ccc1cdd7a90b4e3.zip |
479664: [All Diagram] [Stereotype] improve the duration of elements
creation
- made the minimal change because I have no specification to test after
modification
- there is a strange if (withDelimitator) where both if/else use the
EQUAL_SEPARATOR
- moreover if the umlElement.getValue(stereotype, property.getName()),
it seems it should return
Change-Id: I4944d5ba5f099005744b951c2bb0dd207ef8a780
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=479664
Signed-off-by: Francois Le Fevre - CEA <francois.le-fevre@cea.fr>
Diffstat (limited to 'plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org')
-rw-r--r-- | plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/StereotypeUtil.java | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/StereotypeUtil.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/StereotypeUtil.java index abf1032a402..9565f5bdf0b 100644 --- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/StereotypeUtil.java +++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/StereotypeUtil.java @@ -225,7 +225,7 @@ public class StereotypeUtil { return getPropertyValue(property, stereotype, umlElement, separator, false); } } - + public static String displayPropertyValueOnly(Stereotype stereotype, Property property, Element umlElement, String separator) { org.eclipse.uml2.uml.Type propType = property.getType(); @@ -467,7 +467,7 @@ public class StereotypeUtil { } return out; } - + private static String getPropertyValueOnlyForEnumerationType(Property property, Stereotype stereotype, Element umlElement, final String PROPERTY_VALUE_SEPARATOR) { String out = ""; if ((property.getUpper() == 1) && (umlElement.getValue(stereotype, property.getName()) != null)) { @@ -545,7 +545,7 @@ public class StereotypeUtil { } return out; } - + private static String getPropertyValueOnlyForMetaclassType(Property property, Stereotype stereotype, Element umlElement, final String PROPERTY_VALUE_SEPARATOR, boolean withQualifiedName) { String out = ""; @@ -638,7 +638,7 @@ public class StereotypeUtil { } return out; } - + private static String getPropertyValueOnlyForStereotypeType(Property property, Stereotype stereotype, Element umlElement, final String PROPERTY_VALUE_SEPARATOR, boolean withQualifiedName) { String out = ""; if ((property.getUpper() == 1) && (umlElement.getValue(stereotype, property.getName()) != null)) { @@ -696,10 +696,16 @@ public class StereotypeUtil { */ private static String getPropertyValue(Property property, Stereotype stereotype, Element umlElement, final String PROPERTY_VALUE_SEPARATOR, boolean withDelimitator) { String out = ""; - if ((property.getLower() != 0) || umlElement.getValue(stereotype, property.getName()) != null) { - if (property.getDefaultValue() != null || umlElement.getValue(stereotype, property.getName()) != null) { + Object valueObject = umlElement.getValue(stereotype, property.getName()); + + if(valueObject==null){ + return out = property.getName() + PROPERTY_VALUE_SEPARATOR; + } + + if ((property.getLower() != 0)) { + if (property.getDefaultValue() != null) { if (withDelimitator) { - String value = "" + umlElement.getValue(stereotype, property.getName()); + String value = "" + valueObject; out = property.getName() + EQUAL_SEPARATOR + value + PROPERTY_VALUE_SEPARATOR; if (value.contains("[")) { out = out.replace("[", "[" + QUOTE); @@ -709,11 +715,11 @@ public class StereotypeUtil { out = property.getName() + EQUAL_SEPARATOR + QUOTE + value + QUOTE + PROPERTY_VALUE_SEPARATOR; } } else { - if (umlElement.getValue(stereotype, property.getName()) instanceof EObject) { + if (valueObject instanceof EObject) { ILabelProvider labelProvider = getLabelProvider(property); - return out = property.getName() + EQUAL_SEPARATOR + labelProvider.getText(umlElement.getValue(stereotype, property.getName())) + PROPERTY_VALUE_SEPARATOR; + return out = property.getName() + EQUAL_SEPARATOR + labelProvider.getText(valueObject) + PROPERTY_VALUE_SEPARATOR; } else { - out = property.getName() + EQUAL_SEPARATOR + umlElement.getValue(stereotype, property.getName()) + PROPERTY_VALUE_SEPARATOR; + out = property.getName() + EQUAL_SEPARATOR + valueObject + PROPERTY_VALUE_SEPARATOR; } } } else { @@ -725,7 +731,7 @@ public class StereotypeUtil { } return out; } - + private static String getPropertyValueOnly(Property property, Stereotype stereotype, Element umlElement, final String PROPERTY_VALUE_SEPARATOR, boolean withDelimitator) { String out = ""; if ((property.getLower() != 0) || umlElement.getValue(stereotype, property.getName()) != null) { |