|
Re: How to fix problem with draging edit parts [message #231993 is a reply to message #231898] |
Thu, 22 March 2007 05:16 |
Eclipse User |
|
|
|
Originally posted by: none.unknown.com
This is a GEF bug, and I've believe it's been fixed in 3.2.2
"Boris Stepanov" <freepriman@rambler.ru> wrote in message
news:etoc86$1ns$1@utils.eclipse.org...
> Hello,
>
> I have a table (Container edit part) containing cells (Also container edit
> parts), each cell may contain any other objects. User can drag objects
> inside cell and drag table in graphical viewer.
>
> I found the following problem. When I select Table, Cell and any edit part
> inside cell and try to drag them by mouse (mouse location at the beginning
> is over edit part inside cell edit part), I have got NullPointerException
> (NPE).
>
>
>
>
> End of my stack:
>
> java.lang.NullPointerException
> at
> org.eclipse.gef.tools.DragEditPartsTracker.updateTargetReque st(DragEditPartsTracker.java:603)
> at
> org.eclipse.gef.tools.DragEditPartsTracker.handleDragInProgr ess(DragEditPartsTracker.java:339)
> at org.eclipse.gef.tools.AbstractTool.mouseDrag(AbstractTool.ja va:983)
> at org.eclipse.gef.tools.SelectionTool.mouseDrag(SelectionTool. java:511)
> at org.eclipse.gef.EditDomain.mouseDrag(EditDomain.java:226)
> at
> org.eclipse.gef.ui.parts.DomainEventDispatcher.dispatchMouse Moved(DomainEventDispatcher.java:357)
> at
> org.eclipse.draw2d.LightweightSystem$EventHandler.mouseMove( LightweightSystem.java:533)
> at
> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:145)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3348)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2968)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1914)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:419)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
>
>
>
>
> The problem in the following method of DragEditPartsTracker class:
>
> private void captureSourceDimensions() {
> List editparts = getOperationSet();
> for (int i = 0; i < editparts.size(); i++) {
> GraphicalEditPart child = (GraphicalEditPart)editparts.get(i);
> IFigure figure = child.getFigure();
> PrecisionRectangle bounds = null;
> if (figure instanceof HandleBounds)
> bounds = new PrecisionRectangle(((HandleBounds)figure).getHandleBounds()) ;
> else
> bounds = new PrecisionRectangle(figure.getBounds());
> figure.translateToAbsolute(bounds);
>
> if (compoundSrcRect == null)
> compoundSrcRect = new PrecisionRectangle(bounds);
> else
> compoundSrcRect = compoundSrcRect.union(bounds);
> if (child == getSourceEditPart()) //!!!!!!!!!!!!!!!!!
> sourceRectangle = bounds;
> }
> }
>
> The method getOperationSet use the following method to create list at the
> first time:
>
> protected List createOperationSet() {
> if (getCurrentViewer() != null) {
> List list = ToolUtilities.getSelectionWithoutDependants(
> getCurrentViewer());
> ToolUtilities.filterEditPartsUnderstanding(list,
> getTargetRequest());
> return list;
> }
>
> return new ArrayList();
> }
>
> In this method ToolUtilities uses for filtering selected edit parts. For
> example in my case I have the following list: TableEditPart, CellEditPart,
> PrimitiveEditPart; after filtering: TableEditPart and it is right, but
> getSourceEditPart() (marked string of code) method returns
> PrimitiveEditPart and sourceRectangle field stays to be null and after
> that uses in updateTargetRequest() method where I have got NPE. I think
> that captureSourceDimensions() method should use another method instead of
> getSourceEditPart() which will take into account edit parts filtering.
>
>
> Is it GEF's bug? Or mine?
> How can I fix this ussue?
> Should I add this issue to bugzilla?
>
> --
> Boris Stepanov
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04277 seconds