[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[gef3d-commits] r240 - trunk/org.eclipse.gef3d/src/java/org/eclipse/gef3d/editpolicies

Author: jvonpilgrim
Date: 2009-08-05 09:11:45 -0400 (Wed, 05 Aug 2009)
New Revision: 240

Modified:
   trunk/org.eclipse.gef3d/src/java/org/eclipse/gef3d/editpolicies/FeedbackHelper3D.java
   trunk/org.eclipse.gef3d/src/java/org/eclipse/gef3d/editpolicies/GraphicalNodeEditPolicy3D.java
Log:
fixed problem with host figure not set (in helper)

Modified: trunk/org.eclipse.gef3d/src/java/org/eclipse/gef3d/editpolicies/FeedbackHelper3D.java
===================================================================
--- trunk/org.eclipse.gef3d/src/java/org/eclipse/gef3d/editpolicies/FeedbackHelper3D.java	2009-08-05 12:41:26 UTC (rev 239)
+++ trunk/org.eclipse.gef3d/src/java/org/eclipse/gef3d/editpolicies/FeedbackHelper3D.java	2009-08-05 13:11:45 UTC (rev 240)
@@ -108,7 +108,7 @@
 			} else {
 				bounds.setSize(0, 0, 1);
 			}
-			
+
 			bounds.expand(0.01f);
 			bounds.getPosition(wLocation);
 			bounds.getSize(wSize);
@@ -150,9 +150,10 @@
 			}
 
 			if (i_surfaceSizeDelta != null) {
-//				surface.getWorldDimension(i_surfaceSizeDelta, wSize);
-//				bounds.resize(wSize);
-				bounds.resize(i_surfaceSizeDelta.width,i_surfaceSizeDelta.height,0);
+				// surface.getWorldDimension(i_surfaceSizeDelta, wSize);
+				// bounds.resize(wSize);
+				bounds.resize(i_surfaceSizeDelta.width,
+					i_surfaceSizeDelta.height, 0);
 			}
 
 			bounds.getPosition(wLocation);
@@ -172,12 +173,19 @@
 	 * @param i_hostFigure the host figure
 	 */
 	public void setHostFigure(IFigure i_hostFigure) {
+		if (i_hostFigure == null) // parameter precondition
+			throw new NullPointerException("i_hostFigure must not be null");
 
 		m_hostFigure = i_hostFigure;
 
 		UpdateManager updateManager = m_hostFigure.getUpdateManager();
 		if (updateManager instanceof PickingUpdateManager3D)
 			m_picker = ((PickingUpdateManager3D) updateManager).getPicker();
+		else {
+			throw new IllegalArgumentException(
+				"figure's update manager must be instanceof PickingUpdateManager3D, was "
+					+ updateManager);
+		}
 	}
 
 	/**

Modified: trunk/org.eclipse.gef3d/src/java/org/eclipse/gef3d/editpolicies/GraphicalNodeEditPolicy3D.java
===================================================================
--- trunk/org.eclipse.gef3d/src/java/org/eclipse/gef3d/editpolicies/GraphicalNodeEditPolicy3D.java	2009-08-05 12:41:26 UTC (rev 239)
+++ trunk/org.eclipse.gef3d/src/java/org/eclipse/gef3d/editpolicies/GraphicalNodeEditPolicy3D.java	2009-08-05 13:11:45 UTC (rev 240)
@@ -61,6 +61,7 @@
 	protected FeedbackHelper getFeedbackHelper(CreateConnectionRequest request) {
 		if (feedbackHelper == null) {
 			feedbackHelper = new FeedbackHelper3D();
+			((FeedbackHelper3D) feedbackHelper).setHostFigure(getHostFigure());
 			Point p = request.getLocation();
 			connectionFeedback = createDummyConnection(request);
 			connectionFeedback
@@ -69,12 +70,13 @@
 				.setSourceAnchor(getSourceConnectionAnchor(request));
 			feedbackHelper.setConnection(connectionFeedback);
 			addFeedback(connectionFeedback);
+			
 			feedbackHelper.update(null, p);
+		} else {
+			if (feedbackHelper instanceof FeedbackHelper3D)
+				((FeedbackHelper3D) feedbackHelper).setHostFigure(getHostFigure());
 		}
 
-		if (feedbackHelper instanceof FeedbackHelper3D)
-			((FeedbackHelper3D) feedbackHelper).setHostFigure(getHostFigure());
-
 		return feedbackHelper;
 	}