Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Asynchronous job which should be cancelable
Asynchronous job which should be cancelable [message #1087996] Fri, 16 August 2013 12:18 Go to next message
Markus Oley is currently offline Markus Oley
Messages: 254
Registered: July 2009
Location: Germany
Senior Member
Hi

I want to implement an dialog, which triggers a long running execution after clicking on an button.
You should even be able to cancel this execution by clicking on a Cancel button.
And the execution itself changes some states (e.g. progress bar, status messages...) that are showed in this dialog.

I tried with
new Job("Building all distributions") {
protected IStatus run(IProgressMonitor progress) {

new UIJob("Building all distributions") {
public IStatus runInUIThread(IProgressMonitor monitor) {

//-> some long running actions
service.run (new ISomeProgressInterface () {

@Override
public void distributionStarted(blabla) {
//Changing state of visible elements
lblSomeLabel.setText("Started building distribution " + currentDistro);
update ();
}
@Override
public boolean isCanceled() {
return buildingCancelled;
}
}
return Status.OK_STATUS;
}.schedule();

return Status.OK_STATUS;
}.schedule();


btnCancel.addSelectionListener(new SelectionAdapter() {

@Override
public void widgetSelected(SelectionEvent arg0) {
LOGGER.info("Canceling build");
buildingCancelled = true;
}


But with this construction the selection adapter doesn't notice any clicking.

Could you show me an example how to implement this best possible?

Thanks
Cheers
Markus
Re: Asynchronous job which should be cancelable [message #1094883 is a reply to message #1087996] Mon, 26 August 2013 10:34 Go to previous message
Markus Oley is currently offline Markus Oley
Messages: 254
Registered: July 2009
Location: Germany
Senior Member
Is this the correct forum for this issue?

Previous Topic:How Do You Handle JUnit Tests?
Next Topic:Eclipse JVM on workspace switch
Goto Forum:
  


Current Time: Fri Oct 31 12:16:06 GMT 2014

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

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