public boolean execute(){
  while (!checkPromptNeeded()) {
    Object[] possibleValues;
    if (action != null) {
      possibleValues=new Object[]{Bundle.getMessage("ButtonContinue"),Bundle.getMessage("ButtonAbort"),action};
    }
 else {
      possibleValues=new Object[]{Bundle.getMessage("ButtonContinue"),Bundle.getMessage("ButtonAbort")};
    }
    int selectedValue=JOptionPane.showOptionDialog(component,warning,Bundle.getMessage("ShutDownWarningTitle"),JOptionPane.DEFAULT_OPTION,JOptionPane.WARNING_MESSAGE,null,possibleValues,possibleValues[possibleValues.length - 1]);
    if (selectedValue == 1) {
      return false;
    }
 else     if (selectedValue == 0) {
      return true;
    }
 else     if (selectedValue == 2) {
      return doPrompt();
    }
 else     if (selectedValue == -1) {
      return doClose();
    }
 else {
      log.error("unexpected selection: " + selectedValue);
      return true;
    }
  }
  return true;
}

public boolean execute ( ) { while ( ! checkPromptNeeded ( ) ) { Object [ ] possibleValues ; if ( action != null ) { possibleValues = new Object [ ] { Bundle . getMessage ( "ButtonContinue" ) , Bundle . getMessage ( "ButtonAbort" ) , action } ; } else { possibleValues = new Object [ ] { Bundle . getMessage ( "ButtonContinue" ) , Bundle . getMessage ( "ButtonAbort" ) } ; } int selectedValue = JOptionPane . showOptionDialog ( component , warning , Bundle . getMessage ( "ShutDownWarningTitle" ) , JOptionPane . DEFAULT_OPTION , JOptionPane . WARNING_MESSAGE , null , possibleValues , possibleValues [ possibleValues . length - 1 ] ) ; if ( selectedValue == 1 ) { return false ; } else if ( selectedValue == 0 ) { return true ; } else if ( selectedValue == 2 ) { return doPrompt ( ) ; } else if ( selectedValue == - 1 ) { return doClose ( ) ; } else { log . error ( "unexpected selection: " + selectedValue ) ; return true ; } } return true ; }
take the necessary action .
