cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject [2/7] cayenne git commit: CAY-2385 CAY-2386 Refactored 3 duplicated methods by moving these to their correspondent superclasses
Date Thu, 07 Dec 2017 13:07:08 GMT
CAY-2385 CAY-2386 Refactored 3 duplicated methods by moving these to their correspondent superclasses


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

Branch: refs/heads/master
Commit: f181099ba03f61308aa0b055147f22d7c055f534
Parents: 2d0daee
Author: Emerson Castaneda <emecas@users.noreply.github.com>
Authored: Fri Dec 1 23:04:08 2017 -0500
Committer: Emerson Castaneda <emecas@users.noreply.github.com>
Committed: Tue Dec 5 22:41:23 2017 -0500

----------------------------------------------------------------------
 .../modeler/action/DbEntityCounterpartAction.java       |  9 ---------
 .../modeler/action/ObjEntityCounterpartAction.java      |  9 ---------
 .../cayenne/modeler/undo/CayenneUndoableEdit.java       | 12 ++++++++++++
 .../modeler/undo/RemoveAttributeUndoableEdit.java       | 10 ----------
 .../modeler/undo/RemoveRelationshipUndoableEdit.java    | 10 ----------
 .../org/apache/cayenne/modeler/util/CayenneAction.java  |  9 +++++++++
 6 files changed, 21 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/f181099b/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 35cf7f5..7e43e2f 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
@@ -29,10 +29,8 @@ import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.Entity;
 import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.modeler.Application;
-import org.apache.cayenne.modeler.CayenneModelerFrame;
 import org.apache.cayenne.modeler.ProjectController;
 import org.apache.cayenne.modeler.ProjectTreeModel;
-import org.apache.cayenne.modeler.editor.EditorView;
 import org.apache.cayenne.modeler.event.EntityDisplayEvent;
 import org.apache.cayenne.modeler.util.CayenneAction;
 
@@ -87,13 +85,6 @@ public class DbEntityCounterpartAction extends CayenneAction {
         getProjectController().fireObjEntityDisplayEvent(event);
     }
     
-    public static EditorView editor() {
-        return ((CayenneModelerFrame) Application
-                .getInstance()
-                .getFrameController()
-                .getView()).getView();
-    }
-    
     /**
      * Builds a tree path for a given entity. Urgent for later selection.
      * 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/f181099b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ObjEntityCounterpartAction.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ObjEntityCounterpartAction.java
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ObjEntityCounterpartAction.java
index 3feef17..8920802 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ObjEntityCounterpartAction.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ObjEntityCounterpartAction.java
@@ -25,9 +25,7 @@ import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.Entity;
 import org.apache.cayenne.modeler.Application;
-import org.apache.cayenne.modeler.CayenneModelerFrame;
 import org.apache.cayenne.modeler.ProjectTreeModel;
-import org.apache.cayenne.modeler.editor.EditorView;
 import org.apache.cayenne.modeler.event.EntityDisplayEvent;
 
 public class ObjEntityCounterpartAction extends BaseViewEntityAction {
@@ -61,13 +59,6 @@ public class ObjEntityCounterpartAction extends BaseViewEntityAction {
         getProjectController().fireDbEntityDisplayEvent(event);
     }
 
-    public static EditorView editor() {
-        return ((CayenneModelerFrame) Application
-                .getInstance()
-                .getFrameController()
-                .getView()).getView();
-    }
-
     /**
      * Builds a tree path for a given entity. Urgent for later selection.
      *

http://git-wip-us.apache.org/repos/asf/cayenne/blob/f181099b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/undo/CayenneUndoableEdit.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/undo/CayenneUndoableEdit.java
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/undo/CayenneUndoableEdit.java
index 6bd8527..86baee4 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/undo/CayenneUndoableEdit.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/undo/CayenneUndoableEdit.java
@@ -20,9 +20,13 @@ package org.apache.cayenne.modeler.undo;
 
 import javax.swing.undo.AbstractUndoableEdit;
 
+import org.apache.cayenne.map.DbEntity;
+import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.modeler.Application;
 import org.apache.cayenne.modeler.ProjectController;
 import org.apache.cayenne.modeler.action.ActionManager;
+import org.apache.cayenne.modeler.action.DbEntityCounterpartAction;
+import org.apache.cayenne.modeler.action.ObjEntityCounterpartAction;
 
 public abstract class CayenneUndoableEdit extends AbstractUndoableEdit {
     
@@ -43,4 +47,12 @@ public abstract class CayenneUndoableEdit extends AbstractUndoableEdit
{
     public boolean canUndo() {
         return true;
     }
+    
+    protected void focusObjEntity(ObjEntity objEntity){
+        actionManager.getAction(DbEntityCounterpartAction.class).viewCounterpartEntity(objEntity);
+    }
+
+    protected void focusDBEntity(DbEntity dbEntity){
+        actionManager.getAction(ObjEntityCounterpartAction.class).viewCounterpartObject(dbEntity);
+    }
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/f181099b/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 5fd13d9..3d85beb 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,8 +30,6 @@ 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.ObjEntityCounterpartAction;
 import org.apache.cayenne.modeler.action.RemoveAttributeAction;
 import org.apache.cayenne.modeler.event.EmbeddableDisplayEvent;
 import org.apache.cayenne.modeler.event.EntityDisplayEvent;
@@ -134,14 +132,6 @@ public class RemoveAttributeUndoableEdit extends CayenneUndoableEdit
{
 
     }
 
-    private void focusObjEntity(ObjEntity objEntity){
-        actionManager.getAction(DbEntityCounterpartAction.class).viewCounterpartEntity(objEntity);
-    }
-
-    private void focusDBEntity(DbEntity dbEntity){
-        actionManager.getAction(ObjEntityCounterpartAction.class).viewCounterpartObject(dbEntity);
-    }
-
     @Override
     public String getPresentationName() {
         if (objEntity != null) {

http://git-wip-us.apache.org/repos/asf/cayenne/blob/f181099b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/undo/RemoveRelationshipUndoableEdit.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/undo/RemoveRelationshipUndoableEdit.java
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/undo/RemoveRelationshipUndoableEdit.java
index afe9320..c0d59a0 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/undo/RemoveRelationshipUndoableEdit.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/undo/RemoveRelationshipUndoableEdit.java
@@ -26,8 +26,6 @@ import org.apache.cayenne.map.DbRelationship;
 import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.map.ObjRelationship;
 import org.apache.cayenne.modeler.action.CreateRelationshipAction;
-import org.apache.cayenne.modeler.action.DbEntityCounterpartAction;
-import org.apache.cayenne.modeler.action.ObjEntityCounterpartAction;
 import org.apache.cayenne.modeler.action.RemoveRelationshipAction;
 
 public class RemoveRelationshipUndoableEdit extends CayenneUndoableEdit {
@@ -89,12 +87,4 @@ public class RemoveRelationshipUndoableEdit extends CayenneUndoableEdit
{
             focusDBEntity(dbEntity);
         }
     }
-
-    private void focusObjEntity(ObjEntity objEntity){
-        actionManager.getAction(DbEntityCounterpartAction.class).viewCounterpartEntity(objEntity);
-    }
-
-    private void focusDBEntity(DbEntity dbEntity){
-        actionManager.getAction(ObjEntityCounterpartAction.class).viewCounterpartObject(dbEntity);
-    }
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/f181099b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneAction.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneAction.java
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneAction.java
index 8b294ca..00fabd1 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneAction.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneAction.java
@@ -34,8 +34,10 @@ import javax.swing.KeyStroke;
 
 import org.apache.cayenne.configuration.ConfigurationNode;
 import org.apache.cayenne.modeler.Application;
+import org.apache.cayenne.modeler.CayenneModelerFrame;
 import org.apache.cayenne.modeler.ProjectController;
 import org.apache.cayenne.modeler.dialog.ErrorDebugDialog;
+import org.apache.cayenne.modeler.editor.EditorView;
 import org.apache.cayenne.project.Project;
 import org.apache.cayenne.swing.components.image.FilteredIconFactory;
 import org.apache.cayenne.util.Util;
@@ -322,4 +324,11 @@ public abstract class CayenneAction extends AbstractAction {
             }
         }
     }
+    
+    protected static EditorView editor() {
+        return ((CayenneModelerFrame) Application
+                .getInstance()
+                .getFrameController()
+                .getView()).getView();
+    }
 }


Mime
View raw message