java - Re-enable a disabled cancel button in an Eclipse plug-in progress monitor? -


i've got progressmonitordialog in plug-in cancel button enabled.

while operation running, if user clicks cancel button, want ask them if sure want cancel. checking progressmonitordialog.iscanceled() method.

to use messagedialog openquestion method. if click yes, throw exception , cancel operation.

if click no, invoke progressmonitordialog.setcanceled(false) method , continue operation.

the problem i'm encounter is, once click cancel, button gets disabled , not re-enable.

is there way force cancel button re-enable user has opportunity cancel request again?

this 'confirmcancel' method looks now:

private void confirmcancel(iprogressmonitor monitor) {     display d = display.getdefault();      final mutableboolean cancel = new mutableboolean(false);      d.syncexec(new runnable() {          @override         public void run() {             cancel.setvalue(messagedialog.openquestion(null,                      "confirm cancel",                      "are sure want cancel download?"));         }     });      if (cancel.booleanvalue()) {         logdebug("download canceled in downloadoperation");         throw new operationcanceledexception("copy canceled");     } else {         monitor.setcanceled(false);         // re-enable cancel button     } } 

as usual, moment post question, come answer :)

i override cancelpressed() method of progressmonitordialog display question user and, if yes, run super.cancelprssed() method.


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -