cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmen...@apache.org
Subject svn commit: r670246 [1/2] - in /cayenne/main/trunk/framework: cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/event/ cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ cayenne-modeler/src/main/java/org/apache/cayenne/modeler/acti...
Date Sat, 21 Jun 2008 18:25:31 GMT
Author: kmenard
Date: Sat Jun 21 11:25:29 2008
New Revision: 670246

URL: http://svn.apache.org/viewvc?rev=670246&view=rev
Log:
Fixed CAY-1060: CM: Allow multiple item selections

Added:
    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/util/CayenneCellEditor.java
Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/event/DomainEvent.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/event/MapEvent.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/event/QueryEvent.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/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/RemoveCallbackMethodAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveCallbackMethodForDataMapListenerAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveCallbackMethodForListenerAction.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/AbstractCallbackMethodsTab.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/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/ObjEntityTabbedView.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/ProcedureQueryView.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ProcedureTabbedView.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/editor/dbentity/DbEntityTabbedView.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/AttributeDisplayEvent.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/ProcedureParameterDisplayEvent.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/RelationshipDisplayEvent.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/TablePopupHandler.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneTable.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneWidgetFactory.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/PanelFactory.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/combo/AutoCompletion.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/combo/ComboBoxCellEditor.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/event/DomainEvent.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/event/DomainEvent.java?rev=670246&r1=670245&r2=670246&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/event/DomainEvent.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/event/DomainEvent.java Sat Jun 21 11:25:29 2008
@@ -29,12 +29,10 @@
  * @author Andrus Adamchik
  */
 public class DomainEvent extends MapEvent {
-	protected DataDomain domain;
-
 	/** Creates a domain change event. */
 	public DomainEvent(Object src, DataDomain domain) {
 		super(src);
-		this.domain = domain;
+		setDomain(domain);
 	}
 
 	/** Creates a domain event of a specified type. */
@@ -49,20 +47,6 @@
 		setOldName(oldName);
 	}
 
-	/** Returns domain object associated with this event. */
-	public DataDomain getDomain() {
-		return domain;
-	}
-
-	/**
-	 * Sets domain object associated with this event.
-	 * 
-	 * @param domain The domain to set
-	 */
-	public void setDomain(DataDomain domain) {
-		this.domain = domain;
-	}
-	
 	@Override
     public String getNewName() {
 		return (domain != null) ? domain.getName() : null;

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/event/MapEvent.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/event/MapEvent.java?rev=670246&r1=670245&r2=670246&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/event/MapEvent.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/event/MapEvent.java Sat Jun 21 11:25:29 2008
@@ -19,6 +19,7 @@
 
 package org.apache.cayenne.map.event;
 
+import org.apache.cayenne.access.DataDomain;
 import org.apache.cayenne.event.CayenneEvent;
 import org.apache.cayenne.util.Util;
 
@@ -48,6 +49,11 @@
     protected int id = CHANGE;
     protected String oldName;
     protected boolean oldNameSet;
+    
+    /**
+     * Domain of event object. Might be null
+     */
+    protected DataDomain domain;
 
     /**
      * Constructor for MapEvent.
@@ -107,4 +113,18 @@
         this.oldName = oldName;
         this.oldNameSet = true;
     }
+    
+    /**
+     * Sets domain of event object.
+     */
+    public void setDomain(DataDomain domain) {
+        this.domain = domain;
+    }
+    
+    /**
+     * @return Domain of event object. Might be null
+     */
+    public DataDomain getDomain() {
+        return domain;
+    }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/event/QueryEvent.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/event/QueryEvent.java?rev=670246&r1=670245&r2=670246&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/event/QueryEvent.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/event/QueryEvent.java Sat Jun 21 11:25:29 2008
@@ -19,6 +19,7 @@
 
 package org.apache.cayenne.map.event;
 
+import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.query.Query;
 
 /**
@@ -30,6 +31,11 @@
  */
 public class QueryEvent extends MapEvent {
     protected Query query;
+    
+    /**
+     * Data map containing the query
+     */
+    protected DataMap map;
 
     public QueryEvent(Object source, Query query) {
         super(source);
@@ -45,6 +51,30 @@
         this(source, query);
         setId(type);
     }
+    
+    /**
+     * Creates a query event, specifying DataMap, containing the query
+     */
+    public QueryEvent(Object source, Query query, DataMap map) {
+        this(source, query);
+        setDataMap(map);
+    }
+    
+    /**
+     * Creates a query event, specifying DataMap, containing the query
+     */
+    public QueryEvent(Object source, Query query, String oldName, DataMap map) {
+        this(source, query, oldName);
+        setDataMap(map);
+    }
+    
+    /**
+     * Creates a query event, specifying DataMap, containing the query
+     */
+    public QueryEvent(Object source, Query query, int type, DataMap map) {
+        this(source, query, type);
+        setDataMap(map);
+    }
 
     @Override
     public String getNewName() {
@@ -58,4 +88,18 @@
     public void setQuery(Query query) {
         this.query = query;
     }
+    
+    /**
+     * @return DataMap, containing the query
+     */
+    public DataMap getDataMap() {
+        return map;
+    }
+    
+    /**
+     * Sets DataMap, containing the query
+     */
+    public void setDataMap(DataMap map) {
+        this.map = map;
+    }
 }

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=670246&r1=670245&r2=670246&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 Sat Jun 21 11:25:29 2008
@@ -139,6 +139,12 @@
         PROCEDURE_ACTIONS.addAll(Arrays.asList(CreateProcedureParameterAction
                 .getActionName()));
     }
+    
+    static final Collection<String> MULTIPLE_OBJECTS_ACTIONS = new HashSet<String>(
+            PROJECT_ACTIONS);
+    static {
+        MULTIPLE_OBJECTS_ACTIONS.addAll(Arrays.asList(RemoveAction.getActionName()));
+    }
 
     protected Map<String, Action> actionMap;
 
@@ -268,6 +274,14 @@
         processActionsState(DATA_MAP_ACTIONS);
         getAction(RemoveAction.getActionName()).setName("Remove Query");
     }
+    
+    /**
+     * Invoked when several objects were selected in ProjectTree at time
+     */
+    public void multipleObjectsSelected() {
+        processActionsState(MULTIPLE_OBJECTS_ACTIONS);
+        getAction(RemoveAction.getActionName()).setName("Remove Selected Objects");
+    }
 
     /**
      * Sets the state of all controlled actions, flipping it to "enabled" for all actions

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=670246&r1=670245&r2=670246&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 Sat Jun 21 11:25:29 2008
@@ -74,6 +74,8 @@
 import org.apache.cayenne.modeler.event.DataNodeDisplayListener;
 import org.apache.cayenne.modeler.event.DbEntityDisplayListener;
 import org.apache.cayenne.modeler.event.EntityDisplayEvent;
+import org.apache.cayenne.modeler.event.MultipleObjectsDisplayEvent;
+import org.apache.cayenne.modeler.event.MultipleObjectsDisplayListener;
 import org.apache.cayenne.modeler.event.ObjEntityDisplayListener;
 import org.apache.cayenne.modeler.event.ProcedureDisplayEvent;
 import org.apache.cayenne.modeler.event.ProcedureDisplayListener;
@@ -89,7 +91,7 @@
  */
 public class CayenneModelerFrame extends JFrame implements DataNodeDisplayListener,
         DataMapDisplayListener, ObjEntityDisplayListener, DbEntityDisplayListener,
-        QueryDisplayListener, ProcedureDisplayListener {
+        QueryDisplayListener, ProcedureDisplayListener, MultipleObjectsDisplayListener {
 
     protected EditorView view;
     protected RecentFileMenu recentFileMenu;
@@ -280,6 +282,10 @@
     public void currentProcedureChanged(ProcedureDisplayEvent e) {
         actionManager.procedureSelected();
     }
+    
+    public void currentObjectsChanged(MultipleObjectsDisplayEvent e) {
+        actionManager.multipleObjectsSelected();
+    }
 
     /**
      * Returns the right side view panel.

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=670246&r1=670245&r2=670246&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 Sat Jun 21 11:25:29 2008
@@ -20,10 +20,7 @@
 package org.apache.cayenne.modeler;
 
 import java.awt.Component;
-import java.util.ArrayList;
-import java.util.EventListener;
-import java.util.EventObject;
-import java.util.Iterator;
+import java.util.*;
 
 import javax.swing.event.EventListenerList;
 
@@ -82,6 +79,8 @@
 import org.apache.cayenne.modeler.event.EntityDisplayEvent;
 import org.apache.cayenne.modeler.event.EntityListenerEvent;
 import org.apache.cayenne.modeler.event.EntityListenerListener;
+import org.apache.cayenne.modeler.event.MultipleObjectsDisplayEvent;
+import org.apache.cayenne.modeler.event.MultipleObjectsDisplayListener;
 import org.apache.cayenne.modeler.event.ObjAttributeDisplayListener;
 import org.apache.cayenne.modeler.event.ObjEntityDisplayListener;
 import org.apache.cayenne.modeler.event.ObjRelationshipDisplayListener;
@@ -97,7 +96,9 @@
 import org.apache.cayenne.modeler.util.CayenneController;
 import org.apache.cayenne.modeler.util.CircularArray;
 import org.apache.cayenne.pref.Domain;
+import org.apache.cayenne.project.ApplicationProject;
 import org.apache.cayenne.project.Project;
+import org.apache.cayenne.project.ProjectPath;
 import org.apache.cayenne.query.Query;
 import org.apache.cayenne.util.IDUtil;
 
@@ -125,13 +126,20 @@
         private DataMap map;
         private ObjEntity objEntity;
         private DbEntity dbEntity;
-        private ObjAttribute objAttr;
-        private DbAttribute dbAttr;
-        private ObjRelationship objRel;
-        private DbRelationship dbRel;
+        
+        private ObjAttribute[] objAttrs;
+        private DbAttribute[] dbAttrs;
+        private ObjRelationship[] objRels;
+        private DbRelationship[] dbRels;
+        
         private Procedure procedure;
-        private ProcedureParameter procedureParameter;
+        private ProcedureParameter[] procedureParameters;
         private Query query;
+        
+        /**
+         * Paths of multiple selection
+         */
+        private ProjectPath[] paths;
 
         /**
          * currently selecte entity listener class
@@ -142,9 +150,9 @@
          */
         private CallbackType callbackType;
         /**
-         * currently selected callback method
+         * currently selected callback methods
          */
-        private String callbackMethod;
+        private String[] callbackMethods;
 
         public ControllerState() {
             domain = null;
@@ -152,19 +160,24 @@
             map = null;
 
             objEntity = null;
-            objAttr = null;
-            objRel = null;
-
             dbEntity = null;
-            dbAttr = null;
-            dbRel = null;
-
+            
             procedure = null;
-            procedureParameter = null;
+            
+            //life is much easier if these guys are never null
+            dbAttrs = new DbAttribute[0];
+            dbRels = new DbRelationship[0];
+            procedureParameters = new ProcedureParameter[0];
+            objAttrs = new ObjAttribute[0];
+            objRels = new ObjRelationship[0];
+            
+            callbackMethods = new String[0];
 
             query = null;
 
             event = null;
+            paths = null;
+            
             isRefiring = false;
         }
 
@@ -233,6 +246,7 @@
         currentState = new ControllerState();
     }
 
+    @Override
     public Component getView() {
         return parent.getView();
     }
@@ -357,6 +371,7 @@
         addDbEntityDisplayListener(frame);
         addQueryDisplayListener(frame);
         addProcedureDisplayListener(frame);
+        addMultipleObjectsDisplayListener(frame);
     }
 
     public void reset() {
@@ -396,11 +411,50 @@
     }
 
     protected void refreshNamespace() {
-        DataDomain domain = getCurrentDataDomain();
+        refreshNamespace(getCurrentDataDomain());
+    }
+    
+    protected void refreshNamespace(DataDomain domain) {
         if (domain != null) {
             domain.getEntityResolver().clearCache();
         }
     }
+    
+    /**
+     * Finds a domain containing specified DataNode.
+     */
+    public DataDomain findDomain(DataNode node) {
+        Collection<DataDomain> domains = ((ApplicationProject) getProject()).getConfiguration()
+            .getDomains();
+        
+        for (DataDomain domain : domains) {
+            if (domain.getNode(node.getName()) == node) {
+                return domain;
+            }
+        }
+        
+        return null;
+    }
+    
+    /**
+     * Finds a domain containing specified DataMap.
+     */
+    public DataDomain findDomain(DataMap map) {
+        Collection<DataDomain> domains = ((ApplicationProject) getProject()).getConfiguration()
+            .getDomains();
+        
+        if (map == null) {
+            map = getCurrentDataMap();
+        }
+    
+        for (DataDomain domain : domains) {
+            if (domain.getMap(map.getName()) == map) {
+                return domain;
+            }
+        }
+    
+        return null;
+    }
 
     private void removeFromHistory(EventObject e) {
 
@@ -485,21 +539,33 @@
     public DbEntity getCurrentDbEntity() {
         return currentState.dbEntity;
     }
-
-    public ObjAttribute getCurrentObjAttribute() {
-        return currentState.objAttr;
+    
+    /**
+     * @return Array of selected ObjAttributes
+     */
+    public ObjAttribute[] getCurrentObjAttributes() {
+        return currentState.objAttrs;
     }
-
-    public DbAttribute getCurrentDbAttribute() {
-        return currentState.dbAttr;
+    
+    /**
+     * @return Array of selected DbAttributes
+     */
+    public DbAttribute[] getCurrentDbAttributes() {
+        return currentState.dbAttrs;
     }
-
-    public ObjRelationship getCurrentObjRelationship() {
-        return currentState.objRel;
+    
+    /**
+     * @return Array of selected ObjRelationships
+     */
+    public ObjRelationship[] getCurrentObjRelationships() {
+        return currentState.objRels;
     }
 
-    public DbRelationship getCurrentDbRelationship() {
-        return currentState.dbRel;
+    /**
+     * @return Array of selected DbRelationships
+     */
+    public DbRelationship[] getCurrentDbRelationships() {
+        return currentState.dbRels;
     }
 
     public Query getCurrentQuery() {
@@ -510,8 +576,12 @@
         return currentState.procedure;
     }
 
-    public ProcedureParameter getCurrentProcedureParameter() {
-        return currentState.procedureParameter;
+    public ProcedureParameter[] getCurrentProcedureParameters() {
+        return currentState.procedureParameters;
+    }
+    
+    public ProjectPath[] getCurrentPaths() {
+        return currentState.paths;
     }
 
     public void addDomainDisplayListener(DomainDisplayListener listener) {
@@ -610,6 +680,11 @@
             ProcedureParameterDisplayListener listener) {
         listenerList.add(ProcedureParameterDisplayListener.class, listener);
     }
+    
+    public void addMultipleObjectsDisplayListener(
+            MultipleObjectsDisplayListener listener) {
+        listenerList.add(MultipleObjectsDisplayListener.class, listener);
+    }
 
     public void fireDomainDisplayEvent(DomainDisplayEvent e) {
         boolean changed = e.getDomain() != currentState.domain;
@@ -657,7 +732,7 @@
         setDirty(true);
 
         if (e.getId() == MapEvent.REMOVE) {
-            refreshNamespace();
+            refreshNamespace(e.getDomain());
             removeFromHistory(e);
         }
 
@@ -720,7 +795,7 @@
         setDirty(true);
 
         if (e.getId() == MapEvent.REMOVE) {
-            refreshNamespace();
+            refreshNamespace(e.getDomain());
             removeFromHistory(e);
         }
 
@@ -783,7 +858,7 @@
         setDirty(true);
 
         if (e.getId() == MapEvent.REMOVE) {
-            refreshNamespace();
+            refreshNamespace(e.getDomain());
             removeFromHistory(e);
         }
 
@@ -814,12 +889,12 @@
     public void fireObjEntityEvent(EntityEvent e) {
         setDirty(true);
 
-        if (currentState.map != null && e.getId() == MapEvent.CHANGE) {
-            currentState.map.objEntityChanged(e);
+        if (e.getEntity().getDataMap() != null && e.getId() == MapEvent.CHANGE) {
+            e.getEntity().getDataMap().objEntityChanged(e);
         }
 
         if (e.getId() == MapEvent.REMOVE) {
-            refreshNamespace();
+            refreshNamespace(e.getDomain());
             removeFromHistory(e);
         }
 
@@ -850,12 +925,12 @@
     public void fireDbEntityEvent(EntityEvent e) {
         setDirty(true);
 
-        if (currentState.map != null && e.getId() == MapEvent.CHANGE) {
-            currentState.map.dbEntityChanged(e);
+        if (e.getEntity().getDataMap() != null && e.getId() == MapEvent.CHANGE) {
+            e.getEntity().getDataMap().dbEntityChanged(e);
         }
 
         if (e.getId() == MapEvent.REMOVE) {
-            refreshNamespace();
+            refreshNamespace(e.getDomain());
             removeFromHistory(e);
         }
 
@@ -887,7 +962,7 @@
         setDirty(true);
 
         if (e.getId() == MapEvent.REMOVE) {
-            refreshNamespace();
+            refreshNamespace(e.getDomain());
             removeFromHistory(e);
         }
 
@@ -919,7 +994,7 @@
         setDirty(true);
 
         if (e.getId() == MapEvent.REMOVE) {
-            refreshNamespace();
+            refreshNamespace(e.getDomain());
             removeFromHistory(e);
         }
 
@@ -1174,7 +1249,7 @@
     }
 
     public void fireProcedureParameterDisplayEvent(ProcedureParameterDisplayEvent e) {
-        boolean changed = e.getProcedureParameter() != currentState.procedureParameter;
+        boolean changed = !Arrays.equals(e.getProcedureParameters(), currentState.procedureParameters);
 
         if (changed) {
             if (currentState.procedure != e.getProcedure()) {
@@ -1183,7 +1258,7 @@
                 currentState.map = e.getDataMap();
                 currentState.procedure = e.getProcedure();
             }
-            currentState.procedureParameter = e.getProcedureParameter();
+            currentState.procedureParameters = e.getProcedureParameters();
         }
 
         EventListener[] list = listenerList
@@ -1223,10 +1298,6 @@
     public void fireDbAttributeEvent(AttributeEvent e) {
         setDirty(true);
 
-        if (currentState.map != null && e.getId() == MapEvent.CHANGE) {
-            currentState.map.dbAttributeChanged(e);
-        }
-
         EventListener[] list = listenerList.getListeners(DbAttributeListener.class);
         for (int i = 0; i < list.length; i++) {
             DbAttributeListener temp = (DbAttributeListener) list[i];
@@ -1248,7 +1319,7 @@
     }
 
     public void fireDbAttributeDisplayEvent(AttributeDisplayEvent e) {
-        boolean changed = e.getAttribute() != currentState.dbAttr;
+        boolean changed = !Arrays.equals(e.getAttributes(), currentState.dbAttrs);
 
         if (changed) {
             if (e.getEntity() != currentState.dbEntity) {
@@ -1257,7 +1328,9 @@
                 currentState.map = e.getDataMap();
                 currentState.dbEntity = (DbEntity) e.getEntity();
             }
-            currentState.dbAttr = (DbAttribute) e.getAttribute();
+            currentState.dbAttrs = new DbAttribute[e.getAttributes().length];
+            System.arraycopy(e.getAttributes(), 0, currentState.dbAttrs, 0, 
+                    currentState.dbAttrs.length);
         }
 
         EventListener[] list = listenerList
@@ -1272,10 +1345,6 @@
     public void fireObjAttributeEvent(AttributeEvent e) {
         setDirty(true);
 
-        if (currentState.map != null && e.getId() == MapEvent.CHANGE) {
-            currentState.map.objAttributeChanged(e);
-        }
-
         EventListener[] list = listenerList.getListeners(ObjAttributeListener.class);
         for (int i = 0; i < list.length; i++) {
             ObjAttributeListener temp = (ObjAttributeListener) list[i];
@@ -1297,7 +1366,7 @@
     }
 
     public void fireObjAttributeDisplayEvent(AttributeDisplayEvent e) {
-        boolean changed = e.getAttribute() != currentState.objAttr;
+        boolean changed = !Arrays.equals(e.getAttributes(), currentState.objAttrs); 
 
         if (changed) {
             if (e.getEntity() != currentState.objEntity) {
@@ -1306,7 +1375,9 @@
                 currentState.map = e.getDataMap();
                 currentState.objEntity = (ObjEntity) e.getEntity();
             }
-            currentState.objAttr = (ObjAttribute) e.getAttribute();
+            currentState.objAttrs = new ObjAttribute[e.getAttributes().length];
+            System.arraycopy(e.getAttributes(), 0, currentState.objAttrs, 0, 
+                    currentState.objAttrs.length);
         }
 
         EventListener[] list = listenerList
@@ -1346,8 +1417,7 @@
     }
 
     public void fireDbRelationshipDisplayEvent(RelationshipDisplayEvent e) {
-        boolean changed = e.getRelationship() != currentState.dbRel;
-        e.setRelationshipChanged(changed);
+        boolean changed = !Arrays.equals(e.getRelationships(), currentState.dbRels);
 
         if (changed) {
             if (e.getEntity() != currentState.dbEntity) {
@@ -1356,7 +1426,9 @@
                 currentState.map = e.getDataMap();
                 currentState.dbEntity = (DbEntity) e.getEntity();
             }
-            currentState.dbRel = (DbRelationship) e.getRelationship();
+            currentState.dbRels = new DbRelationship[e.getRelationships().length];
+            System.arraycopy(e.getRelationships(), 0, currentState.dbRels, 0, 
+                    currentState.dbRels.length);
         }
 
         EventListener[] list = listenerList
@@ -1371,10 +1443,6 @@
     public void fireObjRelationshipEvent(RelationshipEvent e) {
         setDirty(true);
 
-        if (currentState.map != null && e.getId() == MapEvent.CHANGE) {
-            currentState.map.objRelationshipChanged(e);
-        }
-
         EventListener[] list = listenerList.getListeners(ObjRelationshipListener.class);
         for (int i = 0; i < list.length; i++) {
             ObjRelationshipListener temp = (ObjRelationshipListener) list[i];
@@ -1394,9 +1462,20 @@
             }
         }
     }
+    
+    public void fireMultipleObjectsDisplayEvent(MultipleObjectsDisplayEvent e) {
+        clearState();
+        currentState.paths = e.getPaths();
+        
+        EventListener[] list = listenerList.getListeners(MultipleObjectsDisplayListener.class);
+        for (int i = 0; i < list.length; i++) {
+            MultipleObjectsDisplayListener temp = (MultipleObjectsDisplayListener) list[i];
+            temp.currentObjectsChanged(e);
+        }
+    }
 
     public void fireObjRelationshipDisplayEvent(RelationshipDisplayEvent e) {
-        boolean changed = e.getRelationship() != currentState.objRel;
+        boolean changed = !Arrays.equals(e.getRelationships(), currentState.objRels);
         e.setRelationshipChanged(changed);
 
         if (changed) {
@@ -1406,7 +1485,9 @@
                 currentState.map = e.getDataMap();
                 currentState.objEntity = (ObjEntity) e.getEntity();
             }
-            currentState.objRel = (ObjRelationship) e.getRelationship();
+            currentState.objRels = new ObjRelationship[e.getRelationships().length];
+            System.arraycopy(e.getRelationships(), 0, currentState.objRels, 0, 
+                    currentState.objRels.length);
         }
 
         EventListener[] list = listenerList
@@ -1416,7 +1497,7 @@
             temp.currentObjRelationshipChanged(e);
         }
     }
-
+    
     public void addDataMap(Object src, DataMap map) {
         addDataMap(src, map, true);
     }
@@ -1470,10 +1551,10 @@
     }
 
     /**
-     * @return currently selected callback method
+     * @return currently selected callback methods
      */
-    public String getCurrentCallbackMethod() {
-        return currentState.callbackMethod;
+    public String[] getCurrentCallbackMethods() {
+        return currentState.callbackMethods;
     }
 
     /**
@@ -1491,10 +1572,10 @@
     }
 
     /**
-     * @return currently selected callback method
+     * @return currently selected callback methods
      */
-    public void setCurrentCallbackMethod(String callbackMethod) {
-        currentState.callbackMethod = callbackMethod;
+    public void setCurrentCallbackMethods(String[] callbackMethods) {
+        currentState.callbackMethods = callbackMethods;
     }
 
     /**

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=670246&r1=670245&r2=670246&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 Sat Jun 21 11:25:29 2008
@@ -75,6 +75,8 @@
 import org.apache.cayenne.modeler.event.DomainDisplayEvent;
 import org.apache.cayenne.modeler.event.DomainDisplayListener;
 import org.apache.cayenne.modeler.event.EntityDisplayEvent;
+import org.apache.cayenne.modeler.event.MultipleObjectsDisplayEvent;
+import org.apache.cayenne.modeler.event.MultipleObjectsDisplayListener;
 import org.apache.cayenne.modeler.event.ObjEntityDisplayListener;
 import org.apache.cayenne.modeler.event.ProcedureDisplayEvent;
 import org.apache.cayenne.modeler.event.ProcedureDisplayListener;
@@ -83,6 +85,7 @@
 import org.apache.cayenne.modeler.util.CellRenderers;
 import org.apache.cayenne.modeler.util.Comparators;
 import org.apache.cayenne.project.Project;
+import org.apache.cayenne.project.ProjectPath;
 import org.apache.cayenne.query.Query;
 import org.apache.cayenne.reflect.PropertyUtils;
 import org.apache.commons.logging.Log;
@@ -95,7 +98,7 @@
         DomainListener, DataMapDisplayListener, DataMapListener, DataNodeDisplayListener,
         DataNodeListener, ObjEntityListener, ObjEntityDisplayListener, DbEntityListener,
         DbEntityDisplayListener, QueryListener, QueryDisplayListener, ProcedureListener,
-        ProcedureDisplayListener {
+        ProcedureDisplayListener, MultipleObjectsDisplayListener {
 
     private static final Log logObj = LogFactory.getLog(ProjectTreeView.class);
 
@@ -124,7 +127,36 @@
         treeSelectionListener = new TreeSelectionListener() {
 
             public void valueChanged(TreeSelectionEvent e) {
-                processSelection(e.getPath());
+                TreePath[] paths = getSelectionPaths();
+                
+                if (paths != null) {
+                    if (paths.length > 1) {
+                        ProjectPath[] projectPaths = new ProjectPath[paths.length];
+                        for (int i = 0; i < paths.length; i++) {
+                            projectPaths[i] = createProjectPath(paths[i]);
+                        }
+                    
+                        mediator.fireMultipleObjectsDisplayEvent(
+                                new MultipleObjectsDisplayEvent(this, projectPaths));
+                    }
+                    else if (paths.length == 1) {
+                        processSelection(paths[0]);
+                    }
+                }
+            }
+            
+            /**
+             * Converts TreePath to ProjectPath 
+             */
+            private ProjectPath createProjectPath(TreePath treePath) {
+                Object[] path = treePath.getPath();
+                Object[] projectPath = new Object[path.length];
+                
+                for (int i = 0; i < projectPath.length; i++) {
+                    projectPath[i] = ((DefaultMutableTreeNode) path[i]).getUserObject();
+                }
+                
+                return new ProjectPath(projectPath);
             }
         };
 
@@ -155,7 +187,7 @@
         setModel(model);
 
         // expand top level
-        getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
+        getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
         Enumeration level = model.getRootNode().children();
         while (level.hasMoreElements()) {
             DefaultMutableTreeNode node = (DefaultMutableTreeNode) level.nextElement();
@@ -170,10 +202,11 @@
     ProjectTreeModel getProjectModel() {
         return (ProjectTreeModel) getModel();
     }
-
+    
     /**
      * Returns a "name" property of the tree node.
      */
+    @Override
     public String convertValueToText(
             Object value,
             boolean selected,
@@ -283,12 +316,15 @@
                 e.getDomain(), e.getDataMap(), e.getQuery()
         });
     }
+    
+    public void currentObjectsChanged(MultipleObjectsDisplayEvent e) {}
 
     public void procedureAdded(ProcedureEvent e) {
 
         DefaultMutableTreeNode node = getProjectModel().getNodeForObjectPath(
                 new Object[] {
-                        mediator.getCurrentDataDomain(), mediator.getCurrentDataMap()
+                        mediator.findDomain(e.getProcedure().getDataMap()),
+                        e.getProcedure().getDataMap()
                 });
 
         if (node == null) {
@@ -304,7 +340,8 @@
     public void procedureChanged(ProcedureEvent e) {
         if (e.isNameChange()) {
             Object[] path = new Object[] {
-                    mediator.getCurrentDataDomain(), mediator.getCurrentDataMap(),
+                    mediator.findDomain(e.getProcedure().getDataMap()),
+                    e.getProcedure().getDataMap(),
                     e.getProcedure()
             };
 
@@ -317,7 +354,8 @@
     public void procedureRemoved(ProcedureEvent e) {
 
         removeNode(new Object[] {
-                mediator.getCurrentDataDomain(), mediator.getCurrentDataMap(),
+                mediator.findDomain(e.getProcedure().getDataMap()),
+                e.getProcedure().getDataMap(),
                 e.getProcedure()
         });
     }
@@ -326,7 +364,8 @@
 
         DefaultMutableTreeNode node = getProjectModel().getNodeForObjectPath(
                 new Object[] {
-                        mediator.getCurrentDataDomain(), mediator.getCurrentDataMap()
+                        e.getDomain() != null ? e.getDomain() : mediator.findDomain(e.getDataMap()),
+                        e.getDataMap()
                 });
 
         if (node == null) {
@@ -343,7 +382,7 @@
 
         if (e.isNameChange()) {
             Object[] path = new Object[] {
-                    mediator.getCurrentDataDomain(), mediator.getCurrentDataMap(),
+                    e.getDomain() != null ? e.getDomain() : mediator.findDomain(e.getDataMap()),
                     e.getQuery()
             };
 
@@ -355,7 +394,8 @@
 
     public void queryRemoved(QueryEvent e) {
         removeNode(new Object[] {
-                mediator.getCurrentDataDomain(), mediator.getCurrentDataMap(),
+                e.getDomain() != null ? e.getDomain() : mediator.findDomain(e.getDataMap()),
+                e.getDataMap(),
                 e.getQuery()
         });
     }
@@ -392,7 +432,8 @@
 
         DefaultMutableTreeNode node = getProjectModel().getNodeForObjectPath(
                 new Object[] {
-                        mediator.getCurrentDataDomain(), e.getDataNode()
+                        e.getDomain() != null ? e.getDomain() : mediator.findDomain(e.getDataNode()), 
+                        e.getDataNode()
                 });
 
         if (node != null) {
@@ -465,7 +506,7 @@
 
         DefaultMutableTreeNode node = getProjectModel().getNodeForObjectPath(
                 new Object[] {
-                    mediator.getCurrentDataDomain()
+                        e.getDomain() != null ? e.getDomain() : mediator.findDomain(e.getDataNode())
                 });
 
         if (node == null) {
@@ -484,14 +525,16 @@
         }
 
         removeNode(new Object[] {
-                mediator.getCurrentDataDomain(), e.getDataNode()
+                e.getDomain() != null ? e.getDomain() : mediator.findDomain(e.getDataNode()),
+                e.getDataNode()
         });
     }
 
     public void dataMapChanged(DataMapEvent e) {
 
         Object[] path = new Object[] {
-                mediator.getCurrentDataDomain(), e.getDataMap()
+                e.getDomain() != null ? e.getDomain() : mediator.findDomain(e.getDataMap()), 
+                e.getDataMap()
         };
 
         updateNode(path);
@@ -505,7 +548,7 @@
     public void dataMapAdded(DataMapEvent e) {
         DefaultMutableTreeNode domainNode = getProjectModel().getNodeForObjectPath(
                 new Object[] {
-                    mediator.getCurrentDataDomain()
+                        e.getDomain() != null ? e.getDomain() : mediator.findDomain(e.getDataMap())
                 });
 
         DefaultMutableTreeNode newMapNode = ProjectTreeModel.wrapProjectNode(e
@@ -516,7 +559,7 @@
 
     public void dataMapRemoved(DataMapEvent e) {
         DataMap map = e.getDataMap();
-        DataDomain domain = mediator.getCurrentDataDomain();
+        DataDomain domain = e.getDomain() != null ? e.getDomain() : mediator.findDomain(e.getDataMap());
 
         removeNode(new Object[] {
                 domain, map
@@ -566,7 +609,8 @@
     protected void entityChanged(EntityEvent e) {
         if (e.isNameChange()) {
             Object[] path = new Object[] {
-                    mediator.getCurrentDataDomain(), mediator.getCurrentDataMap(),
+                    e.getDomain() != null ? e.getDomain() : mediator.findDomain(e.getEntity().getDataMap()), 
+                    e.getEntity().getDataMap(),
                     e.getEntity()
             };
 
@@ -586,7 +630,8 @@
 
         DefaultMutableTreeNode mapNode = getProjectModel().getNodeForObjectPath(
                 new Object[] {
-                        mediator.getCurrentDataDomain(), mediator.getCurrentDataMap()
+                        e.getDomain() != null ? e.getDomain() : mediator.findDomain(e.getEntity().getDataMap()), 
+                        e.getEntity().getDataMap()
                 });
 
         if (mapNode == null) {
@@ -609,7 +654,8 @@
 
         // remove from DataMap tree
         removeNode(new Object[] {
-                mediator.getCurrentDataDomain(), mediator.getCurrentDataMap(),
+                e.getDomain() != null ? e.getDomain() : mediator.findDomain(e.getEntity().getDataMap()), 
+                e.getEntity().getDataMap(),
                 e.getEntity()
         });
     }
@@ -869,11 +915,13 @@
      */
     class PopupHandler extends MouseAdapter
     {
+        @Override
         public void mousePressed(MouseEvent e) 
         {
             mouseReleased(e);
         }
 
+        @Override
         public void mouseReleased(MouseEvent e) 
         {
             if(e.isPopupTrigger())
@@ -885,7 +933,7 @@
                  * Selecting specified row
                  */
                 int row = getRowForLocation(e.getX(), e.getY());
-                if(row != -1)
+                if(row != -1 && !isRowSelected(row))
                     setSelectionRow(row);
                 
                 popup.show(ProjectTreeView.this, e.getX(), e.getY());

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=670246&r1=670245&r2=670246&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 Sat Jun 21 11:25:29 2008
@@ -54,6 +54,7 @@
     /**
      * @return icon file name for button
      */
+    @Override
     public String getIconName() {
         return "icon-remove-method.gif";
     }
@@ -62,13 +63,16 @@
      * performs callback method removing
      * @param e event
      */
+    @Override
     public final void performAction(ActionEvent e) {
         ConfirmRemoveDialog dialog = getConfirmDeleteDialog();
+        
+        String[] methods = getProjectController().getCurrentCallbackMethods();
 
-        if (getProjectController().getCurrentCallbackMethod() != null) {
-            if (dialog.shouldDelete("callback method", getProjectController()
-                    .getCurrentCallbackMethod())) {
-                removeCallbackMethod(e);
+        if (methods.length > 0) {
+            if ((methods.length == 1 && dialog.shouldDelete("callback method", methods[0]))
+                    || (methods.length > 1 && dialog.shouldDelete("selected callback methods"))) {
+                removeCallbackMethods(e);
             }
         }
     }
@@ -77,17 +81,26 @@
      * base logic for callback method removing
      * @param actionEvent event
      */
-    private void removeCallbackMethod(ActionEvent actionEvent) {
+    private void removeCallbackMethods(ActionEvent actionEvent) {
         ProjectController mediator = getProjectController();
         CallbackType callbackType = mediator.getCurrentCallbackType();
-        String callbackMethod = mediator.getCurrentCallbackMethod();
-        getCallbackMap().getCallbackDescriptor(callbackType.getType()).removeCallbackMethod(callbackMethod);
-        CallbackMethodEvent e = new CallbackMethodEvent(
+        
+        String[] callbackMethods = mediator.getCurrentCallbackMethods();
+        
+        for (int i = 0; i < callbackMethods.length; i++) {
+            getCallbackMap().getCallbackDescriptor(callbackType.getType()).removeCallbackMethod(callbackMethods[i]);
+            CallbackMethodEvent e = new CallbackMethodEvent(
                 actionEvent.getSource(),
                 null,
-                callbackMethod,
+                callbackMethods[i],
                 MapEvent.REMOVE);
-        mediator.fireCallbackMethodEvent(e);
+            mediator.fireCallbackMethodEvent(e);
+        }
     }
+    
+    /**
+     * Returns action name, depending on count of selected rows
+     */
+    public abstract String getActionName(boolean multiple);
 }
 

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=670246&r1=670245&r2=670246&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 Sat Jun 21 11:25:29 2008
@@ -46,12 +46,12 @@
 
     /**
      * Constructor for CreateAttributeAction.
-     * @param name
      */
     public CreateAttributeAction(Application application) {
         super(getActionName(), application);
     }
 
+    @Override
     public String getIconName() {
         return "icon-attribute.gif";
     }
@@ -59,6 +59,7 @@
     /**
      * Creates ObjAttribute, DbAttribute depending on context.
      */
+    @Override
     public void performAction(ActionEvent e) {
         if (getProjectController().getCurrentObjEntity() != null) {
             createObjAttribute();
@@ -120,6 +121,7 @@
     /**
      * Returns <code>true</code> if path contains an Entity object.
      */
+    @Override
     public boolean enableForPath(ProjectPath path) {
         if (path == null) {
             return false;

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveAction.java?rev=670246&r1=670245&r2=670246&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveAction.java Sat Jun 21 11:25:29 2008
@@ -72,10 +72,12 @@
         super(actionName, application);
     }
 
+    @Override
     public String getIconName() {
         return "icon-trash.gif";
     }
 
+    @Override
     public KeyStroke getAcceleratorKey() {
         return KeyStroke.getKeyStroke(KeyEvent.VK_D, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
     }
@@ -84,6 +86,7 @@
         return new ConfirmRemoveDialog();
     }
 
+    @Override
     public void performAction(ActionEvent e) {
 
         ProjectController mediator = getProjectController();
@@ -92,22 +95,22 @@
 
         if (mediator.getCurrentObjEntity() != null) {
             if (dialog.shouldDelete("ObjEntity", mediator.getCurrentObjEntity().getName())) {
-                removeObjEntity();
+                removeObjEntity(mediator.getCurrentDataMap(), mediator.getCurrentObjEntity());
             }
         }
         else if (mediator.getCurrentDbEntity() != null) {
             if (dialog.shouldDelete("DbEntity", mediator.getCurrentDbEntity().getName())) {
-                removeDbEntity();
+                removeDbEntity(mediator.getCurrentDataMap(), mediator.getCurrentDbEntity());
             }
         }
         else if (mediator.getCurrentQuery() != null) {
             if (dialog.shouldDelete("query", mediator.getCurrentQuery().getName())) {
-                removeQuery();
+                removeQuery(mediator.getCurrentDataMap(), mediator.getCurrentQuery());
             }
         }
         else if (mediator.getCurrentProcedure() != null) {
             if (dialog.shouldDelete("procedure", mediator.getCurrentProcedure().getName())) {
-                removeProcedure();
+                removeProcedure(mediator.getCurrentDataMap(), mediator.getCurrentProcedure());
             }
         }
         else if (mediator.getCurrentDataMap() != null) {
@@ -115,30 +118,38 @@
 
                 // In context of Data node just remove from Data Node
                 if (mediator.getCurrentDataNode() != null) {
-                    removeDataMapFromDataNode();
+                    removeDataMapFromDataNode(mediator.getCurrentDataNode(), mediator.getCurrentDataMap());
                 }
                 else {
                     // Not under Data Node, remove completely
-                    removeDataMap();
+                    removeDataMap(mediator.getCurrentDataDomain(), mediator.getCurrentDataMap());
                 }
             }
         }
         else if (mediator.getCurrentDataNode() != null) {
             if (dialog.shouldDelete("data node", mediator.getCurrentDataNode().getName())) {
-                removeDataNode();
+                removeDataNode(mediator.getCurrentDataDomain(), mediator.getCurrentDataNode());
             }
         }
         else if (mediator.getCurrentDataDomain() != null) {
             if (dialog.shouldDelete("data domain", mediator.getCurrentDataDomain().getName())) {
-                removeDomain();
+                removeDomain(mediator.getCurrentDataDomain());
+            }
+        }
+        else if (mediator.getCurrentPaths() != null) { //multiple deletion
+            if (dialog.shouldDelete("selected objects")) {
+                ProjectPath[] paths = mediator.getCurrentPaths();
+                for (int i = 0; i < paths.length; i++) {
+                    removeLastPathComponent(paths[i]);
+                }
             }
         }
     }
-
-    protected void removeDomain() {
+    
+    private void removeDomain(DataDomain domain){
         ApplicationProject project = (ApplicationProject) getCurrentProject();
         ProjectController mediator = getProjectController();
-        DataDomain domain = mediator.getCurrentDataDomain();
+        
         project.getConfiguration().removeDomain(domain.getName());
         mediator.fireDomainEvent(new DomainEvent(
                 Application.getFrame(),
@@ -146,83 +157,95 @@
                 MapEvent.REMOVE));
     }
 
-    protected void removeDataMap() {
+    private void removeDataMap(DataDomain domain, DataMap map) {
         ProjectController mediator = getProjectController();
-        DataMap map = mediator.getCurrentDataMap();
-        DataDomain domain = mediator.getCurrentDataDomain();
-        domain.removeMap(map.getName());
-        mediator.fireDataMapEvent(new DataMapEvent(
+        
+        DataMapEvent e = new DataMapEvent(
                 Application.getFrame(),
                 map,
-                MapEvent.REMOVE));
+                MapEvent.REMOVE);
+        e.setDomain(domain);
+
+        domain.removeMap(map.getName());
+        mediator.fireDataMapEvent(e);
     }
 
-    protected void removeDataNode() {
+    private void removeDataNode(DataDomain domain, DataNode node) {
         ProjectController mediator = getProjectController();
-        DataNode node = mediator.getCurrentDataNode();
-        DataDomain domain = mediator.getCurrentDataDomain();
-        domain.removeDataNode(node.getName());
-        mediator.fireDataNodeEvent(new DataNodeEvent(
+        
+        DataNodeEvent e = new DataNodeEvent(
                 Application.getFrame(),
                 node,
-                MapEvent.REMOVE));
+                MapEvent.REMOVE);
+        e.setDomain(domain);
+
+        domain.removeDataNode(node.getName());
+        mediator.fireDataNodeEvent(e);
     }
 
     /**
      * Removes current DbEntity from its DataMap and fires "remove" EntityEvent.
      */
-    protected void removeDbEntity() {
+    private void removeDbEntity(DataMap map, DbEntity ent) {
         ProjectController mediator = getProjectController();
-        DbEntity ent = mediator.getCurrentDbEntity();
-        DataMap map = mediator.getCurrentDataMap();
-        map.removeDbEntity(ent.getName(), true);
-        mediator.fireDbEntityEvent(new EntityEvent(
+        
+        EntityEvent e = new EntityEvent(
                 Application.getFrame(),
                 ent,
-                MapEvent.REMOVE));
+                MapEvent.REMOVE);
+        e.setDomain(mediator.findDomain(map));
+
+        map.removeDbEntity(ent.getName(), true);
+        mediator.fireDbEntityEvent(e);
     }
 
     /**
      * Removes current Query from its DataMap and fires "remove" QueryEvent.
      */
-    protected void removeQuery() {
+    private void removeQuery(DataMap map, Query query) {
         ProjectController mediator = getProjectController();
-        Query query = mediator.getCurrentQuery();
-        DataMap map = mediator.getCurrentDataMap();
-        map.removeQuery(query.getName());
-        mediator.fireQueryEvent(new QueryEvent(
+        
+        QueryEvent e = new QueryEvent(
                 Application.getFrame(),
                 query,
-                MapEvent.REMOVE));
+                MapEvent.REMOVE,
+                map);
+        e.setDomain(mediator.findDomain(map));
+        
+        map.removeQuery(query.getName());
+        mediator.fireQueryEvent(e);
     }
 
     /**
      * Removes current Procedure from its DataMap and fires "remove" ProcedureEvent.
      */
-    protected void removeProcedure() {
+    private void removeProcedure(DataMap map, Procedure procedure) {
         ProjectController mediator = getProjectController();
-        Procedure procedure = mediator.getCurrentProcedure();
-        DataMap map = mediator.getCurrentDataMap();
-        map.removeProcedure(procedure.getName());
-        mediator.fireProcedureEvent(new ProcedureEvent(
+        
+        ProcedureEvent e = new ProcedureEvent(
                 Application.getFrame(),
                 procedure,
-                MapEvent.REMOVE));
+                MapEvent.REMOVE);
+        e.setDomain(mediator.findDomain(map));
+        
+        map.removeProcedure(procedure.getName());
+        mediator.fireProcedureEvent(e);
     }
 
     /**
      * Removes current object entity from its DataMap.
      */
-    protected void removeObjEntity() {
+    private void removeObjEntity(DataMap map, ObjEntity entity) {
         ProjectController mediator = getProjectController();
-        ObjEntity entity = mediator.getCurrentObjEntity();
-
-        DataMap map = mediator.getCurrentDataMap();
-        map.removeObjEntity(entity.getName(), true);
-        mediator.fireObjEntityEvent(new EntityEvent(
+        
+        EntityEvent e = new EntityEvent(
                 Application.getFrame(),
                 entity,
-                MapEvent.REMOVE));
+                MapEvent.REMOVE);
+        e.setDomain(mediator.findDomain(map));
+        
+        map.removeObjEntity(entity.getName(), true);
+        mediator.fireObjEntityEvent(e);
 
         // remove queries that depend on entity
         // TODO: (Andrus, 09/09/2005) show warning dialog?
@@ -237,28 +260,27 @@
                     || (root instanceof String && root
                             .toString()
                             .equals(entity.getName()))) {
-                map.removeQuery(next.getName());
-                mediator.fireQueryEvent(new QueryEvent(
-                        Application.getFrame(),
-                        next,
-                        MapEvent.REMOVE));
+                removeQuery(map, next);
             }
         }
     }
 
-    protected void removeDataMapFromDataNode() {
+    private void removeDataMapFromDataNode(DataNode node, DataMap map) {
         ProjectController mediator = getProjectController();
-        DataNode node = mediator.getCurrentDataNode();
-        DataMap map = mediator.getCurrentDataMap();
+        
+        DataNodeEvent e = new DataNodeEvent(Application.getFrame(), node);
+        e.setDomain(mediator.findDomain(node));
+        
         node.removeDataMap(map.getName());
 
         // Force reloading of the data node in the browse view
-        mediator.fireDataNodeEvent(new DataNodeEvent(Application.getFrame(), node));
+        mediator.fireDataNodeEvent(e);
     }
 
     /**
      * 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;
@@ -294,4 +316,38 @@
             return false;
         }
     }
+    
+    /**
+     * Removes an object, depending on its type
+     */
+    private void removeLastPathComponent(ProjectPath path) {
+        Object lastObject = path.getObject();
+        
+        if (lastObject instanceof DataDomain) {
+            removeDomain((DataDomain) lastObject);
+        }
+        else if (lastObject instanceof DataMap) {
+            Object parent = path.getObjectParent();
+            
+            if(parent instanceof DataDomain)
+                removeDataMap((DataDomain) parent, (DataMap) lastObject);
+            else //if(parent instanceof DataNode)
+                removeDataMapFromDataNode((DataNode) parent, (DataMap) lastObject);
+        }
+        else if (lastObject instanceof DataNode) {
+            removeDataNode((DataDomain) path.getObjectParent(), (DataNode) lastObject);
+        }
+        else if (lastObject instanceof DbEntity) {
+            removeDbEntity((DataMap) path.getObjectParent(), (DbEntity) lastObject);
+        }
+        else if (lastObject instanceof ObjEntity) {
+            removeObjEntity((DataMap) path.getObjectParent(), (ObjEntity) lastObject);
+        }
+        else if (lastObject instanceof Query) {
+            removeQuery((DataMap) path.getObjectParent(), (Query) lastObject);
+        }
+        else if (lastObject instanceof Procedure) {
+            removeProcedure((DataMap) path.getObjectParent(), (Procedure) lastObject);
+        }
+    }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveAttributeAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveAttributeAction.java?rev=670246&r1=670245&r2=670246&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveAttributeAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveAttributeAction.java Sat Jun 21 11:25:29 2008
@@ -43,10 +43,19 @@
 public class RemoveAttributeAction extends RemoveAction {
 
     private final static String ACTION_NAME = "Remove Attribute";
+    
+    /**
+     * Name of action if multiple rels are selected
+     */
+    private final static String ACTION_NAME_MULTIPLE = "Remove Attributes";
 
     public static String getActionName() {
         return ACTION_NAME;
     }
+    
+    public static String getActionName(boolean multiple) {
+        return multiple ? ACTION_NAME_MULTIPLE : ACTION_NAME;
+    }
 
     public RemoveAttributeAction(Application application) {
         super(ACTION_NAME, application);
@@ -56,6 +65,7 @@
      * 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;
@@ -64,49 +74,61 @@
         return path.getObject() instanceof Attribute;
     }
 
+    @Override
     public void performAction(ActionEvent e) {
         ConfirmRemoveDialog dialog = getConfirmDeleteDialog();
 
-        if (getProjectController().getCurrentObjAttribute() != null) {
-            if (dialog.shouldDelete("ObjAttribute", getProjectController()
-                    .getCurrentObjAttribute().getName())) {
-                removeObjAttribute();
+        ObjAttribute[] attrs = getProjectController().getCurrentObjAttributes();
+        if (attrs != null && attrs.length > 0) {
+            if ((attrs.length == 1 && dialog.shouldDelete("ObjAttribute", attrs[0].getName()))
+                || (attrs.length > 1 && dialog.shouldDelete("selected ObjAttributes"))) {
+                removeObjAttributes();
             }
         }
-        else if (getProjectController().getCurrentDbAttribute() != null) {
-            if (dialog.shouldDelete("DbAttribute", getProjectController()
-                    .getCurrentDbAttribute().getName())) {
-                removeDbAttribute();
-            }
+        else {
+            DbAttribute[] dbAttrs = getProjectController().getCurrentDbAttributes();
+            if (dbAttrs != null && dbAttrs.length > 0) {
+                if ((dbAttrs.length == 1 && dialog.shouldDelete("DbAttribute", dbAttrs[0].getName()))
+                    || (dbAttrs.length > 1 && dialog.shouldDelete("selected DbAttributes"))) {
+                    removeDbAttributes();
+                }
+            }            
         }
     }
 
-    protected void removeDbAttribute() {
+    protected void removeDbAttributes() {
         ProjectController mediator = getProjectController();
         DbEntity entity = mediator.getCurrentDbEntity();
-        DbAttribute attrib = mediator.getCurrentDbAttribute();
-        entity.removeAttribute(attrib.getName());
-        ProjectUtil.cleanObjMappings(mediator.getCurrentDataMap());
+        DbAttribute[] attribs = mediator.getCurrentDbAttributes();
+        
+        for (int i = 0; i < attribs.length; i++) {
+            entity.removeAttribute(attribs[i].getName());
+
+            AttributeEvent e = new AttributeEvent(
+                    Application.getFrame(),
+                    attribs[i],
+                    entity,
+                    MapEvent.REMOVE);
+            mediator.fireDbAttributeEvent(e);
+        }
 
-        AttributeEvent e = new AttributeEvent(
-                Application.getFrame(),
-                attrib,
-                entity,
-                MapEvent.REMOVE);
-        mediator.fireDbAttributeEvent(e);
+        ProjectUtil.cleanObjMappings(mediator.getCurrentDataMap());
     }
 
-    protected void removeObjAttribute() {
+    protected void removeObjAttributes() {
         ProjectController mediator = getProjectController();
         ObjEntity entity = mediator.getCurrentObjEntity();
-        ObjAttribute attrib = mediator.getCurrentObjAttribute();
-
-        entity.removeAttribute(attrib.getName());
-        AttributeEvent e = new AttributeEvent(
-                Application.getFrame(),
-                attrib,
-                entity,
-                MapEvent.REMOVE);
-        mediator.fireObjAttributeEvent(e);
+        
+        ObjAttribute[] attribs = mediator.getCurrentObjAttributes();
+        
+        for (int i = 0; i < attribs.length; i++) {
+            entity.removeAttribute(attribs[i].getName());
+            AttributeEvent e = new AttributeEvent(
+                    Application.getFrame(),
+                    attribs[i],
+                    entity,
+                    MapEvent.REMOVE);
+            mediator.fireObjAttributeEvent(e);
+        }
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveCallbackMethodAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveCallbackMethodAction.java?rev=670246&r1=670245&r2=670246&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveCallbackMethodAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveCallbackMethodAction.java Sat Jun 21 11:25:29 2008
@@ -33,6 +33,11 @@
      * unique action name
      */
     public final static String ACTION_NAME = "Remove Callback Method";
+    
+    /**
+     * action name for multiple selection
+     */
+    private final static String ACTION_NAME_MULTIPLE = "Remove Callback Methods";
 
     /**
      * Constructor.
@@ -53,8 +58,14 @@
     /**
      * @return CallbackMap fom which remove callback method
      */
+    @Override
     public CallbackMap getCallbackMap() {
         return getProjectController().getCurrentObjEntity().getCallbackMap();
     }
+
+    @Override
+    public String getActionName(boolean multiple) {
+        return multiple ? ACTION_NAME_MULTIPLE : ACTION_NAME;
+    }
 }
 

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveCallbackMethodForDataMapListenerAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveCallbackMethodForDataMapListenerAction.java?rev=670246&r1=670245&r2=670246&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveCallbackMethodForDataMapListenerAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveCallbackMethodForDataMapListenerAction.java Sat Jun 21 11:25:29 2008
@@ -33,6 +33,11 @@
      * unique action name
      */
     public final static String ACTION_NAME = "Remove callback method for data map entity listener";
+    
+    /**
+     * action name for multiple selection
+     */
+    private final static String ACTION_NAME_MULTIPLE = "Remove callback methods for data map entity listener";
 
     /**
      * Constructor.
@@ -46,9 +51,15 @@
     /**
      * @return CallbackMap fom which remove callback method
      */
+    @Override
     public CallbackMap getCallbackMap() {
         String listenerClass = getProjectController().getCurrentListenerClass();
         return getProjectController().getCurrentDataMap().getDefaultEntityListener(listenerClass).getCallbackMap();
     }
+
+    @Override
+    public String getActionName(boolean multiple) {
+        return multiple ? ACTION_NAME_MULTIPLE : ACTION_NAME;
+    }
 }
 

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveCallbackMethodForListenerAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveCallbackMethodForListenerAction.java?rev=670246&r1=670245&r2=670246&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveCallbackMethodForListenerAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveCallbackMethodForListenerAction.java Sat Jun 21 11:25:29 2008
@@ -34,6 +34,11 @@
      * unique action name
      */
     public final static String ACTION_NAME = "Remove callback method for entity listener";
+    
+    /**
+     * action name for multiple selection
+     */
+    private final static String ACTION_NAME_MULTIPLE = "Remove callback methods for entity listener";
 
     /**
      * Constructor.
@@ -47,10 +52,16 @@
     /**
      * @return CallbackMap fom which remove callback method
      */
+    @Override
     public CallbackMap getCallbackMap() {
         ObjEntity objEnt = getProjectController().getCurrentObjEntity();
         String listenerClass = getProjectController().getCurrentListenerClass();
         return objEnt.getEntityListener(listenerClass).getCallbackMap();
     }
+    
+    @Override
+    public String getActionName(boolean multiple) {
+        return multiple ? ACTION_NAME_MULTIPLE : ACTION_NAME;
+    }
 }
 

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveProcedureParameterAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveProcedureParameterAction.java?rev=670246&r1=670245&r2=670246&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveProcedureParameterAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveProcedureParameterAction.java Sat Jun 21 11:25:29 2008
@@ -38,6 +38,15 @@
 public class RemoveProcedureParameterAction extends RemoveAction {
 
     private final static String ACTION_NAME = "Remove Parameter";
+    
+    /**
+     * Name of action if multiple rels are selected
+     */
+    private final static String ACTION_NAME_MULTIPLE = "Remove Parameters";
+    
+    public static String getActionName(boolean multiple) {
+        return multiple ? ACTION_NAME_MULTIPLE : ACTION_NAME;
+    }
 
     public static String getActionName() {
         return ACTION_NAME;
@@ -51,6 +60,7 @@
      * Returns <code>true</code> if last object in the path contains a removable
      * parameter.
      */
+    @Override
     public boolean enableForPath(ProjectPath path) {
         if (path == null) {
             return false;
@@ -59,27 +69,32 @@
         return path.getObject() instanceof ProcedureParameter;
     }
 
+    @Override
     public void performAction(ActionEvent e) {
         ConfirmRemoveDialog dialog = getConfirmDeleteDialog();
 
-        if (getProjectController().getCurrentProcedureParameter() != null) {
-            if (dialog.shouldDelete("procedure parameter", getProjectController()
-                    .getCurrentProcedureParameter().getName())) {
-                removeProcedureParameter();
+        ProcedureParameter[] params = getProjectController().getCurrentProcedureParameters(); 
+        if (params.length > 0) {
+            if ((params.length == 1 && dialog.shouldDelete("procedure parameter", params[0].getName()))
+               || (params.length > 1 && dialog.shouldDelete("selected procedure parameters"))) {
+                removeProcedureParameters();
             }
         }
     }
 
-    protected void removeProcedureParameter() {
+    protected void removeProcedureParameters() {
         ProjectController mediator = getProjectController();
-        ProcedureParameter parameter = mediator.getCurrentProcedureParameter();
-        mediator.getCurrentProcedure().removeCallParameter(parameter.getName());
+        ProcedureParameter[] parameters = mediator.getCurrentProcedureParameters();
+        
+        for (int i = 0; i < parameters.length; i++) {
+            mediator.getCurrentProcedure().removeCallParameter(parameters[i].getName());
 
-        ProcedureParameterEvent e = new ProcedureParameterEvent(
+            ProcedureParameterEvent e = new ProcedureParameterEvent(
                 Application.getFrame(),
-                parameter,
+                parameters[i],
                 MapEvent.REMOVE);
 
-        mediator.fireProcedureParameterEvent(e);
+            mediator.fireProcedureParameterEvent(e);
+        }
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveRelationshipAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveRelationshipAction.java?rev=670246&r1=670245&r2=670246&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveRelationshipAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveRelationshipAction.java Sat Jun 21 11:25:29 2008
@@ -43,10 +43,19 @@
 public class RemoveRelationshipAction extends RemoveAction {
 
     private final static String ACTION_NAME = "Remove Relationship";
+    
+    /**
+     * Name of action if multiple rels are selected
+     */
+    private final static String ACTION_NAME_MULTIPLE = "Remove Relationships";
 
     public static String getActionName() {
         return ACTION_NAME;
     }
+    
+    public static String getActionName(boolean multiple) {
+        return multiple ? ACTION_NAME_MULTIPLE : ACTION_NAME;
+    }
 
     public RemoveRelationshipAction(Application application) {
         super(ACTION_NAME, application);
@@ -56,6 +65,7 @@
      * Returns <code>true</code> if last object in the path contains a removable
      * relationship.
      */
+    @Override
     public boolean enableForPath(ProjectPath path) {
         if (path == null) {
             return false;
@@ -64,48 +74,60 @@
         return path.getObject() instanceof Relationship;
     }
 
+    @Override
     public void performAction(ActionEvent e) {
         ConfirmRemoveDialog dialog = getConfirmDeleteDialog();
 
-        if (getProjectController().getCurrentObjRelationship() != null) {
-            if (dialog.shouldDelete("ObjRelationship", getProjectController()
-                    .getCurrentObjRelationship().getName())) {
-                removeObjRelationship();
+        ObjRelationship[] rels = getProjectController().getCurrentObjRelationships();
+        if (rels != null && rels.length > 0) {
+            if ((rels.length == 1 && dialog.shouldDelete("ObjRelationship", rels[0].getName()))
+                || (rels.length > 1 && dialog.shouldDelete("selected ObjRelationships"))) {
+                removeObjRelationships();
             }
         }
-        else if (getProjectController().getCurrentDbRelationship() != null) {
-            if (dialog.shouldDelete("DbRelationship", getProjectController()
-                    .getCurrentDbRelationship().getName())) {
-                removeDbRelationship();
-            }
+        else {
+            DbRelationship[] dbRels = getProjectController().getCurrentDbRelationships();
+            if (dbRels != null && dbRels.length > 0) {
+                if ((dbRels.length == 1 && dialog.shouldDelete("DbRelationship", dbRels[0].getName()))
+                    || (dbRels.length > 1 && dialog.shouldDelete("selected DbRelationships"))) {
+                    removeDbRelationships();
+                }
+            }            
         }
     }
 
-    protected void removeObjRelationship() {
+    protected void removeObjRelationships() {
         ProjectController mediator = getProjectController();
         ObjEntity entity = mediator.getCurrentObjEntity();
-        ObjRelationship rel = mediator.getCurrentObjRelationship();
-        entity.removeRelationship(rel.getName());
-        RelationshipEvent e = new RelationshipEvent(
+        ObjRelationship[] rels = mediator.getCurrentObjRelationships();
+        
+        for (int i = 0; i < rels.length; i++) {
+            entity.removeRelationship(rels[i].getName());
+            RelationshipEvent e = new RelationshipEvent(
                 Application.getFrame(),
-                rel,
+                rels[i],
                 entity,
                 MapEvent.REMOVE);
-        mediator.fireObjRelationshipEvent(e);
+            mediator.fireObjRelationshipEvent(e);
+        }
     }
 
-    protected void removeDbRelationship() {
+    protected void removeDbRelationships() {
         ProjectController mediator = getProjectController();
         DbEntity entity = mediator.getCurrentDbEntity();
-        DbRelationship rel = mediator.getCurrentDbRelationship();
-        entity.removeRelationship(rel.getName());
-        ProjectUtil.cleanObjMappings(mediator.getCurrentDataMap());
+        DbRelationship[] rels = mediator.getCurrentDbRelationships();
+        
+        for (int i = 0; i < rels.length; i++) {
+            entity.removeRelationship(rels[i].getName());
 
-        RelationshipEvent e = new RelationshipEvent(
+            RelationshipEvent e = new RelationshipEvent(
                 Application.getFrame(),
-                rel,
+                rels[i],
                 entity,
                 MapEvent.REMOVE);
-        mediator.fireDbRelationshipEvent(e);
+            mediator.fireDbRelationshipEvent(e);
+        }
+        
+        ProjectUtil.cleanObjMappings(mediator.getCurrentDataMap());
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/ConfirmRemoveDialog.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/ConfirmRemoveDialog.java?rev=670246&r1=670245&r2=670246&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/ConfirmRemoveDialog.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/ConfirmRemoveDialog.java Sat Jun 21 11:25:29 2008
@@ -15,12 +15,12 @@
  */
 public class ConfirmRemoveDialog {
     private boolean shouldDelete = true;
-
-    private void showDialog(String type, String name) {
+    
+    private void showDialog(String name) {
 
         JCheckBox neverPromptAgainBox = new JCheckBox("Always delete without prompt.");
 
-        Object message[] = {String.format("Are you sure you would like to delete the %s named '%s'?", type, name), neverPromptAgainBox};
+        Object message[] = {String.format("Are you sure you would like to delete the %s?", name), neverPromptAgainBox};
 
         JOptionPane pane = new JOptionPane(message, JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION);
 
@@ -37,14 +37,18 @@
             Application.getInstance().getPreferenceService().savePreferences();
         }
     }
-
+    
     public boolean shouldDelete(String type, String name) {
+        return shouldDelete(String.format("%s named '%s'?", type, name));
+    }
+
+    public boolean shouldDelete(String name) {
 
         PreferenceDetail pref = Application.getInstance().getPreferenceDomain().getDetail(GeneralPreferences.DELETE_PROMPT_PREFERENCE, true);
 
         // See if the user has opted not to showDialog the delete dialog.
         if ((pref == null) || (false == pref.getBooleanProperty(GeneralPreferences.DELETE_PROMPT_PREFERENCE))) {
-           showDialog(type, name);
+           showDialog(name);
         }
 
         return shouldDelete;

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/query/QueryTypeController.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/query/QueryTypeController.java?rev=670246&r1=670245&r2=670246&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/query/QueryTypeController.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/query/QueryTypeController.java Sat Jun 21 11:25:29 2008
@@ -56,6 +56,7 @@
         this.domain = mediator.getCurrentDataDomain();
     }
 
+    @Override
     protected void doHandleControl(Control control) throws ControlException {
         if (control.matchesID(CANCEL_CONTROL)) {
             shutdown();
@@ -77,6 +78,7 @@
     /**
      * Creates and runs QueryTypeDialog.
      */
+    @Override
     public void startup() {
         setModel(new QueryTypeModel(mediator.getCurrentDataMap()));
         setView(new QueryTypeDialog());
@@ -100,7 +102,7 @@
         dataMap.addQuery(query);
 
         // notify listeners
-        mediator.fireQueryEvent(new QueryEvent(this, query, MapEvent.ADD));
+        mediator.fireQueryEvent(new QueryEvent(this, query, MapEvent.ADD, dataMap));
         mediator
                 .fireQueryDisplayEvent(new QueryDisplayEvent(this, query, dataMap, domain));
         shutdown();

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/AbstractCallbackMethodsTab.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/AbstractCallbackMethodsTab.java?rev=670246&r1=670245&r2=670246&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/AbstractCallbackMethodsTab.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/AbstractCallbackMethodsTab.java Sat Jun 21 11:25:29 2008
@@ -169,6 +169,7 @@
         table.setDragEnabled(true);
         table.setTransferHandler(new StringTransferHandler() {
 
+            @Override
             protected String exportString(JComponent c) {
                 JTable table = (JTable) c;
                 int rowIndex = table.getSelectedRow();
@@ -181,6 +182,7 @@
                 return result;
             }
 
+            @Override
             protected void importString(JComponent c, String callbackMethod) {
                 JTable table = (JTable) c;
                 int rowIndex = table.getSelectedRow();
@@ -195,6 +197,7 @@
                 rebuildTable();
             }
 
+            @Override
             protected void cleanup(JComponent c, boolean remove) {
                 // System.out.println("c");
             }
@@ -256,13 +259,21 @@
 
             public void valueChanged(ListSelectionEvent e) {
                 if (!e.getValueIsAdjusting()) {
-                    mediator.setCurrentCallbackMethod(table.getSelectedRow() >= 0
-                            ? (String) table.getModel().getValueAt(
-                                    table.getSelectedRow(),
-                                    0)
-                            : null);
-                    getRemoveCallbackMethodAction().setEnabled(
-                            table.getSelectedRow() >= 0);
+                    String[] methods = new String[0];
+                    
+                    if (table.getSelectedRow() != -1) {
+                        int[] sel = table.getSelectedRows();
+                        methods = new String[sel.length];
+                        
+                        for (int i = 0; i < sel.length; i++) {
+                            methods[i] = (String) table.getValueAt(sel[i], 0);
+                        }
+                    }
+                        
+                    mediator.setCurrentCallbackMethods(methods);
+                    getRemoveCallbackMethodAction().setEnabled(methods.length > 0);
+                    getRemoveCallbackMethodAction().setName(getRemoveCallbackMethodAction().
+                            getActionName(methods.length > 1));
                 }
             }
         });
@@ -315,7 +326,7 @@
                 CallbackDescriptorTableModel.METHOD_NAME);
         methodNameColumn.setMinWidth(424);
 
-        mediator.setCurrentCallbackMethod(null);
+        mediator.setCurrentCallbackMethods(new String[0]);
     }
 
     /**
@@ -323,6 +334,7 @@
      */
     class StringRenderer extends DefaultTableCellRenderer {
 
+        @Override
         public Component getTableCellRendererComponent(
                 JTable table,
                 Object value,

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/EditorView.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/EditorView.java?rev=670246&r1=670245&r2=670246&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/EditorView.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/EditorView.java Sat Jun 21 11:25:29 2008
@@ -41,6 +41,8 @@
 import org.apache.cayenne.modeler.event.DomainDisplayEvent;
 import org.apache.cayenne.modeler.event.DomainDisplayListener;
 import org.apache.cayenne.modeler.event.EntityDisplayEvent;
+import org.apache.cayenne.modeler.event.MultipleObjectsDisplayEvent;
+import org.apache.cayenne.modeler.event.MultipleObjectsDisplayListener;
 import org.apache.cayenne.modeler.event.ObjEntityDisplayListener;
 import org.apache.cayenne.modeler.event.ProcedureDisplayEvent;
 import org.apache.cayenne.modeler.event.ProcedureDisplayListener;
@@ -59,7 +61,8 @@
  */
 public class EditorView extends JPanel implements ObjEntityDisplayListener,
         DbEntityDisplayListener, DomainDisplayListener, DataMapDisplayListener,
-        DataNodeDisplayListener, ProcedureDisplayListener, QueryDisplayListener {
+        DataNodeDisplayListener, ProcedureDisplayListener, QueryDisplayListener,
+        MultipleObjectsDisplayListener {
 
     private static final String EMPTY_VIEW = "Empty";
     private static final String DOMAIN_VIEW = "Domain";
@@ -161,6 +164,7 @@
         eventController.addDbEntityDisplayListener(this);
         eventController.addProcedureDisplayListener(this);
         eventController.addQueryDisplayListener(this);
+        eventController.addMultipleObjectsDisplayListener(this);
 
         Domain domain = eventController.getApplicationPreferenceDomain().getSubdomain(
                 this.getClass());
@@ -230,4 +234,8 @@
             detailLayout.show(detailPanel, EMPTY_VIEW);
         }
     }
+
+    public void currentObjectsChanged(MultipleObjectsDisplayEvent e) {
+        detailLayout.show(detailPanel, EMPTY_VIEW);
+    }
 }



Mime
View raw message