cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r905642 - in /cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler: ProjectTreeView.java action/SaveAction.java action/SaveAsAction.java
Date Tue, 02 Feb 2010 14:21:47 GMT
Author: oltka
Date: Tue Feb  2 14:21:47 2010
New Revision: 905642

URL: http://svn.apache.org/viewvc?rev=905642&view=rev
Log:
CAY-1339 Remove org.apache.cayenne.project package from runtime

* if change domain name. in pathes add new project and remove old

Modified:
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectTreeView.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/SaveAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/SaveAsAction.java

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectTreeView.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectTreeView.java?rev=905642&r1=905641&r2=905642&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectTreeView.java
(original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectTreeView.java
Tue Feb  2 14:21:47 2010
@@ -437,6 +437,7 @@
         updateNode(path);
 
         if (e.isNameChange()) {
+            
             positionNode(path, Comparators.getNamedObjectComparator());
             showNode(path);
         }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/SaveAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/SaveAction.java?rev=905642&r1=905641&r2=905642&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/SaveAction.java
(original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/SaveAction.java
Tue Feb  2 14:21:47 2010
@@ -55,6 +55,8 @@
     @Override
     protected boolean saveAll() throws Exception {
         Project p = getCurrentProject();
+        
+        String oldPath = p.getConfigurationResource().getURL().getPath();
         // obtain preference object before save, when the project path may change.....
         Domain preference = getProjectController().getPreferenceDomainForProject();
 
@@ -70,7 +72,7 @@
 
         preference.rename(p.getConfigurationResource().getURL().getPath());
 
-        getApplication().getFrameController().addToLastProjListAction(
+        getApplication().getFrameController().changePathInLastProjListAction(oldPath, 
                 p.getConfigurationResource().getURL().getPath());
         Application.getFrame().fireRecentFileListChanged();
 

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/SaveAsAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/SaveAsAction.java?rev=905642&r1=905641&r2=905642&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/SaveAsAction.java
(original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/SaveAsAction.java
Tue Feb  2 14:21:47 2010
@@ -77,6 +77,8 @@
     protected boolean saveAll() throws Exception {
         Project p = getCurrentProject();
 
+        String oldPath = p.getConfigurationResource().getURL().getPath();
+
         // obtain preference object before save, when the project path may change.....
         Domain preference = getProjectController().getPreferenceDomainForProject();
 
@@ -84,28 +86,40 @@
         if (projectDir == null) {
             return false;
         }
-        
+
         if (projectDir.exists() && !projectDir.canWrite()) {
-            JOptionPane.showMessageDialog(Application.getFrame(),
-                    "Can't save project - unable to write to file \"" + projectDir.getPath()
+ "\"",
-                    "Can't Save Project", JOptionPane.OK_OPTION);
+            JOptionPane.showMessageDialog(
+                    Application.getFrame(),
+                    "Can't save project - unable to write to file \""
+                            + projectDir.getPath()
+                            + "\"",
+                    "Can't Save Project",
+                    JOptionPane.OK_OPTION);
             return false;
         }
-        
+
         getProjectController().getProjectWatcher().pauseWatching();
-        
+
         URL url = projectDir.toURL();
-        
+
         URLResource res = new URLResource(url);
-        ///!!!!!!!!!!!!!!!!!!! SAVE AS!!!!!!!!!!!!!!
-        ProjectSaver saver = getApplication().getInjector().getInstance(ProjectSaver.class);
+        // /!!!!!!!!!!!!!!!!!!! SAVE AS!!!!!!!!!!!!!!
+        ProjectSaver saver = getApplication().getInjector().getInstance(
+                ProjectSaver.class);
         saver.saveAs(p, res);
 
         // update preferences domain key
         preference.rename(projectDir.getPath());
-        
-        getApplication().getFrameController().addToLastProjListAction(
-                p.getConfigurationResource().getURL().getPath());
+
+        if (oldPath != null && oldPath.length() != 0) {
+            getApplication().getFrameController().changePathInLastProjListAction(
+                    oldPath,
+                    p.getConfigurationResource().getURL().getPath());
+        }
+        else {
+            getApplication().getFrameController().addToLastProjListAction(
+                    p.getConfigurationResource().getURL().getPath());
+        }
         Application.getFrame().fireRecentFileListChanged();
 
         /**
@@ -124,9 +138,12 @@
     }
 
     public synchronized void performAction(int warningLevel) {
-        
-        ConfigurationValidationVisitor validatVisitor = new ConfigurationValidationVisitor(getCurrentProject());
-        List<ValidationInfo> object = (List<ValidationInfo>) getCurrentProject().getRootNode().acceptVisitor(validatVisitor);
+
+        ConfigurationValidationVisitor validatVisitor = new ConfigurationValidationVisitor(
+                getCurrentProject());
+        List<ValidationInfo> object = (List<ValidationInfo>) getCurrentProject()
+                .getRootNode()
+                .acceptVisitor(validatVisitor);
         int validationCode = validatVisitor.getMaxSeverity();
 
         // If no serious errors, perform save.



Mime
View raw message