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

Bug 486828

Summary: UIState image is not generated and causes NPE in Sample Reflective editor
Product: [Modeling] Sirius Reporter: Maxime Porhel <maxime.porhel>
Component: CoreAssignee: Laurent Redor <laurent.redor>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: laurent.redor, pierre-charles.david
Version: unspecifiedKeywords: triaged
Target Milestone: 4.0.0M6   
Hardware: PC   
OS: Mac OS X   
See Also: https://git.eclipse.org/r/65471
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=e85a9ea51011e9fa0bf25f81afc2769e4f7b18c3
Whiteboard:

Description Maxime Porhel CLA 2016-01-29 09:42:35 EST
I get an NPE in when I open an aird file (for debugging reason) with the Sample Reflective Ecore Model Editor on DRepresentation objects. 

This is due to the create child action which looks for new child descriptors and build the corresponding menus. 

It seems that we have two inconsistent properties in viewpoint.genmodel: 
 . DRepresentation.uiState has edit.CreateChild = true
 . UIState has edit.Image = false 


Steps to reproduce: 
 . open any aird containing representations with the Sample Reflective Ecore Model Editor
 . expand it until you select a DRepresentation

You should see the following NPE: 

java.lang.NullPointerException
	at org.eclipse.emf.edit.ui.provider.ComposedImageDescriptor.getSize(ExtendedImageRegistry.java:406)
	at org.eclipse.jface.resource.CompositeImageDescriptor.getImageData(CompositeImageDescriptor.java:164)
	at org.eclipse.jface.resource.ImageDescriptor.createImage(ImageDescriptor.java:270)
	at org.eclipse.jface.resource.ImageDescriptor.createImage(ImageDescriptor.java:224)
	at org.eclipse.jface.resource.ImageDescriptor.createImage(ImageDescriptor.java:202)
	at org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry.getImage(ExtendedImageRegistry.java:185)
	at org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry.getImageDescriptor(ExtendedImageRegistry.java:205)
	at org.eclipse.emf.edit.ui.action.StaticSelectionCommandAction.objectToImageDescriptor(StaticSelectionCommandAction.java:245)
	at org.eclipse.emf.edit.ui.action.StaticSelectionCommandAction.configureAction(StaticSelectionCommandAction.java:173)
	at org.eclipse.emf.edit.ui.action.CreateChildAction.<init>(CreateChildAction.java:47)
	at org.eclipse.emf.edit.ui.action.CreateChildAction.<init>(CreateChildAction.java:57)
	at org.eclipse.emf.ecore.presentation.EcoreActionBarContributor.generateCreateChildActions(EcoreActionBarContributor.java:826)



java.lang.NullPointerException
	at org.eclipse.emf.edit.ui.provider.ComposedImageDescriptor.getSize(ExtendedImageRegistry.java:406)
	at org.eclipse.jface.resource.CompositeImageDescriptor.getImageData(CompositeImageDescriptor.java:164)
	at org.eclipse.jface.resource.ImageDescriptor.createImage(ImageDescriptor.java:270)
	at org.eclipse.jface.resource.ImageDescriptor.createImage(ImageDescriptor.java:224)
	at org.eclipse.jface.resource.ImageDescriptor.createImage(ImageDescriptor.java:202)
	at org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry.getImage(ExtendedImageRegistry.java:185)
	at org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry.getImageDescriptor(ExtendedImageRegistry.java:205)
	at org.eclipse.emf.edit.ui.action.StaticSelectionCommandAction.objectToImageDescriptor(StaticSelectionCommandAction.java:245)
	at org.eclipse.emf.edit.ui.action.StaticSelectionCommandAction.configureAction(StaticSelectionCommandAction.java:173)
	at org.eclipse.emf.edit.ui.action.CreateChildAction.<init>(CreateChildAction.java:47)
	at org.eclipse.emf.edit.ui.action.CreateChildAction.<init>(CreateChildAction.java:57)
	at org.eclipse.emf.ecore.presentation.EcoreActionBarContributor.generateCreateChildActions(EcoreActionBarContributor.java:826)
	at org.eclipse.emf.ecore.presentation.EcoreActionBarContributor.selectionChangedGen(EcoreActionBarContributor.java:783)
	at org.eclipse.emf.ecore.presentation.EcoreActionBarContributor.selectionChanged(EcoreActionBarContributor.java:801)
	at org.eclipse.emf.ecore.presentation.EcoreActionBarContributor.setActiveEditorGen(EcoreActionBarContributor.java:723)




java.lang.NullPointerException
	at org.eclipse.emf.edit.ui.provider.ComposedImageDescriptor.getSize(ExtendedImageRegistry.java:406)
	at org.eclipse.jface.resource.CompositeImageDescriptor.getImageData(CompositeImageDescriptor.java:164)
	at org.eclipse.jface.resource.ImageDescriptor.createImage(ImageDescriptor.java:270)
	at org.eclipse.jface.resource.ImageDescriptor.createImage(ImageDescriptor.java:224)
	at org.eclipse.jface.resource.ImageDescriptor.createImage(ImageDescriptor.java:202)
	at org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry.getImage(ExtendedImageRegistry.java:185)
	at org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry.getImageDescriptor(ExtendedImageRegistry.java:205)
	at org.eclipse.emf.edit.ui.action.StaticSelectionCommandAction.objectToImageDescriptor(StaticSelectionCommandAction.java:245)
	at org.eclipse.emf.edit.ui.action.StaticSelectionCommandAction.configureAction(StaticSelectionCommandAction.java:173)
	at org.eclipse.emf.edit.ui.action.CreateChildAction.<init>(CreateChildAction.java:47)
	at org.eclipse.emf.edit.ui.action.CreateChildAction.<init>(CreateChildAction.java:57)
	at org.eclipse.emf.ecore.presentation.EcoreActionBarContributor.generateCreateChildActions(EcoreActionBarContributor.java:826)
	at org.eclipse.emf.ecore.presentation.EcoreActionBarContributor.selectionChangedGen(EcoreActionBarContributor.java:783)
	at org.eclipse.emf.ecore.presentation.EcoreActionBarContributor.selectionChanged(EcoreActionBarContributor.java:801)
	at org.eclipse.emf.ecore.presentation.EcoreEditor.setSelection(EcoreEditor.java:1901)
	at org.eclipse.emf.ecore.presentation.EcoreEditor$7.selectionChanged(EcoreEditor.java:1059)
	at org.eclipse.jface.viewers.Viewer$2.run(Viewer.java:163)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:50)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:173)
	at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:160)
	at org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:2197)
Comment 1 Eclipse Genie CLA 2016-01-29 09:56:22 EST
New Gerrit change created: https://git.eclipse.org/r/65471
Comment 2 Maxime Porhel CLA 2016-01-29 09:58:17 EST
The provided path 
 . changes the UIState.edit.Image value to true in viewpoint.genmodel 
 . contains the impact on the generated code and the generated diamond image
Comment 4 Maxime Porhel CLA 2016-02-09 04:06:15 EST
Proposed correction has been merged on master.
Comment 5 Laurent Redor CLA 2016-05-23 11:20:13 EDT
Verified on Sirius 4.0.0 RC1 (4.0.0.201605180923)

I verified this bug by adding explicitely a UIState as child of a DRepresentation in the "Sample Reflective Ecore Model Editor".
Comment 6 Pierre-Charles David CLA 2016-06-24 08:03:48 EDT
Available in Sirius 4.0.0.