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 03:03 Go to next message
Bernd van Velsen is currently offline Bernd van Velsen
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 04:16 Go to previous message
Prakash G.R. is currently offline Prakash G.R.
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: Sat Apr 19 03:01:01 EDT 2014

Powered by FUDForum. Page generated in 0.01583 seconds