This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 143719 - Enhance WizardAction to be easily cancelable from the execute() method
Summary: Enhance WizardAction to be easily cancelable from the execute() method
Status: NEW
Alias: None
Product: installer
Classification: Unclassified
Component: NBI (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Libor Fischmeistr
URL:
Keywords:
Depends on:
Blocks: 242141
  Show dependency tree
 
Reported: 2008-08-13 08:55 UTC by dlipin
Modified: 2014-02-20 13:15 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dlipin 2008-08-13 08:55:49 UTC
This issue raised upon the discussion with Jeff Lin during work on OpenESB Installer.

The task was to get back to the previous panel from the execute() method in the action.
The trivial thing - getWizard().previous() didn`t work since the execute() method continue to happen and invoked 
getWizard().next() in WizardAction.executeForward() method.

The other thing - "getWizard().previous(); return;" doesn`t work either since canceled flag was not set and .next() is 
executed again.

The third possible thing "getWizard().previous(); cancel(); return;" does not work for another reason - cancel() method 
hangs - it is waiting for the "finished" flag to be set to true.
So the option here is to execute cancel() method in a separate thread but it sounds like a hacking.
First variant:
final WizardAction action = this;
new NbiThread() {
           @Override
           public void run() {
               action.cancel();
               action.getWizard().previous();
           }
       }.start();
return;
(this one likely leads to race conditions, maybe fixed by having Thread.sleep(50) before return;)

Another variant:
getWizard().previous();
final WizardAction action = this;
new NbiThread() {
           @Override
           public void run() {
               action.cancel();                        }
       }.start();
return;
(likely RC as well)

Third one:
final WizardAction action = this;
new NbiThread() {
           @Override
           public void run() {
               action.cancel();                        }
       }.start();
getWizard().previous();
return;



The best variant was to dup the WizardAction class to WizardActionMod which is the almost the same but with different 
cancel() method:
public void cancel() {
       canceled = true;
}
With such a action, the following things result in the go back in the wizard sequence:
getWizard().previous();
cancel();
return; 


The current WizardAction should be enhanced to be capable of such functionality and without duplicating the code.
Comment 1 Jiri Rechtacek 2012-10-07 12:58:47 UTC
Assigned to new owner.