Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 321848

Summary: [StateMachine Diagram] Exception when creating a transition
Product: [Modeling] GMF-Tooling Reporter: Christian Waniek <chris.waniek>
Component: SamplesAssignee: Michael Golubev <borlander>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: borlander
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
proposed patch for this bug borlander: iplog+, borlander: review+

Description Christian Waniek CLA 2010-08-05 06:50:41 EDT
Build Identifier: 

org.eclipse.swt.SWTException: Failed to execute runnable (org.eclipse.core.runtime.AssertionFailedException: assertion failed: )
	at org.eclipse.swt.SWT.error(SWT.java:4083)
	at [...]
Caused by: org.eclipse.core.runtime.AssertionFailedException: assertion failed: 
	at org.eclipse.core.runtime.Assert.isTrue(Assert.java:110)
	at org.eclipse.core.runtime.Assert.isTrue(Assert.java:96)
	at org.eclipse.jface.viewers.TextCellEditor.doSetValue(TextCellEditor.java:228)
	at org.eclipse.gmf.runtime.gef.ui.internal.parts.TextCellEditorEx.doSetValue(TextCellEditorEx.java:86)
	at org.eclipse.jface.viewers.CellEditor.setValue(CellEditor.java:855)
	at org.eclipse.gmf.runtime.gef.ui.internal.parts.TextCellEditorEx.setValueAndProcessEditOccured(TextCellEditorEx.java:73)
	at org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager.setEditText(TextDirectEditManager.java:479)
	at org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager.initCellEditor(TextDirectEditManager.java:340)
	at org.eclipse.gef.tools.DirectEditManager.show(DirectEditManager.java:400)
	at org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager.show(TextDirectEditManager.java:546)
	at org.eclipse.uml2.diagram.statemachine.edit.parts.TransitionNameEditPart.performDirectEdit(TransitionNameEditPart.java:325)
	at org.eclipse.uml2.diagram.statemachine.edit.parts.TransitionNameEditPart$2.run(TransitionNameEditPart.java:365)
	at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.runExclusive(TransactionalEditingDomainImpl.java:328)
	at org.eclipse.uml2.diagram.statemachine.edit.parts.TransitionNameEditPart.performDirectEditRequest(TransitionNameEditPart.java:354)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.performRequest(GraphicalEditPart.java:1119)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart.performDirectEditRequest(ConnectionEditPart.java:1500)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart.performRequest(ConnectionEditPart.java:1470)
	at org.eclipse.gmf.runtime.diagram.ui.tools.ConnectionCreationTool$1.run(ConnectionCreationTool.java:241)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
	... 23 more

This is due to an error in the TransitionParser class:
When determining the String to display in the label the Parser either return a String of trigger, guard and behavior or, if these all are empty, the name of the transition. But since the name of the transition isn't given yet we get a null, which let an assertion in the TextCellEditor fail because we can't set null as a valid value for the text of a label.

After I fixed this I had an update problem for the label of the transition. Every time I changed the value it was written to the model but the diagram still showed the old value.
This is due to the condition which notifications affect the TransitionParser, so he can build a new string to display. I had to add here that also a notification concerning the name of the transition has to be respocted.

Attached you'll find a patch fixing these issues.

Reproducible: Always
Comment 1 Christian Waniek CLA 2010-08-05 06:51:07 EDT
Created attachment 175919 [details]
proposed patch for this bug
Comment 2 Michael Golubev CLA 2010-09-10 07:23:48 EDT
Patch committed, fixed now