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

Bug 519107

Summary: [All diagrams] model opening is slow, if multiple diagrams are open
Product: [Modeling] Papyrus Reporter: Ansgar Radermacher <ansgar.radermacher>
Component: DiagramAssignee: Ansgar Radermacher <ansgar.radermacher>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: thanhliem.phan
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/101449
https://git.eclipse.org/c/papyrus/org.eclipse.papyrus.git/commit/?id=bb30ad4f8e8a27d005fd4775a539d836e2cb4084
https://git.eclipse.org/r/102284
https://git.eclipse.org/c/papyrus/org.eclipse.papyrus.git/commit/?id=d9e9abc5aba1d63f661f0ab0446681b997085c55
https://git.eclipse.org/r/102388
https://git.eclipse.org/c/papyrus/org.eclipse.papyrus.git/commit/?id=2f2342b41f9532400a5c0bd2628eecf823ee9310
https://git.eclipse.org/r/103256
https://git.eclipse.org/c/papyrus/org.eclipse.papyrus.git/commit/?id=6d2a9e6738ed35ddba11aa520595e17cd1f47f45
https://git.eclipse.org/r/103319
https://git.eclipse.org/c/papyrus/org.eclipse.papyrus.git/commit/?id=cc970f662d63f8d2be9c8b97e8e37cb597eff8f6
https://git.eclipse.org/r/103322
https://git.eclipse.org/c/papyrus/org.eclipse.papyrus.git/commit/?id=51664ecfa6d4ab67269b2a4aff4dbd354507a782
https://bugs.eclipse.org/bugs/show_bug.cgi?id=521353
https://bugs.eclipse.org/bugs/show_bug.cgi?id=521550
https://bugs.eclipse.org/bugs/show_bug.cgi?id=394779
Whiteboard:

Description Ansgar Radermacher CLA 2017-07-03 09:08:05 EDT
If you open a model containing a set of diagrams that are open by default, the time for opening each diagram adds to the total time of opening the model (in which the UI is not responding).
This is reproducible with the neon and oxygen versions of Papyrus.
It should be possible to reduce the time for opening a diagram and/or assure that the UI is already responsive before all diagrams are openend.
Comment 1 Eclipse Genie CLA 2017-07-18 11:47:25 EDT
New Gerrit change created: https://git.eclipse.org/r/101449
Comment 3 Eclipse Genie CLA 2017-08-01 04:42:03 EDT
New Gerrit change created: https://git.eclipse.org/r/102284
Comment 4 Eclipse Genie CLA 2017-08-01 07:54:39 EDT
Gerrit change https://git.eclipse.org/r/102284 was merged to [streams/3.0-maintenance].
Commit: http://git.eclipse.org/c/papyrus/org.eclipse.papyrus.git/commit/?id=d9e9abc5aba1d63f661f0ab0446681b997085c55
Comment 5 Eclipse Genie CLA 2017-08-02 10:49:25 EDT
New Gerrit change created: https://git.eclipse.org/r/102388
Comment 6 Eclipse Genie CLA 2017-08-02 18:06:12 EDT
Gerrit change https://git.eclipse.org/r/102388 was merged to [streams/2.0-maintenance].
Commit: http://git.eclipse.org/c/papyrus/org.eclipse.papyrus.git/commit/?id=2f2342b41f9532400a5c0bd2628eecf823ee9310
Comment 7 Eclipse Genie CLA 2017-08-17 15:16:06 EDT
New Gerrit change created: https://git.eclipse.org/r/103256
Comment 9 Eclipse Genie CLA 2017-08-18 12:22:55 EDT
New Gerrit change created: https://git.eclipse.org/r/103319
Comment 10 Eclipse Genie CLA 2017-08-18 12:45:10 EDT
Gerrit change https://git.eclipse.org/r/103319 was merged to [streams/3.0-maintenance].
Commit: http://git.eclipse.org/c/papyrus/org.eclipse.papyrus.git/commit/?id=cc970f662d63f8d2be9c8b97e8e37cb597eff8f6
Comment 11 Eclipse Genie CLA 2017-08-18 13:16:38 EDT
New Gerrit change created: https://git.eclipse.org/r/103322
Comment 12 Eclipse Genie CLA 2017-08-18 17:13:08 EDT
Gerrit change https://git.eclipse.org/r/103322 was merged to [streams/2.0-maintenance].
Commit: http://git.eclipse.org/c/papyrus/org.eclipse.papyrus.git/commit/?id=51664ecfa6d4ab67269b2a4aff4dbd354507a782
Comment 13 Thanh Liem PHAN CLA 2017-08-24 10:49:26 EDT
Hi Ansgar,

It seems that this patch break the test EditorReloadTest.testEditPartSelectionRestored identified in bug 521353.

Comment out the added code makes the test passed again.
Comment 14 Ansgar Radermacher CLA 2017-08-24 11:06:45 EDT
(In reply to Thanh Liem PHAN from comment #13)
> Hi Ansgar,
> 
> It seems that this patch break the test
> EditorReloadTest.testEditPartSelectionRestored identified in bug 521353.
> 
> Comment out the added code makes the test passed again.

Thanks for pointing this out. The patch delays diagram editor initialization until it gets the focus.
Do you know whether the failing test in bug 521353 is relevant for the user? (or if we need to force initialization in certain cases).
Comment 15 Thanh Liem PHAN CLA 2017-08-24 11:43:13 EDT
Yes, indeed it is relevant to behavior of user.

I did the following steps to demonstrate the problem:

- Import oep.editor.integration.tests into your instance Papyrus.
- Go to model\reloaded
- Open 2 models employment & library simultaneously
- Change to employment.di window and select one object in its diagrams (class or activity diagram)
- Change to library.di window and select an element, rename it, then save to force reloading the diagram
- Return back to the employment.di window

- Without the patch: the selected object in the employment window is still focused after the reload of library model

- With the patch: the selection is disappeared. We lost the focused object after the diagram reloading.
Comment 16 Thanh Liem PHAN CLA 2017-08-24 11:54:59 EDT
An error in step 4 in the above comment, correct as below
- Change to employment.di window, open the activity diagram and select one object
Comment 17 Thanh Liem PHAN CLA 2017-08-24 11:58:40 EDT
If we select one object in the class diagram in the employment model instead, the selection is preserved after reloading of library.

It is not obvious that why we have different behaviors for class diagram and activity diagram.
Comment 18 Thanh Liem PHAN CLA 2017-08-25 03:59:50 EDT
Tests for Component and Composite Structure diagrams are not passed also. The same results as for Activity diagram.
Comment 19 Ansgar Radermacher CLA 2017-08-25 04:59:22 EDT
(In reply to Thanh Liem PHAN from comment #18)
> Tests for Component and Composite Structure diagrams are not passed also.
> The same results as for Activity diagram.

I can reproduce the issue with your description - thanks. I guess that code related to reload tries to restore the selection when the diagram has not been initialized yet (due to the patch in this bug). Do you want to look into the issue or do you prefer that I'll do that?
Comment 20 Thanh Liem PHAN CLA 2017-08-25 05:08:34 EDT
Hi Ansgar,
I will try to fix it.
A possible solution is to distinguish the reload action with the create part action of PapyrusMultiDiagramEditor in UmlGmfDiagramEditor.
Not sure if we can do this, but I'll try.

Do not hesitate to tell me if you have any idea.
Comment 21 Thanh Liem PHAN CLA 2017-08-29 09:48:30 EDT
Hi Ansgar,

It seems that this patch also breaks the test org.eclipse.papyrus.infra.editor.welcome.tests.WelcomeModelElementTest.restoreActivePagePropert.

Please see the report:
https://hudson.eclipse.org/papyrus/view/Photon%20(Master)/job/Papyrus-Master-Tests/3489/testReport/org.eclipse.papyrus.infra.editor.welcome.tests/WelcomeModelElementTest/restoreActivePageProperty/

The NPE appears when the patch is applied. editor.getDiagram("classes") in line 86 returns null.
Comment out the modif, the NPE disappears.
Comment 22 Thanh Liem PHAN CLA 2017-08-29 10:23:23 EDT
A debug show that the contents of digramGraphicalViewer is null.

Please see the trace stack:

LinkLFDiagramRootEditPart(SimpleRootEditPart).getContents() line: 70	
DiagramGraphicalViewer(AbstractEditPartViewer).getContents() line: 267	
UmlClassDiagramForMultiEditor(DiagramEditor).getDiagramEditPart() line: 614	
PapyrusEditorFixture.getDiagram(IMultiDiagramEditor, String) line: 900	
PapyrusEditorFixture.getDiagram(String) line: 873	
WelcomeModelElementTest.restoreActivePageProperty() line: 86	

The graphical viewer is not correctly initialized.
Comment 23 Ansgar Radermacher CLA 2017-09-05 05:26:30 EDT
(In reply to Thanh Liem PHAN from comment #22)
> A debug show that the contents of digramGraphicalViewer is null.
> 
> Please see the trace stack:
> 
> LinkLFDiagramRootEditPart(SimpleRootEditPart).getContents() line: 70	
> DiagramGraphicalViewer(AbstractEditPartViewer).getContents() line: 267	
> UmlClassDiagramForMultiEditor(DiagramEditor).getDiagramEditPart() line: 614	
> PapyrusEditorFixture.getDiagram(IMultiDiagramEditor, String) line: 900	
> PapyrusEditorFixture.getDiagram(String) line: 873	
> WelcomeModelElementTest.restoreActivePageProperty() line: 86	
> 
> The graphical viewer is not correctly initialized.
Comment 24 Ansgar Radermacher CLA 2017-09-05 05:30:52 EDT
(In reply to Ansgar Radermacher from comment #23)
> (In reply to Thanh Liem PHAN from comment #22)
> > A debug show that the contents of digramGraphicalViewer is null.
> > 
> > Please see the trace stack:
> > 
> > LinkLFDiagramRootEditPart(SimpleRootEditPart).getContents() line: 70	
> > DiagramGraphicalViewer(AbstractEditPartViewer).getContents() line: 267	
> > UmlClassDiagramForMultiEditor(DiagramEditor).getDiagramEditPart() line: 614	
> > PapyrusEditorFixture.getDiagram(IMultiDiagramEditor, String) line: 900	
> > PapyrusEditorFixture.getDiagram(String) line: 873	
> > WelcomeModelElementTest.restoreActivePageProperty() line: 86	
> > 
> > The graphical viewer is not correctly initialized.

Hi Thanh,

can you confirm that the issue is fixed with the corrections done in bug 521353 and bug 521550?
Comment 25 Thanh Liem PHAN CLA 2017-09-05 08:12:36 EDT
Hi Ansgar,

I confirmed that 2 tests EditorReloadTest.testEditPartSelectionRestored and WelcomeModelElementTest.restoreActivePageProperty are passed now.

No new test are failed because of new patches.
Comment 26 Ansgar Radermacher CLA 2017-09-25 04:48:15 EDT
Fixed with gerrit commits.