Bug 551634 - Fragments import SharedElements too late
Summary: Fragments import SharedElements too late
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.12   Edit
Hardware: All Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 562497
  Show dependency tree
 
Reported: 2019-09-30 10:28 EDT by Rainer Herter CLA
Modified: 2020-07-09 09:19 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rainer Herter CLA 2019-09-30 10:28:37 EDT
Following project settings are given:
1) a fragment defining sharedElements for trimmedWindowImpl.
2) another fragment using imports + placeholders in perspectives. Imports + placeholders have references to the sharedElements of fragment 1.
3) just another plugin with fragment having some commands + handlers, nothing special. But this plugin is being loaded by ModelAssembler first... we don't know why.

The project is loading the plugins in a specific order to ensure that the sharedElements are being loaded BEFORE loading the other plugin requiring the sharedElements.

This project setup worked fine with Eclipse 4.7, and is broken since 4.8.
The following change in class "ModelAssembler" causes the problem.

Bug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=509644

Corresponding change:
https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelAssembler.java?id=b3f875c20a46971abeb23067c5cfe701d4750b23



Using fragments with sharedElements, the given order is being scrambled in the ModelAssembler --> createUnifiedFragmentList


In method "processFragments", the generated list of model fragments (variable "wrappers") has the correct order. After calling method "createUnifiedFragmentList()", the list has a faulty order. The sharedElements are at the end of the list, and thus being loaded after every other plugin. This leads to errors creating the model, because the required references for the placeholders are null.


The only fix we could find so far is to add a "sharedElements" to the plugin's fragment "3" on top of all other fragment entries, filled with a "dummy"-part without any further coding. Plugin "3" is determined as the "most important bucket" (we don't know why). The routine in the ModelAssembler then finds the "sharedElements" of plugin 3 and adds all sharedElements of all plugins to the list. Afterwards, all other fragment parts are being added. In this case, all references of all placeholders are available.

Or is there any other possibility to fix this issue?