aboutsummaryrefslogtreecommitdiffstats
path: root/ajbrowser
diff options
context:
space:
mode:
authorwisberg <wisberg>2003-05-05 19:02:55 +0000
committerwisberg <wisberg>2003-05-05 19:02:55 +0000
commitb7cdfa1c98fa399d1892cd3b0a2c58008e0b6c33 (patch)
treec9d20b393c810d2b8801e52a1cdb242b42721c7c /ajbrowser
parent370e5f6ad4e24f58edad4da82d64450457bdc248 (diff)
downloadaspectj-b7cdfa1c98fa399d1892cd3b0a2c58008e0b6c33.tar.gz
aspectj-b7cdfa1c98fa399d1892cd3b0a2c58008e0b6c33.zip
stateful config file chooser now starts with launch dir and
returns to directory of last-opened file, per convention.
Diffstat (limited to 'ajbrowser')
-rw-r--r--ajbrowser/src/org/aspectj/tools/ajbrowser/TopFrame.java19
1 files changed, 13 insertions, 6 deletions
diff --git a/ajbrowser/src/org/aspectj/tools/ajbrowser/TopFrame.java b/ajbrowser/src/org/aspectj/tools/ajbrowser/TopFrame.java
index 2a02478c4..2c73b542c 100644
--- a/ajbrowser/src/org/aspectj/tools/ajbrowser/TopFrame.java
+++ b/ajbrowser/src/org/aspectj/tools/ajbrowser/TopFrame.java
@@ -23,6 +23,7 @@ import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.WindowEvent;
import java.io.File;
+import java.io.IOException;
import javax.swing.AbstractAction;
import javax.swing.BorderFactory;
@@ -57,6 +58,8 @@ import org.aspectj.asm.ProgramElementNode;
*/
public class TopFrame extends JFrame {
+ private static final File CURRENT_DIR = new File(".");
+
JLabel statusText_label = new JLabel();
//private AJButtonMenuCombo lastBuildCombo = null;
@@ -93,6 +96,8 @@ public class TopFrame extends JFrame {
private Border border6;
private Border border7;
private JMenuItem svProperties_menuItem = new JMenuItem();
+ private File lastChosenDir = CURRENT_DIR;
+
JPanel toolBar_panel = new JPanel();
JToolBar build_toolBar = new JToolBar();
JButton closeConfig_button = new JButton();
@@ -542,13 +547,10 @@ public class TopFrame extends JFrame {
private void openConfig_button_actionPerformed(ActionEvent e) {
JFileChooser fileChooser = new JFileChooser();
+ fileChooser.setCurrentDirectory(lastChosenDir);
fileChooser.setFileFilter(new FileFilter() {
public boolean accept(File f) {
- if (f.getPath().endsWith(".lst") || f.isDirectory()) {
- return true;
- } else {
- return false;
- }
+ return (f.getPath().endsWith(".lst") || f.isDirectory());
}
public String getDescription() {
return "AspectJ Build Configuration (*.lst)";
@@ -556,9 +558,14 @@ public class TopFrame extends JFrame {
});
int returnVal = fileChooser.showOpenDialog(this);
if(returnVal == JFileChooser.APPROVE_OPTION) {
- String path = fileChooser.getSelectedFile().getAbsolutePath();//.replace('\\', '/');
+ File result = fileChooser.getSelectedFile();
+ String path = result.getAbsolutePath();//.replace('\\', '/');
BrowserManager.getDefault().getConfigFiles().add(0, path);
Ajde.getDefault().getConfigurationManager().setActiveConfigFile(path);
+ lastChosenDir = result.getParentFile();
+ if (null == lastChosenDir) {
+ lastChosenDir = CURRENT_DIR;
+ }
refreshBuildMenu();
}
}