Search code examples
eclipsercpe4

How to invoke a command/operation when the e4 UI is up and running?


In my e4 application I want to invoke some operation automatically at that time when the UI is up and running.

I read about introducing a LifeCycleManager - which seemed to be a fit.

But apparently I cannot use any of the life cycle annotations listed there.

How can I invoke some operation in e4 that moment the UI has finished coming up?


Solution

  • You can use the UIEvents.UILifeCycle.APP_STARTUP_COMPLETE event to run code when the application startup is complete.

    Adding a method to your life cycle class subscribing to this event is one way of doing that - something like:

    @Optional
    @Inject
    public void appStartupComplete(@UIEventTopic(UIEvents.UILifeCycle.APP_STARTUP_COMPLETE) final Event event)
    {
       ....
    }
    

    Note that Event is org.osgi.service.event.Event