cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertdzeig...@apache.org
Subject svn commit: r764235 - /cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorController.java
Date Sat, 11 Apr 2009 19:03:23 GMT
Author: robertdzeigler
Date: Sat Apr 11 19:03:22 2009
New Revision: 764235

URL: http://svn.apache.org/viewvc?rev=764235&view=rev
Log:
CAY-1181: Default class generation folder is wrong

Modified:
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorController.java

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorController.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorController.java?rev=764235&r1=764234&r2=764235&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorController.java
(original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/codegen/GeneratorController.java
Sat Apr 11 19:03:22 2009
@@ -45,6 +45,8 @@
 import org.apache.cayenne.pref.Domain;
 import org.apache.cayenne.pref.PreferenceDetail;
 import org.apache.cayenne.swing.BindingBuilder;
+import org.apache.cayenne.swing.BindingDelegate;
+import org.apache.cayenne.swing.ObjectBinding;
 import org.apache.cayenne.util.Util;
 import org.apache.cayenne.validation.BeanValidationFailure;
 import org.apache.cayenne.validation.SimpleValidationFailure;
@@ -69,8 +71,16 @@
         initBindings(new BindingBuilder(getApplication().getBindingFactory(), this));
     }
 
+    public String getOutputPath() {
+        return preferences.getOutputPath();
+    }
+
+    public void setOutputPath(String path) {
+        preferences.setOutputPath(path);
+    }
+
     protected void initBindings(BindingBuilder bindingBuilder) {
-              
+
         initOutputFolder();
 
         JTextField outputFolder = ((GeneratorControllerPanel) getView())
@@ -78,8 +88,9 @@
         JButton outputSelect = ((GeneratorControllerPanel) getView())
                 .getSelectOutputFolder();
 
-        outputFolder.setText(preferences.getOutputPath());
+        outputFolder.setText(getOutputPath());
         bindingBuilder.bindToAction(outputSelect, "selectOutputFolderAction()");
+        bindingBuilder.bindToTextField(outputFolder,"outputPath");
     }
 
     protected CodeGeneratorControllerBase getParentController() {
@@ -426,39 +437,33 @@
             // update model
             String path = selected.getAbsolutePath();
             outputFolder.setText(path);
-            //be sure to update the destdir property, if it's not null.
-            //this ensures that if the user selected a /different/ dir than the system-property
default,
-            //they get back that directory throughought the session.
-            if (System.getProperty("cayenne.cgen.destdir") != null) {
-                System.setProperty("cayenne.cgen.destdir",path);
-            }
-            preferences.setOutputPath(path);
+            setOutputPath(path);
         }
     }
-    
+
     private void initOutputFolder(){
-        
+
         String path = null;
-        if (System.getProperty("cayenne.cgen.destdir") != null) {
-            preferences.setOutputPath(System.getProperty("cayenne.cgen.destdir"));
-            return;
-        }
         if (preferences.getOutputPath() == null) {
-            // init default directory..
-            FSPath lastPath = Application
-                    .getInstance()
-                    .getFrameController()
-                    .getLastDirectory();
-
-            path = checkDefaultMavenResourceDir(lastPath,"test");
-
-            if (path != null || (path=checkDefaultMavenResourceDir(lastPath,"main")) != null)
{
-                preferences.setOutputPath(path);
+            if (System.getProperty("cayenne.cgen.destdir") != null) {
+                setOutputPath(System.getProperty("cayenne.cgen.destdir"));
             } else {
-                File lastDir = (lastPath != null)
-                        ? lastPath.getExistingDirectory(false)
-                        : null;
-                preferences.setOutputPath(lastDir != null ? lastDir.getAbsolutePath() : null);
+                // init default directory..
+                FSPath lastPath = Application
+                        .getInstance()
+                        .getFrameController()
+                        .getLastDirectory();
+
+                path = checkDefaultMavenResourceDir(lastPath,"test");
+
+                if (path != null || (path=checkDefaultMavenResourceDir(lastPath,"main"))
!= null) {
+                    setOutputPath(path);
+                } else {
+                    File lastDir = (lastPath != null)
+                            ? lastPath.getExistingDirectory(false)
+                            : null;
+                    setOutputPath(lastDir != null ? lastDir.getAbsolutePath() : null);
+                }
             }
         }
     }



Mime
View raw message