[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools.gef] Re: IndexOutOfBoundsException in

Thanks for the guidance. I was able to track it down to the problem section of code.

In my ConnectionEditPart (extends AbstractConnectionEditPart) createEditPolicies I was installing the following edit policy :

installEditPolicy(EditPolicy.CONNECTION_BENDPOINTS_ROLE, new PartConnectionSelectionHandlesEditPolicy());

When I comment that line out, I no longer have the problem. This was probably due to an improperly extended SelectionHandlesEditPolicy. Here is the policy

public class PartConnectionSelectionHandlesEditPolicy extends SelectionHandlesEditPolicy {

  public PartConnectionSelectionHandlesEditPolicy() {
    super();
  }

protected List createSelectionHandles() {
List list = new ArrayList();
ConnectionEditPart connPart = (ConnectionEditPart) getHost();
PointList points = getConnection().getPoints();
for (int i = 0; i < points.size() - 2; i++) {
BendpointHandle handle = new BendpointCreationHandle(connPart, 0, new BendpointLocator(getConnection(), i + 1));
list.add(handle);
}
return list;
}

protected Connection getConnection() {
return (Connection) getHostFigure();
}
}


Thanks,
Patrick

Randy Hudson wrote:
Try hard to reproduce in the logic example. That way we can reproduce it and debug.

It looks like the number of bends in the connection might be changing as you drag the connection around, and the bendpoint editpolicy for some reason is not rebuilding its handles when this occurs. Therefore, it ends up with a handle referencing a bend index which is too large.

the policy should track the "points" property of the connection, and refresh its handles if the number of points changes.

"Patrick Clark" <p.clark@xxxxxxxxxxxxxx> wrote in message news:d1npkm$r9e$1@xxxxxxxxxxxxxxxxxxx

In certain situations I am seeing an exception when drawing a connector from one figure to another in my GEF drawing. The exception seems to be coming from the GEF and draw2d. This only occurs when I am attempting to reconnect an existing connection and happens while I am moving the end of the connector.

I have been looking at this for some time and can't seem to find the root cause. I haven't found anything in the news group. Please let me know if anyone has any ideas or additional information is necessary.

Here is the stack trace:
!ENTRY org.eclipse.ui 4 0 Mar 21, 2005 17:08:00.525
!MESSAGE Index: 3, Size: 3
!STACK 0
java.lang.IndexOutOfBoundsException: Index: 3, Size: 3
at org.eclipse.draw2d.geometry.PointList.getPoint(PointList.java:183)
at org.eclipse.draw2d.BendpointLocator.getReferencePoint(BendpointLocator.java:56)
at org.eclipse.draw2d.AbstractLocator.relocate(AbstractLocator.java:103)
at org.eclipse.gef.handles.AbstractHandle.validate(AbstractHandle.java:208)
at org.eclipse.draw2d.Figure.validate(Figure.java:1606)
at org.eclipse.draw2d.Figure.validate(Figure.java:1606)
at org.eclipse.draw2d.FreeformLayeredPane.validate(FreeformLayeredPane.java:122)
at org.eclipse.draw2d.FreeformViewport$FreeformViewportLayout.calculatePreferredSize(FreeformViewport.java:28)
at org.eclipse.draw2d.AbstractLayout.getPreferredSize(AbstractLayout.java:93)
at org.eclipse.draw2d.AbstractHintLayout.getPreferredSize(AbstractHintLayout.java:86)
at org.eclipse.draw2d.Figure.getPreferredSize(Figure.java:648)
at org.eclipse.draw2d.ScrollPaneSolver.solve(ScrollPaneSolver.java:75)
at org.eclipse.draw2d.FigureCanvas.layoutViewport(FigureCanvas.java:222)
at org.eclipse.draw2d.FigureCanvas.access$4(FigureCanvas.java:220)
at org.eclipse.draw2d.FigureCanvas$3.notifyValidating(FigureCanvas.java:185)
at org.eclipse.draw2d.UpdateManager.fireValidating(UpdateManager.java:93)
at org.eclipse.draw2d.DeferredUpdateManager.validateFigures(DeferredUpdateManager.java:233)
at org.eclipse.draw2d.DeferredUpdateManager.performUpdate(DeferredUpdateManager.java:137)
at org.eclipse.draw2d.DeferredUpdateManager$UpdateRequest.run(DeferredUpdateManager.java:62)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:106)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:2749)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2434)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1377)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1348)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:254)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141)
at com.fastrieve.eclipse.plugin.FastrieveAdminApplication.run(FastrieveAdminApplication.java:28)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:335)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.eclipse.core.launcher.Main.basicRun(Main.java:183)
at org.eclipse.core.launcher.Main.run(Main.java:644)
at org.eclipse.core.launcher.Main.main(Main.java:628)


Thanks,
Patrick