Revision: 3501
Author: [email protected]
Date: Thu May  6 08:50:42 2010
Log: Fixes for a few issues with copy-paste.
http://code.google.com/p/power-architect/source/detail?r=3501

Modified:
 /trunk/src/main/java/ca/sqlpower/architect/swingui/DBTree.java
 /trunk/src/main/java/ca/sqlpower/architect/swingui/TablePane.java

=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/swingui/DBTree.java Wed Mar 17 14:29:59 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/swingui/DBTree.java Thu May 6 08:50:42 2010
@@ -969,11 +969,16 @@
                     for (int j = i + 1; j < sortedLengths.size(); j++) {
for (SQLObject childObject : pathLengthsToSelectedObjectsMap.get(sortedLengths.get(j))) {
                             SQLObject parent = childObject;
+                            boolean parented = false;
for (int k = 0; k < sortedLengths.get(j) - pathCount; k++) { if (!(parent.getParent() instanceof SQLObject)) break;
                                 parent = (SQLObject) parent.getParent();
-                            }
-                            if (parent != singleParent) {
+                                if (parent == singleParent) {
+                                    parented = true;
+                                    break;
+                                }
+                            }
+                            if (!parented) {
                                 isParentOfAllSelected = false;
                                 break;
                             }
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/swingui/TablePane.java Thu Apr 29 08:28:11 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/swingui/TablePane.java Thu May 6 08:50:42 2010
@@ -834,11 +834,19 @@
             }

             try {
+ List<SQLColumn> droppedColumns = new ArrayList<SQLColumn>();
+                for (SQLObject o : droppedItems) {
+                    if (o instanceof SQLColumn) {
+                        droppedColumns.add((SQLColumn) o);
+                    } else if (o instanceof SQLTable) {
+ droppedColumns.addAll(((SQLTable) o).getChildren(SQLColumn.class));
+                    }
+                }
                 for (int i = 0; i < importedKeys.size(); i++) {
                     // Not dealing with self-referencing tables right now.
if (importedKeys.get(i).getPkTable().equals(importedKeys.get(i).getFkTable())) continue;
                     for (int j = 0; j < droppedItems.size(); j++) {
- if (importedKeys.get(i).containsFkColumn((SQLColumn)(droppedItems.get(j)))) { + if (importedKeys.get(i).containsFkColumn(droppedColumns.get(j))) { importedKeys.get(i).setIdentifying(newColumnsInPk);
                             break;
                         }

Reply via email to