Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 434983

Summary: [SashEditor] Provide a mechanism to move the editor layout model to either the *.di (Legacy) or hidden *.sash resource (1.0)
Product: [Modeling] Papyrus Reporter: Camille Letavernier <cletavernier>
Component: CoreAssignee: Christian Damus <give.a.damus>
Status: RESOLVED FIXED QA Contact:
Severity: minor    
Priority: P2 CC: papyrus-bugs
Version: 1.0.0   
Target Milestone: M4   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/61591
https://git.eclipse.org/c/papyrus/org.eclipse.papyrus.git/commit/?id=09d56589be181c7088207733d1a54814eb54e47e
https://git.eclipse.org/c/papyrus/org.eclipse.papyrus.git/commit/?id=b8081f2a0b4fc7bf52ff060f34da21a5d9d215fa
Whiteboard:
Bug Depends on:    
Bug Blocks: 469188    

Description Camille Letavernier CLA 2014-05-15 12:10:28 EDT
In Bug 400809, a mechanism to store the editor layout model outside the workspace has been implemented

Legacy models (< 1.0) store the layout model in the *.di resource, whereas current models (>= 1.0) store it into a hidden *.sash resource (In the user preferences space)

There is no way to switch from one mode to the other. We should implement this migration

See also Comment 1 and Comment 2 from Bug 430976
Comment 1 Christian Damus CLA 2015-11-30 08:59:38 EST
Taking this under the umbrella of the "welcome page" feature, bug 469188.
Comment 2 Eclipse Genie CLA 2015-11-30 14:07:13 EST
New Gerrit change created: https://git.eclipse.org/r/61591
Comment 3 Christian Damus CLA 2015-11-30 14:16:42 EST
(In reply to Eclipse Genie from comment #2)
> New Gerrit change created: https://git.eclipse.org/r/61591

The patch adds the following new behaviours:

* prompt to make page layout of a "legacy" resource private on first open
* toggle menu action to switch between private and shared storage

The drop-down menu in the toolbar button contributed by the Papyrus Editor now adds a toggle option for "Private Page Layout".  Turning this option off moves the layout information from the *.sash resource in the workspace metadata area to the *.di resource in the workspace.  Turning on does the reverse.

Also, on first opening a "legacy mode" model in which the page layout is stored in the *.di, the user is prompted to move the layout information into private storage.

This is demonstrated in a brief video:

    https://youtu.be/t7mEmyb8ODI

The "first open" condition is detected by the non-existence of a *.sash resource corresponding to the model in the workspace metadata area.  If such resource does not exist, then it is inferred that this model is "legacy mode" and has always shared its page layout.  According to the user's response to the prompt dialog, the following happens:

* "yes":  the page layout is moved from the *.di to the *.sash and saved
* "no":  the page layout is not moved but the empty *.sash is created so
   that the user won't be prompted again for this model
* "cancel":  nothing is done and the user will be prompted again when opening
   the model again (this lets the user defer the decision)

The dialog includes a "Remember my decision" check box that, if selected and the dialog is not cancelled, remembers the user's answer as an "Always" or "Never" setting in a new preference page for the editor (the default preference is "Ask each time").
Comment 5 Christian Damus CLA 2015-12-02 14:37:40 EST
(In reply to Eclipse Genie from comment #4)
> Gerrit change https://git.eclipse.org/r/61591 was merged to [master].
> Commit:
> http://git.eclipse.org/c/papyrus/org.eclipse.papyrus.git/commit/
> ?id=09d56589be181c7088207733d1a54814eb54e47e

Fixed on the master branch for the Neon release.
Comment 6 Camille Letavernier CLA 2015-12-03 04:23:03 EST
The dialog when opening legacy models for the first time freezes the Extra-Tests:

https://hudson.eclipse.org/papyrus/user/camille.letavernier@cea.fr/my-views/view/Current%20Releases/job/Papyrus-Master-Extra-Tests/1652/artifact/screenshot.jpg
Comment 7 Christian Damus CLA 2015-12-03 07:26:58 EST
(In reply to Camille Letavernier from comment #6)
> The dialog when opening legacy models for the first time freezes the

Yup, sorry about that.  I accounted for the editor-related test framework bits used by most plug-ins (especially in the main tests), but missed the AbstractCDOUITest, which understandably has its own way of opening editors.

Fixed with commit b8081f2a0b4fc7bf52ff060f34da21a5d9d215fa.