From a17e7d109a2046b41795bb5c04353fcd87868865 Mon Sep 17 00:00:00 2001 From: fros4943 Date: Thu, 12 Mar 2009 13:20:58 +0000 Subject: [PATCH] minor fix: only reset dialogstate if mote type is not loaded --- .../se/sics/cooja/dialogs/AbstractCompileDialog.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/cooja/java/se/sics/cooja/dialogs/AbstractCompileDialog.java b/tools/cooja/java/se/sics/cooja/dialogs/AbstractCompileDialog.java index 65d84fc5a..5ca04d404 100644 --- a/tools/cooja/java/se/sics/cooja/dialogs/AbstractCompileDialog.java +++ b/tools/cooja/java/se/sics/cooja/dialogs/AbstractCompileDialog.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: AbstractCompileDialog.java,v 1.4 2009/03/11 18:18:57 fros4943 Exp $ + * $Id: AbstractCompileDialog.java,v 1.5 2009/03/12 13:20:58 fros4943 Exp $ */ package se.sics.cooja.dialogs; @@ -286,9 +286,8 @@ public abstract class AbstractCompileDialog extends JDialog { } }); - setDialogState(DialogState.NO_SELECTION); - /* Restore old configuration if mote type is already configured */ + boolean restoredDialogState = false; if (moteType != null) { /* Restore description */ if (moteType.getDescription() != null) { @@ -299,9 +298,11 @@ public abstract class AbstractCompileDialog extends JDialog { if (moteType.getContikiSourceFile() != null) { contikiField.setText(moteType.getContikiSourceFile().getAbsolutePath()); setDialogState(DialogState.SELECTED_SOURCE); + restoredDialogState = true; } else if (moteType.getContikiFirmwareFile() != null) { contikiField.setText(moteType.getContikiFirmwareFile().getAbsolutePath()); setDialogState(DialogState.SELECTED_FIRMWARE); + restoredDialogState = true; } /* Restore mote interface classes */ @@ -315,8 +316,12 @@ public abstract class AbstractCompileDialog extends JDialog { if (moteType.getCompileCommands() != null) { setCompileCommands(moteType.getCompileCommands()); setDialogState(DialogState.AWAITING_COMPILATION); + restoredDialogState = true; } } + if (!restoredDialogState) { + setDialogState(DialogState.NO_SELECTION); + } descriptionField.requestFocus(); descriptionField.select(0, descriptionField.getText().length());