| Summary: | DragEditPartsTracker falls on null pointer exception in method getOperationSet() | ||
|---|---|---|---|
| Product: | [Tools] GEF | Reporter: | Martin Kollar <KollarM> |
| Component: | GEF-Legacy GEF (MVC) | Assignee: | gef-inbox <gef-inbox> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | nyssen |
| Version: | 3.2 | ||
| Target Milestone: | 3.2.0 (Callisto) RC1 | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
The tracker expects the target editpart to be set only when something's happening (button down, key down, etc), which implies that there's a current viewer. Why do you need to set the target editpart, right away? What does your TextDragTracker do? Something similar to the SelectionRangeDragTracker in the text example? Current implementation of createOperationSet method is as follows:
protected List createOperationSet() {
if (getCurrentViewer() != null) {
List list = ToolUtilities.getSelectionWithoutDependants(
getCurrentViewer());
ToolUtilities.filterEditPartsUnderstanding(list, getTargetRequest());
return list;
}
return new ArrayList();
}
The NULL-check (getCurrentViewer() != null) was introduced as part of the fix for bug #106780. It obviously also solved this issue, so marking it as fixed in 3.2RC1 as well.
|
I have my own TextDragTracker that extends DragEditPartsTracker. When I create in instnace of this TextEditPart, I call at first super(EditPart) and then setTargetEditPart(EditPart) public TextDragTracker(EditPart owner, Point startLocation) { super(owner); setTargetEditPart(getSourceEditPart()); setDefaultCursor(Cursors.IBEAM); if (startLocation != null) setStartLocation(startLocation); } But setTargetEditPart(...) calls getOperationSet() and that calls createOperationSet() and this falls on null pointer exception because getCurrentViewer() returns null. In GEF3.1 this worked becasue there was no updating of "the current snap-to strategy"