Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjeremie.tatibouet2016-05-30 15:59:57 +0000
committerGerrit Code Review @ Eclipse.org2016-07-05 08:52:11 +0000
commita74d91a377dc6494fd78c8723ac5db6eebb7c6f5 (patch)
tree57a7be8613c22d92c04259441d3dfa43592fdc31
parent7547d4270efa1485f5dc75d7d7aec165322fa758 (diff)
downloadorg.eclipse.papyrus-a74d91a377dc6494fd78c8723ac5db6eebb7c6f5.tar.gz
org.eclipse.papyrus-a74d91a377dc6494fd78c8723ac5db6eebb7c6f5.tar.xz
org.eclipse.papyrus-a74d91a377dc6494fd78c8723ac5db6eebb7c6f5.zip
[Fix] - Bug 477573 - Invalid string representation generation for an
internal transition having an effect behavior. Change-Id: I93e3c56e4f24ac96987efcc4089989f11093fd49 Signed-off-by: jeremie.tatibouet <jeremie.tatibouet@cea.fr>
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/parsers/TransitionPropertiesParser.java27
1 files changed, 14 insertions, 13 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/parsers/TransitionPropertiesParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/parsers/TransitionPropertiesParser.java
index 4c66c49be6a..ff4ca342925 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/parsers/TransitionPropertiesParser.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/parsers/TransitionPropertiesParser.java
@@ -8,6 +8,7 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
+ * Jeremie TATIBOUET (CEA LIST) - Fix https://bugs.eclipse.org/bugs/show_bug.cgi?id=477573
*/
package org.eclipse.papyrus.uml.diagram.statemachine.custom.parsers;
@@ -153,14 +154,16 @@ public class TransitionPropertiesParser implements IParser, ISemanticParser {
* Get the unformatted registered string value which shall be displayed
*/
protected String getValueString(IAdaptable element, int flags) {
- Object obj = element.getAdapter(EObject.class);
- View view = null;
- if (obj instanceof View) {
- view = (View) obj;
- obj = view.getElement();
+ EObject semanticElement = element.getAdapter(EObject.class);
+ View view = element.getAdapter(View.class);
+ // If it is not possible to adapt directly the element
+ // as an EObject then it might be possible to first retrieve
+ // the view and then obtain the EObject that is behind the view
+ if(semanticElement == null && view != null){
+ semanticElement = view.getElement();
}
- if (obj instanceof Transition) {
- Transition trans = (Transition) obj;
+ if (semanticElement instanceof Transition && view != null) {
+ Transition trans = (Transition) semanticElement;
StringBuilder result = new StringBuilder();
String textForTrigger = getTextForTrigger(view, trans);
if (textForTrigger != null && !EMPTY_STRING.equals(textForTrigger)) {
@@ -169,13 +172,11 @@ public class TransitionPropertiesParser implements IParser, ISemanticParser {
result.append(getTextForGuard(trans));
String textForEffect = getTextForEffect(view, trans);
if (textForEffect != null && !EMPTY_STRING.equals(textForEffect)) {
- if (textForEffect != null && !EMPTY_STRING.equals(textForEffect)) {
- result.append("/"); //$NON-NLS-1$
- if (lineBreakBeforeEffect(view)) {
- result.append("\n"); //$NON-NLS-1$
- }
- result.append(textForEffect);
+ result.append("/"); //$NON-NLS-1$
+ if (lineBreakBeforeEffect(view)) {
+ result.append("\n"); //$NON-NLS-1$
}
+ result.append(textForEffect);
}
return result.toString();
}

Back to the top