SWT - Creating child context in ShellActivationListener [message #1745776] |
Mon, 17 October 2016 13:15 |
Andrzej Witecki Messages: 2 Registered: November 2015 |
Junior Member |
|
|
In E4 apps based on PartRenderingEngine every activated shell is being handled by ShellActivationListener. This listener binds proper context to the activated Shell. Everything seems to be logical in case of MWindow related Shells but when "regular" Shell (e.g. progress dialog) is being activated then listener binds it to the context created as a child of MApplication context and activates this context (see ShellActivationListener#activate for details).
Due to this solution we cannot fully operate using UI-based-dependencies (e.g. PartServiceImpl) stored within window's context when the operation is triggered from such "regular" Shell. This is misleading as the Shell is created within running UI of E4 app.
Real example:
1. Create long-run operation which opens proper editor in the end
2. Run this operation using IProgressService#runInUI
3. Operation fails in the end because EPartService was resolved from activated non-UI context (created using MApplication), i.e. we got ApplicationPartService instead of PartServiceImpl
Wouldn't it be rational to use application.getContext().getActiveChild() as a parent context in ShellActivationListener#activate? I cannot find any counterarguments for that at this moment.
Andrzej
|
|
|
Powered by
FUDForum. Page generated in 0.02884 seconds