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

Bug 568037

Summary: [ELK] Handle Arrange Selection with ELK layout
Product: [Modeling] Sirius Reporter: Laurent Redor <laurent.redor>
Component: DiagramAssignee: Laurent Redor <laurent.redor>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: florian.barbin
Version: 6.0.0   
Target Milestone: 6.4.0   
Hardware: All   
OS: All   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=540987
https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/171012
https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/171013
https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/171014
https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/171466
https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/171467
https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/171465
https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/171469
https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/171470
https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/171474
https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/171476
https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/171477
https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/171475
https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/171844
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=602af26b4783f254f86f9d4d9ae08fbba0c97330
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=e91363a303ee66dc18df06b7bc546df507e74b5a
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=fa93312c74e550c40a6b64ebe91242437335a802
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=3e2e640c4569fe1214079941922ae7d11030d2b6
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=e96e20e29cfde10b353b635bc34bc1d4e6ce8f0f
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=eb17055c5bf38d3084c5e08d9bcfdac7dd662c52
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=789a4f679e177a1b2ca8023fcb3a7c069882fc77
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=fce346e996a812ec3beed499bbf3da4d85925b96
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=6605f1b8521015624215049275c1499481c395fe
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=1ecf269c144463b716469c6520346e6178400025
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=fcc641e1e91063931e71327a2a2495413a863d32
Whiteboard:
Bug Depends on:    
Bug Blocks: 539778, 540987, 553497, 560323    
Attachments:
Description Flags
ELKLayoutProblems.zip none

Description Laurent Redor CLA 2020-10-20 06:51:14 EDT
Created attachment 284519 [details]
ELKLayoutProblems.zip

The goal of this feature is to have a correct behavior when launching "Arrange Selection" action with an ELK layout. This issue is a sub part of bug 540987  that tried to cover "arrange selection" and "pinned elements" at same time.
The behavior will not be the same as standard layout. And it will probably be changed/improved in the future.

Steps to reproduce:
* Import project ELKLayoutProblems_D (from ELKLayoutProblems.zip)
* --- Standard behavior (without ELK) ---
* Open the diagram containerNodeAndBorderNodeDiagram
* Select "p1" and launch action "Arrange selection"
* Expected: 
    * The content of "p1" is correctly layouted, 
    * "p1" is resized to avoid scrollbar to display all its children
    * "p1" is moved to avoid overlaps with other elements (technical information, thanks to "org.eclipse.sirius.diagram.ui.tools.internal.layout.PinnedElementsHandler.resolveOverlaps(IGraphicalEditPart)")
* Select "p2" and launch action "Arrange selection"
* Expected: 
    * The content of "p2" is correctly layouted, 
    * "p2" is resized to avoid scrollbar to display all its children
    * "p2" is moved to avoid overlaps with other elements
* Select "p3" (an autosized container) and launch action "Arrange selection"
* Expected: 
    * The content of "p3" is correctly layouted, 
    * "p3" is resized to avoid scrollbar to display all its children
    * "p3" is moved to avoid overlaps with other elements
    * "p3" size is always autosized (visible with the corresponding grayed icon in the tabbar)
* Undo the 3 arranges
* Select "p1" and "p2" and launch action "Arrange selection"
* Expected: 
    * The content of "p1" and "p2" are correctly layouted, 
    * "p1" and "p2" are resized to avoid scrollbar to display all its children
    * "p1" and "p2" are moved to avoid overlaps with other elements (but they overlap each other).
* --- Behavior with ELK ---
* Open the diagram containerNodeAndBorderNodeDiagramWithELK
* Select "p1" and launch action "Arrange selection"
* Expected: 
    * The content of "p1" is correctly layouted, 
    * "p1" is resized to avoid scrollbar to display all its children
    * "p1" location remains the same
    * "p1" overlaps "p2" (maybe this point will be imprived in the future)
* Select "p2" and launch action "Arrange selection"
* Expected: 
    * The content of "p2" is correctly layouted, 
    * "p2" is resized to avoid scrollbar to display all its children
    * "p2" location remains the same
    * "p2" overlaps "p3" (and "p1" as previously)
* Select "p3" (an autosized container) and launch action "Arrange selection"
* Expected: 
    * The content of "p3" is correctly layouted, 
    * "p3" is resized to avoid scrollbar to display all its children
    * "p3" location remains the same
    * "p3" overlaps "p2" (as previously)
    * "p3" size is no longer autosized (ELK does not managed auto-sized aspect)
* Select "p1" and "p2" and launch action "Arrange selection"
    * The content of "p1" and "p2" are correctly layouted, 
    * "p1" and "p2" are resized to avoid scrollbar to display all its children
    * "p1" and "p2" are layouted relative to each other (not overlap between them) and overlap other elements (ELK ignores other elements during an arrange selection).
Comment 1 Laurent Redor CLA 2020-10-20 06:54:49 EDT
This issue is also linked to:
* bug 539778 - [ELK] Layout initialization of container elements
* bug 553497 - [ELK] Arrange new elements at diagram opening

I think that it blocks these other issues.
Comment 2 Laurent Redor CLA 2020-10-20 06:56:22 EDT
The steps to validate from bug 538373 comment 2 must also be checked (the corresponding code will be changed/reverted partially).
Comment 3 Laurent Redor CLA 2020-10-20 09:17:06 EDT
Another problem has been detected when selecting only nodes of a container to arrange. The result is the same as standard layout (ELK layout is not used in this case).

Steps to reproduce:
* Import project ELKLayoutProblems_D (from ELKLayoutProblems.zip)
* --- Standard behavior (without ELK) ---
* Open the diagram containerNodeAndBorderNodeDiagram
* Select "C11" and "C12" and launch action "Arrange selection"
* Expected: 
    * The content of "p1" is correctly layouted: C11 and C12 are on the same line, C12 at the right of C11.
	* "p1" is not resized to avoid scrollbar (indeed it is not selected as element to be layouted)
	* "p1" is not moved (same reason)
* Select "C21" and "C24" and launch action "Arrange selection"
* Expected: 
    * The content of "p2" is "correctly" layouted: C21 and C24 have been layouted and also moved to avoid overlap with C22 and C23.
	* "p2" is not resized to avoid scrollbar (indeed it is not selected as element to be layouted)
	* "p2" is not moved (same reason)
* --- Behavior with ELK ---
* Open the diagram containerNodeAndBorderNodeDiagramWithELK
* Select "C11" and "C12" and launch action "Arrange selection"
* Expected: 
    * The content of "p1" is correctly layouted: C11 and C12 are on the same line, C12 at the right of C11. But the space between C11 and C12 is smaller than standard layout, and the space it the left of C11 is smaller tha standard layout.
	* The top left corner of the C11 and C12 remains fixed.
	* "p1" is not resized to avoid scrollbar (indeed it is not selected as element to be layouted)
	* "p1" is not moved (same reason)
* Select "C21" and "C24" and launch action "Arrange selection"
* Expected: 
    * The content of "p2" is "correctly" layouted: C21 and C24 have been layouted and they overlap C22 and C23 (maybe this point will be improved in the future).
	* The top left corner of the C21 and C24 remains fixed.
	* "p2" is not resized to avoid scrollbar (indeed it is not selected as element to be layouted)
	* "p2" is not moved (same reason)
Comment 4 Eclipse Genie CLA 2020-10-20 09:23:38 EDT
New Gerrit change created: https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/171012
Comment 5 Eclipse Genie CLA 2020-10-20 09:23:39 EDT
New Gerrit change created: https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/171013
Comment 6 Eclipse Genie CLA 2020-10-20 09:23:40 EDT
New Gerrit change created: https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/171014
Comment 7 Eclipse Genie CLA 2020-10-29 14:24:34 EDT
New Gerrit change created: https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/171466
Comment 8 Eclipse Genie CLA 2020-10-29 14:24:35 EDT
New Gerrit change created: https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/171467
Comment 9 Eclipse Genie CLA 2020-10-29 14:24:37 EDT
New Gerrit change created: https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/171465
Comment 10 Eclipse Genie CLA 2020-10-29 14:24:38 EDT
New Gerrit change created: https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/171469
Comment 11 Eclipse Genie CLA 2020-10-29 14:24:39 EDT
New Gerrit change created: https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/171470
Comment 12 Eclipse Genie CLA 2020-10-29 14:24:43 EDT
New Gerrit change created: https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/171474
Comment 13 Eclipse Genie CLA 2020-10-29 14:24:44 EDT
New Gerrit change created: https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/171476
Comment 14 Eclipse Genie CLA 2020-10-29 14:24:45 EDT
New Gerrit change created: https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/171477
Comment 15 Eclipse Genie CLA 2020-10-29 14:24:56 EDT
New Gerrit change created: https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/171475
Comment 16 Eclipse Genie CLA 2020-11-05 11:58:14 EST
New Gerrit change created: https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/171844
Comment 28 Laurent Redor CLA 2020-11-06 05:01:43 EST
The steps to validate are the same as steps to reproduce from:
* comment 0
* comment 2
* comment 3
Comment 29 Pierre-Charles David CLA 2020-12-04 04:23:13 EST
Available in Sirius 6.4.0, see https://download.eclipse.org/sirius/updates/releases/6.4.0/ for details.