Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Show Dialog after Job is finished
Show Dialog after Job is finished [message #467808] Thu, 10 May 2007 21:10 Go to next message
Roshan S. is currently offline Roshan S.Friend
Messages: 125
Registered: July 2009
Senior Member
Hi,
I'm trying to show an OK dialog that says either that the job has
completed successfully or it has been canceled, but the dialog window
does not come up after the job completes, is this possible?

Thanks,
Roshan

Job job = new Job("Design 2 .NET Generation") {
protected IStatus run(IProgressMonitor monitor) {
//monitor.work();
...
...
//
monitor.done();
return Status.OK_STATUS;
}
};
job.addJobChangeListener(new JobChangeAdapter() {
public void done(IJobChangeEvent event) {
if (event.getResult().isOK())
{
MessageBox msgBox = new MessageBox(new Shell(),
SWT.OK|SWT.ICON_INFORMATION);
msgBox.setMessage("Completed successfully");
msgBox.open();

}
else
{
MessageBox msgBox = new MessageBox(new Shell(),
SWT.OK|SWT.ICON_ERROR);
msgBox.setMessage("Did not complete successfully");
msgBox.open();

}
}
});
job.setUser(true); // displays progress bar dialog
job.schedule(); // start as soon as possible
Re: Show Dialog after Job is finished [message #467810 is a reply to message #467808] Thu, 10 May 2007 21:41 Go to previous message
John Arthorne is currently offline John ArthorneFriend
Messages: 176
Registered: July 2009
Senior Member
You need to put your dialog code in a Display.asyncExec since the job
will be executing outside the UI thread.
--

Roshan Soni wrote:
> Hi,
> I'm trying to show an OK dialog that says either that the job has
> completed successfully or it has been canceled, but the dialog window
> does not come up after the job completes, is this possible?
>
> Thanks,
> Roshan
>
> Job job = new Job("Design 2 .NET Generation") {
> protected IStatus run(IProgressMonitor monitor) {
> //monitor.work();
> ...
> ...
> //
> monitor.done();
> return Status.OK_STATUS;
> }
> };
> job.addJobChangeListener(new JobChangeAdapter() {
> public void done(IJobChangeEvent event) {
> if (event.getResult().isOK())
> {
> MessageBox msgBox = new MessageBox(new Shell(),
> SWT.OK|SWT.ICON_INFORMATION);
> msgBox.setMessage("Completed successfully");
> msgBox.open();
>
> }
> else
> {
> MessageBox msgBox = new MessageBox(new Shell(),
> SWT.OK|SWT.ICON_ERROR);
> msgBox.setMessage("Did not complete successfully");
> msgBox.open();
>
> }
> }
> });
> job.setUser(true); // displays progress bar dialog
> job.schedule(); // start as soon as possible
Previous Topic:Programmatically minimize view stack to trim
Next Topic:RCP Based Standalone Help
Goto Forum:
  


Current Time: Fri Apr 26 20:57:36 GMT 2024

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

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

Back to the top