Hey Paul, 2013/12/2 Paul Webster <[email protected]>: > 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.
So I'll use this method, even if, as you pointed out, I will continue to live in a cross world between 3.x and 4.x APIs, since I won't be able to migrate all my code at once (and also I depend on so many things that are still stuck in the 3.x world, I guess ...) > >> >> 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 > _______________________________________________ e4-dev mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/e4-dev
