cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmen...@apache.org
Subject svn commit: r701839 [1/2] - in /cayenne/main/trunk: docs/doc/src/main/resources/ framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/ framework/cayenne-...
Date Sun, 05 Oct 2008 18:07:18 GMT
Author: kmenard
Date: Sun Oct  5 11:07:16 2008
New Revision: 701839

URL: http://svn.apache.org/viewvc?rev=701839&view=rev
Log:
Fixed CAY-1080: Support for copy/paste of entities/attributes/relationships

Patch by Andrey Razumovsky.

Added:
    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/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/MultipleObjectsAction.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/util/CayenneTransferable.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/resources/org/apache/cayenne/modeler/images/icon-copy.gif   (with props)
    cayenne/main/trunk/framework/cayenne-modeler/src/main/resources/org/apache/cayenne/modeler/images/icon-cut.gif   (with props)
    cayenne/main/trunk/framework/cayenne-modeler/src/main/resources/org/apache/cayenne/modeler/images/icon-paste.gif   (with props)
Modified:
    cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataNode.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/ExpressionParameter.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DbJoin.java
    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/AbstractRemoveCallbackMethodAction.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/CreateDbEntityAction.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/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/RemoveEntityListenerAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveEntityListenerForDataMapAction.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/dialog/ConfirmRemoveDialog.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/query/QueryTypeController.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjEntityAttributeTab.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjEntityRelationshipTab.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ProcedureParameterTab.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbentity/DbEntityAttributeTab.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbentity/DbEntityRelationshipTab.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/ModelerUtil.java

Modified: cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt?rev=701839&r1=701838&r2=701839&view=diff
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt (original)
+++ cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt Sun Oct  5 11:07:16 2008
@@ -30,6 +30,7 @@
 CAY-1061 ResourceFinder: abstract API for looking up resources, including multiple resources for a given name
 CAY-1068 Add support for start index/offset of queries
 CAY-1070 Generating SelectQuery Access Code
+CAY-1080 Support for copy/paste of entities/attributes/relationships
 CAY-1085 Use standard JDBC API for writing Oracle LOBs
 CAY-1091 Upgrade to Hessian 3.1.6
 CAY-1094 CM DataNode panel reorg - pull the password encoding options into a tab

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataNode.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataNode.java?rev=701839&r1=701838&r2=701839&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataNode.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataNode.java Sun Oct  5 11:07:16 2008
@@ -118,6 +118,13 @@
     public Collection<DataMap> getDataMaps() {
         return Collections.unmodifiableCollection(dataMaps.values());
     }
+    
+    /**
+     * Returns datamap with specified name, null if none present
+     */
+    public DataMap getDataMap(String name) {
+        return dataMaps.get(name);
+    }
 
     public void setDataMaps(Collection<DataMap> dataMaps) {
         for (DataMap map : dataMaps) {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/ExpressionParameter.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/ExpressionParameter.java?rev=701839&r1=701838&r2=701839&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/ExpressionParameter.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/ExpressionParameter.java Sun Oct  5 11:07:16 2008
@@ -22,12 +22,14 @@
 
 import org.apache.cayenne.util.Util;
 
+import java.io.Serializable;
+
 /**
  * Named parameter for paramterized expressions.
  * 
  * @author Andrus Adamchik
  */
-public class ExpressionParameter {
+public class ExpressionParameter implements Serializable {
 	protected String name;
 
     /**

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DbJoin.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DbJoin.java?rev=701839&r1=701838&r2=701839&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DbJoin.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DbJoin.java Sun Oct  5 11:07:16 2008
@@ -19,6 +19,8 @@
 
 package org.apache.cayenne.map;
 
+import java.io.Serializable;
+
 import org.apache.cayenne.CayenneRuntimeException;
 import org.apache.cayenne.util.ToStringBuilder;
 import org.apache.cayenne.util.XMLEncoder;
@@ -30,7 +32,7 @@
  * @since 1.1
  * @author Andrus Adamchik
  */
-public class DbJoin implements XMLSerializable {
+public class DbJoin implements XMLSerializable, Serializable {
 
     protected DbRelationship relationship;
     protected String sourceName;

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=701839&r1=701838&r2=701839&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 Sun Oct  5 11:07:16 2008
@@ -19,11 +19,76 @@
 
 package org.apache.cayenne.modeler;
 
-import org.apache.cayenne.modeler.action.*;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+
+import javax.swing.Action;
+import javax.swing.ActionMap;
+import javax.swing.JComponent;
+import javax.swing.TransferHandler;
+
+import org.apache.cayenne.modeler.action.AboutAction;
+import org.apache.cayenne.modeler.action.ConfigurePreferencesAction;
+import org.apache.cayenne.modeler.action.CopyAction;
+import org.apache.cayenne.modeler.action.CopyAttributeAction;
+import org.apache.cayenne.modeler.action.CopyProcedureParameterAction;
+import org.apache.cayenne.modeler.action.CopyRelationshipAction;
+import org.apache.cayenne.modeler.action.CreateAttributeAction;
+import org.apache.cayenne.modeler.action.CreateCallbackMethodAction;
+import org.apache.cayenne.modeler.action.CreateCallbackMethodForDataMapListenerAction;
+import org.apache.cayenne.modeler.action.CreateCallbackMethodForListenerAction;
+import org.apache.cayenne.modeler.action.CreateDataMapAction;
+import org.apache.cayenne.modeler.action.CreateDataMapEntityListenerAction;
+import org.apache.cayenne.modeler.action.CreateDbEntityAction;
+import org.apache.cayenne.modeler.action.CreateDomainAction;
+import org.apache.cayenne.modeler.action.CreateNodeAction;
+import org.apache.cayenne.modeler.action.CreateObjEntityAction;
+import org.apache.cayenne.modeler.action.CreateObjEntityListenerAction;
+import org.apache.cayenne.modeler.action.CreateProcedureAction;
+import org.apache.cayenne.modeler.action.CreateProcedureParameterAction;
+import org.apache.cayenne.modeler.action.CreateQueryAction;
+import org.apache.cayenne.modeler.action.CreateRelationshipAction;
+import org.apache.cayenne.modeler.action.CutAction;
+import org.apache.cayenne.modeler.action.CutAttributeAction;
+import org.apache.cayenne.modeler.action.CutProcedureParameterAction;
+import org.apache.cayenne.modeler.action.CutRelationshipAction;
+import org.apache.cayenne.modeler.action.DbEntitySyncAction;
+import org.apache.cayenne.modeler.action.DocumentationAction;
+import org.apache.cayenne.modeler.action.ExitAction;
+import org.apache.cayenne.modeler.action.FindAction;
+import org.apache.cayenne.modeler.action.GenerateCodeAction;
+import org.apache.cayenne.modeler.action.GenerateDBAction;
+import org.apache.cayenne.modeler.action.ImportDBAction;
+import org.apache.cayenne.modeler.action.ImportDataMapAction;
+import org.apache.cayenne.modeler.action.ImportEOModelAction;
+import org.apache.cayenne.modeler.action.MigrateAction;
+import org.apache.cayenne.modeler.action.NavigateBackwardAction;
+import org.apache.cayenne.modeler.action.NavigateForwardAction;
+import org.apache.cayenne.modeler.action.NewProjectAction;
+import org.apache.cayenne.modeler.action.ObjEntitySyncAction;
+import org.apache.cayenne.modeler.action.OpenProjectAction;
+import org.apache.cayenne.modeler.action.PasteAction;
+import org.apache.cayenne.modeler.action.ProjectAction;
+import org.apache.cayenne.modeler.action.RemoveAction;
+import org.apache.cayenne.modeler.action.RemoveAttributeAction;
+import org.apache.cayenne.modeler.action.RemoveCallbackMethodAction;
+import org.apache.cayenne.modeler.action.RemoveCallbackMethodForDataMapListenerAction;
+import org.apache.cayenne.modeler.action.RemoveCallbackMethodForListenerAction;
+import org.apache.cayenne.modeler.action.RemoveEntityListenerAction;
+import org.apache.cayenne.modeler.action.RemoveEntityListenerForDataMapAction;
+import org.apache.cayenne.modeler.action.RemoveProcedureParameterAction;
+import org.apache.cayenne.modeler.action.RemoveRelationshipAction;
+import org.apache.cayenne.modeler.action.RevertAction;
+import org.apache.cayenne.modeler.action.SaveAction;
+import org.apache.cayenne.modeler.action.SaveAsAction;
+import org.apache.cayenne.modeler.action.ShowLogConsoleAction;
+import org.apache.cayenne.modeler.action.ValidateAction;
 import org.apache.cayenne.modeler.util.CayenneAction;
-
-import javax.swing.*;
-import java.util.*;
+import org.apache.cayenne.project.ProjectPath;
 
 /**
  * An object that manages CayenneModeler actions.
@@ -49,9 +114,11 @@
                 RemoveAction.getActionName(),
                 CreateNodeAction.getActionName(),
                 ImportDBAction.getActionName(),
-                ImportEOModelAction.getActionName()));
+                ImportEOModelAction.getActionName(),
+                
+                PasteAction.getActionName()));
     }
-
+    
     static final Collection<String> DATA_MAP_ACTIONS = new HashSet<String>(DOMAIN_ACTIONS);
     static {
         DATA_MAP_ACTIONS.addAll(Arrays.asList(
@@ -61,7 +128,10 @@
                 CreateQueryAction.getActionName(),
                 CreateProcedureAction.getActionName(),
                 GenerateDBAction.getActionName(),
-                MigrateAction.getActionName()));
+                MigrateAction.getActionName(),
+                
+                CutAction.getActionName(),
+                CopyAction.getActionName()));
     }
 
     static final Collection<String> OBJ_ENTITY_ACTIONS = new HashSet<String>(
@@ -92,7 +162,11 @@
     static final Collection<String> MULTIPLE_OBJECTS_ACTIONS = new HashSet<String>(
             PROJECT_ACTIONS);
     static {
-        MULTIPLE_OBJECTS_ACTIONS.addAll(Arrays.asList(RemoveAction.getActionName()));
+        MULTIPLE_OBJECTS_ACTIONS.addAll(Arrays.asList(
+                RemoveAction.getActionName(),
+                CutAction.getActionName(),
+                CopyAction.getActionName(),
+                PasteAction.getActionName()));
     }
 
     protected Map<String, Action> actionMap;
@@ -151,7 +225,17 @@
         // search action registered
         registerAction(new FindAction(application));
         
-        registerAction(new ShowLogConsoleAction(application)).setAlwaysOn(true);;
+        registerAction(new ShowLogConsoleAction(application)).setAlwaysOn(true);
+        
+        registerAction(new CutAction(application));
+        registerAction(new CutAttributeAction(application));
+        registerAction(new CutRelationshipAction(application));
+        registerAction(new CutProcedureParameterAction(application));
+        registerAction(new CopyAction(application));
+        registerAction(new CopyAttributeAction(application));
+        registerAction(new CopyRelationshipAction(application));
+        registerAction(new CopyProcedureParameterAction(application));
+        registerAction(new PasteAction(application));
     }
 
     private CayenneAction registerAction(CayenneAction action) {
@@ -174,12 +258,12 @@
      */
     public void projectOpened() {
         processActionsState(PROJECT_ACTIONS);
-        getAction(RemoveAction.getActionName()).setName("Remove");
+        updateActions("");
     }
 
     public void projectClosed() {
         processActionsState(Collections.EMPTY_SET);
-        getAction(RemoveAction.getActionName()).setName("Remove");
+        updateActions("");
     }
 
     /**
@@ -187,51 +271,88 @@
      */
     public void domainSelected() {
         processActionsState(DOMAIN_ACTIONS);
+        updateActions("DataDomain");
     }
 
     public void dataNodeSelected() {
         processActionsState(DOMAIN_ACTIONS);
-        getAction(RemoveAction.getActionName()).setName("Remove DataNode");
+        updateActions("DataNode");
     }
 
     public void dataMapSelected() {
         processActionsState(DATA_MAP_ACTIONS);
-        getAction(RemoveAction.getActionName()).setName("Remove DataMap");
+        updateActions("DataMap");
         // reset
         // getAction(CreateAttributeAction.getActionName()).setName("Create Attribute");
     }
 
     public void objEntitySelected() {
         processActionsState(OBJ_ENTITY_ACTIONS);
-        getAction(RemoveAction.getActionName()).setName("Remove ObjEntity");
+        updateActions("ObjEntity");
     }
 
     public void dbEntitySelected() {
         processActionsState(DB_ENTITY_ACTIONS);
-        getAction(RemoveAction.getActionName()).setName("Remove DbEntity");
+        updateActions("DbEntity");
     }
 
     public void derivedDbEntitySelected() {
         processActionsState(DB_ENTITY_ACTIONS);
-        getAction(RemoveAction.getActionName()).setName("Remove Derived DbEntity");
+        updateActions("Derived DbEntity");
     }
 
     public void procedureSelected() {
         processActionsState(PROCEDURE_ACTIONS);
-        getAction(RemoveAction.getActionName()).setName("Remove Procedure");
+        updateActions("Procedure");
     }
 
     public void querySelected() {
         processActionsState(DATA_MAP_ACTIONS);
-        getAction(RemoveAction.getActionName()).setName("Remove Query");
+        updateActions("Query");
     }
     
     /**
      * Invoked when several objects were selected in ProjectTree at time
      */
-    public void multipleObjectsSelected() {
+    public void multipleObjectsSelected(ProjectPath[] paths) {
         processActionsState(MULTIPLE_OBJECTS_ACTIONS);
-        getAction(RemoveAction.getActionName()).setName("Remove Selected Objects");
+        
+        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])) {
+            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])) {
+                    canCopy = false;
+                    break;
+                }
+            }
+        }
+        
+        cutAction.setEnabled(canCopy);
+        getAction(CopyAction.getActionName()).setEnabled(canCopy);
+    }
+    
+    /**
+     * Updates Remove, Cut and Copy actions' names
+     */
+    private void updateActions(String postfix) {
+        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();
     }
 
     /**
@@ -248,4 +369,19 @@
             }
         }
     }
+    
+    /**
+     * 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),
+                getAction(copyName));
+        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=701839&r1=701838&r2=701839&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 Sun Oct  5 11:07:16 2008
@@ -45,6 +45,7 @@
 
 import org.apache.cayenne.modeler.action.AboutAction;
 import org.apache.cayenne.modeler.action.ConfigurePreferencesAction;
+import org.apache.cayenne.modeler.action.CopyAction;
 import org.apache.cayenne.modeler.action.CreateDataMapAction;
 import org.apache.cayenne.modeler.action.CreateDbEntityAction;
 import org.apache.cayenne.modeler.action.CreateDomainAction;
@@ -52,6 +53,7 @@
 import org.apache.cayenne.modeler.action.CreateObjEntityAction;
 import org.apache.cayenne.modeler.action.CreateProcedureAction;
 import org.apache.cayenne.modeler.action.CreateQueryAction;
+import org.apache.cayenne.modeler.action.CutAction;
 import org.apache.cayenne.modeler.action.DocumentationAction;
 import org.apache.cayenne.modeler.action.ExitAction;
 import org.apache.cayenne.modeler.action.FindAction;
@@ -66,6 +68,7 @@
 import org.apache.cayenne.modeler.action.NewProjectAction;
 import org.apache.cayenne.modeler.action.ObjEntitySyncAction;
 import org.apache.cayenne.modeler.action.OpenProjectAction;
+import org.apache.cayenne.modeler.action.PasteAction;
 import org.apache.cayenne.modeler.action.ProjectAction;
 import org.apache.cayenne.modeler.action.RemoveAction;
 import org.apache.cayenne.modeler.action.RevertAction;
@@ -161,12 +164,14 @@
         getContentPane().setLayout(new BorderLayout());
 
         JMenu fileMenu = new JMenu("File");
+        JMenu editMenu = new JMenu("Edit");
         JMenu projectMenu = new JMenu("Project");
         JMenu toolMenu = new JMenu("Tools");
         JMenu helpMenu = new JMenu("Help");
 
         if (OperatingSystem.getOS() != OperatingSystem.MAC_OS_X) {
             fileMenu.setMnemonic(KeyEvent.VK_F);
+            editMenu.setMnemonic(KeyEvent.VK_E);
             projectMenu.setMnemonic(KeyEvent.VK_P);
             toolMenu.setMnemonic(KeyEvent.VK_T);
             helpMenu.setMnemonic(KeyEvent.VK_H);
@@ -181,6 +186,10 @@
         fileMenu.add(getAction(SaveAsAction.getActionName()).buildMenu());
         fileMenu.add(getAction(RevertAction.getActionName()).buildMenu());
         fileMenu.addSeparator();
+        
+        editMenu.add(getAction(CutAction.getActionName()).buildMenu());
+        editMenu.add(getAction(CopyAction.getActionName()).buildMenu());
+        editMenu.add(getAction(PasteAction.getActionName()).buildMenu());
 
         recentFileMenu = new RecentFileMenu("Recent Projects");
         addRecentFileListListener(recentFileMenu);
@@ -237,6 +246,7 @@
         JMenuBar menuBar = new JMenuBar();
 
         menuBar.add(fileMenu);
+        menuBar.add(editMenu);
         menuBar.add(projectMenu);
         menuBar.add(toolMenu);
         menuBar.add(helpMenu);
@@ -323,6 +333,12 @@
         toolBar.add(getAction(OpenProjectAction.getActionName()).buildButton());
         toolBar.add(getAction(SaveAction.getActionName()).buildButton());
         toolBar.add(getAction(RemoveAction.getActionName()).buildButton());
+        
+        toolBar.addSeparator();
+        
+        toolBar.add(getAction(CutAction.getActionName()).buildButton());
+        toolBar.add(getAction(CopyAction.getActionName()).buildButton());
+        toolBar.add(getAction(PasteAction.getActionName()).buildButton());
 
         toolBar.addSeparator();
 
@@ -394,7 +410,7 @@
     }
     
     public void currentObjectsChanged(MultipleObjectsDisplayEvent e) {
-        actionManager.multipleObjectsSelected();
+        actionManager.multipleObjectsSelected(e.getPaths());
     }
 
     /**

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=701839&r1=701838&r2=701839&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 Sun Oct  5 11:07:16 2008
@@ -20,7 +20,15 @@
 package org.apache.cayenne.modeler;
 
 import java.awt.Component;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.EventListener;
+import java.util.EventObject;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
 
 import javax.swing.event.EventListenerList;
 
@@ -95,6 +103,7 @@
 import org.apache.cayenne.modeler.pref.DataNodeDefaults;
 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.pref.Domain;
 import org.apache.cayenne.project.ApplicationProject;
 import org.apache.cayenne.project.Project;
@@ -1658,4 +1667,56 @@
     public ProjectWatchdog getProjectWatcher() {
         return watchdog;
     }
+    
+    /**
+     * Returns currently selected object, null if there are none, List if there are several
+     */
+    public Object getCurrentObject() {
+        if (getCurrentObjEntity() != null) {
+            return getCurrentObjEntity();
+        }
+        else if (getCurrentDbEntity() != null) {
+            return getCurrentDbEntity();
+        }
+        else if (getCurrentQuery() != null) {
+            return getCurrentQuery();
+        }
+        else if (getCurrentProcedure() != null) {
+            return getCurrentProcedure();
+        }
+        else if (getCurrentDataMap() != null) {
+            return getCurrentDataMap();
+        }
+        else if (getCurrentDataNode() != null) {
+            return getCurrentDataNode();
+        }
+        else if (getCurrentDataDomain() != null) {
+            return getCurrentDataDomain();
+        }
+        else if (getCurrentPaths() != null) { //multiple objects
+            ProjectPath[] paths = getCurrentPaths();
+            List<Object> result = new Vector<Object>();
+            
+            Object parent = paths[0].getObjectParent();
+            
+            for (int i = 0; i < paths.length; i++) {
+                Object lastObject = paths[i].getObject();
+                result.add(lastObject);
+            }
+            
+            /**
+             * Here we sort the list of objects to minimize the risk that objects will be
+             * pasted incorrectly. For instance, ObjEntity should go before Query, to increase
+             * chances that Query's root would be set. 
+             */
+            Collections.sort(result, parent instanceof DataMap ? 
+                    Comparators.getDataMapChildrenComparator() :
+                    Comparators.getDataDomainChildrenComparator());
+            
+            return result;
+        }
+        
+        return null;
+    }
+
 }

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=701839&r1=701838&r2=701839&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 Sun Oct  5 11:07:16 2008
@@ -58,6 +58,7 @@
 import org.apache.cayenne.map.event.ProcedureListener;
 import org.apache.cayenne.map.event.QueryEvent;
 import org.apache.cayenne.map.event.QueryListener;
+import org.apache.cayenne.modeler.action.CopyAction;
 import org.apache.cayenne.modeler.action.CreateDataMapAction;
 import org.apache.cayenne.modeler.action.CreateDbEntityAction;
 import org.apache.cayenne.modeler.action.CreateDomainAction;
@@ -65,7 +66,9 @@
 import org.apache.cayenne.modeler.action.CreateObjEntityAction;
 import org.apache.cayenne.modeler.action.CreateProcedureAction;
 import org.apache.cayenne.modeler.action.CreateQueryAction;
+import org.apache.cayenne.modeler.action.CutAction;
 import org.apache.cayenne.modeler.action.ObjEntitySyncAction;
+import org.apache.cayenne.modeler.action.PasteAction;
 import org.apache.cayenne.modeler.action.RemoveAction;
 import org.apache.cayenne.modeler.event.DataMapDisplayEvent;
 import org.apache.cayenne.modeler.event.DataMapDisplayListener;
@@ -178,8 +181,11 @@
         mediator.addProcedureDisplayListener(this);
         mediator.addQueryListener(this);
         mediator.addQueryDisplayListener(this);
+        
+        mediator.getApplication().getActionManager().setupCCP(this, 
+                CutAction.getActionName(), CopyAction.getActionName());
     }
-
+    
     private void initFromModel(Project project) {
         // build model
         ProjectTreeModel model = new ProjectTreeModel(project);
@@ -898,6 +904,10 @@
         popup.add(buildMenu(ObjEntitySyncAction.getActionName()));
         popup.addSeparator();
         popup.add(buildMenu(RemoveAction.getActionName()));
+        popup.addSeparator();
+        popup.add(buildMenu(CutAction.getActionName()));
+        popup.add(buildMenu(CopyAction.getActionName()));
+        popup.add(buildMenu(PasteAction.getActionName()));
         
         return popup;
     }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/AbstractRemoveCallbackMethodAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/AbstractRemoveCallbackMethodAction.java?rev=701839&r1=701838&r2=701839&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/AbstractRemoveCallbackMethodAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/AbstractRemoveCallbackMethodAction.java Sun Oct  5 11:07:16 2008
@@ -64,8 +64,8 @@
      * @param e event
      */
     @Override
-    public final void performAction(ActionEvent e) {
-        ConfirmRemoveDialog dialog = getConfirmDeleteDialog();
+    public final void performAction(ActionEvent e, boolean allowAsking) {
+        ConfirmRemoveDialog dialog = getConfirmDeleteDialog(allowAsking);
         
         String[] methods = getProjectController().getCurrentCallbackMethods();
 

Added: 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=701839&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CopyAction.java (added)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CopyAction.java Sun Oct  5 11:07:16 2008
@@ -0,0 +1,131 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+package org.apache.cayenne.modeler.action;
+
+import java.awt.Toolkit;
+import java.awt.datatransfer.Clipboard;
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
+
+import javax.swing.KeyStroke;
+
+import org.apache.cayenne.map.DataMap;
+import org.apache.cayenne.map.DbAttribute;
+import org.apache.cayenne.map.DbEntity;
+import org.apache.cayenne.map.DbRelationship;
+import org.apache.cayenne.map.ObjAttribute;
+import org.apache.cayenne.map.ObjEntity;
+import org.apache.cayenne.map.ObjRelationship;
+import org.apache.cayenne.map.Procedure;
+import org.apache.cayenne.map.ProcedureParameter;
+import org.apache.cayenne.modeler.Application;
+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;
+
+/**
+ * Action for copying entities, queries etc. into system buffer
+ * @author Andrey Razumovsky
+ */
+public class CopyAction extends CayenneAction {
+    public static String getActionName() {
+        return "Copy";
+    }
+
+    /**
+     * Constructor for CopyAction
+     */
+    public CopyAction(Application application) {
+        this(getActionName(), application);
+    }
+    
+    /**
+     * Constructor for descendants
+     */
+    protected CopyAction(String name, Application application) {
+        super(name, application);
+    }
+
+    @Override
+    public String getIconName() {
+        return "icon-copy.gif";
+    }
+    
+    @Override
+    public KeyStroke getAcceleratorKey() {
+        return KeyStroke.getKeyStroke(KeyEvent.VK_C, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
+    }
+
+    /**
+     * Performs copying of items into system buffer
+     */
+    @Override
+    public void performAction(ActionEvent e) {
+        ProjectController mediator = getProjectController();
+        
+        Object content = copy(mediator);
+        
+        if (content != null) {
+            Clipboard sysClip = Toolkit.getDefaultToolkit().getSystemClipboard();
+            sysClip.setContents(new CayenneTransferable(content), null);
+        }
+        
+        //update paste button
+        ((PasteAction) getApplication().getAction(PasteAction.getActionName())).updateState();
+    }
+    
+    /**
+     * Detects selected objects and returns them
+     */
+    public Object copy(ProjectController mediator) {
+        return mediator.getCurrentObject();
+    }
+    
+    /**
+     * Prints an object in XML format to an output stream
+     */
+    protected void print(XMLEncoder encoder, XMLSerializable object) {
+        object.encodeAsXML(encoder);
+    }
+    
+    /**
+     * Returns <code>true</code> if last object in the path contains a removable object.
+     */
+    @Override
+    public boolean enableForPath(ProjectPath path) {
+        if (path == null) {
+            return false;
+        }
+        
+        Object last = path.getObject();
+        if (last instanceof DataMap || last instanceof Query
+                || last instanceof DbEntity || last instanceof ObjEntity
+                || last instanceof DbAttribute || last instanceof DbRelationship
+                || last instanceof ObjAttribute || last instanceof ObjRelationship
+                || last instanceof Procedure || last instanceof ProcedureParameter) {
+            return true;
+        }
+
+        return false;
+    }
+}

Added: 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=701839&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CopyAttributeAction.java (added)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CopyAttributeAction.java Sun Oct  5 11:07:16 2008
@@ -0,0 +1,78 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+package org.apache.cayenne.modeler.action;
+
+import java.util.Arrays;
+
+import org.apache.cayenne.map.Attribute;
+import org.apache.cayenne.modeler.Application;
+import org.apache.cayenne.modeler.ProjectController;
+import org.apache.cayenne.project.ProjectPath;
+
+/**
+ * Action for copying attribute(s)
+ * @author Andrey Razumovsky
+ */
+public class CopyAttributeAction extends CopyAction implements MultipleObjectsAction {
+    private final static String ACTION_NAME = "Copy Attribute";
+    
+    /**
+     * Name of action if multiple attrs are selected
+     */
+    private final static String ACTION_NAME_MULTIPLE = "Copy Attributes";
+
+    public static String getActionName() {
+        return ACTION_NAME;
+    }
+    
+    public String getActionName(boolean multiple) {
+        return multiple ? ACTION_NAME_MULTIPLE : ACTION_NAME;
+    }
+
+    public CopyAttributeAction(Application application) {
+        super(ACTION_NAME, application);
+    }
+
+    /**
+     * Returns <code>true</code> if last object in the path contains a removable
+     * attribute.
+     */
+    @Override
+    public boolean enableForPath(ProjectPath path) {
+        if (path == null) {
+            return false;
+        }
+
+        return path.getObject() instanceof Attribute;
+    }
+    
+    @Override
+    public Object copy(ProjectController mediator) {
+        Object[] attrs = getProjectController().getCurrentObjAttributes();
+        if (attrs == null || attrs.length == 0) {
+            attrs = getProjectController().getCurrentDbAttributes();
+        }
+        
+        if (attrs != null && attrs.length > 0) {
+            return Arrays.asList(attrs);
+        }
+        
+        return null;
+    }
+}

Added: 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=701839&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CopyProcedureParameterAction.java (added)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CopyProcedureParameterAction.java Sun Oct  5 11:07:16 2008
@@ -0,0 +1,75 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+package org.apache.cayenne.modeler.action;
+
+import java.util.Arrays;
+
+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)
+ * @author Andrey Razumovsky
+ */
+public class CopyProcedureParameterAction extends CopyAction implements MultipleObjectsAction {
+    private final static String ACTION_NAME = "Copy Procedure Parameter";
+    
+    /**
+     * Name of action if multiple attrs are selected
+     */
+    private final static String ACTION_NAME_MULTIPLE = "Copy Procedure Parameters";
+
+    public static String getActionName() {
+        return ACTION_NAME;
+    }
+    
+    public String getActionName(boolean multiple) {
+        return multiple ? ACTION_NAME_MULTIPLE : ACTION_NAME;
+    }
+
+    public CopyProcedureParameterAction(Application application) {
+        super(ACTION_NAME, application);
+    }
+
+    /**
+     * Returns <code>true</code> if last object in the path contains a removable
+     * attribute.
+     */
+    @Override
+    public boolean enableForPath(ProjectPath path) {
+        if (path == null) {
+            return false;
+        }
+
+        return path.getObject() instanceof ProcedureParameter;
+    }
+    
+    @Override
+    public Object copy(ProjectController mediator) {
+        Object[] params = getProjectController().getCurrentProcedureParameters();
+        
+        if (params != null && params.length > 0) {
+            return Arrays.asList(params);
+        }
+        
+        return null;
+    }
+}

Added: 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=701839&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CopyRelationshipAction.java (added)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CopyRelationshipAction.java Sun Oct  5 11:07:16 2008
@@ -0,0 +1,78 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+package org.apache.cayenne.modeler.action;
+
+import java.util.Arrays;
+
+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)
+ * @author Andrey Razumovsky
+ */
+public class CopyRelationshipAction extends CopyAction implements MultipleObjectsAction {
+    private final static String ACTION_NAME = "Copy Relationship";
+    
+    /**
+     * Name of action if multiple attrs are selected
+     */
+    private final static String ACTION_NAME_MULTIPLE = "Copy Relationships";
+
+    public static String getActionName() {
+        return ACTION_NAME;
+    }
+    
+    public String getActionName(boolean multiple) {
+        return multiple ? ACTION_NAME_MULTIPLE : ACTION_NAME;
+    }
+
+    public CopyRelationshipAction(Application application) {
+        super(ACTION_NAME, application);
+    }
+
+    /**
+     * Returns <code>true</code> if last object in the path contains a removable
+     * attribute.
+     */
+    @Override
+    public boolean enableForPath(ProjectPath path) {
+        if (path == null) {
+            return false;
+        }
+
+        return path.getObject() 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=701839&r1=701838&r2=701839&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 Sun Oct  5 11:07:16 2008
@@ -78,14 +78,22 @@
                 objEntity);
         objEntity.addAttribute(attr);
 
+        fireObjAttributeEvent(this, mediator, objEntity, attr);
+    }
+    
+    /**
+     * Fires events when an obj attribute was added
+     */
+    static void fireObjAttributeEvent(Object src, ProjectController mediator, ObjEntity objEntity, 
+            ObjAttribute attr) {
         mediator.fireObjAttributeEvent(new AttributeEvent(
-                this,
+                src,
                 attr,
                 objEntity,
                 MapEvent.ADD));
 
         AttributeDisplayEvent ade = new AttributeDisplayEvent(
-                this,
+                src,
                 attr,
                 objEntity,
                 mediator.getCurrentDataMap(),
@@ -102,14 +110,22 @@
         dbEntity.addAttribute(attr);
 
         ProjectController mediator = getProjectController();
+        fireDbAttributeEvent(this, mediator, dbEntity, attr);
+    }
+    
+    /**
+     * Fires events when a db attribute was added
+     */
+    static void fireDbAttributeEvent(Object src, ProjectController mediator, DbEntity dbEntity, 
+            DbAttribute attr) {
         mediator.fireDbAttributeEvent(new AttributeEvent(
-                this,
+                src,
                 attr,
                 dbEntity,
                 MapEvent.ADD));
 
         AttributeDisplayEvent ade = new AttributeDisplayEvent(
-                this,
+                src,
                 attr,
                 dbEntity,
                 mediator.getCurrentDataMap(),

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=701839&r1=701838&r2=701839&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 Sun Oct  5 11:07:16 2008
@@ -62,8 +62,15 @@
         ProjectController mediator = getProjectController();
         DbEntity entity = createEntity(mediator.getCurrentDataMap());
 
-        mediator.fireDbEntityEvent(new EntityEvent(this, entity, MapEvent.ADD));
-        EntityDisplayEvent displayEvent = new EntityDisplayEvent(this, entity, mediator
+        fireDbEntityEvent(this, mediator, entity);
+    }
+    
+    /**
+     * Fires events when a db entity was added
+     */
+    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(), mediator
                 .getCurrentDataDomain());
         displayEvent.setMainTabFocus(true);

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=701839&r1=701838&r2=701839&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 Sun Oct  5 11:07:16 2008
@@ -70,8 +70,16 @@
         // use domain name as DataNode base, as node names must be unique across the
         // project...
         DataNode node = buildDataNode();
-        mediator.fireDataNodeEvent(new DataNodeEvent(this, node, MapEvent.ADD));
-        mediator.fireDataNodeDisplayEvent(new DataNodeDisplayEvent(this, domain, node));
+        fireDataNodeEvent(this, mediator, domain, node);
+    }
+    
+    /**
+     * Fires events when a obj entity was added
+     */
+    static void fireDataNodeEvent(Object src, ProjectController mediator, DataDomain domain,
+            DataNode node) {
+        mediator.fireDataNodeEvent(new DataNodeEvent(src, node, MapEvent.ADD));
+        mediator.fireDataNodeDisplayEvent(new DataNodeDisplayEvent(src, domain, 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=701839&r1=701838&r2=701839&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 Sun Oct  5 11:07:16 2008
@@ -115,9 +115,17 @@
         merger.addEntityMergeListener(DeleteRuleUpdater.getEntityMergeListener());
         merger.synchronizeWithDbEntity(entity);
 
-        mediator.fireObjEntityEvent(new EntityEvent(this, entity, MapEvent.ADD));
+        fireObjEntityEvent(this, mediator, dataMap, entity);
+    }
+    
+    /**
+     * Fires events when a obj entity was added
+     */
+    static void fireObjEntityEvent(Object src, ProjectController mediator, DataMap dataMap,
+            ObjEntity entity) {
+        mediator.fireObjEntityEvent(new EntityEvent(src, entity, MapEvent.ADD));
         EntityDisplayEvent displayEvent = new EntityDisplayEvent(
-                this,
+                src,
                 entity,
                 dataMap,
                 mediator.getCurrentDataNode(),

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=701839&r1=701838&r2=701839&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 Sun Oct  5 11:07:16 2008
@@ -51,9 +51,17 @@
         ProjectController mediator = getProjectController();
         Procedure procedure = createProcedure(mediator.getCurrentDataMap());
 
-        mediator.fireProcedureEvent(new ProcedureEvent(this, procedure, MapEvent.ADD));
+        fireProcedureEvent(this, mediator, mediator.getCurrentDataMap(), procedure);
+    }
+    
+    /**
+     * Fires events when a procedure was added
+     */
+    static void fireProcedureEvent(Object src, ProjectController mediator, DataMap dataMap,
+            Procedure procedure) {
+        mediator.fireProcedureEvent(new ProcedureEvent(src, procedure, MapEvent.ADD));
         mediator.fireProcedureDisplayEvent(new ProcedureDisplayEvent(
-                this,
+                src,
                 procedure,
                 mediator.getCurrentDataMap(),
                 mediator.getCurrentDataDomain()));

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=701839&r1=701838&r2=701839&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 Sun Oct  5 11:07:16 2008
@@ -74,16 +74,24 @@
         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, 
+            ProcedureParameter parameter) {
         mediator.fireProcedureParameterEvent(
-            new ProcedureParameterEvent(this, parameter, MapEvent.ADD));
+                new ProcedureParameterEvent(src, parameter, MapEvent.ADD));
 
-        mediator.fireProcedureParameterDisplayEvent(
-            new ProcedureParameterDisplayEvent(
-                this,
-                parameter,
-                procedure,
-                mediator.getCurrentDataMap(),
-                mediator.getCurrentDataDomain()));
+            mediator.fireProcedureParameterDisplayEvent(
+                new ProcedureParameterDisplayEvent(
+                    src,
+                    parameter,
+                    procedure,
+                    mediator.getCurrentDataMap(),
+                    mediator.getCurrentDataDomain()));
     }
 
     /**

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=701839&r1=701838&r2=701839&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 Sun Oct  5 11:07:16 2008
@@ -19,7 +19,13 @@
 
 package org.apache.cayenne.modeler.action;
 
-import org.apache.cayenne.map.*;
+import java.awt.event.ActionEvent;
+
+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.event.MapEvent;
 import org.apache.cayenne.map.event.RelationshipEvent;
 import org.apache.cayenne.modeler.Application;
@@ -30,8 +36,6 @@
 import org.apache.cayenne.project.NamedObjectFactory;
 import org.apache.cayenne.project.ProjectPath;
 
-import java.awt.event.ActionEvent;
-
 /**
  * @author Andrus Adamchik
  */
@@ -69,47 +73,62 @@
         }
     }
 
-    public void createObjRelationship(ObjEntity objEnt) {
+    public void createObjRelationship(ObjEntity objEntity) {
         ProjectController mediator = getProjectController();
 
         ObjRelationship rel =
             (ObjRelationship) NamedObjectFactory.createObject(
                 ObjRelationship.class,
-                objEnt);
-        rel.setSourceEntity(objEnt);
+                objEntity);
+        rel.setSourceEntity(objEntity);
         DeleteRuleUpdater.updateObjRelationship(rel);
         
-        objEnt.addRelationship(rel);
-
+        objEntity.addRelationship(rel);
+        fireObjRelationshipEvent(this, mediator, objEntity, rel);
+    }
+    
+    /**
+     * Fires events when a obj rel was added
+     */
+    static void fireObjRelationshipEvent(Object src, ProjectController mediator, ObjEntity objEntity, 
+            ObjRelationship rel) {
         mediator.fireObjRelationshipEvent(
-            new RelationshipEvent(this, rel, objEnt, MapEvent.ADD));
-        
+            new RelationshipEvent(src, rel, objEntity, MapEvent.ADD));
+            
         RelationshipDisplayEvent rde = new RelationshipDisplayEvent(
-                this,
+                src,
                 rel,
-                objEnt,
+                objEntity,
                 mediator.getCurrentDataMap(),
                 mediator.getCurrentDataDomain());
         
         mediator.fireObjRelationshipDisplayEvent(rde);
     }
 
-    public void createDbRelationship(DbEntity dbEnt) {
+    public void createDbRelationship(DbEntity dbEntity) {
         ProjectController mediator = getProjectController();
 
         DbRelationship rel =
-            (DbRelationship) NamedObjectFactory.createObject(DbRelationship.class, dbEnt);
+            (DbRelationship) NamedObjectFactory.createObject(DbRelationship.class, dbEntity);
 
-        rel.setSourceEntity(dbEnt);
-        dbEnt.addRelationship(rel);
+        rel.setSourceEntity(dbEntity);
+        dbEntity.addRelationship(rel);
 
+        fireDbRelationshipEvent(this, mediator, dbEntity, rel);
+    }
+    
+    /**
+     * Fires events when a db rel was added
+     */
+    static void fireDbRelationshipEvent(Object src, ProjectController mediator, DbEntity dbEntity, 
+            DbRelationship rel) {
         mediator.fireDbRelationshipEvent(
-            new RelationshipEvent(this, rel, dbEnt, MapEvent.ADD));
+            new RelationshipEvent(src, rel, dbEntity, MapEvent.ADD));
 
         RelationshipDisplayEvent rde = new RelationshipDisplayEvent(
-                this,
+                src,
                 rel,
-                dbEnt,
+                dbEntity,
                 mediator.getCurrentDataMap(),
                 mediator.getCurrentDataDomain());
         

Added: 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=701839&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CutAction.java (added)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CutAction.java Sun Oct  5 11:07:16 2008
@@ -0,0 +1,80 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+package org.apache.cayenne.modeler.action;
+
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
+
+import javax.swing.KeyStroke;
+
+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.
+ * @author Andrey Razumovsky
+ */
+public class CutAction extends CayenneAction {
+    public static String getActionName() {
+        return "Cut";
+    }
+
+    /**
+     * Constructor for CutAction
+     */
+    public CutAction(Application application) {
+        this(getActionName(), application);
+    }
+    
+    /**
+     * Constructor for descendants
+     */
+    protected CutAction(String name, Application application) {
+        super(name, application);
+    }
+
+    @Override
+    public String getIconName() {
+        return "icon-cut.gif";
+    }
+    
+    @Override
+    public KeyStroke getAcceleratorKey() {
+        return KeyStroke.getKeyStroke(KeyEvent.VK_X, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
+    }
+
+    /**
+     * Performs cutting of items
+     */
+    @Override
+    public void performAction(ActionEvent e) {
+        application.getAction(CopyAction.getActionName()).performAction(e);
+        ((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);
+    }
+}

Added: 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=701839&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CutAttributeAction.java (added)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CutAttributeAction.java Sun Oct  5 11:07:16 2008
@@ -0,0 +1,72 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+package org.apache.cayenne.modeler.action;
+
+import java.awt.event.ActionEvent;
+
+import org.apache.cayenne.map.Attribute;
+import org.apache.cayenne.modeler.Application;
+import org.apache.cayenne.project.ProjectPath;
+
+/**
+ * Action for cutting attribute(s)
+ * @author Andrey Razumovsky
+ */
+public class CutAttributeAction extends CutAction implements MultipleObjectsAction {
+    private final static String ACTION_NAME = "Cut Attribute";
+    
+    /**
+     * Name of action if multiple attrs are selected
+     */
+    private final static String ACTION_NAME_MULTIPLE = "Cut Attributes";
+
+    public static String getActionName() {
+        return ACTION_NAME;
+    }
+    
+    public String getActionName(boolean multiple) {
+        return multiple ? ACTION_NAME_MULTIPLE : ACTION_NAME;
+    }
+
+    public CutAttributeAction(Application application) {
+        super(ACTION_NAME, application);
+    }
+
+    /**
+     * Returns <code>true</code> if last object in the path contains a removable
+     * attribute.
+     */
+    @Override
+    public boolean enableForPath(ProjectPath path) {
+        if (path == null) {
+            return false;
+        }
+
+        return path.getObject() instanceof Attribute;
+    }
+    
+    /**
+     * Performs cutting of items
+     */
+    @Override
+    public void performAction(ActionEvent e) {
+        application.getAction(CopyAttributeAction.getActionName()).performAction(e);
+        ((RemoveAction) application.getAction(RemoveAttributeAction.getActionName())).performAction(e, false);
+    }
+}

Added: 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=701839&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CutProcedureParameterAction.java (added)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CutProcedureParameterAction.java Sun Oct  5 11:07:16 2008
@@ -0,0 +1,73 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+package org.apache.cayenne.modeler.action;
+
+import java.awt.event.ActionEvent;
+
+import org.apache.cayenne.map.ProcedureParameter;
+import org.apache.cayenne.modeler.Application;
+import org.apache.cayenne.project.ProjectPath;
+
+/**
+ * Action for cutting procedure parameter(s)
+ * @author Andrey Razumovsky
+ */
+public class CutProcedureParameterAction extends CutAction implements MultipleObjectsAction {
+    private final static String ACTION_NAME = "Cut Procedure Parameter";
+    
+    /**
+     * Name of action if multiple attrs are selected
+     */
+    private final static String ACTION_NAME_MULTIPLE = "Cut Procedure Parameters";
+
+    public static String getActionName() {
+        return ACTION_NAME;
+    }
+    
+    public String getActionName(boolean multiple) {
+        return multiple ? ACTION_NAME_MULTIPLE : ACTION_NAME;
+    }
+
+    public CutProcedureParameterAction(Application application) {
+        super(ACTION_NAME, application);
+    }
+
+    /**
+     * Returns <code>true</code> if last object in the path contains a removable
+     * attribute.
+     */
+    @Override
+    public boolean enableForPath(ProjectPath path) {
+        if (path == null) {
+            return false;
+        }
+
+        return path.getObject() 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);
+    }
+}

Added: 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=701839&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CutRelationshipAction.java (added)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CutRelationshipAction.java Sun Oct  5 11:07:16 2008
@@ -0,0 +1,72 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+package org.apache.cayenne.modeler.action;
+
+import java.awt.event.ActionEvent;
+
+import org.apache.cayenne.map.Relationship;
+import org.apache.cayenne.modeler.Application;
+import org.apache.cayenne.project.ProjectPath;
+
+/**
+ * Action for cutting attribute(s)
+ * @author Andrey Razumovsky
+ */
+public class CutRelationshipAction extends CutAction implements MultipleObjectsAction {
+    private final static String ACTION_NAME = "Cut Relationship";
+    
+    /**
+     * Name of action if multiple attrs are selected
+     */
+    private final static String ACTION_NAME_MULTIPLE = "Cut Relationships";
+
+    public static String getActionName() {
+        return ACTION_NAME;
+    }
+    
+    public String getActionName(boolean multiple) {
+        return multiple ? ACTION_NAME_MULTIPLE : ACTION_NAME;
+    }
+
+    public CutRelationshipAction(Application application) {
+        super(ACTION_NAME, application);
+    }
+
+    /**
+     * Returns <code>true</code> if last object in the path contains a removable
+     * attribute.
+     */
+    @Override
+    public boolean enableForPath(ProjectPath path) {
+        if (path == null) {
+            return false;
+        }
+
+        return path.getObject() 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);
+    }
+}

Added: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/MultipleObjectsAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/MultipleObjectsAction.java?rev=701839&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/MultipleObjectsAction.java (added)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/MultipleObjectsAction.java Sun Oct  5 11:07:16 2008
@@ -0,0 +1,33 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+package org.apache.cayenne.modeler.action;
+
+import javax.swing.Action;
+
+/**
+ * MultipleObjectsAction is an action, which can be applied to multiple objects at once.
+ * Therefore the name of the action might change
+ * @author Andrey Razumovsky
+ */
+public interface MultipleObjectsAction extends Action {
+    /**
+     * @return The name for the action, either if one or multiple objects are selected 
+     */
+    public String getActionName(boolean multiple);
+}



Mime
View raw message