Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorashatilov2015-02-09 05:38:47 -0500
committerashatilov2015-02-09 05:38:47 -0500
commitea7caf632e235f27d6bb4b700e3055349a2c3837 (patch)
tree50d3b6a6e64861529b4eebad3c482b2274308922
parent3e6df7e2972cceb33570163abc94fcab42c16425 (diff)
downloadorg.eclipse.papyrus-ea7caf632e235f27d6bb4b700e3055349a2c3837.tar.gz
org.eclipse.papyrus-ea7caf632e235f27d6bb4b700e3055349a2c3837.tar.xz
org.eclipse.papyrus-ea7caf632e235f27d6bb4b700e3055349a2c3837.zip
Bug 457049 - [All Diagram] Void floating label shall not be shown as
"null" cherry picked from: I37a7407d618ef3dda114e759c7ee63019792d125 Change-Id: I7b476baba726ca0924fce9267b71ff792a311920 Signed-off-by: ashatilov <montages.as@gmail.com>
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/PropertyUtil.java30
1 files changed, 17 insertions, 13 deletions
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/PropertyUtil.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/PropertyUtil.java
index 66bd872e81d..7faaf3494fb 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/PropertyUtil.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/PropertyUtil.java
@@ -166,18 +166,18 @@ public class PropertyUtil {
StringBuffer buffer = new StringBuffer();
// visibility
buffer.append(" ");
- buffer.append(NamedElementUtil.getVisibilityAsSign(property));
+ buffer.append(getNonNullString(NamedElementUtil.getVisibilityAsSign(property)));
// derived property
- buffer.append(getDerived(property));
+ buffer.append(getNonNullString(getDerived(property)));
// name
buffer.append(" ");
- buffer.append(getName(property));
+ buffer.append(getNonNullString(getName(property)));
// type
if (property.getType() != null) {
- buffer.append(" : " + property.getType().getName());
+ buffer.append(" : " + getNonNullString(property.getType().getName()));
} else {
buffer.append(" : " + TypeUtil.UNDEFINED_TYPE_NAME);
}
@@ -185,17 +185,17 @@ public class PropertyUtil {
// multiplicity -> do not display [1]
String multiplicity = MultiplicityElementUtil.getMultiplicityAsString(property);
if (!multiplicity.trim().equals("[1]")) {
- buffer.append(multiplicity);
+ buffer.append(getNonNullString(multiplicity));
}
// default value
if (property.getDefaultValue() != null) {
buffer.append(" = ");
- buffer.append(ValueSpecificationUtil.getSpecificationValue(property.getDefaultValue()));
+ buffer.append(getNonNullString(ValueSpecificationUtil.getSpecificationValue(property.getDefaultValue())));
}
// property modifiers
- buffer.append(PropertyUtil.getModifiersAsString(property, false));
+ buffer.append(getNonNullString(PropertyUtil.getModifiersAsString(property, false)));
return buffer.toString();
}
@@ -208,6 +208,10 @@ public class PropertyUtil {
}
}
+ private static String getNonNullString(String source) {
+ return source == null ? "" : source;
+ }
+
/**
* return the custom label of the property, given UML2 specification and a custom style.
*
@@ -222,7 +226,7 @@ public class PropertyUtil {
buffer.append(" ");
if (style.contains(ICustomAppearance.DISP_VISIBILITY)) {
- buffer.append(NamedElementUtil.getVisibilityAsSign(property));
+ buffer.append(getNonNullString(NamedElementUtil.getVisibilityAsSign(property)));
}
// derived property
@@ -234,13 +238,13 @@ public class PropertyUtil {
// name
if (style.contains(ICustomAppearance.DISP_NAME)) {
buffer.append(" ");
- buffer.append(property.getName());
+ buffer.append(getNonNullString(property.getName()));
}
if (style.contains(ICustomAppearance.DISP_TYPE)) {
// type
if (property.getType() != null) {
- buffer.append(": " + property.getType().getName());
+ buffer.append(": " + getNonNullString(property.getType().getName()));
} else {
buffer.append(": " + TypeUtil.UNDEFINED_TYPE_NAME);
}
@@ -248,7 +252,7 @@ public class PropertyUtil {
if (style.contains(ICustomAppearance.DISP_MULTIPLICITY)) {
// multiplicity -> do not display [1]
- String multiplicity = MultiplicityElementUtil.getMultiplicityAsString(property);
+ String multiplicity = getNonNullString(MultiplicityElementUtil.getMultiplicityAsString(property));
buffer.append(multiplicity);
}
@@ -256,14 +260,14 @@ public class PropertyUtil {
// default value
if (property.getDefaultValue() != null) {
buffer.append(" = ");
- buffer.append(ValueSpecificationUtil.getSpecificationValue(property.getDefaultValue()));
+ buffer.append(getNonNullString(ValueSpecificationUtil.getSpecificationValue(property.getDefaultValue())));
}
}
if (style.contains(ICustomAppearance.DISP_MODIFIERS)) {
boolean multiLine = style.contains(ICustomAppearance.DISP_MULTI_LINE);
// property modifiers
- String modifiers = PropertyUtil.getModifiersAsString(property, multiLine);
+ String modifiers = getNonNullString(PropertyUtil.getModifiersAsString(property, multiLine));
if (!modifiers.equals("")) {
if (multiLine) {
buffer.append("\n");

Back to the top