From f183579eaac79e5ed6fa716231cc166509603b55 Mon Sep 17 00:00:00 2001 From: Shigeru KANEMOTO Date: Wed, 13 Feb 2013 01:01:59 +0900 Subject: [PATCH] Fix: Exception if type ESC for close confirmation. If you type an Escape key if a close econfirmation dialog is prompted for unsaved file, an exception thrown. This behavior fixed. --- app/src/processing/app/Editor.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/app/src/processing/app/Editor.java b/app/src/processing/app/Editor.java index da16f87f6..cc9d080c6 100644 --- a/app/src/processing/app/Editor.java +++ b/app/src/processing/app/Editor.java @@ -2043,16 +2043,15 @@ public class Editor extends JFrame implements RunnerListener { JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); - if (result == JOptionPane.YES_OPTION) { + switch (result) { + case JOptionPane.YES_OPTION: return handleSave(true); - - } else if (result == JOptionPane.NO_OPTION) { + case JOptionPane.NO_OPTION: return true; // ok to continue - - } else if (result == JOptionPane.CANCEL_OPTION) { - return false; - - } else { + case JOptionPane.CANCEL_OPTION: + case JOptionPane.CLOSED_OPTION: // Escape key pressed + return false; + default: throw new IllegalStateException(); }