Bug 492516 - Canonical refresh done in DiagramDialectUIServices.export might lead to IllegealStateExceptions
Summary: Canonical refresh done in DiagramDialectUIServices.export might lead to Illeg...
Status: NEW
Alias: None
Product: Sirius
Classification: Modeling
Component: Diagram (show other bugs)
Version: 3.1.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on: 485324 492517
Blocks:
  Show dependency tree
 
Reported: 2016-04-27 04:07 EDT by Maxime Porhel CLA
Modified: 2016-04-27 04:17 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maxime Porhel CLA 2016-04-27 04:07:41 EDT
+++ This bug was initially created as a clone of Bug #485324 +++

A popup "Cannot modify resource set without a write transaction" is displayed when exporting as image for the diagram in attachment.

Scenario to reproduce :
1. Import projects from the attached archive
2. Launch a runtime from them
3. Import AQLBug.test in this second runtime
4. Open the diagram
5. Export as diagram using the action from tabbar => KO the popup appears

The popup appears because of IllegalStateException which is thrown from TransactionChangeRecorder.assertWriting() because DiagramDialectUIServices
.synchronizeDiagram() is not called in a EMF Command.
In addition non GMF model change is done by DDiagramCanonicalSynchronizer, it is only a touch notification from RegionContainerUpdateLayoutOperation which could be avoided.
Comment 1 Maxime Porhel CLA 2016-04-27 04:16:49 EDT
DiagramDialectUIServices.export does a canonical refresh before creating the offscreen diagram edit part to do the export. 

This canonical refresh is not safe as it is executed out of a transaction (no precommit calls, if the model is modified "cannot write resource without transaction" ISE, model modified but opened editor not refresh by postcommits, ...)
See coments on https://git.eclipse.org/r/#/c/63697/1

The possibility to execute the canonical refresh in a transaction then leads to several questions: 
. who create the transaction ? The diagramDialectUIServices.export must be consistent with the others dialects and services of DialectUIServices
. can the export add a command on the undo stack, what is the meaning of this undo: also delete the created file(s) ?
. if we do a canonical refresh, why do we not do a full refresh (and same question for table and tree) , or should be detect that there is a problem and ask the user to refresh its representation ? 


Note that the action is used for the export from the aird contextual menu and from the tabbar.