Community
Participate
Working Groups
When in a text widget, the update fails (service throwing exception or transaction rollback), then the text of widget is not restored to model content. This also cause refresh issues aterward when another fiel is edited. This come from the chain of interpretation when the widget triggers a model update. Update is ordered by following method: org.eclipse.eef.ide.ui.internal.widgets.EEFTextLifecycleManager#updateValue(boolean) This method expected a IStatus != OK on error which is not provided by Sirius interpretation. When enable such error, following method must be changed: - in org.eclipse.sirius.properties.core.internal.SiriusToolServices #executeOperation(SiriusInputDescriptor, EObject, String): instead of creating and running a SiriusCommand (useless as we are already in a transaction) perform, ```java List<ICommandTask> toPerform = Collections.singletonList(task); if (TaskExecutor.canExecute(toPerform)) { TaskExecutor.execute(toPerform); } ``` - in org.eclipse.sirius.ui.properties.internal.TransactionalEditingDomainContextAdapter #performModelChange(Runnable) change the log listener into a transaction call back like this: ```java ted.getCommandStack().execute(new RecordingCommand(ted) { @Override protected void doExecute() { InternalTransaction transaction = ((InternalTransactionalEditingDomain) ted).getActiveTransaction(); resultProvider.set(() -> transaction.getStatus()); effect.run(); } }); return resultProvider.get() == null ? new Status(IStatus.ERROR, "org.eclipse.sirius.ui.properties", "Transaction fails for properties command") : resultProvider.get().get(); ``` User using Sirius 6.3.x can achieve the same behavior by: - creating a custom TextDescriptionConverter -- change the call to SiriusToolServices into a custom service. -- registered in org.eclipse.sirius.properties.core.descriptionConverter extension point -- declaring custom service in odesign. - extending TransactionalEditingDomainContextAdapter -- change how perfomChange(...) behaves -- registered in org.eclipse.sirius.ui.properties.contextAdapterProvider extension point
amend on TransactionalEditingDomainContextAdapter full code is: ``` AtomicReference<Supplier<IStatus>> resultProvider = new AtomicReference<>(); ted.getCommandStack().execute(new RecordingCommand(ted) { @Override protected void doExecute() { InternalTransaction transaction = ((InternalTransactionalEditingDomain) ted) .getActiveTransaction(); resultProvider.set(() -> transaction.getStatus()); effect.run(); } }); return resultProvider.get() == null ? new Status(IStatus.ERROR, "org.eclipse.sirius.ui.properties", "Transaction fails for properties command") : resultProvider.get().get(); ```