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

Bug 193186

Summary: NPE on adding a new element to a compartment with label figures and list layout
Product: [Modeling] GMF-Tooling Reporter: Steffen Becker <steffen.becker>
Component: CoreAssignee: Artem Tikhomirov <tikhomirov.artem>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P3    
Version: 2.0   
Target Milestone: 2.0   
Hardware: PC   
OS: Windows NT   
Whiteboard:

Description Steffen Becker CLA 2007-06-18 15:40:48 EDT
Build ID: 3.3.RC4

Steps To Reproduce:
I have a compartment which shows labels with icons like in the mindmap tutorial. They layout is set to list layout = true in gmfgen. All models validate and it worked in M7. With RC3 and N180607 i get an NPE exception on adding an element to the compartment or on opening old diagram files. 

org.eclipse.core.commands.ExecutionException: While executing the operation, an exception occurred
at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:519)
at org.eclipse.gmf.runtime.diagram.ui.parts.DiagramCommandStack.execute(DiagramCommandStack.java:205)
at org.eclipse.gmf.runtime.diagram.ui.parts.DiagramCommandStack.execute(DiagramCommandStack.java:168)
at org.eclipse.gmf.runtime.diagram.ui.parts.DiagramCommandStack.execute(DiagramCommandStack.java:155)
at org.eclipse.gef.tools.AbstractTool.executeCommand(AbstractTool.java:388)
at org.eclipse.gef.tools.AbstractTool.executeCurrentCommand(AbstractTool.java:400)
at org.eclipse.gmf.runtime.diagram.ui.tools.CreationTool.performCreation(CreationTool.java:133)
at org.eclipse.gef.tools.CreationTool.handleButtonUp(CreationTool.java:178)
at org.eclipse.gef.tools.AbstractTool.mouseUp(AbstractTool.java:1053)
at org.eclipse.gef.EditDomain.mouseUp(EditDomain.java:259)
at org.eclipse.gef.ui.parts.DomainEventDispatcher.dispatchMouseReleased(DomainEventDispatcher.java:374)
at org.eclipse.draw2d.LightweightSystem$EventHandler.mouseUp(LightweightSystem.java:538)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:206)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
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:504)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:443)
at org.eclipse.equinox.launcher.Main.run(Main.java:1169)
at org.eclipse.equinox.launcher.Main.main(Main.java:1144)
Caused by: java.lang.NullPointerException
at org.eclipse.draw2d.Figure.add(Figure.java:146)
at org.eclipse.draw2d.Figure.add(Figure.java:179)
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.addChildVisual(AbstractGraphicalEditPart.java:198)
at org.eclipse.gef.editparts.AbstractEditPart.addChild(AbstractEditPart.java:197)
at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.addChild(GraphicalEditPart.java:1292)
at org.eclipse.gef.editparts.AbstractEditPart.refreshChildren(AbstractEditPart.java:727)
at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.handleNotificationEvent(GraphicalEditPart.java:1437)
at org.eclipse.gmf.runtime.diagram.ui.editparts.ResizableCompartmentEditPart.handleNotificationEvent(ResizableCompartmentEditPart.java:142)
at org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart.handleNotificationEvent(ListCompartmentEditPart.java:150)
at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.notifyChanged(GraphicalEditPart.java:1411)
at org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker.fireNotification(DiagramEventBroker.java:492)
at org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker.resourceSetChanged(DiagramEventBroker.java:393)
at org.eclipse.gmf.runtime.diagram.ui.internal.DiagramEventBrokerThreadSafe.resourceSetChanged(DiagramEventBrokerThreadSafe.java:72)
at org.eclipse.gmf.runtime.diagram.core.DiagramEditingDomainFactory$DiagramEditingDomain.postcommit(DiagramEditingDomainFactory.java:213)
at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.deactivate(TransactionalEditingDomainImpl.java:475)
at org.eclipse.emf.transaction.impl.TransactionImpl.close(TransactionImpl.java:531)
at org.eclipse.emf.transaction.impl.TransactionImpl.commit(TransactionImpl.java:372)
at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:140)
at org.eclipse.gmf.runtime.common.core.command.CompositeCommand.doExecuteWithResult(CompositeCommand.java:406)
at org.eclipse.gmf.runtime.common.core.command.AbstractCommand.execute(AbstractCommand.java:134)
at org.eclipse.gmf.runtime.common.core.command.CompositeCommand.doExecuteWithResult(CompositeCommand.java:406)
at org.eclipse.gmf.runtime.common.core.command.AbstractCommand.execute(AbstractCommand.java:134)
at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:511)
... 37 more


More information:
Might also be related to the two bugs I reported just before this one.
Comment 1 Artem Tikhomirov CLA 2007-06-19 11:43:33 EDT
Looks like there's smth wrong with gmfgraph model.
Comment 2 Steffen Becker CLA 2007-06-19 18:26:39 EDT
You were right, good guess :-) The issue was that the label which should get displayed in the compartment was defined as child of a Rectangle in GMFGraph, something which seemed to be legacy from migrating the models for 1,5 year now. Obviously GMF2 M7 and earlier had no problem with this, but RC2 now has. I consider the GMFGraph as it was before as invalid, right? I would suggest, there should be a constraint that checks that labels which are used in compartments directly are the only child of a figure description - or something similar.
Comment 3 Artem Tikhomirov CLA 2007-06-20 05:35:48 EDT
(In reply to comment #2)
Labels inside compartment are full-fledged nodes, just represented with a simple line of text. Nested figures (e.g. child label inside a rectangle) are not for such usecases, they should be used to denote e.g. predefined position of label or to ensure its instantiation at apropriate moment of time. IOW, figure inside figure represents exact instance, while DiagramElement (and the figure it links) represents *class* of instances, hence, using child figures for this is not appropriate.
Comment 4 Richard Gronback CLA 2008-08-13 13:12:12 EDT
[target cleanup] 2.0 RC was the original target milestone for this bug
Comment 5 Eclipse Webmaster CLA 2010-07-19 22:17:35 EDT
[GMF Restructure] Bug 319140 : product GMF and component
Generation was the original product and component for this bug