Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » IProgressMonitor report error to user
IProgressMonitor report error to user [message #523977] Tue, 30 March 2010 07:03 Go to next message
Bernd van Velsen is currently offline Bernd van VelsenFriend
Messages: 19
Registered: November 2009
Junior Member
I currently use the Job API to perform long-running task. But a task can also throw some kind Exception. What is the best way to display the error to the user(in the progressDialog i presume, but how?)

this is an example of what i currently do. but this does not display the error...

final Job job = new Job("Export Program") {
@Override
protected IStatus run(final IProgressMonitor monitor) {
monitor.beginTask("Some nice progress message here ...", 100);
try {
//Do long running task
}
catch (final Exception e) {
monitor.subTask("error");
monitor.done();
return Status.CANCEL_STATUS;
}
monitor.done();
return Status.OK_STATUS;
}
}

Re: IProgressMonitor report error to user [message #523989 is a reply to message #523977] Tue, 30 March 2010 08:16 Go to previous message
Prakash G.R. is currently offline Prakash G.R.Friend
Messages: 621
Registered: July 2009
Senior Member
On 30/03/10 12:33 PM, Bernd van Velsen wrote:
> I currently use the Job API to perform long-running task. But a task can
> also throw some kind Exception. What is the best way to display the
> error to the user(in the progressDialog i presume, but how?)
>
> this is an example of what i currently do. but this does not display the
> error...
>
> final Job job = new Job("Export Program") {
> @Override
> protected IStatus run(final IProgressMonitor monitor) {
> monitor.beginTask("Some nice progress message here ...", 100);
> try {
> //Do long running task
> }
> catch (final Exception e) {
> monitor.subTask("error");
> monitor.done();
> return Status.CANCEL_STATUS;
> }
> monitor.done();
> return Status.OK_STATUS;
> }
> }

If its an error, then create an error status with necessary details and
return it.

- Prakash
Platform UI Team, IBM

www.eclipse-tips.com
Previous Topic:Restart after an update?
Next Topic:Is it possible to remove the minimise button from a View's tab?
Goto Forum:
  


Current Time: Thu Apr 25 10:17:38 GMT 2024

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

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

Back to the top