Return-Path: Delivered-To: apmail-cayenne-commits-archive@www.apache.org Received: (qmail 1487 invoked from network); 11 Apr 2009 19:03:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 11 Apr 2009 19:03:44 -0000 Received: (qmail 29556 invoked by uid 500); 11 Apr 2009 19:03:44 -0000 Delivered-To: apmail-cayenne-commits-archive@cayenne.apache.org Received: (qmail 29532 invoked by uid 500); 11 Apr 2009 19:03:44 -0000 Mailing-List: contact commits-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cayenne.apache.org Delivered-To: mailing list commits@cayenne.apache.org Received: (qmail 29521 invoked by uid 99); 11 Apr 2009 19:03:44 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 11 Apr 2009 19:03:43 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 11 Apr 2009 19:03:43 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 4875623889F1; Sat, 11 Apr 2009 19:03:23 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@cayenne.apache.org From: robertdzeigler@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090411190323.4875623889F1@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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); + } } } }