Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How to fix problem with draging edit parts
How to fix problem with draging edit parts [message #231898] Tue, 20 March 2007 10:15 Go to next message
Boris Stepanov is currently offline Boris StepanovFriend
Messages: 68
Registered: July 2009
Member
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
Re: How to fix problem with draging edit parts [message #231993 is a reply to message #231898] Thu, 22 March 2007 05:16 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: How to fix problem with draging edit parts [message #232352 is a reply to message #231993] Wed, 28 March 2007 16:28 Go to previous messageGo to next message
Bryan Gilbert is currently offline Bryan GilbertFriend
Messages: 1
Registered: July 2009
Junior Member
Can you post the bugzilla reference that addresses this fix?

Thanks
Bryan
Re: How to fix problem with draging edit parts [message #232422 is a reply to message #231993] Fri, 30 March 2007 05:47 Go to previous message
Boris Stepanov is currently offline Boris StepanovFriend
Messages: 68
Registered: July 2009
Member
I have checked it in GEF 3.2.2. Bug is fixed. Thank you.

> This is a GEF bug, and I've believe it's been fixed in 3.2.2
--
Boris Stepanov
Previous Topic:double click in outline
Next Topic:[QUERY] Superior Routing + Placement
Goto Forum:
  


Current Time: Fri Apr 26 17:37:05 GMT 2024

Powered by FUDForum. Page generated in 0.03273 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top