Wrong use of boolean, should be different

This commit is contained in:
comp500 2019-08-10 19:37:14 +01:00
parent 5fc7d6382d
commit e6637b9af8
3 changed files with 7 additions and 4 deletions

View File

@ -172,6 +172,8 @@ public class UpdateManager {
} }
if (cancelled) { if (cancelled) {
System.out.println("Update cancelled by user!");
System.exit(1);
return; return;
} }

View File

@ -23,6 +23,7 @@ public interface IUserInterface {
void executeManager(Runnable task); void executeManager(Runnable task);
// Return true if the installation was cancelled!
Future<Boolean> showOptions(List<IOptionDetails> option); Future<Boolean> showOptions(List<IOptionDetails> option);
} }

View File

@ -102,14 +102,14 @@ public class OptionsSelectWindow extends JDialog implements ActionListener {
addWindowListener(new WindowAdapter() { addWindowListener(new WindowAdapter() {
@Override @Override
public void windowClosing(WindowEvent e) { public void windowClosing(WindowEvent e) {
future.complete(false); future.complete(true);
} }
@Override @Override
public void windowClosed(WindowEvent e) { public void windowClosed(WindowEvent e) {
// Just in case closing didn't get triggered - if something else called dispose() the // Just in case closing didn't get triggered - if something else called dispose() the
// future will have already completed // future will have already completed
future.complete(false); future.complete(true);
} }
}); });
} }
@ -189,10 +189,10 @@ public class OptionsSelectWindow extends JDialog implements ActionListener {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals("OK")) { if (e.getActionCommand().equals("OK")) {
tableModel.finalise(); tableModel.finalise();
future.complete(true); future.complete(false);
dispose(); dispose();
} else if (e.getActionCommand().equals("Cancel")) { } else if (e.getActionCommand().equals("Cancel")) {
future.complete(false); future.complete(true);
dispose(); dispose();
} }
} }