Community
Participate
Working Groups
If the execution of a CreateInstance fails during the execution of a tool, for example if the featureName into which to attach the new instance has a typo, Sirius reports the problem but continues executing the rest of the tool's operations, including the sub-tasks of the CreateInstance operation. Except that it executes them in the context of the original element (the one into which the new instance should have been attached) instead of the new instance.
Created attachment 260086 [details] Sample test case to reproduce the issue Steps to reproduce: 1. Import the attached sample project. 2. Open the session in sample.aird, and the diagram inside (there's only one). 3. Select the 'Package' tool from the palette, and apply it to the package 'A' on the diagram. The tool should normally create a sub-package inside 'A' and name if 'NewPackage'. Instead, it renames 'A' itself into 'NewPackage' => KO. Unless the error log is open, nothing indicates to the users that anything went wrong. Here the result is obviously broken, and the user can undo it, but in a more complex tool, the 'CreateInstance' and subsequent operation may be applied to parts of the model which are not directly visible on the diagram, and depending on te operations executed, it may well corrupt the semantic model in a way that is not immediatly visible. Here is the exception which *is* logged in the error log (but most users will probably never see it): org.eclipse.sirius.ecore.extender.business.api.accessor.exception.FeatureNotFoundException: eSubPackages on org.eclipse.emf.ecore.impl.EPackageImpl@1920a0a5 (name: A) (nsURI: null, nsPrefix: null) at org.eclipse.sirius.ecore.extender.business.api.accessor.ModelAccessor.eIsMany(ModelAccessor.java:319) at org.eclipse.sirius.business.internal.helper.task.operations.CreateInstanceTask.execute(CreateInstanceTask.java:88) at org.eclipse.sirius.business.internal.helper.task.ExecuteToolOperationTask.executeTask(ExecuteToolOperationTask.java:127) at org.eclipse.sirius.business.internal.helper.task.ExecuteToolOperationTask.executeTask(ExecuteToolOperationTask.java:138) at org.eclipse.sirius.business.internal.helper.task.ExecuteToolOperationTask.execute(ExecuteToolOperationTask.java:111) at org.eclipse.sirius.business.api.helper.task.TaskExecutor.execute(TaskExecutor.java:64) at org.eclipse.sirius.tools.api.command.SiriusCommand.doExecute(SiriusCommand.java:80) at org.eclipse.emf.transaction.RecordingCommand.execute(RecordingCommand.java:135) at org.eclipse.sirius.diagram.ui.tools.api.command.GMFCommandWrapper.doExecuteWithResult(GMFCommandWrapper.java:102) at org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand.doExecute(AbstractTransactionalCommand.java:247) at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150) at org.eclipse.gmf.runtime.common.core.command.CompositeCommand.doExecuteWithResult(CompositeCommand.java:403) at org.eclipse.gmf.runtime.common.core.command.AbstractCommand.execute(AbstractCommand.java:134) at org.eclipse.sirius.diagram.ui.tools.internal.commands.WrappingCommandIgnoringAffectedFiles.execute(WrappingCommandIgnoringAffectedFiles.java:124) at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:488) at org.eclipse.sirius.diagram.ui.tools.internal.editor.DDiagramCommandStack.execute(DDiagramCommandStack.java:71) at org.eclipse.sirius.diagram.ui.tools.internal.editor.DDiagramCommandStack.execute(DDiagramCommandStack.java:52) at org.eclipse.gmf.runtime.diagram.ui.parts.DiagramCommandStack.execute(DiagramCommandStack.java:156)