| Summary: | PREF_SAVE_WHEN_NO_EDITOR at false doesn't prevent ask for save dirty resources | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Modeling] Sirius | Reporter: | Hugo Marchadour <hugo.marchadour> | ||||
| Component: | Core | Assignee: | Project inbox <sirius.core-inbox> | ||||
| Status: | RESOLVED INVALID | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | laurent.redor | ||||
| Version: | 3.1.0 | Keywords: | triaged | ||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Mac OS X | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
A potential workaround: Provide a custom EditingSession and override promptToSaveOnClose to return ISaveablePart2.NO. Works as design! When the preference PREF_SAVE_WHEN_NO_EDITOR is true, when the last editor is closed, if the user anwers "no" to the question "Do you want to save?", the session is rollback to the last saved state (all the modifications, made since last save, are lost). When the preference PREF_SAVE_WHEN_NO_EDITOR is false, when the last editor is closed, it the user anwers "no" to the question "Do you want to save?", the session remains dirty and a "*" is adding as prefix of the modeling project name in the Model Explorer view. I think you misunderstood the purpose of this preference. Is it right? Ok, it's a bit tricky to understand but it's also a corner case... For me, ask for save is a way to prevent a lost of data but also a boring step... With SiriusUIPreferencesKeys.PREF_RELOAD_ON_LAST_EDITOR_CLOSE = false, I can't lost data so it's overkill in my point of view. In a general case, I think it's a good thing to avoid modal dialogs as much as possible. But Ok for works as design, I've my workaround ;) |
Created attachment 262031 [details] To reproduce, a design with override preferences in plugin activator. According to the org.eclipse.sirius.ui.business.api.preferences.SiriusUIPreferencesKeys javadoc: PREF_SAVE_WHEN_NO_EDITOR Says if session should be saved on a resource change of there is no opened dialect editors. In the provided attachment, you will see that a prompt appears with SiriusUIPreferencesKeys.PREF_SAVE_WHEN_NO_EDITOR = false SiriusUIPreferencesKeys.PREF_RELOAD_ON_LAST_EDITOR_CLOSE = false (Set in plugin Activator) It's perhaps an E4 compatibility API break... I reproduce on Mars anyway: Import the design Run a launch config Create a modeling project with an ecore (one EPackage, one EClass to bind design mappings) Add viewpoint on modeling project Create a representation on EPackage (the editor is dirty) Close the editor -> there is a prompt to save instead of just keep the modeling project dirty