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

Bug 323109

Summary: [Class Diagram] error when creating a Decompose relationship
Product: [Modeling] Papyrus Reporter: saadia dhouib <dhouib>
Component: CoreAssignee: Patrick Tessier <Patrick.Tessier>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 0.7.0   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description saadia dhouib CLA 2010-08-19 04:35:21 EDT
Steps to reproduce:
1.	Create Requirement0
2.	Create Requirement1
3.	Create Requirement2
4.	Create a decomposition relationship from Requirement0 to Requirement1
5.	Create a decomposition relationship from Requirement0 to Requirement2
6.	Click on Requirement0
7.	Now you will have this error:

Problems occurred when invoking code from plug-in: "org.eclipse.papyrus.sasheditor".
java.lang.NullPointerException
	at org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(TransactionUtil.java:61)
	at org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest.<init>(DestroyElementRequest.java:118)
	at org.eclipse.papyrus.diagram.clazz.edit.policies.ClassItemSemanticEditPolicy.addDestroyChildNodesCommand(ClassItemSemanticEditPolicy.java:250)
	at org.eclipse.papyrus.diagram.clazz.custom.policies.itemsemantic.CustomClassItemSemanticEditPolicy.getDestroyElementCommandGen(CustomClassItemSemanticEditPolicy.java:228)
	at org.eclipse.papyrus.diagram.clazz.custom.policies.itemsemantic.CustomClassItemSemanticEditPolicy.getDestroyElementCommand(CustomClassItemSemanticEditPolicy.java:243)
	at org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy.getSemanticCommandSwitch(UMLBaseItemSemanticEditPolicy.java:693)
	at org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy.getSemanticCommand(UMLBaseItemSemanticEditPolicy.java:673)
	at org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEditPolicy.getCommand(SemanticEditPolicy.java:69)
	at org.eclipse.papyrus.diagram.clazz.edit.policies.UMLBaseItemSemanticEditPolicy.getCommand(UMLBaseItemSemanticEditPolicy.java:545)
	at org.eclipse.gef.editparts.AbstractEditPart.getCommand(AbstractEditPart.java:501)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.access$1(GraphicalEditPart.java:1)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart$1.run(GraphicalEditPart.java:482)
	at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.runExclusive(TransactionalEditingDomainImpl.java:328)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.getCommand(GraphicalEditPart.java:477)
	at org.eclipse.papyrus.diagram.common.actions.DeleteFromModelAction.getCommand(DeleteFromModelAction.java:113)
	at org.eclipse.gmf.runtime.diagram.ui.actions.DiagramAction.getCommand(DiagramAction.java:161)
	at org.eclipse.gmf.runtime.diagram.ui.actions.DiagramAction.calculateEnabled(DiagramAction.java:124)
	at org.eclipse.gmf.runtime.diagram.ui.actions.DiagramAction.refresh(DiagramAction.java:114)
	at org.eclipse.gmf.runtime.common.ui.action.AbstractActionHandler.selectionChanged(AbstractActionHandler.java:387)
	at org.eclipse.papyrus.sasheditor.internal.eclipsecopy.MultiPageSelectionProvider$1.run(MultiPageSelectionProvider.java:113)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.papyrus.sasheditor.internal.eclipsecopy.MultiPageSelectionProvider.fireEventChange(MultiPageSelectionProvider.java:110)
	at org.eclipse.papyrus.sasheditor.internal.eclipsecopy.MultiPageSelectionProvider.fireSelectionChanged(MultiPageSelectionProvider.java:92)
	at org.eclipse.papyrus.sasheditor.internal.eclipsecopy.MultiPageEditorSite.handleSelectionChanged(MultiPageEditorSite.java:463)
	at org.eclipse.papyrus.sasheditor.internal.eclipsecopy.MultiPageEditorSite$3.selectionChanged(MultiPageEditorSite.java:385)
	at org.eclipse.gmf.runtime.diagram.ui.parts.DiagramGraphicalViewer.flushSelectionEvents(DiagramGraphicalViewer.java:269)
	at org.eclipse.gmf.runtime.diagram.ui.parts.DiagramGraphicalViewer$1.run(DiagramGraphicalViewer.java:247)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4041)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3660)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Comment 1 Yann Tanguy CLA 2010-08-31 10:03:02 EDT
This bug originally relate to Class diagram (then transitively to Requirement diagram) : 

java.lang.NullPointerException
	at org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(TransactionUtil.java:61)
	at org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest.<init>(DestroyElementRequest.java:118)
	at org.eclipse.papyrus.diagram.clazz.edit.policies.ClassItemSemanticEditPolicy.addDestroyChildNodesCommand(ClassItemSemanticEditPolicy.java:250)

AFAIU the problem is caused not when selecting the class but when trying to delete it (the issue on selection probably a side effect). When creating the deletion command, the ClassItemSemanticEditPolicy tries to compose the command with command to delete children. On possible child is ContainmentCircleEditPart, which is associated to Port metamodel type in GMFGen model, but relates to no semantic element in reality... The generated code (in ClassItemSemanticEditPolicy) tries to create a semantic deletion command for ContainmentCircleEditPart which is not related to any semantic element and cause NPE during deletion command execution.
Comment 2 Camille Letavernier CLA 2013-06-25 10:59:05 EDT
I cannot reproduce the issue in the current version; I close this task