remember last source file

This commit is contained in:
fros4943 2009-04-01 14:01:45 +00:00
parent fe1f594d73
commit def81a5d02

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: AbstractCompileDialog.java,v 1.6 2009/03/26 15:40:37 fros4943 Exp $ * $Id: AbstractCompileDialog.java,v 1.7 2009/04/01 14:01:45 fros4943 Exp $
*/ */
package se.sics.cooja.dialogs; package se.sics.cooja.dialogs;
@ -66,7 +66,7 @@ public abstract class AbstractCompileDialog extends JDialog {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static Logger logger = Logger.getLogger(AbstractCompileDialog.class); private static Logger logger = Logger.getLogger(AbstractCompileDialog.class);
protected final static Dimension LABEL_DIMENSION = new Dimension(170, 15); protected final static Dimension LABEL_DIMENSION = new Dimension(170, 25);
private static File lastFile = null; private static File lastFile = null;
@ -151,6 +151,13 @@ public abstract class AbstractCompileDialog extends JDialog {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
JFileChooser fc = new JFileChooser(); JFileChooser fc = new JFileChooser();
if (lastFile == null) {
String path = GUI.getExternalToolsSetting("COMPILE_LAST_FILE", null);
if (path != null) {
lastFile = new File(path);
}
}
/* Last file/directory */ /* Last file/directory */
if (lastFile != null) { if (lastFile != null) {
if (lastFile.isDirectory()) { if (lastFile.isDirectory()) {
@ -488,6 +495,8 @@ public abstract class AbstractCompileDialog extends JDialog {
} }
lastFile = file; lastFile = file;
GUI.setExternalToolsSetting("COMPILE_LAST_FILE", lastFile.getAbsolutePath());
if (file.getName().endsWith(".c")) { if (file.getName().endsWith(".c")) {
setDialogState(DialogState.SELECTED_SOURCE); setDialogState(DialogState.SELECTED_SOURCE);
return; return;