cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject cayenne git commit: CAY-2379 Modeler: Visualization issue after an undo action for a deleted ObjAttribute
Date Fri, 01 Dec 2017 13:55:36 GMT
Repository: cayenne
Updated Branches:
  refs/heads/STABLE-4.0 812375276 -> a34b9bb48


CAY-2379 Modeler: Visualization issue after an undo action for a deleted ObjAttribute


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/a34b9bb4
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/a34b9bb4
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/a34b9bb4

Branch: refs/heads/STABLE-4.0
Commit: a34b9bb482e1ee0dbea3ad34f71e6133bed00a6d
Parents: 8123752
Author: Nikita Timofeev <stariy95@gmail.com>
Authored: Fri Dec 1 16:55:14 2017 +0300
Committer: Nikita Timofeev <stariy95@gmail.com>
Committed: Fri Dec 1 16:55:14 2017 +0300

----------------------------------------------------------------------
 docs/doc/src/main/resources/RELEASE-NOTES.txt            |  1 +
 .../modeler/action/DbEntityCounterpartAction.java        | 11 ++++++-----
 .../modeler/undo/RemoveAttributeUndoableEdit.java        |  7 +++++++
 3 files changed, 14 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/a34b9bb4/docs/doc/src/main/resources/RELEASE-NOTES.txt
----------------------------------------------------------------------
diff --git a/docs/doc/src/main/resources/RELEASE-NOTES.txt b/docs/doc/src/main/resources/RELEASE-NOTES.txt
index 7d5c475..e315ab9 100644
--- a/docs/doc/src/main/resources/RELEASE-NOTES.txt
+++ b/docs/doc/src/main/resources/RELEASE-NOTES.txt
@@ -20,6 +20,7 @@ CAY-2365 SQLExec query tries to convert (unexpected) result set into objects
 CAY-2367 ClassCastException reading object with an attribute of type 'char'
 CAY-2368 ColumnSelect: Property.self() translates into wrong SQL code
 CAY-2370 ValueObjectType for byte[] fails lookup
+CAY-2379 Modeler: Visualization issue after an undo action for a deleted ObjAttribute
 CAY-2382 Lack of synchronization in DataContext serialization
 
 ----------------------------------

http://git-wip-us.apache.org/repos/asf/cayenne/blob/a34b9bb4/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/DbEntityCounterpartAction.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/DbEntityCounterpartAction.java
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/DbEntityCounterpartAction.java
index f127133..35cf7f5 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/DbEntityCounterpartAction.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/DbEntityCounterpartAction.java
@@ -22,10 +22,8 @@ package org.apache.cayenne.modeler.action;
 import java.awt.event.ActionEvent;
 import java.util.Iterator;
 
-import javax.swing.tree.DefaultMutableTreeNode;
 import javax.swing.tree.TreePath;
 
-import org.apache.cayenne.configuration.ConfigurationNode;
 import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.Entity;
@@ -74,7 +72,10 @@ public class DbEntityCounterpartAction extends CayenneAction {
         }
 
         ObjEntity entity = it.next();
-        
+        viewCounterpartEntity(entity);
+    }
+
+    public void viewCounterpartEntity(ObjEntity entity) {        
         TreePath path = buildTreePath(entity);
         editor().getProjectTreeView().getSelectionModel().setSelectionPath(path);
         
@@ -94,9 +95,9 @@ public class DbEntityCounterpartAction extends CayenneAction {
     }
     
     /**
-     * Builds a tree path for a given path. Urgent for later selection.
+     * Builds a tree path for a given entity. Urgent for later selection.
      * 
-     * @param path
+     * @param entity to build path for
      * @return tree path
      */
     public static TreePath buildTreePath(Entity entity) {

http://git-wip-us.apache.org/repos/asf/cayenne/blob/a34b9bb4/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/undo/RemoveAttributeUndoableEdit.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/undo/RemoveAttributeUndoableEdit.java
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/undo/RemoveAttributeUndoableEdit.java
index 52e5292..5db0c52 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/undo/RemoveAttributeUndoableEdit.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/undo/RemoveAttributeUndoableEdit.java
@@ -30,6 +30,7 @@ import org.apache.cayenne.map.EmbeddableAttribute;
 import org.apache.cayenne.map.ObjAttribute;
 import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.modeler.action.CreateAttributeAction;
+import org.apache.cayenne.modeler.action.DbEntityCounterpartAction;
 import org.apache.cayenne.modeler.action.RemoveAttributeAction;
 import org.apache.cayenne.modeler.event.EmbeddableDisplayEvent;
 import org.apache.cayenne.modeler.event.EntityDisplayEvent;
@@ -114,6 +115,7 @@ public class RemoveAttributeUndoableEdit extends CayenneUndoableEdit {
             for (ObjAttribute attr : objAttributes) {
                 action.createObjAttribute(dataMap, objEntity, attr);
             }
+            focusObjEntity(objEntity);
         }
 
         if (dbEntity != null) {
@@ -130,6 +132,11 @@ public class RemoveAttributeUndoableEdit extends CayenneUndoableEdit
{
 
     }
 
+    private void focusObjEntity(ObjEntity objEntity){
+        actionManager.getAction(DbEntityCounterpartAction.class)
+                .viewCounterpartEntity(objEntity);
+    }
+
     @Override
     public String getPresentationName() {
         if (objEntity != null) {


Mime
View raw message