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. This fix is based on PR by Emerson Castaneda, with minor cleanup. Closes #246
Date Fri, 01 Dec 2017 12:56:01 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master 9382e4733 -> 201ccc2ab


CAY-2379 Modeler: Visualization issue after an undo action for a deleted ObjAttribute.
This fix is based on PR by Emerson Castaneda, with minor cleanup.
Closes #246


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

Branch: refs/heads/master
Commit: 201ccc2ab6a65ffc2c08e76f6191a47ed82d49eb
Parents: 9382e47
Author: Nikita Timofeev <stariy95@gmail.com>
Authored: Fri Dec 1 15:42:56 2017 +0300
Committer: Nikita Timofeev <stariy95@gmail.com>
Committed: Fri Dec 1 15:42:56 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/201ccc2a/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 7b98895..31053bc 100644
--- a/docs/doc/src/main/resources/RELEASE-NOTES.txt
+++ b/docs/doc/src/main/resources/RELEASE-NOTES.txt
@@ -17,6 +17,7 @@ Changes/New Features:
 Bug Fixes:
 
 CAY-2370 ValueObjectType for byte[] fails lookup
+CAY-2379 Modeler: Visualization issue after an undo action for a deleted ObjAttribute
 CAY-2380 ReferenceMap should not store or return null values
 CAY-2382 Lack of synchronization in DataContext serialization
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/201ccc2a/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/201ccc2a/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