Skip to main content


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 OleyFriend
Messages: 304
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 OleyFriend
Messages: 304
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 Mar 29 14:24:25 GMT 2024

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

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

Back to the top