Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » UIEvents.UILifeCycle.APP_SHUTDOWN_STARTED event is not thrown
UIEvents.UILifeCycle.APP_SHUTDOWN_STARTED event is not thrown [message #1718449] Wed, 23 December 2015 20:53 Go to next message
Peter Szanto is currently offline Peter SzantoFriend
Messages: 4
Registered: December 2015
Junior Member
In a new E4 project I tried to catch UIEvents.UILifeCycle.APP_STARTUP_COMPLETE and UIEvents.UILifeCycle.APP_SHUTDOWN_STARTED lifecycle events but only the startup event is triggered, the shutdown event is not thrown when I quit program with Exit menu or clicking the Windows close button.

In E4LifeCycle.java I tried:
	@Inject
	@Optional
	public void subscribeAppStartupComplete(@UIEventTopic(UIEvents.UILifeCycle.APP_STARTUP_COMPLETE) Event event) {
		System.out.println("app startup complete");
	}

	@Inject
	@Optional
	public void subscribeAppShutdownStarted(@UIEventTopic(UIEvents.UILifeCycle.APP_SHUTDOWN_STARTED) Event event) {
		System.out.println("app shutdown started");
	}


Another try with EventHandlers:
	@PostContextCreate
	void postContextCreate(IEclipseContext workbenchContext) {
		eventBroker.subscribe(UIEvents.UILifeCycle.APP_STARTUP_COMPLETE, startupHandler);
		eventBroker.subscribe(UIEvents.UILifeCycle.APP_SHUTDOWN_STARTED, shutdownHandler);
	}

	private EventHandler startupHandler = new EventHandler() {
		@Override
		public void handleEvent(org.osgi.service.event.Event event) {
			System.out.println("startup handler started");
		}
	};

	private EventHandler shutdownHandler = new EventHandler() {
		@Override
		public void handleEvent(org.osgi.service.event.Event event) {
			System.out.println("shutdown handler started");
		}
	};


Is there a better method to catch this event ?
(Eclipse Neon M4 but it is also reproducible in Eclipse Mars)
Re: UIEvents.UILifeCycle.APP_SHUTDOWN_STARTED event is not thrown [message #1721220 is a reply to message #1718449] Mon, 25 January 2016 20:25 Go to previous messageGo to next message
Eclipse UserFriend
It seems that you are responsible for issuing the APP_SHUTDOWN_STARTED. The E3.x layer does it as part of Workbench.close().

Brian.
Re: UIEvents.UILifeCycle.APP_SHUTDOWN_STARTED event is not thrown [message #1721240 is a reply to message #1721220] Tue, 26 January 2016 06:04 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
On 25.01.16 21:25, Brian de Alwis wrote:
> It seems that you are responsible for issuing the APP_SHUTDOWN_STARTED.
> The E3.x layer does it as part of Workbench.close().
>
> Brian.

That sounds wrong - IMHO the framework should post this event.

Tom
Re: UIEvents.UILifeCycle.APP_SHUTDOWN_STARTED event is not thrown [message #1722754 is a reply to message #1721240] Mon, 08 February 2016 20:40 Go to previous message
Peter Szanto is currently offline Peter SzantoFriend
Messages: 4
Registered: December 2015
Junior Member
Now there is a bug report for this problem:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=487460
Previous Topic:Migrating from eclipse 3.4 to 4.3
Next Topic:Toggle breakpoint in ruler popup menu
Goto Forum:
  


Current Time: Thu Apr 25 12:22:52 GMT 2024

Powered by FUDForum. Page generated in 0.03530 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top