You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2006/07/18 02:01:13 UTC

svn commit: r422921 [2/2] - in /incubator/cayenne/soc/trunk/cayenne-rop/rop-browser: .settings/ dist/ src/org/apache/cayenne/ropbrowser/commands/ src/org/apache/cayenne/ropbrowser/figures/ src/org/apache/cayenne/ropbrowser/layout/ src/org/apache/cayenn...

Modified: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/policies/CollectionSelectionPolicy.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/policies/CollectionSelectionPolicy.java?rev=422921&r1=422920&r2=422921&view=diff
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/policies/CollectionSelectionPolicy.java (original)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/policies/CollectionSelectionPolicy.java Mon Jul 17 17:01:12 2006
@@ -16,7 +16,11 @@
  */
 package org.apache.cayenne.ropbrowser.policies;
 
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.RequestConstants;
 import org.eclipse.gef.editpolicies.SelectionEditPolicy;
+import org.eclipse.gef.requests.SelectionRequest;
 
 /**
  * An empty {@link org.eclipse.gef.editpolicies.SelectionEditPolicy}.
@@ -29,5 +33,10 @@
 	}
 	
 	protected void hideSelection() {
+	}
+	
+	// TODO fix exception on drag
+	public EditPart getTargetEditPart(Request request) {
+		return null;
 	}
 }

Added: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/policies/ElementXYLayoutEditPolicy.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/policies/ElementXYLayoutEditPolicy.java?rev=422921&view=auto
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/policies/ElementXYLayoutEditPolicy.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/policies/ElementXYLayoutEditPolicy.java Mon Jul 17 17:01:12 2006
@@ -0,0 +1,74 @@
+/*
+ *  Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed 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.ropbrowser.policies;
+
+import org.apache.cayenne.ropbrowser.commands.ElementSetConstraintCommand;
+import org.apache.cayenne.ropbrowser.model.ModelElement;
+import org.apache.cayenne.ropbrowser.parts.ElementEditPart;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.XYLayoutEditPolicy;
+import org.eclipse.gef.requests.ChangeBoundsRequest;
+import org.eclipse.gef.requests.CreateRequest;
+
+/**
+ * An edit policy handling the layout of elements.
+ * 
+ * @author Marcel Gordon
+ */
+public class ElementXYLayoutEditPolicy extends XYLayoutEditPolicy {
+	
+	protected Command createAddCommand(EditPart child, Object constraint) {
+		return null;
+	}
+	
+	/**
+	 * @see ConstrainedLayoutEditPolicy#createChangeConstraintCommand(ChangeBoundsRequest, EditPart, Object)
+	 */
+	protected Command createChangeConstraintCommand(ChangeBoundsRequest request,
+			EditPart child, Object constraint) {
+		if (child instanceof ElementEditPart && constraint instanceof Rectangle) {
+			return new ElementSetConstraintCommand(
+					(ModelElement) child.getModel(), request, (Rectangle) constraint);
+		}
+		return super.createChangeConstraintCommand(request, child, constraint);
+	}
+	
+	/**
+	 * @see ConstrainedLayoutEditPolicy#createChangeConstraintCommand(EditPart, Object)
+	 */
+	protected Command createChangeConstraintCommand(EditPart child,
+			Object constraint) {
+		return null;
+	}
+	
+	/**
+	 * @see LayoutEditPolicy#getCreateCommand(CreateRequest)
+	 */
+	protected Command getCreateCommand(CreateRequest request) {
+		return null;
+	}
+	
+	/**
+	 * @see LayoutEditPolicy#getDeleteDependantCommand(org.eclipse.gef.Request)
+	 */
+	protected Command getDeleteDependantCommand(Request request) {
+		return null;
+	}
+	
+}