Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Restarting RCP application
Restarting RCP application [message #1172353] Tue, 05 November 2013 21:54 Go to next message
Ralf Heydenreich is currently offline Ralf HeydenreichFriend
Messages: 235
Registered: July 2009
Senior Member
Hi all,
perhaps it sounds a bit odd, but want to restart my application before
it gets visible.
Short explanation: I work on a product where the user can select the
working directory at first startup. This is achieved through a
LifecycleManager (@PostContextCreate), where I raise up a popup dialog.
The dialog is displayed correctly, but now I don't know how to restart
the workbench, since it isn't available. What I have is an
IApplicationContext and a Display. I know that IWorkbench now has a
restart() method, but I can't get an object for it. How can I do this?

Thanks in advance,
Ralf.
Re: Restarting RCP application [message #1173157 is a reply to message #1172353] Wed, 06 November 2013 10:23 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Look at the implementation of IWorkbench#restart and do the same, in the
end we are setting some equinox stuff ;-)

Tom

On 05.11.13 22:54, Ralf Heydenreich wrote:
> Hi all,
> perhaps it sounds a bit odd, but want to restart my application before
> it gets visible.
> Short explanation: I work on a product where the user can select the
> working directory at first startup. This is achieved through a
> LifecycleManager (@PostContextCreate), where I raise up a popup dialog.
> The dialog is displayed correctly, but now I don't know how to restart
> the workbench, since it isn't available. What I have is an
> IApplicationContext and a Display. I know that IWorkbench now has a
> restart() method, but I can't get an object for it. How can I do this?
>
> Thanks in advance,
> Ralf.
>
Re: Restarting RCP application [message #1173297 is a reply to message #1173157] Wed, 06 November 2013 12:23 Go to previous messageGo to next message
Ralf Heydenreich is currently offline Ralf HeydenreichFriend
Messages: 235
Registered: July 2009
Senior Member
Hi Tom,
I thought about it. But if I look into E4Workbench (which is the only class that implements IWorkbench I found) I found the following:

public boolean restart() {
	this.restart = true;
	return close();
}


and later

public boolean close() {
	if (renderer != null) {
		renderer.stop();
	}
	if (uiEventPublisher != null && appModel != null) {
		((Notifier) appModel).eAdapters().remove(uiEventPublisher);
		uiEventPublisher = null;
	}
	if (osgiRegistration != null) {
		osgiRegistration.unregister();
		osgiRegistration = null;
	}
	return true;
}


But in my application (or in the dialog which I've open) I can't access fields like osgiRegistration or (perhaps the most important) restart. But this is essential for restarting (at least I think that). Can you give me please some further hints about this?

Ralf.
Re: Restarting RCP application [message #1173327 is a reply to message #1173297] Wed, 06 November 2013 12:45 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Hi,

I see the problem is that what you'd like is to have the
@PostContextCreate return a value. I don't see how you can achieve what
you want in 4.3 without rolling your own E4Application :-(

I think you should file a bugzilla requesting that:

@PostContextCreate returns a int which if not 0 is interpreted as the
return value for IApplication#start

Tom

On 06.11.13 13:23, Ralf Heydenreich wrote:
> Hi Tom,
> I thought about it. But if I look into E4Workbench (which is the only
> class that implements IWorkbench I found) I found the following:
>
>
> public boolean restart() {
> this.restart = true;
> return close();
> }
>
>
> and later
>
>
> public boolean close() {
> if (renderer != null) {
> renderer.stop();
> }
> if (uiEventPublisher != null && appModel != null) {
> ((Notifier) appModel).eAdapters().remove(uiEventPublisher);
> uiEventPublisher = null;
> }
> if (osgiRegistration != null) {
> osgiRegistration.unregister();
> osgiRegistration = null;
> }
> return true;
> }
>
>
> But in my application (or in the dialog which I've open) I can't access
> fields like osgiRegistration or (perhaps the most important) restart.
> But this is essential for restarting (at least I think that). Can you
> give me please some further hints about this?
>
> Ralf.
Previous Topic:e4 Eclipse DI vs. e3 compatibility Mode
Next Topic:Reuse of Menu Elements / MenuContributions
Goto Forum:
  


Current Time: Thu Mar 28 17:59:45 GMT 2024

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

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

Back to the top