Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to shutdown RCP from within
How to shutdown RCP from within [message #463796] Thu, 15 February 2007 12:27 Go to next message
Eclipse UserFriend
How can an RCP application shut itself down?

In this case I have a thread running looking for events on a server. If
the event is found I want to shut down the applications. Searching the
newsgroup I came up with these two methods (they are the same I guess):

PlatformUI.getWorkbench().close();
Activator.getDefault().getWorkbench().close();

However both throw an exception:

Exception in thread "Thread-3" java.lang.NullPointerException
at
org.eclipse.jface.dialogs.IconAndMessageDialog.getSWTImage(I conAndMessageDialog.java:270)
at
org.eclipse.jface.dialogs.IconAndMessageDialog.getErrorImage (IconAndMessageDialog.java:217)
..
..
..

Thanks
Bill Blalock
Re: How to shutdown RCP from within [message #463800 is a reply to message #463796] Thu, 15 February 2007 13:12 Go to previous messageGo to next message
Eclipse UserFriend
I also tried

...getWorkbenchConfigurer().emergencyClose();

from the WorkbenchAdvisor. The it resulted in the same exception.

Thanks

> How can an RCP application shut itself down?

> In this case I have a thread running looking for events on a server. If
> the event is found I want to shut down the applications. Searching the
> newsgroup I came up with these two methods (they are the same I guess):

> PlatformUI.getWorkbench().close();
> Activator.getDefault().getWorkbench().close();

> However both throw an exception:

> Exception in thread "Thread-3" java.lang.NullPointerException
> at
>
org.eclipse.jface.dialogs.IconAndMessageDialog.getSWTImage(I conAndMessageDialog.java:270)
> at
>
org.eclipse.jface.dialogs.IconAndMessageDialog.getErrorImage (IconAndMessageDialog.java:217)
> ..
> ..
> ..

> Thanks
> Bill Blalock
Re: How to shutdown RCP from within [message #463804 is a reply to message #463796] Thu, 15 February 2007 13:56 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

I think you have threading problem. Do you wrap up your execution using
Display#asyncExec()?

Tom

Bill Blalock schrieb:
> How can an RCP application shut itself down?
>
> In this case I have a thread running looking for events on a server. If
> the event is found I want to shut down the applications. Searching the
> newsgroup I came up with these two methods (they are the same I guess):
>
> PlatformUI.getWorkbench().close();
> Activator.getDefault().getWorkbench().close();
>
> However both throw an exception:
>
> Exception in thread "Thread-3" java.lang.NullPointerException
> at
> org.eclipse.jface.dialogs.IconAndMessageDialog.getSWTImage(I conAndMessageDialog.java:270)
>
> at
> org.eclipse.jface.dialogs.IconAndMessageDialog.getErrorImage (IconAndMessageDialog.java:217)
>
> .
> .
> .
>
> Thanks
> Bill Blalock
>
>
>
>
Re: How to shutdown RCP from within [message #463806 is a reply to message #463804] Thu, 15 February 2007 14:39 Go to previous message
Eclipse UserFriend
Thanks Tom!

That did it!

Activator.getDefault().getWorkbench().getDisplay().asyncExec (
new Runnable() {
public void run() {
Activator.getDefault().getWorkbench().close();
}
});

Is this what you mean? Any other suggestions?

I didn't think to try this because, in my mind, I wasn't accessing SWT.
Thinking about it I realize that by touching the workbench I am accessing
SWT whether or not it my intention to manipulate the display.

Bill Blalock

> Hi,

> I think you have threading problem. Do you wrap up your execution using
> Display#asyncExec()?

> Tom

> Bill Blalock schrieb:
>> How can an RCP application shut itself down?
>>
>> In this case I have a thread running looking for events on a server. If
>> the event is found I want to shut down the applications. Searching the
>> newsgroup I came up with these two methods (they are the same I guess):
>>
>> PlatformUI.getWorkbench().close();
>> Activator.getDefault().getWorkbench().close();
>>
>> However both throw an exception:
>>
>> Exception in thread "Thread-3" java.lang.NullPointerException
>> at
>>
org.eclipse.jface.dialogs.IconAndMessageDialog.getSWTImage(I conAndMessageDialog.java:270)
>>
>> at
>>
org.eclipse.jface.dialogs.IconAndMessageDialog.getErrorImage (IconAndMessageDialog.java:217)
>>
>> .
>> .
>> .
>>
>> Thanks
>> Bill Blalock
>>
>>
>>
>>
Previous Topic:Tracking down the source of a NullPointerException during shutdown
Next Topic:Starting an RCP app invisibly
Goto Forum:
  


Current Time: Thu Mar 27 13:45:06 EDT 2025

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

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

Back to the top