cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r990053 - in /cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne: modeler/editor/DataDomainView.java modeler/util/ProjectUtil.java pref/RenamedPreferences.java
Date Fri, 27 Aug 2010 07:10:06 GMT
Author: aadamchik
Date: Fri Aug 27 07:10:06 2010
New Revision: 990053

URL: http://svn.apache.org/viewvc?rev=990053&view=rev
Log:
refactoring DataDomain renaming... there's still a prefs related bug there somewhere

Modified:
    cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/DataDomainView.java
    cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/ProjectUtil.java
    cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/pref/RenamedPreferences.java

Modified: cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/DataDomainView.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/DataDomainView.java?rev=990053&r1=990052&r2=990053&view=diff
==============================================================================
--- cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/DataDomainView.java
(original)
+++ cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/DataDomainView.java
Fri Aug 27 07:10:06 2010
@@ -43,7 +43,6 @@ import org.apache.cayenne.modeler.Projec
 import org.apache.cayenne.modeler.dialog.datadomain.CacheSyncConfigController;
 import org.apache.cayenne.modeler.event.DomainDisplayEvent;
 import org.apache.cayenne.modeler.event.DomainDisplayListener;
-import org.apache.cayenne.modeler.util.ProjectUtil;
 import org.apache.cayenne.modeler.util.TextAdapter;
 import org.apache.cayenne.pref.RenamedPreferences;
 import org.apache.cayenne.util.Util;
@@ -331,26 +330,29 @@ public class DataDomainView extends JPan
     }
 
     void setDomainName(String newName) {
-        if (newName == null || newName.trim().length() == 0) {
-            throw new ValidationException("Enter name for DataDomain");
-        }
 
         DataChannelDescriptor dataChannelDescriptor = (DataChannelDescriptor) Application
                 .getInstance()
                 .getProject()
                 .getRootNode();
+
+        if (Util.nullSafeEquals(dataChannelDescriptor.getName(), newName)) {
+            return;
+        }
+
+        if (newName == null || newName.trim().length() == 0) {
+            throw new ValidationException("Enter name for DataDomain");
+        }
+
         Preferences prefs = projectController.getPreferenceForDataDomain();
 
         DomainEvent e = new DomainEvent(
                 this,
                 dataChannelDescriptor,
                 dataChannelDescriptor.getName());
-        ProjectUtil.setDataDomainName(dataChannelDescriptor, newName);
-
-        // copy all old preference to new preferences
-        Preferences oldPref = prefs;
-        RenamedPreferences.copyPreferences(newName, oldPref);
+        dataChannelDescriptor.setName(newName);
 
+        RenamedPreferences.copyPreferences(newName, prefs);
         projectController.fireDomainEvent(e);
     }
 

Modified: cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/ProjectUtil.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/ProjectUtil.java?rev=990053&r1=990052&r2=990053&view=diff
==============================================================================
--- cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/ProjectUtil.java
(original)
+++ cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/ProjectUtil.java
Fri Aug 27 07:10:06 2010
@@ -87,12 +87,6 @@ public class ProjectUtil {
         }
     }
 
-    public static void setDataDomainName(
-            DataChannelDescriptor domain,
-            String newName) {
-        domain.setName(newName);
-    }
-
     public static void setDataNodeName(DataChannelDescriptor domain, DataNodeDescriptor node,
String newName) {
         node.setName(newName);
     }

Modified: cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/pref/RenamedPreferences.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/pref/RenamedPreferences.java?rev=990053&r1=990052&r2=990053&view=diff
==============================================================================
--- cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/pref/RenamedPreferences.java
(original)
+++ cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/pref/RenamedPreferences.java
Fri Aug 27 07:10:06 2010
@@ -24,7 +24,7 @@ import java.util.List;
 import java.util.prefs.BackingStoreException;
 import java.util.prefs.Preferences;
 
-/*
+/**
  * use for preferences where in preference's node path contains dependence from name dataChanelDescriptor,

  * dataNodeDescriptor, dataMap etc.
  */



Mime
View raw message