-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
E4 application model fragments applied in wrong order when supplied with Model-Fragment manifest header #2530
Comments
I don't think that activation order is actually what is desired, but one would more sort them depending on their dependencies (e.g. Wires). |
That means enhancing the existing sort to
Also sounds like the better approach to me. Especially considering that we could not sort extension-provided and manifest-provided fragments together.
|
I think regarding dependencies it does not make much of a difference, as a rough recipe one should do:
Now one should iteratively work on the data structure in the following way:
Actually OSGi should already handle cyclic dependencies, but if its the case we can assume it as an error and then something happens (e.g. even random order)
Activation actually do not matter, if you mean "installed later, they should be applied at install time, I don't think there is much other option but this case is quite rare and at worst requires a restart of Eclipse to properly work. |
Ah, sorry, misunderstood you there in the first place. You are actually in favor of considering the bundle dependencies, and not the imports and IDs inside the fragments. In that case, yes your outlined approach should work, except that it is somewhat inconvenient that one would have to reimplement things which OSGi has already done, i.e. the bundle wiring, and transitive dependencies.
I think I meant activation. Let me see if I can get something working here... |
You don't need to reimplement it you can use Bundle Wiring Api, but the interpretation needs to be done by the software. Of course if we can additionally discover requirements not expressed in terms of OSGi that would be quite handy, needing requirements on other bundles is always a bit odd when working in E4... |
When different fragments are applied to build the full application model, it is important that they are applied in the correct order. Otherwise, the following errors can occur while the model fragment is applies:
There is some code in the ModelAssembler which sorts the fragments to avoid these issues, but from my understanding it is incomplete:
When the model fragments are contributed with a plugin.xml extension, there is a workaround: By specifying a dependency between bundles, the order in which bundles are activated can be influenced, and this affects the order in which the extensions are processed. But when the model fragment is contributed with the Manifest, this does not work.
There is a BundleTracker installed which collects all bundles which have been activated until the extensions are processed and checks if they have the Model-Fragment header. But because the BundleTracker internally uses a HashMap, the order in which bundles and their model fragments are returned is mixed up. It is actually pretty stable, but it's not the order in which the bundles were activated.
I've encountered this with org.eclipse.e4.ui.workbench:1.15.500. And seeing that there have not been that many changes, I'm reasonable confident that the issue still persists.
https://github.com/eclipse-platform/eclipse.platform.ui/blob/master/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelAssembler.java#L365
Are the integration builds available on maven? That would allow me to easily check this also with the latest version.
Steps to reproduce
Difficult to describe reliable steps to reproduce this problem since it depends on the state of a HashMap.
However, in general you need the following components:
Depending on the order in which these two fragments are applied, either the menu entry triggers the expected functionality, or not.
Expected behavior:
Whether fragments are contributed with a plugin.xml extension or with the Model-Fragment manifest header, the dependencies between the fragments are considered correctly when applying the fragments to the application model.
Tested under this environment:
Community
The text was updated successfully, but these errors were encountered: