OSDN Git Service

introduce stigmata system properties, .current.directory'' and startup.directory...
authortama3 <tama3@acee48c3-7b26-0410-bdac-b3d0e5314bbc>
Tue, 2 Oct 2007 06:34:12 +0000 (06:34 +0000)
committertama3 <tama3@acee48c3-7b26-0410-bdac-b3d0e5314bbc>
Tue, 2 Oct 2007 06:34:12 +0000 (06:34 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/stigmata/trunk@227 acee48c3-7b26-0410-bdac-b3d0e5314bbc

src/main/java/jp/naist/se/stigmata/ui/swing/FileIOManager.java
src/main/java/jp/naist/se/stigmata/ui/swing/StigmataFrame.java

index cc27c0f..428c940 100644 (file)
@@ -12,6 +12,8 @@ import javax.swing.JFileChooser;
 import javax.swing.SwingUtilities;\r
 import javax.swing.filechooser.FileFilter;\r
 \r
+import jp.naist.se.stigmata.BirthmarkEnvironment;\r
+\r
 /**\r
  * \r
  * @author Haruaki TAMADA\r
@@ -20,13 +22,21 @@ import javax.swing.filechooser.FileFilter;
 public class FileIOManager{\r
     private Component parent;\r
     private File currentDirectory;\r
+    private BirthmarkEnvironment env;\r
 \r
-    public FileIOManager(Component parent){\r
+    public FileIOManager(Component parent, BirthmarkEnvironment env){\r
         this.parent = parent;\r
-        if(System.getProperty("execution.directory") != null){\r
+        this.env = env;\r
+        if(env.getProperty(".current.directory") != null){\r
+            currentDirectory = new File(env.getProperty(".current.directory"));\r
+        }\r
+        if(env.getProperty("startup.directory") != null){\r
+            currentDirectory = new File(env.getProperty("startup.directory"));\r
+        }\r
+        if(currentDirectory == null && System.getProperty("execution.directory") != null){\r
             currentDirectory = new File(System.getProperty("execution.directory"));\r
         }\r
-        else{\r
+        if(currentDirectory == null){\r
             currentDirectory = new File(".");\r
         }\r
     }\r
@@ -40,6 +50,7 @@ public class FileIOManager{
             throw new IllegalArgumentException(directory.getName() + " is not directory");\r
         }\r
         this.currentDirectory = directory;\r
+        env.addProperty(".current.directory", directory.getAbsolutePath());\r
     }\r
 \r
     public File findFile(boolean open){\r
index b11724d..ea48713 100644 (file)
@@ -87,7 +87,7 @@ public class StigmataFrame extends JFrame{
     public StigmataFrame(Stigmata stigmata, BirthmarkEnvironment environment){\r
         this.stigmata = stigmata;\r
         this.environment = environment;\r
-        this.fileio = new FileIOManager(this);\r
+        this.fileio = new FileIOManager(this, environment);\r
         Image iconImage = Utility.getImage("stigmata.icon");\r
         if(iconImage != null){\r
             setIconImage(iconImage);\r