Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorashatilov2015-01-12 13:28:27 +0000
committerAlexey Shatilov2015-02-05 18:06:00 +0000
commitcc8b9de4b1daac6dd7216bcbf4aa8d2eb92fd0b6 (patch)
treedccc59ae97d9b46005aba64c9794c7315cc3b0c0 /plugins/uml/tools
parentdea5cbf0bbce35bc7ea90c554d0aecfc70aeb384 (diff)
downloadorg.eclipse.papyrus-cc8b9de4b1daac6dd7216bcbf4aa8d2eb92fd0b6.tar.gz
org.eclipse.papyrus-cc8b9de4b1daac6dd7216bcbf4aa8d2eb92fd0b6.tar.xz
org.eclipse.papyrus-cc8b9de4b1daac6dd7216bcbf4aa8d2eb92fd0b6.zip
Bug 457049 - [All Diagram] Void floating label shall not be shown as
"null" Change-Id: I37a7407d618ef3dda114e759c7ee63019792d125 Signed-off-by: ashatilov <montages.as@gmail.com>
Diffstat (limited to 'plugins/uml/tools')
-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