Community
Participate
Working Groups
In a tree Representation use "Create" Tool in this a "Create Instance" for this a "Open Dialog" Operation. The Open Dialog ends up with NPE. In Debug var task in the ModelOperationToTask class on line 169 is null on second call of this class. !ENTRY org.eclipse.ui 4 0 2017-08-23 10:25:26.451 !MESSAGE Unhandled event loop exception !STACK 0 java.lang.NullPointerException at org.eclipse.sirius.business.internal.helper.task.ModelOperationToTask.createTask(ModelOperationToTask.java:169) at org.eclipse.sirius.business.internal.helper.task.ExecuteToolOperationTask.createTask(ExecuteToolOperationTask.java:168) at org.eclipse.sirius.business.internal.helper.task.ExecuteToolOperationTask.createChildrenTasks(ExecuteToolOperationTask.java:149) at org.eclipse.sirius.business.internal.helper.task.ExecuteToolOperationTask.<init>(ExecuteToolOperationTask.java:98) at org.eclipse.sirius.business.api.helper.task.TaskHelper.buildTaskFromModelOperation(TaskHelper.java:105) at org.eclipse.sirius.tree.tools.internal.command.TreeCommandFactory.buildCommandFromModelOfTool(TreeCommandFactory.java:246) at org.eclipse.sirius.tree.tools.internal.command.TreeCommandFactory.buildCreateLineCommandFromTool(TreeCommandFactory.java:280) at org.eclipse.sirius.tree.ui.tools.internal.editor.actions.CreateToolItemAction.run(CreateToolItemAction.java:133) at org.eclipse.jface.action.Action.runWithEvent(Action.java:473) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:565) at org.eclipse.jface.action.ActionContributionItem.lambda$4(ActionContributionItem.java:397) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5252) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1348) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4522) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4107) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1155) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1044) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153) at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:680) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148) at com.bug.rcp.Application.start(Application.java:18) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590) at org.eclipse.equinox.launcher.Main.run(Main.java:1499) at org.eclipse.equinox.launcher.Main.main(Main.java:1472)
Hi, from the look of the stack, one possible explanation would be that the org.eclipse.sirius.ui.properties is not present in the runtime context (where you actually run your modeler). The "Open Dialog" and "Open Wizard" operations are not actually contributed by the core of Sirius, but by the the (optional) EEF-based properties view support feature. It's possible that you have this feature installed in your development environment (it must be because you were able to create an "Open Dialog" operation), but that it is not available in your runtime. If this explanation is correct, you can probably fix the issue by having an explicit dependency from your modeler plug-in to org.eclipse.sirius.ui.properties. Can you confirm? We'll need to document this (https://www.eclipse.org/sirius/doc/specifier/general/Model_Operations.html#dialogandwizard does not mention it), and make the code more robust to avoid the NPE anyway.
This issue is effectively linked to that the plug-in that contains the Dialog declaration is not present in the runtime. Scenario to reproduce: * launch a runtime which have org.eclipse.sirius.ui.properties and oes.ui.properties.ext.widgets.reference * import both vsp and Sirius modeling project(attached with this bug) into the runtime * open testOpenDialogOp project and "my_diag1" diagram * use create_class tool and click on diagram -> a dialog box is opened * close dialog -> a class has been created * Now, relaunch the runtime but without any of oes.ui.properties.xxx plug-in (change launch config and uncheck plug-in) * open testOpenDialogOp project and "my_diag1" diagram * use create_class tool and click on diagram -> NPE
Created attachment 269995 [details] vsp and testOpenDialogOp modeling project
(In reply to Pierre-Charles David from comment #1) > Hi, > > from the look of the stack, one possible explanation would be that the > org.eclipse.sirius.ui.properties is not present in the runtime context > (where you actually run your modeler). The "Open Dialog" and "Open Wizard" > operations are not actually contributed by the core of Sirius, but by the > the (optional) EEF-based properties view support feature. It's possible that > you have this feature installed in your development environment (it must be > because you were able to create an "Open Dialog" operation), but that it is > not available in your runtime. If this explanation is correct, you can > probably fix the issue by having an explicit dependency from your modeler > plug-in to org.eclipse.sirius.ui.properties. > > Can you confirm? > > We'll need to document this > (https://www.eclipse.org/sirius/doc/specifier/general/Model_Operations. > html#dialogandwizard does not mention it), and make the code more robust to > avoid the NPE anyway. Yes, I can confirm that this was fixing the problem.
(In reply to M V from comment #4) > (In reply to Pierre-Charles David from comment #1) > > Hi, > > > > from the look of the stack, one possible explanation would be that the > > org.eclipse.sirius.ui.properties is not present in the runtime context > > (where you actually run your modeler). The "Open Dialog" and "Open Wizard" > > operations are not actually contributed by the core of Sirius, but by the > > the (optional) EEF-based properties view support feature. It's possible that > > you have this feature installed in your development environment (it must be > > because you were able to create an "Open Dialog" operation), but that it is > > not available in your runtime. If this explanation is correct, you can > > probably fix the issue by having an explicit dependency from your modeler > > plug-in to org.eclipse.sirius.ui.properties. > > > > Can you confirm? > > > > We'll need to document this > > (https://www.eclipse.org/sirius/doc/specifier/general/Model_Operations. > > html#dialogandwizard does not mention it), and make the code more robust to > > avoid the NPE anyway. > > Yes, I can confirm that this was fixing the problem. Thanks for the confirmation. We'll improve the documentation and update the code to provide a more useful error message if it occurs at runtime.
New Gerrit change created: https://git.eclipse.org/r/104969
New Gerrit change created: https://git.eclipse.org/r/105195
Gerrit change https://git.eclipse.org/r/104969 was merged to [master]. Commit: http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=3d40d8a67cd9fda2c99f8f90d21fec2d92c6cddb
Will be marked as fixed once the Junit test (that fails on hudson for now) will be merged.
Gerrit change https://git.eclipse.org/r/105195 was merged to [master]. Commit: http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=0d59a7a926dc90fc3c49634b7079dd33b03a4e7c
Available in Sirius 5.1.0, see https://wiki.eclipse.org/Sirius/5.1.0.