Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » multiple instances of an eclipse 4 application project
multiple instances of an eclipse 4 application project [message #1744130] Thu, 22 September 2016 14:42 Go to next message
Jean-Pascal Laux is currently offline Jean-Pascal LauxFriend
Messages: 38
Registered: December 2011
Member
Hello,

I have read a lot of thing about but I don't find if a solution exists.
I have to run my exported project 3 or 4 times on the same computer.

For moment, I always have Workplace is locked message.

Jean-Pascal
Re: multiple instances of an eclipse 4 application project [message #1744175 is a reply to message #1744130] Fri, 23 September 2016 07:29 Go to previous messageGo to next message
Christoph Keimel is currently offline Christoph KeimelFriend
Messages: 478
Registered: December 2010
Location: Germany
Senior Member
Hi Jean-Pascal,

I have used this code in the LifeCycleManager on @PostContextCreate to achieve this:

eventBroker.subscribe(Constants.APPLICATION_LAUNCHED, new EventHandler() {
	@Override
	public void handleEvent(Event event) {
		logger.info("Releasing Application Lock on Data Area ..."); //$NON-NLS-1$
		Platform.getInstanceLocation().release();
		eventBroker.unsubscribe(this);
	}
});

You can use Platform.getInstanceLocation().release() to release the lock. But first you need to wait for the application launch to be finished because the lock has not been set at this point, so you wait for the APPLICATION_LAUNCHED event system with IEventBroker. Constants.APPLICATION_LAUNCHED comes with the efxclipse renderer. If you are using SWT you will need to find the appropriate event.

If you use this, you should be aware that the persisted state of the application (like the saved app model, preferences, etc.) will likely by overwritten by the last application that was saved and will be inconsistent across the applications.

Hope this helps,
Christoph
Re: multiple instances of an eclipse 4 application project [message #1744192 is a reply to message #1744175] Fri, 23 September 2016 09:57 Go to previous message
Jean-Pascal Laux is currently offline Jean-Pascal LauxFriend
Messages: 38
Registered: December 2011
Member
Hi Christoph,

Thanks !
It works fine.
I use SWT end the event is UIEvents.UILifeCycle.APP_STARTUP_COMPLETE

Have a nice WE
Jean-Pascal
Previous Topic:P2 periodic check
Next Topic:Neon: Restore editor state on startup
Goto Forum:
  


Current Time: Thu Sep 21 08:53:40 GMT 2017

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

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