cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r924267 [1/2] - in /cayenne/main/trunk/framework: cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ ca...
Date Wed, 17 Mar 2010 13:11:41 GMT
Author: oltka
Date: Wed Mar 17 13:11:38 2010
New Revision: 924267

URL: http://svn.apache.org/viewvc?rev=924267&view=rev
Log:
CAY-1339 Remove org.apache.cayenne.project package from runtime

* remove the ProjectPath from the modeler

Added:
    cayenne/main/trunk/framework/cayenne-project-unpublished/src/main/java/org/apache/cayenne/project2/ConfigurationNodeParentGetter.java
      - copied, changed from r923185, cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/MultipleObjectsDisplayListener.java
    cayenne/main/trunk/framework/cayenne-project-unpublished/src/main/java/org/apache/cayenne/project2/DefaultConfigurationNodeParentGetter.java
Modified:
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ActionManager.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/CayenneModelerFrame.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectController.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectTreeView.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CopyAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CopyAttributeAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CopyProcedureParameterAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CopyRelationshipAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateAttributeAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateDataMapAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateDbEntityAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateEmbeddableAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateNodeAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateObjEntityAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateProcedureAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateProcedureParameterAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateRelationshipAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CutAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CutAttributeAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CutProcedureParameterAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CutRelationshipAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/DbEntitySyncAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ExitAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/GenerateCodeAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/GenerateDBAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ImportDBAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ImportEOModelAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/InferRelationshipsAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/MigrateAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ObjEntitySyncAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/PasteAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ProjectAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveAttributeAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveProcedureParameterAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveRelationshipAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/SaveAsAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ValidateAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/EditorView.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/DisplayEvent.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/MultipleObjectsDisplayEvent.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/MultipleObjectsDisplayListener.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/graph/action/EntityDisplayAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/graph/action/ShowGraphEntityAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneAction.java
    cayenne/main/trunk/framework/cayenne-project-unpublished/src/main/java/org/apache/cayenne/project2/CayenneProjectModule.java

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ActionManager.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ActionManager.java?rev=924267&r1=924266&r2=924267&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ActionManager.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ActionManager.java Wed Mar 17 13:11:38 2010
@@ -31,6 +31,7 @@ import javax.swing.ActionMap;
 import javax.swing.JComponent;
 import javax.swing.TransferHandler;
 
+import org.apache.cayenne.configuration.ConfigurationNode;
 import org.apache.cayenne.modeler.action.AboutAction;
 import org.apache.cayenne.modeler.action.ConfigurePreferencesAction;
 import org.apache.cayenne.modeler.action.CopyAction;
@@ -92,7 +93,7 @@ import org.apache.cayenne.modeler.action
 import org.apache.cayenne.modeler.action.ValidateAction;
 import org.apache.cayenne.modeler.graph.action.ShowGraphEntityAction;
 import org.apache.cayenne.modeler.util.CayenneAction;
-import org.apache.cayenne.project.ProjectPath;
+import org.apache.cayenne.project2.ConfigurationNodeParentGetter;
 
 /**
  * An object that manages CayenneModeler actions.
@@ -105,10 +106,8 @@ public class ActionManager {
 
     // search action added to project actions
     static final Collection<String> PROJECT_ACTIONS = Arrays.asList(RevertAction
-            .getActionName(), 
-            ProjectAction
-            .getActionName(), ValidateAction.getActionName(), SaveAsAction
-            .getActionName(), FindAction.getActionName());
+            .getActionName(), ProjectAction.getActionName(), ValidateAction
+            .getActionName(), SaveAsAction.getActionName(), FindAction.getActionName());
 
     static final Collection<String> DOMAIN_ACTIONS = new HashSet<String>(PROJECT_ACTIONS);
     static {
@@ -121,7 +120,7 @@ public class ActionManager {
                 ImportEOModelAction.getActionName(),
                 PasteAction.getActionName()));
     }
-    
+
     static final Collection<String> DATA_MAP_ACTIONS = new HashSet<String>(DOMAIN_ACTIONS);
     static {
         DATA_MAP_ACTIONS.addAll(Arrays.asList(
@@ -161,17 +160,16 @@ public class ActionManager {
     static final Collection<String> EMBEDDABLE_ACTIONS = new HashSet<String>(
             DATA_MAP_ACTIONS);
     static {
-        EMBEDDABLE_ACTIONS.addAll(Arrays.asList(
-                CreateAttributeAction.getActionName()));
+        EMBEDDABLE_ACTIONS.addAll(Arrays.asList(CreateAttributeAction.getActionName()));
     }
-    
+
     static final Collection<String> PROCEDURE_ACTIONS = new HashSet<String>(
             DATA_MAP_ACTIONS);
     static {
         PROCEDURE_ACTIONS.addAll(Arrays.asList(CreateProcedureParameterAction
                 .getActionName()));
     }
-    
+
     static final Collection<String> MULTIPLE_OBJECTS_ACTIONS = new HashSet<String>(
             PROJECT_ACTIONS);
     static {
@@ -237,9 +235,9 @@ public class ActionManager {
         registerAction(new NavigateForwardAction(application)).setAlwaysOn(true);
         // search action registered
         registerAction(new FindAction(application));
-        
+
         registerAction(new ShowLogConsoleAction(application)).setAlwaysOn(true);
-        
+
         registerAction(new CutAction(application));
         registerAction(new CutAttributeAction(application));
         registerAction(new CutRelationshipAction(application));
@@ -249,15 +247,15 @@ public class ActionManager {
         registerAction(new CopyRelationshipAction(application));
         registerAction(new CopyProcedureParameterAction(application));
         registerAction(new PasteAction(application));
-        
-        UndoAction undoAction = new UndoAction(application); 
+
+        UndoAction undoAction = new UndoAction(application);
         undoAction.setEnabled(false);
         registerAction(undoAction);
-        
+
         RedoAction redoAction = new RedoAction(application);
         redoAction.setEnabled(false);
         registerAction(redoAction);
-        
+
         registerAction(new CreateEmbeddableAction(application));
         registerAction(new ShowGraphEntityAction(application));
     }
@@ -332,41 +330,47 @@ public class ActionManager {
         processActionsState(DATA_MAP_ACTIONS);
         updateActions("Query");
     }
-    
+
     public void embeddableSelected() {
         processActionsState(EMBEDDABLE_ACTIONS);
         updateActions("Embeddable");
     }
-    
+
     /**
      * Invoked when several objects were selected in ProjectTree at time
      */
-    public void multipleObjectsSelected(ProjectPath[] paths) {
+    public void multipleObjectsSelected(
+            ConfigurationNode[] objects,
+            Application application) {
         processActionsState(MULTIPLE_OBJECTS_ACTIONS);
-        
+
         updateActions("Selected Objects");
-        
+
         CayenneAction cutAction = getAction(CutAction.getActionName());
-        boolean canCopy = true; // cut/copy can be performed if selected objects are on the same level
-        
-        if (!cutAction.enableForPath(paths[0])) {
+        boolean canCopy = true; // cut/copy can be performed if selected objects are on
+        // the same level
+
+        if (!cutAction.enableForPath((ConfigurationNode) objects[0])) {
             canCopy = false;
         }
         else {
-            Object parent = paths[0].getObjectParent();
-            
-            for (int i = 1; i < paths.length; i++) {
-                if (paths[i].getObjectParent() != parent || !cutAction.enableForPath(paths[i])) {
+            ConfigurationNodeParentGetter parentGetter = application.getInjector().getInstance(
+                    ConfigurationNodeParentGetter.class);
+            Object parent = parentGetter.getParent(objects[0]);
+
+            for (int i = 1; i < objects.length; i++) {
+                if (parentGetter.getParent(objects[i]) != parent
+                        || !cutAction.enableForPath((ConfigurationNode) objects[i])) {
                     canCopy = false;
                     break;
                 }
             }
         }
-        
+
         cutAction.setEnabled(canCopy);
         getAction(CopyAction.getActionName()).setEnabled(canCopy);
     }
-    
+
     /**
      * Updates Remove, Cut and Copy actions' names
      */
@@ -374,11 +378,11 @@ public class ActionManager {
         if (postfix.length() > 0) {
             postfix = " " + postfix;
         }
-        
+
         getAction(RemoveAction.getActionName()).setName("Remove" + postfix);
         getAction(CutAction.getActionName()).setName("Cut" + postfix);
         getAction(CopyAction.getActionName()).setName("Copy" + postfix);
-        
+
         ((PasteAction) getAction(PasteAction.getActionName())).updateState();
     }
 
@@ -396,19 +400,20 @@ public class ActionManager {
             }
         }
     }
-    
+
     /**
-     * Replaces standard Cut, Copy and Paste action maps, so that accelerators like 
-     * Ctrl+X, Ctrl+C, Ctrl+V would work 
+     * Replaces standard Cut, Copy and Paste action maps, so that accelerators like
+     * Ctrl+X, Ctrl+C, Ctrl+V would work
      */
     public void setupCCP(JComponent comp, String cutName, String copyName) {
         ActionMap map = comp.getActionMap();
-        
-        map.put(TransferHandler.getCutAction().getValue(Action.NAME), 
-                getAction(cutName));
-        map.put(TransferHandler.getCopyAction().getValue(Action.NAME),
+
+        map.put(TransferHandler.getCutAction().getValue(Action.NAME), getAction(cutName));
+        map.put(
+                TransferHandler.getCopyAction().getValue(Action.NAME),
                 getAction(copyName));
-        map.put(TransferHandler.getPasteAction().getValue(Action.NAME),
+        map.put(
+                TransferHandler.getPasteAction().getValue(Action.NAME),
                 getAction(PasteAction.getActionName()));
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/CayenneModelerFrame.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/CayenneModelerFrame.java?rev=924267&r1=924266&r2=924267&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/CayenneModelerFrame.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/CayenneModelerFrame.java Wed Mar 17 13:11:38 2010
@@ -473,8 +473,8 @@ public class CayenneModelerFrame extends
         actionManager.procedureSelected();
     }
 
-    public void currentObjectsChanged(MultipleObjectsDisplayEvent e) {
-        actionManager.multipleObjectsSelected(e.getPaths());
+    public void currentObjectsChanged(MultipleObjectsDisplayEvent e, Application application) {
+        actionManager.multipleObjectsSelected(e.getNodes(), application);
     }
 
     public void currentEmbeddableChanged(EmbeddableDisplayEvent e) {

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectController.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectController.java?rev=924267&r1=924266&r2=924267&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectController.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectController.java Wed Mar 17 13:11:38 2010
@@ -46,6 +46,7 @@ import org.apache.cayenne.configuration.
 import org.apache.cayenne.configuration.event.ProcedureParameterListener;
 import org.apache.cayenne.configuration.event.QueryEvent;
 import org.apache.cayenne.configuration.event.QueryListener;
+import org.apache.cayenne.configuration.ConfigurationNode;
 import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.configuration.DataNodeDescriptor;
 import org.apache.cayenne.map.DataMap;
@@ -116,7 +117,7 @@ import org.apache.cayenne.modeler.pref.D
 import org.apache.cayenne.modeler.util.CayenneController;
 import org.apache.cayenne.modeler.util.CircularArray;
 import org.apache.cayenne.modeler.util.Comparators;
-import org.apache.cayenne.project.ProjectPath;
+import org.apache.cayenne.project2.ConfigurationNodeParentGetter;
 import org.apache.cayenne.project2.Project;
 import org.apache.cayenne.query.Query;
 import org.apache.cayenne.util.IDUtil;
@@ -165,7 +166,7 @@ public class ProjectController extends C
         /**
          * Paths of multiple selection
          */
-        private ProjectPath[] paths;
+        private Object[] paths;
 
         /**
          * currently selecte entity listener class
@@ -373,7 +374,7 @@ public class ProjectController extends C
                 }
                 else {
                     projectControllerPreferences = projectControllerPreferences
-                    .node(projectControllerPreferences.absolutePath());
+                            .node(projectControllerPreferences.absolutePath());
                 }
             }
         }
@@ -627,7 +628,7 @@ public class ProjectController extends C
         return currentState.procedureParameters;
     }
 
-    public ProjectPath[] getCurrentPaths() {
+    public Object[] getCurrentPaths() {
         return currentState.paths;
     }
 
@@ -1609,13 +1610,13 @@ public class ProjectController extends C
 
     public void fireMultipleObjectsDisplayEvent(MultipleObjectsDisplayEvent e) {
         clearState();
-        currentState.paths = e.getPaths();
+        currentState.paths = e.getNodes();
 
         EventListener[] list = listenerList
                 .getListeners(MultipleObjectsDisplayListener.class);
         for (EventListener listener : list) {
             MultipleObjectsDisplayListener temp = (MultipleObjectsDisplayListener) listener;
-            temp.currentObjectsChanged(e);
+            temp.currentObjectsChanged(e, getApplication());
         }
     }
 
@@ -1837,14 +1838,15 @@ public class ProjectController extends C
             return getCurrentDataNode();
         }
         else if (getCurrentPaths() != null) { // multiple objects
-            ProjectPath[] paths = getCurrentPaths();
+            Object[] paths = getCurrentPaths();
             List<Object> result = new Vector<Object>();
 
-            Object parent = paths[0].getObjectParent();
+            ConfigurationNodeParentGetter parentGetter = getApplication().getInjector().getInstance(
+                    ConfigurationNodeParentGetter.class);
+            Object parent = parentGetter.getParent((ConfigurationNode) paths[0]);
 
-            for (ProjectPath path : paths) {
-                Object lastObject = path.getObject();
-                result.add(lastObject);
+            for (Object path : paths) {
+                result.add(path);
             }
 
             /**

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectTreeView.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectTreeView.java?rev=924267&r1=924266&r2=924267&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectTreeView.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectTreeView.java Wed Mar 17 13:11:38 2010
@@ -46,6 +46,7 @@ import org.apache.cayenne.configuration.
 import org.apache.cayenne.configuration.event.ProcedureListener;
 import org.apache.cayenne.configuration.event.QueryEvent;
 import org.apache.cayenne.configuration.event.QueryListener;
+import org.apache.cayenne.configuration.ConfigurationNode;
 import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.configuration.DataNodeDescriptor;
 import org.apache.cayenne.map.DataMap;
@@ -90,7 +91,6 @@ import org.apache.cayenne.modeler.event.
 import org.apache.cayenne.modeler.event.QueryDisplayListener;
 import org.apache.cayenne.modeler.util.CellRenderers;
 import org.apache.cayenne.modeler.util.Comparators;
-import org.apache.cayenne.project.ProjectPath;
 import org.apache.cayenne.project2.Project;
 import org.apache.cayenne.query.Query;
 import org.apache.cayenne.reflect.PropertyUtils;
@@ -139,7 +139,7 @@ public class ProjectTreeView extends JTr
 
                 if (paths != null) {
                     if (paths.length > 1) {
-                        ProjectPath[] projectPaths = new ProjectPath[paths.length];
+                        ConfigurationNode[] projectPaths = new ConfigurationNode[paths.length];
                         for (int i = 0; i < paths.length; i++) {
                             projectPaths[i] = createProjectPath(paths[i]);
                         }
@@ -156,17 +156,14 @@ public class ProjectTreeView extends JTr
             }
 
             /**
-             * Converts TreePath to ProjectPath
+             * Converts TreePath to Object
              */
-            private ProjectPath createProjectPath(TreePath treePath) {
+            private ConfigurationNode createProjectPath(TreePath treePath) {
                 Object[] path = treePath.getPath();
-                Object[] projectPath = new Object[path.length];
+                ConfigurationNode projectPath = (ConfigurationNode) ((DefaultMutableTreeNode) path[path.length - 1])
+                        .getUserObject();
 
-                for (int i = 0; i < projectPath.length; i++) {
-                    projectPath[i] = ((DefaultMutableTreeNode) path[i]).getUserObject();
-                }
-
-                return new ProjectPath(projectPath);
+                return projectPath;
             }
         };
 
@@ -343,7 +340,9 @@ public class ProjectTreeView extends JTr
         });
     }
 
-    public void currentObjectsChanged(MultipleObjectsDisplayEvent e) {
+    public void currentObjectsChanged(
+            MultipleObjectsDisplayEvent e,
+            Application application) {
     }
 
     public void procedureAdded(ProcedureEvent e) {

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CopyAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CopyAction.java?rev=924267&r1=924266&r2=924267&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CopyAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CopyAction.java Wed Mar 17 13:11:38 2010
@@ -25,6 +25,7 @@ import java.awt.event.KeyEvent;
 
 import javax.swing.KeyStroke;
 
+import org.apache.cayenne.configuration.ConfigurationNode;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
@@ -40,7 +41,6 @@ import org.apache.cayenne.modeler.Applic
 import org.apache.cayenne.modeler.ProjectController;
 import org.apache.cayenne.modeler.util.CayenneAction;
 import org.apache.cayenne.modeler.util.CayenneTransferable;
-import org.apache.cayenne.project.ProjectPath;
 import org.apache.cayenne.query.Query;
 import org.apache.cayenne.util.XMLEncoder;
 import org.apache.cayenne.util.XMLSerializable;
@@ -113,18 +113,17 @@ public class CopyAction extends CayenneA
      * Returns <code>true</code> if last object in the path contains a removable object.
      */
     @Override
-    public boolean enableForPath(ProjectPath path) {
-        if (path == null) {
+    public boolean enableForPath(ConfigurationNode object) {
+        if (object == null) {
             return false;
         }
         
-        Object last = path.getObject();
-        if (last instanceof DataMap || last instanceof Query
-                || last instanceof DbEntity || last instanceof ObjEntity
-                || last instanceof Embeddable || last instanceof EmbeddableAttribute
-                || last instanceof DbAttribute || last instanceof DbRelationship
-                || last instanceof ObjAttribute || last instanceof ObjRelationship
-                || last instanceof Procedure || last instanceof ProcedureParameter) {
+        if (object instanceof DataMap || object instanceof Query
+                || object instanceof DbEntity || object instanceof ObjEntity
+                || object instanceof Embeddable || object instanceof EmbeddableAttribute
+                || object instanceof DbAttribute || object instanceof DbRelationship
+                || object instanceof ObjAttribute || object instanceof ObjRelationship
+                || object instanceof Procedure || object instanceof ProcedureParameter) {
             return true;
         }
 

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CopyAttributeAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CopyAttributeAction.java?rev=924267&r1=924266&r2=924267&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CopyAttributeAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CopyAttributeAction.java Wed Mar 17 13:11:38 2010
@@ -20,11 +20,11 @@ package org.apache.cayenne.modeler.actio
 
 import java.util.Arrays;
 
+import org.apache.cayenne.configuration.ConfigurationNode;
 import org.apache.cayenne.map.Attribute;
 import org.apache.cayenne.map.EmbeddableAttribute;
 import org.apache.cayenne.modeler.Application;
 import org.apache.cayenne.modeler.ProjectController;
-import org.apache.cayenne.project.ProjectPath;
 
 /**
  * Action for copying attribute(s)
@@ -55,13 +55,13 @@ public class CopyAttributeAction extends
      * attribute.
      */
     @Override
-    public boolean enableForPath(ProjectPath path) {
-        if (path == null) {
+    public boolean enableForPath(ConfigurationNode object) {
+        if (object == null) {
             return false;
         }
-        boolean isEnable = path.getObject() instanceof Attribute;
+        boolean isEnable = object instanceof Attribute;
         if (!isEnable) {
-            isEnable = path.getObject() instanceof EmbeddableAttribute;
+            isEnable = object instanceof EmbeddableAttribute;
         }
 
         return isEnable;

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CopyProcedureParameterAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CopyProcedureParameterAction.java?rev=924267&r1=924266&r2=924267&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CopyProcedureParameterAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CopyProcedureParameterAction.java Wed Mar 17 13:11:38 2010
@@ -20,10 +20,10 @@ package org.apache.cayenne.modeler.actio
 
 import java.util.Arrays;
 
+import org.apache.cayenne.configuration.ConfigurationNode;
 import org.apache.cayenne.map.ProcedureParameter;
 import org.apache.cayenne.modeler.Application;
 import org.apache.cayenne.modeler.ProjectController;
-import org.apache.cayenne.project.ProjectPath;
 
 /**
  * Action for copying procedure parameter(s)
@@ -53,12 +53,12 @@ public class CopyProcedureParameterActio
      * attribute.
      */
     @Override
-    public boolean enableForPath(ProjectPath path) {
-        if (path == null) {
+    public boolean enableForPath(ConfigurationNode object) {
+        if (object == null) {
             return false;
         }
 
-        return path.getObject() instanceof ProcedureParameter;
+        return object instanceof ProcedureParameter;
     }
     
     @Override

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CopyRelationshipAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CopyRelationshipAction.java?rev=924267&r1=924266&r2=924267&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CopyRelationshipAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CopyRelationshipAction.java Wed Mar 17 13:11:38 2010
@@ -20,17 +20,18 @@ package org.apache.cayenne.modeler.actio
 
 import java.util.Arrays;
 
+import org.apache.cayenne.configuration.ConfigurationNode;
 import org.apache.cayenne.map.Relationship;
 import org.apache.cayenne.modeler.Application;
 import org.apache.cayenne.modeler.ProjectController;
-import org.apache.cayenne.project.ProjectPath;
 
 /**
  * Action for copying relationship(s)
  */
 public class CopyRelationshipAction extends CopyAction implements MultipleObjectsAction {
+
     private final static String ACTION_NAME = "Copy Relationship";
-    
+
     /**
      * Name of action if multiple attrs are selected
      */
@@ -39,7 +40,7 @@ public class CopyRelationshipAction exte
     public static String getActionName() {
         return ACTION_NAME;
     }
-    
+
     public String getActionName(boolean multiple) {
         return multiple ? ACTION_NAME_MULTIPLE : ACTION_NAME;
     }
@@ -53,25 +54,25 @@ public class CopyRelationshipAction exte
      * attribute.
      */
     @Override
-    public boolean enableForPath(ProjectPath path) {
-        if (path == null) {
+    public boolean enableForPath(ConfigurationNode object) {
+        if (object == null) {
             return false;
         }
 
-        return path.getObject() instanceof Relationship;
+        return object instanceof Relationship;
     }
-    
+
     @Override
     public Object copy(ProjectController mediator) {
         Object[] rels = getProjectController().getCurrentObjRelationships();
         if (rels == null || rels.length == 0) {
             rels = getProjectController().getCurrentDbRelationships();
         }
-        
+
         if (rels != null && rels.length > 0) {
             return Arrays.asList(rels);
         }
-        
+
         return null;
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateAttributeAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateAttributeAction.java?rev=924267&r1=924266&r2=924267&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateAttributeAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateAttributeAction.java Wed Mar 17 13:11:38 2010
@@ -21,7 +21,9 @@ package org.apache.cayenne.modeler.actio
 
 import java.awt.event.ActionEvent;
 
+import org.apache.cayenne.configuration.ConfigurationNode;
 import org.apache.cayenne.configuration.DataChannelDescriptor;
+import org.apache.cayenne.map.Attribute;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
@@ -30,6 +32,7 @@ import org.apache.cayenne.map.Embeddable
 import org.apache.cayenne.map.Entity;
 import org.apache.cayenne.map.ObjAttribute;
 import org.apache.cayenne.map.ObjEntity;
+import org.apache.cayenne.map.Relationship;
 import org.apache.cayenne.map.event.AttributeEvent;
 import org.apache.cayenne.map.event.EmbeddableAttributeEvent;
 import org.apache.cayenne.map.event.MapEvent;
@@ -230,11 +233,15 @@ public class CreateAttributeAction exten
      * Returns <code>true</code> if path contains an Entity object.
      */
     @Override
-    public boolean enableForPath(ProjectPath path) {
-        if (path == null) {
+    public boolean enableForPath(ConfigurationNode object) {
+        if (object == null) {
             return false;
         }
 
-        return path.firstInstanceOf(Entity.class) != null;
+        if(object instanceof Attribute){
+            return ((Attribute)object).getParent() != null && ((Attribute)object).getParent() instanceof Entity;
+        }
+        
+        return false;
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateDataMapAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateDataMapAction.java?rev=924267&r1=924266&r2=924267&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateDataMapAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateDataMapAction.java Wed Mar 17 13:11:38 2010
@@ -21,13 +21,14 @@ package org.apache.cayenne.modeler.actio
 
 import java.awt.event.ActionEvent;
 
+import org.apache.cayenne.configuration.ConfigurationNode;
 import org.apache.cayenne.configuration.DataChannelDescriptor;
+import org.apache.cayenne.configuration.DataNodeDescriptor;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.modeler.Application;
 import org.apache.cayenne.modeler.ProjectController;
 import org.apache.cayenne.modeler.undo.CreateDataMapUndoableEdit;
 import org.apache.cayenne.modeler.util.CayenneAction;
-import org.apache.cayenne.project.ProjectPath;
 import org.apache.cayenne.resource.Resource;
 import org.apache.cayenne.util.NamedObjectFactory;
 
@@ -87,11 +88,11 @@ public class CreateDataMapAction extends
     /**
      * Returns <code>true</code> if path contains a DataDomain object.
      */
-    public boolean enableForPath(ProjectPath path) {
-        if (path == null) {
+    public boolean enableForPath(ConfigurationNode object) {
+        if (object == null) {
             return false;
         }
 
-        return path.firstInstanceOf(DataChannelDescriptor.class) != null;
+        return ((DataNodeDescriptor) object).getDataChannelDescriptor() != null;
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateDbEntityAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateDbEntityAction.java?rev=924267&r1=924266&r2=924267&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateDbEntityAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateDbEntityAction.java Wed Mar 17 13:11:38 2010
@@ -21,9 +21,11 @@ package org.apache.cayenne.modeler.actio
 
 import java.awt.event.ActionEvent;
 
+import org.apache.cayenne.configuration.ConfigurationNode;
 import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.DbEntity;
+import org.apache.cayenne.map.Entity;
 import org.apache.cayenne.map.event.EntityEvent;
 import org.apache.cayenne.map.event.MapEvent;
 import org.apache.cayenne.modeler.Application;
@@ -31,15 +33,12 @@ import org.apache.cayenne.modeler.Projec
 import org.apache.cayenne.modeler.event.EntityDisplayEvent;
 import org.apache.cayenne.modeler.undo.CreateDbEntityUndoableEdit;
 import org.apache.cayenne.modeler.util.CayenneAction;
-import org.apache.cayenne.project.ProjectPath;
 import org.apache.cayenne.util.NamedObjectFactory;
 
 /**
  */
 public class CreateDbEntityAction extends CayenneAction {
 
-    
-
     public static String getActionName() {
         return "Create DbEntity";
     }
@@ -77,8 +76,12 @@ public class CreateDbEntityAction extend
      */
     static void fireDbEntityEvent(Object src, ProjectController mediator, DbEntity entity) {
         mediator.fireDbEntityEvent(new EntityEvent(src, entity, MapEvent.ADD));
-        EntityDisplayEvent displayEvent = new EntityDisplayEvent(src, entity, mediator
-                .getCurrentDataMap(), mediator.getCurrentDataNode(),  (DataChannelDescriptor)mediator.getProject().getRootNode());
+        EntityDisplayEvent displayEvent = new EntityDisplayEvent(
+                src,
+                entity,
+                mediator.getCurrentDataMap(),
+                mediator.getCurrentDataNode(),
+                (DataChannelDescriptor) mediator.getProject().getRootNode());
         displayEvent.setMainTabFocus(true);
         mediator.fireDbEntityDisplayEvent(displayEvent);
     }
@@ -96,11 +99,11 @@ public class CreateDbEntityAction extend
     /**
      * Returns <code>true</code> if path contains a DataMap object.
      */
-    public boolean enableForPath(ProjectPath path) {
-        if (path == null) {
+    public boolean enableForPath(ConfigurationNode object) {
+        if (object == null) {
             return false;
         }
 
-        return path.firstInstanceOf(DataMap.class) != null;
+        return ((Entity) object).getDataMap() != null;
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateEmbeddableAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateEmbeddableAction.java?rev=924267&r1=924266&r2=924267&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateEmbeddableAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateEmbeddableAction.java Wed Mar 17 13:11:38 2010
@@ -20,9 +20,11 @@ package org.apache.cayenne.modeler.actio
 
 import java.awt.event.ActionEvent;
 
+import org.apache.cayenne.configuration.ConfigurationNode;
 import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.Embeddable;
+import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.map.event.EmbeddableEvent;
 import org.apache.cayenne.map.event.MapEvent;
 import org.apache.cayenne.modeler.Application;
@@ -30,7 +32,6 @@ import org.apache.cayenne.modeler.Projec
 import org.apache.cayenne.modeler.event.EmbeddableDisplayEvent;
 import org.apache.cayenne.modeler.undo.CreateEmbeddableUndoableEdit;
 import org.apache.cayenne.modeler.util.CayenneAction;
-import org.apache.cayenne.project.ProjectPath;
 import org.apache.cayenne.util.NamedObjectFactory;
 
 public class CreateEmbeddableAction extends CayenneAction {
@@ -92,11 +93,15 @@ public class CreateEmbeddableAction exte
      * Returns <code>true</code> if path contains a DataMap object.
      */
     @Override
-    public boolean enableForPath(ProjectPath path) {
-        if (path == null) {
+    public boolean enableForPath(ConfigurationNode object) {
+        if (object == null) {
             return false;
         }
 
-        return path.firstInstanceOf(DataMap.class) != null;
+        if(object instanceof ObjEntity){
+            return ((ObjEntity)object).getParent() != null && ((ObjEntity)object).getParent() instanceof DataMap;
+        }
+        
+        return false;
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateNodeAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateNodeAction.java?rev=924267&r1=924266&r2=924267&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateNodeAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateNodeAction.java Wed Mar 17 13:11:38 2010
@@ -22,6 +22,7 @@ package org.apache.cayenne.modeler.actio
 import java.awt.event.ActionEvent;
 
 import org.apache.cayenne.access.dbsync.SkipSchemaUpdateStrategy;
+import org.apache.cayenne.configuration.ConfigurationNode;
 import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.configuration.DataNodeDescriptor;
 import org.apache.cayenne.configuration.XMLPoolingDataSourceFactory;
@@ -33,15 +34,12 @@ import org.apache.cayenne.modeler.Projec
 import org.apache.cayenne.modeler.event.DataNodeDisplayEvent;
 import org.apache.cayenne.modeler.undo.CreateNodeUndoableEdit;
 import org.apache.cayenne.modeler.util.CayenneAction;
-import org.apache.cayenne.project.ProjectPath;
 import org.apache.cayenne.util.NamedObjectFactory;
 
 /**
  */
 public class CreateNodeAction extends CayenneAction {
 
-    
-
     public static String getActionName() {
         return "Create DataNode";
     }
@@ -66,11 +64,13 @@ public class CreateNodeAction extends Ca
         DataNodeDescriptor node = buildDataNode();
         createDataNode(node);
         application.getUndoManager().addEdit(
-                new CreateNodeUndoableEdit(application,node));
+                new CreateNodeUndoableEdit(application, node));
     }
 
     public void createDataNode(DataNodeDescriptor node) {
-        DataChannelDescriptor domain = (DataChannelDescriptor)getProjectController().getProject().getRootNode();
+        DataChannelDescriptor domain = (DataChannelDescriptor) getProjectController()
+                .getProject()
+                .getRootNode();
         domain.getNodeDescriptors().add(node);
         getProjectController().fireDataNodeEvent(
                 new DataNodeEvent(this, node, MapEvent.ADD));
@@ -81,12 +81,12 @@ public class CreateNodeAction extends Ca
     /**
      * Returns <code>true</code> if path contains a DataDomain object.
      */
-    public boolean enableForPath(ProjectPath path) {
-        if (path == null) {
+    public boolean enableForPath(ConfigurationNode object) {
+        if (object == null) {
             return false;
         }
 
-        return path.firstInstanceOf(DataChannelDescriptor.class) != null;
+        return ((DataNodeDescriptor) object).getDataChannelDescriptor() != null;
     }
 
     /**
@@ -94,15 +94,17 @@ public class CreateNodeAction extends Ca
      */
     public DataNodeDescriptor buildDataNode() {
         ProjectController mediator = getProjectController();
-        DataChannelDescriptor domain =  (DataChannelDescriptor)mediator.getProject().getRootNode();
+        DataChannelDescriptor domain = (DataChannelDescriptor) mediator
+                .getProject()
+                .getRootNode();
 
         // use domain name as DataNode base, as node names must be unique across the
         // project...
-        DataNodeDescriptor node =  buildDataNode(domain);
+        DataNodeDescriptor node = buildDataNode(domain);
 
         DataSourceInfo src = new DataSourceInfo();
         node.setDataSourceDescriptor(src);
-        
+
         // by default create JDBC Node
         node.setDataSourceFactoryType(XMLPoolingDataSourceFactory.class.getName());
         node.setSchemaUpdateStrategyType(SkipSchemaUpdateStrategy.class.getName());
@@ -114,13 +116,14 @@ public class CreateNodeAction extends Ca
      * A factory method that makes a new DataNode.
      */
     DataNodeDescriptor buildDataNode(DataChannelDescriptor domain) {
-        String name = NamedObjectFactory.createName(DataNodeDescriptor.class, domain, domain
-                .getName()
-                + "Node");
+        String name = NamedObjectFactory.createName(
+                DataNodeDescriptor.class,
+                domain,
+                domain.getName() + "Node");
 
         DataNodeDescriptor node = new DataNodeDescriptor(name);
         node.setDataChannelDescriptor(domain);
-       
+
         return node;
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateObjEntityAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateObjEntityAction.java?rev=924267&r1=924266&r2=924267&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateObjEntityAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateObjEntityAction.java Wed Mar 17 13:11:38 2010
@@ -21,6 +21,7 @@ package org.apache.cayenne.modeler.actio
 
 import java.awt.event.ActionEvent;
 
+import org.apache.cayenne.configuration.ConfigurationNode;
 import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.DbEntity;
@@ -32,7 +33,6 @@ import org.apache.cayenne.modeler.Projec
 import org.apache.cayenne.modeler.event.EntityDisplayEvent;
 import org.apache.cayenne.modeler.undo.CreateObjEntityUndoableEdit;
 import org.apache.cayenne.modeler.util.CayenneAction;
-import org.apache.cayenne.project.ProjectPath;
 import org.apache.cayenne.util.DeleteRuleUpdater;
 import org.apache.cayenne.util.EntityMergeSupport;
 import org.apache.cayenne.util.NameConverter;
@@ -42,8 +42,6 @@ import org.apache.cayenne.util.NamedObje
  */
 public class CreateObjEntityAction extends CayenneAction {
 
-    
-
     public static String getActionName() {
         return "Create ObjEntity";
     }
@@ -144,7 +142,7 @@ public class CreateObjEntityAction exten
                 entity,
                 dataMap,
                 mediator.getCurrentDataNode(),
-                (DataChannelDescriptor)mediator.getProject().getRootNode());
+                (DataChannelDescriptor) mediator.getProject().getRootNode());
         displayEvent.setMainTabFocus(true);
         mediator.fireObjEntityDisplayEvent(displayEvent);
     }
@@ -153,11 +151,16 @@ public class CreateObjEntityAction exten
      * Returns <code>true</code> if path contains a DataMap object.
      */
     @Override
-    public boolean enableForPath(ProjectPath path) {
-        if (path == null) {
+    public boolean enableForPath(ConfigurationNode object) {
+        if (object == null) {
             return false;
         }
 
-        return path.firstInstanceOf(DataMap.class) != null;
+        if (object instanceof ObjEntity) {
+            return ((ObjEntity) object).getParent() != null
+                    && ((ObjEntity) object).getParent() instanceof DataMap;
+        }
+
+        return false;
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateProcedureAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateProcedureAction.java?rev=924267&r1=924266&r2=924267&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateProcedureAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateProcedureAction.java Wed Mar 17 13:11:38 2010
@@ -21,6 +21,7 @@ package org.apache.cayenne.modeler.actio
 
 import java.awt.event.ActionEvent;
 
+import org.apache.cayenne.configuration.ConfigurationNode;
 import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.configuration.event.ProcedureEvent;
 import org.apache.cayenne.map.DataMap;
@@ -31,7 +32,6 @@ import org.apache.cayenne.modeler.Projec
 import org.apache.cayenne.modeler.event.ProcedureDisplayEvent;
 import org.apache.cayenne.modeler.undo.CreateProcedureUndoableEdit;
 import org.apache.cayenne.modeler.util.CayenneAction;
-import org.apache.cayenne.project.ProjectPath;
 import org.apache.cayenne.util.NamedObjectFactory;
 
 /**
@@ -40,8 +40,6 @@ import org.apache.cayenne.util.NamedObje
  */
 public class CreateProcedureAction extends CayenneAction {
 
-    
-
     public static String getActionName() {
         return "Create Stored Procedure";
     }
@@ -77,7 +75,7 @@ public class CreateProcedureAction exten
                 src,
                 procedure,
                 mediator.getCurrentDataMap(),
-                (DataChannelDescriptor)mediator.getProject().getRootNode()));
+                (DataChannelDescriptor) mediator.getProject().getRootNode()));
     }
 
     public void createProcedure(DataMap map, Procedure procedure) {
@@ -90,12 +88,12 @@ public class CreateProcedureAction exten
     /**
      * Returns <code>true</code> if path contains a DataMap object.
      */
-    public boolean enableForPath(ProjectPath path) {
-        if (path == null) {
+    public boolean enableForPath(ConfigurationNode object) {
+        if (object == null) {
             return false;
         }
 
-        return path.firstInstanceOf(DataMap.class) != null;
+        return ((Procedure) object).getDataMap() != null;
     }
 
     public String getIconName() {

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateProcedureParameterAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateProcedureParameterAction.java?rev=924267&r1=924266&r2=924267&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateProcedureParameterAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateProcedureParameterAction.java Wed Mar 17 13:11:38 2010
@@ -21,6 +21,7 @@ package org.apache.cayenne.modeler.actio
 
 import java.awt.event.ActionEvent;
 
+import org.apache.cayenne.configuration.ConfigurationNode;
 import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.configuration.event.ProcedureParameterEvent;
 import org.apache.cayenne.map.Procedure;
@@ -30,21 +31,19 @@ import org.apache.cayenne.modeler.Applic
 import org.apache.cayenne.modeler.ProjectController;
 import org.apache.cayenne.modeler.event.ProcedureParameterDisplayEvent;
 import org.apache.cayenne.modeler.util.CayenneAction;
-import org.apache.cayenne.project.ProjectPath;
 import org.apache.cayenne.util.NamedObjectFactory;
 
 /**
  */
 public class CreateProcedureParameterAction extends CayenneAction {
 
-    
-
     public static String getActionName() {
-    	return "Create Parameter";
+        return "Create Parameter";
     }
 
     /**
      * Constructor for CreateProcedureParameterAction.
+     * 
      * @param name
      */
     public CreateProcedureParameterAction(Application application) {
@@ -67,42 +66,44 @@ public class CreateProcedureParameterAct
     public void createProcedureParameter() {
         Procedure procedure = getProjectController().getCurrentProcedure();
 
-        ProcedureParameter parameter =
-            (ProcedureParameter) NamedObjectFactory.createObject(
-                ProcedureParameter.class,
-                procedure);
-                
+        ProcedureParameter parameter = (ProcedureParameter) NamedObjectFactory
+                .createObject(ProcedureParameter.class, procedure);
+
         procedure.addCallParameter(parameter);
 
         ProjectController mediator = getProjectController();
         fireProcedureParameterEvent(this, mediator, procedure, parameter);
     }
-    
+
     /**
      * Fires events when an proc parameter was added
      */
-    static void fireProcedureParameterEvent(Object src, ProjectController mediator, Procedure procedure, 
+    static void fireProcedureParameterEvent(
+            Object src,
+            ProjectController mediator,
+            Procedure procedure,
             ProcedureParameter parameter) {
-        mediator.fireProcedureParameterEvent(
-                new ProcedureParameterEvent(src, parameter, MapEvent.ADD));
-
-            mediator.fireProcedureParameterDisplayEvent(
-                new ProcedureParameterDisplayEvent(
-                    src,
-                    parameter,
-                    procedure,
-                    mediator.getCurrentDataMap(),
-                    (DataChannelDescriptor)mediator.getProject().getRootNode()));
+        mediator.fireProcedureParameterEvent(new ProcedureParameterEvent(
+                src,
+                parameter,
+                MapEvent.ADD));
+
+        mediator.fireProcedureParameterDisplayEvent(new ProcedureParameterDisplayEvent(
+                src,
+                parameter,
+                procedure,
+                mediator.getCurrentDataMap(),
+                (DataChannelDescriptor) mediator.getProject().getRootNode()));
     }
 
     /**
      * Returns <code>true</code> if path contains a Procedure object.
      */
-    public boolean enableForPath(ProjectPath path) {
-        if (path == null) {
+    public boolean enableForPath(ConfigurationNode object) {
+        if (object == null) {
             return false;
         }
 
-        return path.firstInstanceOf(Procedure.class) != null;
+        return ((ProcedureParameter) object).getProcedure() != null;
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateRelationshipAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateRelationshipAction.java?rev=924267&r1=924266&r2=924267&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateRelationshipAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateRelationshipAction.java Wed Mar 17 13:11:38 2010
@@ -21,12 +21,14 @@ package org.apache.cayenne.modeler.actio
 
 import java.awt.event.ActionEvent;
 
+import org.apache.cayenne.configuration.ConfigurationNode;
 import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.DbRelationship;
 import org.apache.cayenne.map.Entity;
 import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.map.ObjRelationship;
+import org.apache.cayenne.map.Relationship;
 import org.apache.cayenne.map.event.MapEvent;
 import org.apache.cayenne.map.event.RelationshipEvent;
 import org.apache.cayenne.modeler.Application;
@@ -34,7 +36,6 @@ import org.apache.cayenne.modeler.Projec
 import org.apache.cayenne.modeler.event.RelationshipDisplayEvent;
 import org.apache.cayenne.modeler.undo.CreateRelationshipUndoableEdit;
 import org.apache.cayenne.modeler.util.CayenneAction;
-import org.apache.cayenne.project.ProjectPath;
 import org.apache.cayenne.util.DeleteRuleUpdater;
 import org.apache.cayenne.util.NamedObjectFactory;
 
@@ -42,8 +43,6 @@ import org.apache.cayenne.util.NamedObje
  */
 public class CreateRelationshipAction extends CayenneAction {
 
-    
-
     public static String getActionName() {
         return "Create Relationship";
     }
@@ -127,7 +126,7 @@ public class CreateRelationshipAction ex
                 rel,
                 objEntity,
                 mediator.getCurrentDataMap(),
-                (DataChannelDescriptor)mediator.getProject().getRootNode());
+                (DataChannelDescriptor) mediator.getProject().getRootNode());
 
         mediator.fireObjRelationshipDisplayEvent(rde);
     }
@@ -161,7 +160,7 @@ public class CreateRelationshipAction ex
                 rel,
                 dbEntity,
                 mediator.getCurrentDataMap(),
-                (DataChannelDescriptor)mediator.getProject().getRootNode());
+                (DataChannelDescriptor) mediator.getProject().getRootNode());
 
         mediator.fireDbRelationshipDisplayEvent(rde);
     }
@@ -170,11 +169,16 @@ public class CreateRelationshipAction ex
      * Returns <code>true</code> if path contains an Entity object.
      */
     @Override
-    public boolean enableForPath(ProjectPath path) {
-        if (path == null) {
+    public boolean enableForPath(ConfigurationNode object) {
+        if (object == null) {
             return false;
         }
 
-        return path.firstInstanceOf(Entity.class) != null;
+        if (object instanceof Relationship) {
+            return ((Relationship) object).getParent() != null
+                    && ((Relationship) object).getParent() instanceof Entity;
+        }
+
+        return false;
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CutAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CutAction.java?rev=924267&r1=924266&r2=924267&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CutAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CutAction.java Wed Mar 17 13:11:38 2010
@@ -24,14 +24,15 @@ import java.awt.event.KeyEvent;
 
 import javax.swing.KeyStroke;
 
+import org.apache.cayenne.configuration.ConfigurationNode;
 import org.apache.cayenne.modeler.Application;
 import org.apache.cayenne.modeler.util.CayenneAction;
-import org.apache.cayenne.project.ProjectPath;
 
 /**
  * Action for cutting entities, queries etc.
  */
 public class CutAction extends CayenneAction {
+
     public static String getActionName() {
         return "Cut";
     }
@@ -42,7 +43,7 @@ public class CutAction extends CayenneAc
     public CutAction(Application application) {
         this(getActionName(), application);
     }
-    
+
     /**
      * Constructor for descendants
      */
@@ -54,10 +55,12 @@ public class CutAction extends CayenneAc
     public String getIconName() {
         return "icon-cut.gif";
     }
-    
+
     @Override
     public KeyStroke getAcceleratorKey() {
-        return KeyStroke.getKeyStroke(KeyEvent.VK_X, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
+        return KeyStroke.getKeyStroke(KeyEvent.VK_X, Toolkit
+                .getDefaultToolkit()
+                .getMenuShortcutKeyMask());
     }
 
     /**
@@ -66,14 +69,15 @@ public class CutAction extends CayenneAc
     @Override
     public void performAction(ActionEvent e) {
         application.getAction(CopyAction.getActionName()).performAction(e);
-        ((RemoveAction) application.getAction(RemoveAction.getActionName())).performAction(e, false);
+        ((RemoveAction) application.getAction(RemoveAction.getActionName()))
+                .performAction(e, false);
     }
-    
+
     /**
      * Returns <code>true</code> if last object in the path contains a removable object.
      */
     @Override
-    public boolean enableForPath(ProjectPath path) {
-        return application.getAction(CopyAction.getActionName()).enableForPath(path);
+    public boolean enableForPath(ConfigurationNode object) {
+        return application.getAction(CopyAction.getActionName()).enableForPath(object);
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CutAttributeAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CutAttributeAction.java?rev=924267&r1=924266&r2=924267&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CutAttributeAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CutAttributeAction.java Wed Mar 17 13:11:38 2010
@@ -20,10 +20,10 @@ package org.apache.cayenne.modeler.actio
 
 import java.awt.event.ActionEvent;
 
+import org.apache.cayenne.configuration.ConfigurationNode;
 import org.apache.cayenne.map.Attribute;
 import org.apache.cayenne.map.EmbeddableAttribute;
 import org.apache.cayenne.modeler.Application;
-import org.apache.cayenne.project.ProjectPath;
 
 /**
  * Action for cutting attribute(s)
@@ -54,13 +54,13 @@ public class CutAttributeAction extends 
      * attribute.
      */
     @Override
-    public boolean enableForPath(ProjectPath path) {
-        if (path == null) {
+    public boolean enableForPath(ConfigurationNode object) {
+        if (object == null) {
             return false;
         }
-        boolean isEnable = path.getObject() instanceof Attribute;
+        boolean isEnable = object instanceof Attribute;
         if (!isEnable) {
-            isEnable = path.getObject() instanceof EmbeddableAttribute;
+            isEnable = object instanceof EmbeddableAttribute;
         }
 
         return isEnable;

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CutProcedureParameterAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CutProcedureParameterAction.java?rev=924267&r1=924266&r2=924267&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CutProcedureParameterAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CutProcedureParameterAction.java Wed Mar 17 13:11:38 2010
@@ -20,16 +20,18 @@ package org.apache.cayenne.modeler.actio
 
 import java.awt.event.ActionEvent;
 
+import org.apache.cayenne.configuration.ConfigurationNode;
 import org.apache.cayenne.map.ProcedureParameter;
 import org.apache.cayenne.modeler.Application;
-import org.apache.cayenne.project.ProjectPath;
 
 /**
  * Action for cutting procedure parameter(s)
  */
-public class CutProcedureParameterAction extends CutAction implements MultipleObjectsAction {
+public class CutProcedureParameterAction extends CutAction implements
+        MultipleObjectsAction {
+
     private final static String ACTION_NAME = "Cut Procedure Parameter";
-    
+
     /**
      * Name of action if multiple attrs are selected
      */
@@ -38,7 +40,7 @@ public class CutProcedureParameterAction
     public static String getActionName() {
         return ACTION_NAME;
     }
-    
+
     public String getActionName(boolean multiple) {
         return multiple ? ACTION_NAME_MULTIPLE : ACTION_NAME;
     }
@@ -52,21 +54,23 @@ public class CutProcedureParameterAction
      * attribute.
      */
     @Override
-    public boolean enableForPath(ProjectPath path) {
-        if (path == null) {
+    public boolean enableForPath(ConfigurationNode object) {
+        if (object == null) {
             return false;
         }
 
-        return path.getObject() instanceof ProcedureParameter;
+        return object instanceof ProcedureParameter;
     }
-    
+
     /**
      * Performs cutting of items
      */
     @Override
     public void performAction(ActionEvent e) {
-        application.getAction(CopyProcedureParameterAction.getActionName()).performAction(e);
-        ((RemoveAction) application.getAction(RemoveProcedureParameterAction.getActionName()))
-            .performAction(e, false);
+        application
+                .getAction(CopyProcedureParameterAction.getActionName())
+                .performAction(e);
+        ((RemoveAction) application.getAction(RemoveProcedureParameterAction
+                .getActionName())).performAction(e, false);
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CutRelationshipAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CutRelationshipAction.java?rev=924267&r1=924266&r2=924267&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CutRelationshipAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CutRelationshipAction.java Wed Mar 17 13:11:38 2010
@@ -20,16 +20,17 @@ package org.apache.cayenne.modeler.actio
 
 import java.awt.event.ActionEvent;
 
+import org.apache.cayenne.configuration.ConfigurationNode;
 import org.apache.cayenne.map.Relationship;
 import org.apache.cayenne.modeler.Application;
-import org.apache.cayenne.project.ProjectPath;
 
 /**
  * Action for cutting attribute(s)
  */
 public class CutRelationshipAction extends CutAction implements MultipleObjectsAction {
+
     private final static String ACTION_NAME = "Cut Relationship";
-    
+
     /**
      * Name of action if multiple attrs are selected
      */
@@ -38,7 +39,7 @@ public class CutRelationshipAction exten
     public static String getActionName() {
         return ACTION_NAME;
     }
-    
+
     public String getActionName(boolean multiple) {
         return multiple ? ACTION_NAME_MULTIPLE : ACTION_NAME;
     }
@@ -52,20 +53,21 @@ public class CutRelationshipAction exten
      * attribute.
      */
     @Override
-    public boolean enableForPath(ProjectPath path) {
-        if (path == null) {
+    public boolean enableForPath(ConfigurationNode object) {
+        if (object == null) {
             return false;
         }
 
-        return path.getObject() instanceof Relationship;
+        return object instanceof Relationship;
     }
-    
+
     /**
      * Performs cutting of items
      */
     @Override
     public void performAction(ActionEvent e) {
         application.getAction(CopyRelationshipAction.getActionName()).performAction(e);
-        ((RemoveAction) application.getAction(RemoveRelationshipAction.getActionName())).performAction(e, false);
+        ((RemoveAction) application.getAction(RemoveRelationshipAction.getActionName()))
+                .performAction(e, false);
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/DbEntitySyncAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/DbEntitySyncAction.java?rev=924267&r1=924266&r2=924267&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/DbEntitySyncAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/DbEntitySyncAction.java Wed Mar 17 13:11:38 2010
@@ -32,7 +32,6 @@ import org.apache.cayenne.modeler.Projec
 import org.apache.cayenne.modeler.dialog.objentity.EntitySyncController;
 import org.apache.cayenne.modeler.undo.DbEntitySyncUndoableEdit;
 import org.apache.cayenne.modeler.util.CayenneAction;
-import org.apache.cayenne.project.ProjectPath;
 import org.apache.cayenne.util.EntityMergeSupport;
 
 /**
@@ -111,15 +110,4 @@ public class DbEntitySyncAction extends 
             application.getUndoManager().addEdit(undoableEdit);
         }
     }
-
-    /**
-     * Returns <code>true</code> if path contains a ObjEntity object.
-     */
-    public boolean enableForPath(ProjectPath path) {
-        if (path == null) {
-            return false;
-        }
-
-        return path.firstInstanceOf(DbEntity.class) != null;
-    }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ExitAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ExitAction.java?rev=924267&r1=924266&r2=924267&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ExitAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ExitAction.java Wed Mar 17 13:11:38 2010
@@ -19,10 +19,10 @@
 
 package org.apache.cayenne.modeler.action;
 
+import org.apache.cayenne.configuration.ConfigurationNode;
 import org.apache.cayenne.modeler.Application;
 import org.apache.cayenne.modeler.dialog.LogConsole;
 import org.apache.cayenne.pref.RenamedPreferences;
-import org.apache.cayenne.project.ProjectPath;
 
 import java.awt.event.ActionEvent;
 
@@ -62,7 +62,7 @@ public class ExitAction extends ProjectA
     /**
     * Always returns true.
     */
-    public boolean enableForPath(ProjectPath path) {
+    public boolean enableForPath(ConfigurationNode object) {
         return true;
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/GenerateCodeAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/GenerateCodeAction.java?rev=924267&r1=924266&r2=924267&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/GenerateCodeAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/GenerateCodeAction.java Wed Mar 17 13:11:38 2010
@@ -25,7 +25,6 @@ import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.modeler.Application;
 import org.apache.cayenne.modeler.dialog.codegen.CodeGeneratorController;
 import org.apache.cayenne.modeler.util.CayenneAction;
-import org.apache.cayenne.project.ProjectPath;
 
 public class GenerateCodeAction extends CayenneAction {
 
@@ -48,15 +47,4 @@ public class GenerateCodeAction extends 
                     .startup();
         }
     }
-
-    /**
-     * Returns <code>true</code> if path contains a DataMap object.
-     */
-    public boolean enableForPath(ProjectPath path) {
-        if (path == null) {
-            return false;
-        }
-
-        return path.firstInstanceOf(DataMap.class) != null;
-    }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/GenerateDBAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/GenerateDBAction.java?rev=924267&r1=924266&r2=924267&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/GenerateDBAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/GenerateDBAction.java Wed Mar 17 13:11:38 2010
@@ -26,7 +26,6 @@ import org.apache.cayenne.modeler.Applic
 import org.apache.cayenne.modeler.dialog.db.DBGeneratorOptions;
 import org.apache.cayenne.modeler.dialog.db.DataSourceWizard;
 import org.apache.cayenne.modeler.pref.DBConnectionInfo;
-import org.apache.cayenne.project.ProjectPath;
 
 /**
  * Action that generates database tables from a DataMap.
@@ -71,15 +70,4 @@ public class GenerateDBAction extends DB
                 connectWizard.getConnectionInfo(),
                 map).startupAction();
     }
-
-    /**
-     * Returns <code>true</code> if path contains a DataMap object.
-     */
-    public boolean enableForPath(ProjectPath path) {
-        if (path == null) {
-            return false;
-        }
-
-        return path.firstInstanceOf(DataMap.class) != null;
-    }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ImportDBAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ImportDBAction.java?rev=924267&r1=924266&r2=924267&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ImportDBAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ImportDBAction.java Wed Mar 17 13:11:38 2010
@@ -24,13 +24,11 @@ import java.sql.Connection;
 
 import javax.swing.SwingUtilities;
 
-import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.dba.DbAdapter;
 import org.apache.cayenne.modeler.Application;
 import org.apache.cayenne.modeler.dialog.db.ConnectionWizard;
 import org.apache.cayenne.modeler.dialog.db.DbLoaderHelper;
 import org.apache.cayenne.modeler.pref.DBConnectionInfo;
-import org.apache.cayenne.project.ProjectPath;
 
 /**
  * Action that imports database structure into a DataMap.
@@ -95,15 +93,4 @@ public class ImportDBAction extends DBWi
         
         th.start();
     }
-
-    /**
-     * Returns <code>true</code> if path contains a DataDomain object.
-     */
-    public boolean enableForPath(ProjectPath path) {
-        if (path == null) {
-            return false;
-        }
-
-        return path.firstInstanceOf(DataChannelDescriptor.class) != null;
-    }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ImportEOModelAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ImportEOModelAction.java?rev=924267&r1=924266&r2=924267&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ImportEOModelAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ImportEOModelAction.java Wed Mar 17 13:11:38 2010
@@ -53,7 +53,6 @@ import org.apache.cayenne.modeler.pref.F
 import org.apache.cayenne.modeler.util.AdapterMapping;
 import org.apache.cayenne.modeler.util.CayenneAction;
 import org.apache.cayenne.modeler.util.FileFilters;
-import org.apache.cayenne.project.ProjectPath;
 import org.apache.cayenne.query.Query;
 import org.apache.cayenne.util.NamedObjectFactory;
 import org.apache.cayenne.wocompat.EOModelProcessor;
@@ -199,17 +198,6 @@ public class ImportEOModelAction extends
     }
 
     /**
-     * Returns <code>true</code> if path contains a DataDomain object.
-     */
-    public boolean enableForPath(ProjectPath path) {
-        if (path == null) {
-            return false;
-        }
-
-        return path.firstInstanceOf(DataChannelDescriptor.class) != null;
-    }
-
-    /**
      * Adds DataMap into the project.
      */
     protected void addDataMap(DataMap map, DataMap currentMap) {

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/InferRelationshipsAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/InferRelationshipsAction.java?rev=924267&r1=924266&r2=924267&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/InferRelationshipsAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/InferRelationshipsAction.java Wed Mar 17 13:11:38 2010
@@ -24,7 +24,6 @@ import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.modeler.Application;
 import org.apache.cayenne.modeler.dialog.autorelationship.InferRelationshipsController;
 import org.apache.cayenne.modeler.util.CayenneAction;
-import org.apache.cayenne.project.ProjectPath;
 
 
 public class InferRelationshipsAction extends CayenneAction {
@@ -48,13 +47,4 @@ public class InferRelationshipsAction ex
                     .startup();
         }
     }
-    
-    public boolean enableForPath(ProjectPath path) {
-        if (path == null) {
-            return false;
-        }
-
-        return path.firstInstanceOf(DataMap.class) != null;
-    }
-
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/MigrateAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/MigrateAction.java?rev=924267&r1=924266&r2=924267&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/MigrateAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/MigrateAction.java Wed Mar 17 13:11:38 2010
@@ -26,7 +26,6 @@ import org.apache.cayenne.modeler.Applic
 import org.apache.cayenne.modeler.dialog.db.DataSourceWizard;
 import org.apache.cayenne.modeler.dialog.db.MergerOptions;
 import org.apache.cayenne.modeler.pref.DBConnectionInfo;
-import org.apache.cayenne.project.ProjectPath;
 
 /**
  * Action that alter database schema to match a DataMap.
@@ -71,15 +70,4 @@ public class MigrateAction extends DBWiz
                 connectWizard.getConnectionInfo(),
                 map).startupAction();
     }
-
-    /**
-     * Returns <code>true</code> if path contains a DataMap object.
-     */
-    public boolean enableForPath(ProjectPath path) {
-        if (path == null) {
-            return false;
-        }
-
-        return path.firstInstanceOf(DataMap.class) != null;
-    }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ObjEntitySyncAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ObjEntitySyncAction.java?rev=924267&r1=924266&r2=924267&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ObjEntitySyncAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ObjEntitySyncAction.java Wed Mar 17 13:11:38 2010
@@ -34,7 +34,6 @@ import org.apache.cayenne.modeler.Projec
 import org.apache.cayenne.modeler.dialog.objentity.EntitySyncController;
 import org.apache.cayenne.modeler.event.EntityDisplayEvent;
 import org.apache.cayenne.modeler.util.CayenneAction;
-import org.apache.cayenne.project.ProjectPath;
 import org.apache.cayenne.util.EntityMergeSupport;
 
 /**
@@ -93,15 +92,4 @@ public class ObjEntitySyncAction extends
             }
         }
     }
-
-    /**
-     * Returns <code>true</code> if path contains a ObjEntity object.
-     */
-    public boolean enableForPath(ProjectPath path) {
-        if (path == null) {
-            return false;
-        }
-
-        return path.firstInstanceOf(ObjEntity.class) != null;
-    }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/PasteAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/PasteAction.java?rev=924267&r1=924266&r2=924267&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/PasteAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/PasteAction.java Wed Mar 17 13:11:38 2010
@@ -31,6 +31,7 @@ import java.util.Map;
 import javax.swing.JOptionPane;
 import javax.swing.KeyStroke;
 
+import org.apache.cayenne.configuration.ConfigurationNode;
 import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.configuration.DataNodeDescriptor;
 import org.apache.cayenne.map.DataMap;
@@ -52,7 +53,6 @@ import org.apache.cayenne.modeler.undo.P
 import org.apache.cayenne.modeler.undo.PasteUndoableEdit;
 import org.apache.cayenne.modeler.util.CayenneAction;
 import org.apache.cayenne.modeler.util.CayenneTransferable;
-import org.apache.cayenne.project.ProjectPath;
 import org.apache.cayenne.query.AbstractQuery;
 import org.apache.cayenne.query.Query;
 
@@ -102,23 +102,33 @@ public class PasteAction extends Cayenne
             Object currentObject = getProjectController().getCurrentObject();
 
             if (content != null && currentObject != null) {
-                
+
                 PasteCompoundUndoableEdit undoableEdit = new PasteCompoundUndoableEdit();
-                
-                DataChannelDescriptor domain = (DataChannelDescriptor)getProjectController().getProject().getRootNode();
+
+                DataChannelDescriptor domain = (DataChannelDescriptor) getProjectController()
+                        .getProject()
+                        .getRootNode();
                 DataMap map = getProjectController().getCurrentDataMap();
-                
+
                 if (content instanceof List) {
                     for (Object o : (List) content) {
                         paste(currentObject, o);
-                        undoableEdit.addEdit(new PasteUndoableEdit(domain, map, currentObject, o));
+                        undoableEdit.addEdit(new PasteUndoableEdit(
+                                domain,
+                                map,
+                                currentObject,
+                                o));
                     }
                 }
                 else {
                     paste(currentObject, content);
-                    undoableEdit.addEdit(new PasteUndoableEdit(domain, map, currentObject, content));
+                    undoableEdit.addEdit(new PasteUndoableEdit(
+                            domain,
+                            map,
+                            currentObject,
+                            content));
                 }
-                
+
                 application.getUndoManager().addEdit(undoableEdit);
             }
         }
@@ -129,17 +139,22 @@ public class PasteAction extends Cayenne
             ErrorDebugDialog.guiException(ex);
         }
     }
-    
+
     private void paste(Object where, Object content) {
-    	paste(where, content, (DataChannelDescriptor)getProjectController().getProject().getRootNode(), getProjectController().getCurrentDataMap()); 
+        paste(where, content, (DataChannelDescriptor) getProjectController()
+                .getProject()
+                .getRootNode(), getProjectController().getCurrentDataMap());
     }
 
     /**
      * Pastes single object
      */
-    public void paste(Object where, Object content, DataChannelDescriptor domain, DataMap map) {
+    public void paste(
+            Object where,
+            Object content,
+            DataChannelDescriptor domain,
+            DataMap map) {
         final ProjectController mediator = getProjectController();
-      
 
         /**
          * Add a little intelligence - if a tree leaf is selected, we can paste to a
@@ -346,8 +361,8 @@ public class PasteAction extends Cayenne
                 attr.setName(getFreeName(checker, attr.getName()));
 
                 dbEntity.addAttribute(attr);
-                CreateAttributeAction
-                        .fireDbAttributeEvent(this, mediator, mediator.getCurrentDataMap(), dbEntity, attr);
+                CreateAttributeAction.fireDbAttributeEvent(this, mediator, mediator
+                        .getCurrentDataMap(), dbEntity, attr);
             }
             else if (content instanceof DbRelationship) {
                 DbRelationship rel = (DbRelationship) content;
@@ -378,12 +393,8 @@ public class PasteAction extends Cayenne
                 attr.setName(getFreeName(checker, attr.getName()));
 
                 objEntity.addAttribute(attr);
-                CreateAttributeAction.fireObjAttributeEvent(
-                        this,
-                        mediator,
-                        mediator.getCurrentDataMap(),
-                        objEntity,
-                        attr);
+                CreateAttributeAction.fireObjAttributeEvent(this, mediator, mediator
+                        .getCurrentDataMap(), objEntity, attr);
             }
             else if (content instanceof ObjRelationship) {
                 ObjRelationship rel = (ObjRelationship) content;
@@ -473,8 +484,8 @@ public class PasteAction extends Cayenne
      * Returns <code>true</code> if last object in the path contains a removable object.
      */
     @Override
-    public boolean enableForPath(ProjectPath path) {
-        if (path == null) {
+    public boolean enableForPath(ConfigurationNode object) {
+        if (object == null) {
             return false;
         }
 
@@ -524,8 +535,8 @@ public class PasteAction extends Cayenne
                             || content instanceof ObjRelationship || isTreeLeaf(content)))
                     ||
 
-                    (currentObject instanceof Embeddable 
-                            && (content instanceof EmbeddableAttribute || isTreeLeaf(content))) ||
+                    (currentObject instanceof Embeddable && (content instanceof EmbeddableAttribute || isTreeLeaf(content)))
+                    ||
 
                     (currentObject instanceof Procedure
                             && (content instanceof ProcedureParameter || isTreeLeaf(content)) ||

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ProjectAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ProjectAction.java?rev=924267&r1=924266&r2=924267&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ProjectAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ProjectAction.java Wed Mar 17 13:11:38 2010
@@ -26,7 +26,6 @@ import org.apache.cayenne.modeler.Cayenn
 import org.apache.cayenne.modeler.ProjectController;
 import org.apache.cayenne.modeler.dialog.UnsavedChangesDialog;
 import org.apache.cayenne.modeler.util.CayenneAction;
-import org.apache.cayenne.project.ProjectPath;
 
 /**
  */
@@ -115,7 +114,7 @@ public class ProjectAction extends Cayen
     /**
      * Always returns true.
      */
-    public boolean enableForPath(ProjectPath path) {
+    public boolean enableForPath(Object object) {
         return true;
     }
 }



Mime
View raw message