Hi Laurent, On Mon, Dec 2, 2013 at 8:04 AM, Laurent PETIT <[email protected]>wrote:
> I have considered it, not tried yet. > > So far, I have spotted in past discussions on the subject the > following possibilities: > > 1/ EventBroker + APP_STARTUP_COMPLETE event => when to register to the > EventBroker in the context of Eclipse the IDE? By doing it in my > current Model Processor hook ? > Yes, we often use model processors to register for events (especially related to model changes) for the application going forward. This is the Eclipse4 compatible approach. > 2/ Extend org.eclipse.ui.startup ? I have read that I am guaranteed > that when my earlyStartup() method is called the Workbench is already > totaly operational. But then how to get the MApplication instance? > Currently I'm doing > > PlatformUI.getWorkbench().getService(IEclipseContext.class).get(MApplication.class). > If you use org.eclipse.ui.startup, you've picked the right pattern. This is based on 3.x (o.e.ui.startup is not part of Eclipse4) but if you need access to things that need the Workbench, then you are tied to 3.x anyway. > 3/ Just use asyncExec on the display. But how to get the display instance? > If you are running in the IDE (which has the Workbench) this is the hardest thing to get correct. Calling Display.getDefault() can instantiate a display on the incorrect thread and cause problems. We use org.eclipse.ui.IWorkbench.getDisplay() but that's then tied to 1) running against the 3.x Workbench and 2) waiting until the workbench is up, which happens after the model processor stuff is called. Later, Paul -- Paul Webster Hi floor. Make me a sammich! - GIR
_______________________________________________ e4-dev mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/e4-dev
