From e25226f01eb40a7d4763551ce13a7428b4a3a414 Mon Sep 17 00:00:00 2001 From: Niclas Finne Date: Fri, 19 Oct 2012 14:07:22 +0200 Subject: [PATCH] Use the directory of the source file as initial directory when opening file browser --- .../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 4b2e3fac1..814cc8d3c 100644 --- a/tools/cooja/java/se/sics/cooja/dialogs/AbstractCompileDialog.java +++ b/tools/cooja/java/se/sics/cooja/dialogs/AbstractCompileDialog.java @@ -184,6 +184,10 @@ public abstract class AbstractCompileDialog extends JDialog { public void actionPerformed(ActionEvent e) { JFileChooser fc = new JFileChooser(); + File fp = new File(contikiField.getText()); + if (fp.exists() && fp.isFile()) { + lastFile = fp; + } if (lastFile == null) { String path = GUI.getExternalToolsSetting("COMPILE_LAST_FILE", null); if (path != null) { @@ -691,6 +695,8 @@ public abstract class AbstractCompileDialog extends JDialog { } private Action defaultAction = new AbstractAction("Use default") { + private static final long serialVersionUID = 2874355910493988933L; + public void actionPerformed(ActionEvent e) { /* Unselect all */ for (Component c : moteIntfBox.getComponents()) { @@ -713,7 +719,7 @@ public abstract class AbstractCompileDialog extends JDialog { * @return Currently selected mote interface classes */ public Class[] getSelectedMoteInterfaceClasses() { - ArrayList> selected = new ArrayList(); + ArrayList> selected = new ArrayList>(); for (Component c : moteIntfBox.getComponents()) { if (!(c instanceof JCheckBox)) { @@ -736,8 +742,7 @@ public abstract class AbstractCompileDialog extends JDialog { } Class[] arr = new Class[selected.size()]; - selected.toArray(arr); - return arr; + return selected.toArray(arr); } /**