From: Niclas F. <ni...@us...> - 2012-10-22 22:53:55
|
Summary of changes: .../sics/cooja/dialogs/AbstractCompileDialog.java | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) - Log ----------------------------------------------------------------- commit e25226f01eb40a7d4763551ce13a7428b4a3a414 Author: Niclas Finne <nf...@si...> Date: Fri Oct 19 14:07:22 2012 +0200 Use the directory of the source file as initial directory when opening file browser diff --git a/tools/cooja/java/se/sics/cooja/dialogs/AbstractCompileDialog.java b/tools/cooja/java/se/sics/cooja/dialogs/AbstractCompileDialog.java index 4b2e3fa..814cc8d 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<? extends MoteInterface>[] getSelectedMoteInterfaceClasses() { - ArrayList<Class<? extends MoteInterface>> selected = new ArrayList(); + ArrayList<Class<? extends MoteInterface>> selected = new ArrayList<Class<? extends MoteInterface>>(); for (Component c : moteIntfBox.getComponents()) { if (!(c instanceof JCheckBox)) { @@ -736,8 +742,7 @@ public abstract class AbstractCompileDialog extends JDialog { } Class<? extends MoteInterface>[] arr = new Class[selected.size()]; - selected.toArray(arr); - return arr; + return selected.toArray(arr); } /** ----------------------------------------------------------------------- -- contiki |