Community
Participate
Working Groups
Step to reproduce: * Create a non .ecore model (uml or any other model) * Open with the Sirius Ecore Editor * An NPE occurs: java.lang.NullPointerException at org.eclipse.sirius.business.api.query.DRepresentationQuery.getAnnotation(DRepresentationQuery.java:73) at org.eclipse.sirius.diagram.tools.internal.graphical.edit.DiagramCreationUtil.findAssociatedGMFDiagram(DiagramCreationUtil.java:52) at org.eclipse.sirius.diagram.business.internal.dialect.DiagramDialectServices.createAndStoreGMFDiagram(DiagramDialectServices.java:195) at org.eclipse.sirius.diagram.business.internal.command.CreateAndStoreGMFDiagramCommand.doExecute(CreateAndStoreGMFDiagramCommand.java:48) at org.eclipse.emf.transaction.RecordingCommand.execute(RecordingCommand.java:135) ... at fr.obeo.dsl.viewpoint.collab.api.editingdomain.NonDirtyingCapableWorkspaceCommandStack.doExecute(NonDirtyingCapableWorkspaceCommandStack.java:65) at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:165) at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:219) at org.eclipse.sirius.diagram.tools.api.editor.AbstractSpecificDDiagramEditor$1.createGMFDiagram(AbstractSpecificDDiagramEditor.java:69) at org.eclipse.sirius.diagram.tools.api.editor.AbstractSpecificDDiagramEditor$1.getNewEditorInputURI(AbstractSpecificDDiagramEditor.java:56) at org.eclipse.sirius.ui.business.api.editor.SpecificEditorInputTranformer.createNewEditorInput(SpecificEditorInputTranformer.java:270) at org.eclipse.sirius.ui.business.api.editor.SpecificEditorInputTranformer.transformInput(SpecificEditorInputTranformer.java:166) at org.eclipse.sirius.diagram.tools.api.editor.AbstractSpecificDDiagramEditor.init(AbstractSpecificDDiagramEditor.java:100) at org.eclipse.ui.internal.EditorManager.createSite(EditorManager.java:798) I did not set the component attribute of the bug to Diagram as it should be tested on Diagram, Table other implementations of SpecificEditor if exists. The Sirius Ecore Editor is a specifc editor provided by the org.eclipse.sirius.pim.ecore.design, it is designed to open an 'Entities' diagram on the root EPackage of an ecore file. The SpecificInputTransformer could detect thaht no representation was created and trigger a specific exception to warn the suer that his model is not compatible with the current specific editor.
When creating an uml model and trying to open it with Sirius Ecore Editor, I have not the same problem (see stack trace [1]), but there is also a problem. [1]: java.lang.IllegalArgumentException: A representation file cannot be added as semantic resource. at org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl.doAddSemanticResource(DAnalysisSessionImpl.java:781) at org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl.addSemanticResource(DAnalysisSessionImpl.java:682) at org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl.addSemanticResource(DAnalysisSessionImpl.java:753) at org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl.addSemanticResource(DAnalysisSessionImpl.java:766) at org.eclipse.sirius.tools.api.command.semantic.AddSemanticResourceCommand.doExecute(AddSemanticResourceCommand.java:82) at org.eclipse.emf.transaction.RecordingCommand.execute(RecordingCommand.java:135) at org.eclipse.emf.workspace.EMFCommandOperation.doExecute(EMFCommandOperation.java:119) at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150) at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:513) at org.eclipse.emf.workspace.impl.WorkspaceCommandStackImpl.doExecute(WorkspaceCommandStackImpl.java:208) at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:165) at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:219) at org.eclipse.sirius.ui.business.api.editor.SpecificEditorInputTranformer.createSessionAndRepresentation(SpecificEditorInputTranformer.java:202) at org.eclipse.sirius.ui.business.api.editor.SpecificEditorInputTranformer.transformInput(SpecificEditorInputTranformer.java:165) at org.eclipse.sirius.diagram.tools.api.editor.AbstractSpecificDDiagramEditor.init(AbstractSpecificDDiagramEditor.java:100) at org.eclipse.ui.internal.EditorReference.initialize(EditorReference.java:359) at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:306) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56) at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:877) at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:857) at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:119) at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:333) at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:254) at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162) at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:102) at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:71) at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:53) at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:129) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:949) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:633) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:735) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$2(PartRenderingEngine.java:706) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$7.run(PartRenderingEngine.java:700) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:685) at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.showTab(StackRenderer.java:1096) at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer$1.handleEvent(LazyStackRenderer.java:66) at org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java:41) at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:180) at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150) at org.eclipse.swt.widgets.Display.syncExec(Display.java:4491) at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:205) at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:38) at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:197) at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:197) at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148) at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135) at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78) at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39) at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:80) at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:58) at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374) at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElement(ElementContainerImpl.java:171) at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.showElementInWindow(ModelServiceImpl.java:576) at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.bringToTop(ModelServiceImpl.java:543) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.delegateBringToTop(PartServiceImpl.java:610) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.bringToTop(PartServiceImpl.java:322) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.showPart(PartServiceImpl.java:1034) at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:3112) at org.eclipse.ui.internal.WorkbenchPage.access$21(WorkbenchPage.java:3034) at org.eclipse.ui.internal.WorkbenchPage$8.run(WorkbenchPage.java:3016) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3012) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2976) at org.eclipse.ui.actions.OpenWithMenu.openEditor(OpenWithMenu.java:338) at org.eclipse.ui.actions.OpenWithMenu$3.handleEvent(OpenWithMenu.java:216) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1392) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3742) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3363) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124) 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:354) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591) at org.eclipse.equinox.launcher.Main.run(Main.java:1450) at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
On a 'non-ecore' model, the SpecificEditorInputTransformer is not able to create the expected representation (here a package entities diagram from the viewpoint Design). See org.eclipse.sirius.ui.business.api.editor.SpecificEditorInputTranformer.transformInput(IEditorInput, ISelection, boolean), line 165, the created representation is null. So we cannot create the editor input in return createNewEditorInput(representation, semanticModelPath); We should throw and log an error to indicate the user we fail to create the representation as its model does not be supported by the chosen specific editor.