From 088b1733c934262d8d8a399bfc86af436ec0afcc Mon Sep 17 00:00:00 2001 From: Patrick Ziegler Date: Tue, 17 Jun 2025 06:24:16 +0200 Subject: [PATCH] [GEF] Streamline Handle lookup in GEF viewer The Handles of a viewer should be determined via the findHandleAt(Point) method declared by the GraphicalViewer interface. This interface needs to be implemented by our GraphicalViewer, just like the Handle interface needs to be implemented by our Handle. The drag-tracker tool getter and setter have to be renamed to match the signature specified by the interface. --- .../selection/TopSelectionEditPolicy.java | 4 +-- .../eclipse/wb/gef/core/IEditPartViewer.java | 12 --------- .../wb/gef/graphical/handles/Handle.java | 22 +++++++++++++--- .../wb/gef/graphical/handles/MoveHandle.java | 4 +-- .../wb/gef/graphical/tools/SelectionTool.java | 25 ++++++++++-------- .../gef/graphical/GraphicalViewer.java | 26 +++++++------------ .../wb/internal/gef/tree/TreeViewer.java | 12 --------- .../AbstractColumnSelectionEditPolicy.java | 4 +-- .../grid/AbstractGridSelectionEditPolicy.java | 4 +-- .../NonResizableSelectionEditPolicy.java | 4 +-- .../AbsoluteBasedSelectionEditPolicy.java | 4 +-- .../group/gef/GroupSelectionEditPolicy2.java | 2 +- .../ColumnLayoutSelectionEditPolicy.java | 4 +-- .../StackLayoutSelectionEditPolicy.java | 4 +-- .../AbstractPartSelectionEditPolicy.java | 4 +-- .../widgets/SashFormSelectionEditPolicy.java | 6 ++--- .../TreeTreeColumnSelectionEditPolicy.java | 4 +-- .../selection/ColumnSelectionEditPolicy.java | 4 +-- .../selection/RowSelectionEditPolicy.java | 4 +-- .../selection/ColumnSelectionEditPolicy.java | 4 +-- .../selection/RowSelectionEditPolicy.java | 4 +-- .../box/StrutSelectionEditPolicy.java | 4 +-- .../layout/CardLayoutSelectionEditPolicy.java | 4 +-- .../selection/ColumnSelectionEditPolicy.java | 4 +-- .../selection/RowSelectionEditPolicy.java | 4 +-- .../TableTableColumnSelectionEditPolicy.java | 4 +-- .../layout/RowLayoutSelectionEditPolicy.java | 4 +-- .../layout/form/FormSelectionEditPolicy2.java | 4 +-- .../form/FormSelectionEditPolicyClassic.java | 4 +-- .../wb/tests/gef/EmptyEditPartViewer.java | 12 --------- .../wb/tests/gef/GefCursorTestCase.java | 4 +-- .../eclipse/wb/tests/gef/GraphicalRobot.java | 9 ++++--- .../wb/tests/gef/SelectionToolTest.java | 6 ++--- 33 files changed, 99 insertions(+), 125 deletions(-) diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/core/gef/policy/selection/TopSelectionEditPolicy.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/core/gef/policy/selection/TopSelectionEditPolicy.java index adcbd0f41..447c90592 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/core/gef/policy/selection/TopSelectionEditPolicy.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/core/gef/policy/selection/TopSelectionEditPolicy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2023 Google, Inc. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -68,7 +68,7 @@ protected List createSelectionHandles() { private Handle createResizeHandle(int direction) { ResizeHandle handle = new ResizeHandle(getHost(), direction); - handle.setDragTrackerTool(new ResizeTracker(direction, REQ_RESIZE)); + handle.setDragTracker(new ResizeTracker(direction, REQ_RESIZE)); return handle; } diff --git a/org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/core/IEditPartViewer.java b/org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/core/IEditPartViewer.java index 55ad4e032..399cf61ca 100644 --- a/org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/core/IEditPartViewer.java +++ b/org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/core/IEditPartViewer.java @@ -15,7 +15,6 @@ import org.eclipse.wb.gef.graphical.handles.Handle; import org.eclipse.wb.internal.gef.core.EditDomain; -import org.eclipse.draw2d.geometry.Point; import org.eclipse.jface.viewers.ISelectionProvider; import java.util.Collection; @@ -149,15 +148,4 @@ EditPart findTargetEditPart(int x, final Collection exclude, final Conditional conditional, String layer); - - /** - * @return the {@link Handle} at the specified location. - */ - Handle findTargetHandle(Point location); - - /** - * Returns the {@link Handle} at the specified location (x, y). Returns - * null if no handle exists at the given location (x, y). - */ - Handle findTargetHandle(int x, int y); } \ No newline at end of file diff --git a/org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/graphical/handles/Handle.java b/org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/graphical/handles/Handle.java index cd77405ec..f9ae691df 100644 --- a/org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/graphical/handles/Handle.java +++ b/org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/graphical/handles/Handle.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2023 Google, Inc. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -19,6 +19,7 @@ import org.eclipse.draw2d.AncestorListener; import org.eclipse.draw2d.IFigure; import org.eclipse.draw2d.Locator; +import org.eclipse.draw2d.geometry.Point; /** * {@link Handle} will add an {@link IAncestorListener} to the owner's figure, and will @@ -27,7 +28,7 @@ * @author lobas_av * @coverage gef.graphical */ -public abstract class Handle extends Figure implements AncestorListener { +public abstract class Handle extends Figure implements AncestorListener, org.eclipse.gef.Handle { private final GraphicalEditPart m_owner; private final Locator m_locator; @@ -130,7 +131,8 @@ protected final Locator getLocator() { * Returns the drag tracker {@link Tool} to use when the user clicks on this handle. If the drag * tracker has not been set, it will be lazily created by calling {@link #createDragTracker()}. */ - public Tool getDragTrackerTool() { + @Override + public Tool getDragTracker() { if (m_dragTracker == null) { m_dragTracker = createDragTrackerTool(); } @@ -140,7 +142,7 @@ public Tool getDragTrackerTool() { /** * Sets the drag tracker {@link Tool} for this handle. */ - public void setDragTrackerTool(Tool dragTracker) { + public void setDragTracker(Tool dragTracker) { m_dragTracker = dragTracker; } @@ -150,4 +152,16 @@ public void setDragTrackerTool(Tool dragTracker) { protected final Tool createDragTrackerTool() { return null; } + + /** + * By default, the center of the handle is returned. + * + * @see org.eclipse.gef.Handle#getAccessibleLocation() + */ + @Override + public Point getAccessibleLocation() { + Point p = getBounds().getCenter(); + translateToAbsolute(p); + return p; + } } \ No newline at end of file diff --git a/org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/graphical/handles/MoveHandle.java b/org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/graphical/handles/MoveHandle.java index 91c0e5608..6c59c0065 100644 --- a/org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/graphical/handles/MoveHandle.java +++ b/org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/graphical/handles/MoveHandle.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2023 Google, Inc. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -53,7 +53,7 @@ public MoveHandle(GraphicalEditPart owner, Locator locator) { { Tool tracker = new DragEditPartTracker(owner); tracker.setDefaultCursor(getCursor()); - setDragTrackerTool(tracker); + setDragTracker(tracker); } } diff --git a/org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/graphical/tools/SelectionTool.java b/org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/graphical/tools/SelectionTool.java index 2bae3ad6f..4ece09894 100644 --- a/org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/graphical/tools/SelectionTool.java +++ b/org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/graphical/tools/SelectionTool.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2024 Google, Inc. and others. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -18,6 +18,7 @@ import org.eclipse.wb.gef.core.tools.Tool; import org.eclipse.wb.gef.graphical.handles.Handle; import org.eclipse.wb.internal.gef.core.EditDomain; +import org.eclipse.wb.internal.gef.graphical.GraphicalViewer; import org.eclipse.draw2d.geometry.Point; import org.eclipse.gef.DragTracker; @@ -57,7 +58,7 @@ public class SelectionTool extends TargetingTool { * null, this method will activate it and set the {@link EditDomain} and * {@link IEditPartViewer}. */ - public void setDragTrackerTool(DragTracker dragTracker) { + public void setDragTracker(DragTracker dragTracker) { if (m_dragTracker != dragTracker) { if (m_dragTracker != null) { m_dragTracker.deactivate(); @@ -125,15 +126,17 @@ protected boolean handleButtonDown(int button) { } // if ((m_stateMask & SWT.ALT) != 0) { - setDragTrackerTool(new MarqueeDragTracker()); + setDragTracker(new MarqueeDragTracker()); return true; } // Point current = getCurrentInput().getMouseLocation(); - Handle handle = getCurrentViewer().findTargetHandle(current.x, current.y); - if (handle != null) { - setDragTrackerTool(handle.getDragTrackerTool()); - return true; + if (getCurrentViewer() instanceof GraphicalViewer gv) { + Handle handle = (Handle) gv.findHandleAt(current); + if (handle != null) { + setDragTracker(handle.getDragTracker()); + return true; + } } // updateTargetRequest(); @@ -142,10 +145,10 @@ protected boolean handleButtonDown(int button) { // EditPart editPart = getTargetEditPart(); if (editPart == null) { - setDragTrackerTool(null); + setDragTracker(null); getCurrentViewer().deselectAll(); } else { - setDragTrackerTool(editPart.getDragTracker(getTargetRequest())); + setDragTracker(editPart.getDragTracker(getTargetRequest())); lockTargetEditPart(editPart); } } @@ -155,7 +158,7 @@ protected boolean handleButtonDown(int button) { @Override protected boolean handleButtonUp(int button) { ((SelectionRequest) getTargetRequest()).setLastButtonPressed(0); - setDragTrackerTool(null); + setDragTracker(null); m_state = STATE_INITIAL; unlockTargetEditPart(); return true; @@ -165,7 +168,7 @@ protected boolean handleButtonUp(int button) { protected boolean handleMove() { if (m_state == STATE_DRAG) { m_state = STATE_INITIAL; - setDragTrackerTool(null); + setDragTracker(null); } if (m_state == STATE_INITIAL) { updateTargetRequest(); diff --git a/org.eclipse.wb.core/src-gef/org/eclipse/wb/internal/gef/graphical/GraphicalViewer.java b/org.eclipse.wb.core/src-gef/org/eclipse/wb/internal/gef/graphical/GraphicalViewer.java index 3bbf39161..34c88a878 100644 --- a/org.eclipse.wb.core/src-gef/org/eclipse/wb/internal/gef/graphical/GraphicalViewer.java +++ b/org.eclipse.wb.core/src-gef/org/eclipse/wb/internal/gef/graphical/GraphicalViewer.java @@ -16,7 +16,6 @@ import org.eclipse.wb.draw2d.Layer; import org.eclipse.wb.gef.core.EditPart; import org.eclipse.wb.gef.graphical.GraphicalEditPart; -import org.eclipse.wb.gef.graphical.handles.Handle; import org.eclipse.wb.internal.draw2d.FigureCanvas; import org.eclipse.wb.internal.draw2d.IRootFigure; import org.eclipse.wb.internal.draw2d.RootFigure; @@ -26,6 +25,7 @@ import org.eclipse.wb.internal.gef.core.TargetEditPartFindVisitor; import org.eclipse.draw2d.geometry.Point; +import org.eclipse.gef.Handle; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Cursor; import org.eclipse.swt.widgets.Composite; @@ -37,7 +37,7 @@ * @author lobas_av * @coverage gef.graphical */ -public class GraphicalViewer extends AbstractEditPartViewer { +public class GraphicalViewer extends AbstractEditPartViewer implements org.eclipse.gef.GraphicalViewer { protected final FigureCanvas m_canvas; private final RootEditPart m_rootEditPart; private EditEventManager m_eventManager; @@ -194,31 +194,23 @@ protected boolean acceptResult(Figure figure) { return visitor.getTargetEditPart(); } - /** - * @return the {@link Handle} at the specified location. - */ - @Override - public Handle findTargetHandle(Point location) { - return findTargetHandle(location.x, location.y); - } - /** * Returns the {@link Handle} at the specified location (x, y). Returns * null if no handle exists at the given location (x, y). */ @Override - public Handle findTargetHandle(int x, int y) { + public Handle findHandleAt(Point p) { Handle target; - if ((target = findTargetHandle(MENU_HANDLE_LAYER_STATIC, x, y)) != null) { + if ((target = findTargetHandle(MENU_HANDLE_LAYER_STATIC, p)) != null) { return target; } - if ((target = findTargetHandle(MENU_HANDLE_LAYER, x, y)) != null) { + if ((target = findTargetHandle(MENU_HANDLE_LAYER, p)) != null) { return target; } - if ((target = findTargetHandle(HANDLE_LAYER_STATIC, x, y)) != null) { + if ((target = findTargetHandle(HANDLE_LAYER_STATIC, p)) != null) { return target; } - if ((target = findTargetHandle(HANDLE_LAYER, x, y)) != null) { + if ((target = findTargetHandle(HANDLE_LAYER, p)) != null) { return target; } return null; @@ -229,8 +221,8 @@ public Handle findTargetHandle(int x, int y) { * location in given layer. Returns null if no handle exists at the * given location (x, y). */ - private Handle findTargetHandle(String layer, int x, int y) { - TargetFigureFindVisitor visitor = new TargetFigureFindVisitor(m_canvas, x, y); + private Handle findTargetHandle(String layer, Point p) { + TargetFigureFindVisitor visitor = new TargetFigureFindVisitor(m_canvas, p.x, p.y); ((Layer) m_rootEditPart.getLayer(layer)).accept(visitor, false); Figure targetFigure = visitor.getTargetFigure(); return targetFigure instanceof Handle ? (Handle) targetFigure : null; diff --git a/org.eclipse.wb.core/src-gef/org/eclipse/wb/internal/gef/tree/TreeViewer.java b/org.eclipse.wb.core/src-gef/org/eclipse/wb/internal/gef/tree/TreeViewer.java index 62d88f1bd..061dc4b97 100644 --- a/org.eclipse.wb.core/src-gef/org/eclipse/wb/internal/gef/tree/TreeViewer.java +++ b/org.eclipse.wb.core/src-gef/org/eclipse/wb/internal/gef/tree/TreeViewer.java @@ -12,13 +12,11 @@ *******************************************************************************/ package org.eclipse.wb.internal.gef.tree; -import org.eclipse.wb.gef.graphical.handles.Handle; import org.eclipse.wb.gef.tree.TreeEditPart; import org.eclipse.wb.internal.core.utils.ui.UiUtils; import org.eclipse.wb.internal.gef.core.AbstractEditPartViewer; import org.eclipse.wb.internal.gef.core.EditDomain; -import org.eclipse.draw2d.geometry.Point; import org.eclipse.gef.EditPart; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.SelectionChangedEvent; @@ -256,14 +254,4 @@ public org.eclipse.wb.gef.core.EditPart findTargetEditPart(int x, String layer) { return null; } - - @Override - public Handle findTargetHandle(Point location) { - return null; - } - - @Override - public Handle findTargetHandle(int x, int y) { - return null; - } } \ No newline at end of file diff --git a/org.eclipse.wb.core/src/org/eclipse/wb/core/gef/policy/layout/generic/AbstractColumnSelectionEditPolicy.java b/org.eclipse.wb.core/src/org/eclipse/wb/core/gef/policy/layout/generic/AbstractColumnSelectionEditPolicy.java index c8cde7f70..66104e75c 100644 --- a/org.eclipse.wb.core/src/org/eclipse/wb/core/gef/policy/layout/generic/AbstractColumnSelectionEditPolicy.java +++ b/org.eclipse.wb.core/src/org/eclipse/wb/core/gef/policy/layout/generic/AbstractColumnSelectionEditPolicy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2023 Google, Inc. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -75,7 +75,7 @@ protected List createStaticHandles() { // create resize column handle SideResizeHandle resizeHandle = new SideResizeHandle(getHost(), PositionConstants.RIGHT, 10, true); - resizeHandle.setDragTrackerTool(new ResizeTracker(getHost(), + resizeHandle.setDragTracker(new ResizeTracker(getHost(), PositionConstants.EAST, REQ_RESIZE)); handles.add(resizeHandle); diff --git a/org.eclipse.wb.core/src/org/eclipse/wb/core/gef/policy/layout/grid/AbstractGridSelectionEditPolicy.java b/org.eclipse.wb.core/src/org/eclipse/wb/core/gef/policy/layout/grid/AbstractGridSelectionEditPolicy.java index d0be697d4..2d9c7971e 100644 --- a/org.eclipse.wb.core/src/org/eclipse/wb/core/gef/policy/layout/grid/AbstractGridSelectionEditPolicy.java +++ b/org.eclipse.wb.core/src/org/eclipse/wb/core/gef/policy/layout/grid/AbstractGridSelectionEditPolicy.java @@ -410,7 +410,7 @@ private class SizeHandle extends SquareHandle { public SizeHandle(int direction, Locator locator) { super(getHost(), locator); setCursor(Cursors.getDirectionalCursor(direction)); - setDragTrackerTool(new ResizeTracker(direction, REQ_RESIZE_SIZE)); + setDragTracker(new ResizeTracker(direction, REQ_RESIZE_SIZE)); } @Override @@ -576,7 +576,7 @@ private class SpanHandle extends SquareHandle { public SpanHandle(int direction, Locator locator) { super(getHost(), locator); setCursor(Cursors.getDirectionalCursor(direction)); - setDragTrackerTool(new ResizeTracker(direction, REQ_RESIZE_SPAN)); + setDragTracker(new ResizeTracker(direction, REQ_RESIZE_SPAN)); } @Override diff --git a/org.eclipse.wb.core/src/org/eclipse/wb/core/gef/policy/selection/NonResizableSelectionEditPolicy.java b/org.eclipse.wb.core/src/org/eclipse/wb/core/gef/policy/selection/NonResizableSelectionEditPolicy.java index d8c2bd497..2bec3c6d9 100644 --- a/org.eclipse.wb.core/src/org/eclipse/wb/core/gef/policy/selection/NonResizableSelectionEditPolicy.java +++ b/org.eclipse.wb.core/src/org/eclipse/wb/core/gef/policy/selection/NonResizableSelectionEditPolicy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -53,7 +53,7 @@ protected List createSelectionHandles() { */ private Handle createHandle(int direction) { ResizeHandle handle = new ResizeHandle(getHost(), direction); - handle.setDragTrackerTool(new ResizeTracker(direction, null)); + handle.setDragTracker(new ResizeTracker(direction, null)); return handle; } } \ No newline at end of file diff --git a/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/gef/policy/layout/absolute/AbsoluteBasedSelectionEditPolicy.java b/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/gef/policy/layout/absolute/AbsoluteBasedSelectionEditPolicy.java index de57238e4..13bb54078 100644 --- a/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/gef/policy/layout/absolute/AbsoluteBasedSelectionEditPolicy.java +++ b/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/gef/policy/layout/absolute/AbsoluteBasedSelectionEditPolicy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -66,7 +66,7 @@ protected List createSelectionHandles() { */ private Handle createResizeHandle(int direction) { ResizeHandle handle = new ResizeHandle(getHost(), direction); - handle.setDragTrackerTool(new ResizeTracker(direction, REQ_RESIZE) { + handle.setDragTracker(new ResizeTracker(direction, REQ_RESIZE) { @Override protected Command getCommand() { return getLayoutEditPolicy().getResizeCommandImpl(getRequest()); diff --git a/org.eclipse.wb.layout.group/src/org/eclipse/wb/internal/layout/group/gef/GroupSelectionEditPolicy2.java b/org.eclipse.wb.layout.group/src/org/eclipse/wb/internal/layout/group/gef/GroupSelectionEditPolicy2.java index a40e131f8..987210e67 100644 --- a/org.eclipse.wb.layout.group/src/org/eclipse/wb/internal/layout/group/gef/GroupSelectionEditPolicy2.java +++ b/org.eclipse.wb.layout.group/src/org/eclipse/wb/internal/layout/group/gef/GroupSelectionEditPolicy2.java @@ -112,7 +112,7 @@ protected List createSelectionHandles() { */ private Handle createResizeHandle(int direction) { ResizeHandle handle = new ResizeHandle(getHost(), direction); - handle.setDragTrackerTool(new ResizeTracker(direction, REQ_RESIZE)); + handle.setDragTracker(new ResizeTracker(direction, REQ_RESIZE)); return handle; } diff --git a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gef/policy/forms/layout/ColumnLayoutSelectionEditPolicy.java b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gef/policy/forms/layout/ColumnLayoutSelectionEditPolicy.java index 782619b85..dd0d091df 100644 --- a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gef/policy/forms/layout/ColumnLayoutSelectionEditPolicy.java +++ b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gef/policy/forms/layout/ColumnLayoutSelectionEditPolicy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2023 Google, Inc. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -79,7 +79,7 @@ protected List createSelectionHandles() { */ private Handle createHandle(int direction) { ResizeHandle handle = new ResizeHandle(getHost(), direction); - handle.setDragTrackerTool(new ResizeTracker(direction, REQ_RESIZE)); + handle.setDragTracker(new ResizeTracker(direction, REQ_RESIZE)); return handle; } diff --git a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gef/policy/layout/StackLayoutSelectionEditPolicy.java b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gef/policy/layout/StackLayoutSelectionEditPolicy.java index ebf76af48..ac90e261d 100644 --- a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gef/policy/layout/StackLayoutSelectionEditPolicy.java +++ b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gef/policy/layout/StackLayoutSelectionEditPolicy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2023 Google, Inc. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -75,7 +75,7 @@ private Handle createHandle(int direction) { ResizeHandle handle = new ResizeHandle(getHost(), direction); ResizeTracker tracker = new ResizeTracker(direction, null); tracker.setDefaultCursor(Cursors.SIZEALL); - handle.setDragTrackerTool(tracker); + handle.setDragTracker(tracker); handle.setCursor(Cursors.SIZEALL); return handle; } diff --git a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gef/policy/rcp/perspective/AbstractPartSelectionEditPolicy.java b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gef/policy/rcp/perspective/AbstractPartSelectionEditPolicy.java index 53de576a4..8b752ef8d 100644 --- a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gef/policy/rcp/perspective/AbstractPartSelectionEditPolicy.java +++ b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gef/policy/rcp/perspective/AbstractPartSelectionEditPolicy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2024 Google, Inc. and others. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -100,7 +100,7 @@ protected List createStaticHandles() { resizeHandle.setCursor(Cursors.SIZEN); } // single static handle - resizeHandle.setDragTrackerTool(new ResizeTracker(getHost(), m_line.getPosition(), REQ_RESIZE)); + resizeHandle.setDragTracker(new ResizeTracker(getHost(), m_line.getPosition(), REQ_RESIZE)); return List.of(resizeHandle); } diff --git a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gef/policy/widgets/SashFormSelectionEditPolicy.java b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gef/policy/widgets/SashFormSelectionEditPolicy.java index 94b5f8e48..4ed6ea513 100644 --- a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gef/policy/widgets/SashFormSelectionEditPolicy.java +++ b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gef/policy/widgets/SashFormSelectionEditPolicy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2023 Google, Inc. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -81,12 +81,12 @@ protected List createStaticHandles() { SideResizeHandle resizeHandle; if (m_composite.isHorizontal()) { resizeHandle = new SideResizeHandle(getHost(), PositionConstants.RIGHT, 10, true); - resizeHandle.setDragTrackerTool(new ResizeTracker(getHost(), + resizeHandle.setDragTracker(new ResizeTracker(getHost(), PositionConstants.EAST, REQ_RESIZE)); } else { resizeHandle = new SideResizeHandle(getHost(), PositionConstants.BOTTOM, 10, true); - resizeHandle.setDragTrackerTool(new ResizeTracker(getHost(), + resizeHandle.setDragTracker(new ResizeTracker(getHost(), PositionConstants.SOUTH, REQ_RESIZE)); } diff --git a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gef/policy/widgets/TreeTreeColumnSelectionEditPolicy.java b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gef/policy/widgets/TreeTreeColumnSelectionEditPolicy.java index 7b28d780b..1a54305a3 100644 --- a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gef/policy/widgets/TreeTreeColumnSelectionEditPolicy.java +++ b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gef/policy/widgets/TreeTreeColumnSelectionEditPolicy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2023 Google, Inc. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -74,7 +74,7 @@ protected List createStaticHandles() { // create resize column handle SideResizeHandle resizeHandle = new SideResizeHandle(getHost(), PositionConstants.RIGHT, 10, true); - resizeHandle.setDragTrackerTool(new ResizeTracker(getHost(), + resizeHandle.setDragTracker(new ResizeTracker(getHost(), PositionConstants.EAST, REQ_RESIZE)); handles.add(resizeHandle); diff --git a/org.eclipse.wb.swing.FormLayout/src/org/eclipse/wb/internal/swing/FormLayout/gef/header/selection/ColumnSelectionEditPolicy.java b/org.eclipse.wb.swing.FormLayout/src/org/eclipse/wb/internal/swing/FormLayout/gef/header/selection/ColumnSelectionEditPolicy.java index 3758838a4..9a7c5e6f3 100644 --- a/org.eclipse.wb.swing.FormLayout/src/org/eclipse/wb/internal/swing/FormLayout/gef/header/selection/ColumnSelectionEditPolicy.java +++ b/org.eclipse.wb.swing.FormLayout/src/org/eclipse/wb/internal/swing/FormLayout/gef/header/selection/ColumnSelectionEditPolicy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -59,7 +59,7 @@ public ColumnSelectionEditPolicy(LayoutEditPolicy mainPolicy) { @Override protected Handle createResizeHandle() { Handle handle = new SideResizeHandle(getHost(), PositionConstants.RIGHT, 7, false); - handle.setDragTrackerTool(new ResizeTracker(getHost(), PositionConstants.EAST, REQ_RESIZE)); + handle.setDragTracker(new ResizeTracker(getHost(), PositionConstants.EAST, REQ_RESIZE)); return handle; } diff --git a/org.eclipse.wb.swing.FormLayout/src/org/eclipse/wb/internal/swing/FormLayout/gef/header/selection/RowSelectionEditPolicy.java b/org.eclipse.wb.swing.FormLayout/src/org/eclipse/wb/internal/swing/FormLayout/gef/header/selection/RowSelectionEditPolicy.java index 6f14054ad..affbca7c6 100644 --- a/org.eclipse.wb.swing.FormLayout/src/org/eclipse/wb/internal/swing/FormLayout/gef/header/selection/RowSelectionEditPolicy.java +++ b/org.eclipse.wb.swing.FormLayout/src/org/eclipse/wb/internal/swing/FormLayout/gef/header/selection/RowSelectionEditPolicy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -59,7 +59,7 @@ public RowSelectionEditPolicy(LayoutEditPolicy mainPolicy) { @Override protected Handle createResizeHandle() { Handle handle = new SideResizeHandle(getHost(), PositionConstants.BOTTOM, 7, false); - handle.setDragTrackerTool(new ResizeTracker(getHost(), PositionConstants.SOUTH, REQ_RESIZE)); + handle.setDragTracker(new ResizeTracker(getHost(), PositionConstants.SOUTH, REQ_RESIZE)); return handle; } diff --git a/org.eclipse.wb.swing.MigLayout/src/org/eclipse/wb/internal/swing/MigLayout/gef/header/selection/ColumnSelectionEditPolicy.java b/org.eclipse.wb.swing.MigLayout/src/org/eclipse/wb/internal/swing/MigLayout/gef/header/selection/ColumnSelectionEditPolicy.java index 73c049dcc..c033197c5 100644 --- a/org.eclipse.wb.swing.MigLayout/src/org/eclipse/wb/internal/swing/MigLayout/gef/header/selection/ColumnSelectionEditPolicy.java +++ b/org.eclipse.wb.swing.MigLayout/src/org/eclipse/wb/internal/swing/MigLayout/gef/header/selection/ColumnSelectionEditPolicy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -53,7 +53,7 @@ public ColumnSelectionEditPolicy(LayoutEditPolicy mainPolicy) { @Override protected Handle createResizeHandle() { Handle handle = new SideResizeHandle(getHost(), PositionConstants.RIGHT, 7, true); - handle.setDragTrackerTool(new ResizeTracker(getHost(), PositionConstants.EAST, REQ_RESIZE)); + handle.setDragTracker(new ResizeTracker(getHost(), PositionConstants.EAST, REQ_RESIZE)); return handle; } diff --git a/org.eclipse.wb.swing.MigLayout/src/org/eclipse/wb/internal/swing/MigLayout/gef/header/selection/RowSelectionEditPolicy.java b/org.eclipse.wb.swing.MigLayout/src/org/eclipse/wb/internal/swing/MigLayout/gef/header/selection/RowSelectionEditPolicy.java index b42b2dc4f..9fe0f238f 100644 --- a/org.eclipse.wb.swing.MigLayout/src/org/eclipse/wb/internal/swing/MigLayout/gef/header/selection/RowSelectionEditPolicy.java +++ b/org.eclipse.wb.swing.MigLayout/src/org/eclipse/wb/internal/swing/MigLayout/gef/header/selection/RowSelectionEditPolicy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -53,7 +53,7 @@ public RowSelectionEditPolicy(LayoutEditPolicy mainPolicy) { @Override protected Handle createResizeHandle() { Handle handle = new SideResizeHandle(getHost(), PositionConstants.BOTTOM, 7, true); - handle.setDragTrackerTool(new ResizeTracker(getHost(), PositionConstants.SOUTH, REQ_RESIZE)); + handle.setDragTracker(new ResizeTracker(getHost(), PositionConstants.SOUTH, REQ_RESIZE)); return handle; } diff --git a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/gef/policy/component/box/StrutSelectionEditPolicy.java b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/gef/policy/component/box/StrutSelectionEditPolicy.java index 266ad850c..7687e8158 100644 --- a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/gef/policy/component/box/StrutSelectionEditPolicy.java +++ b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/gef/policy/component/box/StrutSelectionEditPolicy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2023 Google, Inc. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -75,7 +75,7 @@ protected List createSelectionHandles() { */ protected Handle createResizeHandle(int handleSide, int resizeDirection) { SideResizeHandle resizeHandle = new SideResizeHandle(getHost(), handleSide, 5, true); - resizeHandle.setDragTrackerTool(new ResizeTracker(getHost(), resizeDirection, REQ_RESIZE)); + resizeHandle.setDragTracker(new ResizeTracker(getHost(), resizeDirection, REQ_RESIZE)); return resizeHandle; } diff --git a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/gef/policy/layout/CardLayoutSelectionEditPolicy.java b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/gef/policy/layout/CardLayoutSelectionEditPolicy.java index caab7c737..20d4fc3d5 100644 --- a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/gef/policy/layout/CardLayoutSelectionEditPolicy.java +++ b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/gef/policy/layout/CardLayoutSelectionEditPolicy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2023 Google, Inc. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -75,7 +75,7 @@ private Handle createHandle(int direction) { ResizeHandle handle = new ResizeHandle(getHost(), direction); ResizeTracker tracker = new ResizeTracker(direction, null); tracker.setDefaultCursor(Cursors.SIZEALL); - handle.setDragTrackerTool(tracker); + handle.setDragTracker(tracker); handle.setCursor(Cursors.SIZEALL); return handle; } diff --git a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/gef/policy/layout/gbl/header/selection/ColumnSelectionEditPolicy.java b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/gef/policy/layout/gbl/header/selection/ColumnSelectionEditPolicy.java index efd37c0f0..17ebb9037 100644 --- a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/gef/policy/layout/gbl/header/selection/ColumnSelectionEditPolicy.java +++ b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/gef/policy/layout/gbl/header/selection/ColumnSelectionEditPolicy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -52,7 +52,7 @@ public ColumnSelectionEditPolicy(LayoutEditPolicy mainPolicy) { @Override protected Handle createResizeHandle() { Handle handle = new SideResizeHandle(getHost(), PositionConstants.RIGHT, 7, false); - handle.setDragTrackerTool(new ResizeTracker(getHost(), PositionConstants.EAST, REQ_RESIZE)); + handle.setDragTracker(new ResizeTracker(getHost(), PositionConstants.EAST, REQ_RESIZE)); return handle; } diff --git a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/gef/policy/layout/gbl/header/selection/RowSelectionEditPolicy.java b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/gef/policy/layout/gbl/header/selection/RowSelectionEditPolicy.java index 21d8e8d65..bcbc1e8e8 100644 --- a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/gef/policy/layout/gbl/header/selection/RowSelectionEditPolicy.java +++ b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/gef/policy/layout/gbl/header/selection/RowSelectionEditPolicy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -52,7 +52,7 @@ public RowSelectionEditPolicy(LayoutEditPolicy mainPolicy) { @Override protected Handle createResizeHandle() { Handle handle = new SideResizeHandle(getHost(), PositionConstants.BOTTOM, 7, false); - handle.setDragTrackerTool(new ResizeTracker(getHost(), PositionConstants.SOUTH, REQ_RESIZE)); + handle.setDragTracker(new ResizeTracker(getHost(), PositionConstants.SOUTH, REQ_RESIZE)); return handle; } diff --git a/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/gef/policy/TableTableColumnSelectionEditPolicy.java b/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/gef/policy/TableTableColumnSelectionEditPolicy.java index 163347a37..d5ad6a40a 100644 --- a/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/gef/policy/TableTableColumnSelectionEditPolicy.java +++ b/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/gef/policy/TableTableColumnSelectionEditPolicy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2023 Google, Inc. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -76,7 +76,7 @@ protected List createStaticHandles() { // create resize column handle SideResizeHandle resizeHandle = new SideResizeHandle(getHost(), PositionConstants.RIGHT, 10, true); - resizeHandle.setDragTrackerTool(new ResizeTracker(getHost(), + resizeHandle.setDragTracker(new ResizeTracker(getHost(), PositionConstants.EAST, REQ_RESIZE)); handles.add(resizeHandle); diff --git a/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/gef/policy/layout/RowLayoutSelectionEditPolicy.java b/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/gef/policy/layout/RowLayoutSelectionEditPolicy.java index de7911d81..e0b1b4d23 100644 --- a/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/gef/policy/layout/RowLayoutSelectionEditPolicy.java +++ b/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/gef/policy/layout/RowLayoutSelectionEditPolicy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2023 Google, Inc. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -78,7 +78,7 @@ protected List createSelectionHandles() { */ private Handle createHandle(int direction) { ResizeHandle handle = new ResizeHandle(getHost(), direction); - handle.setDragTrackerTool(new ResizeTracker(direction, REQ_RESIZE)); + handle.setDragTracker(new ResizeTracker(direction, REQ_RESIZE)); return handle; } diff --git a/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/gef/policy/layout/form/FormSelectionEditPolicy2.java b/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/gef/policy/layout/form/FormSelectionEditPolicy2.java index 1dd1a6511..94fd5f1ea 100644 --- a/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/gef/policy/layout/form/FormSelectionEditPolicy2.java +++ b/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/gef/policy/layout/form/FormSelectionEditPolicy2.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2023 Google, Inc. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -85,7 +85,7 @@ protected Color getFillColor() { return isPrimary() ? ColorConstants.lightBlue : ColorConstants.white; } }; - handle.setDragTrackerTool(new ResizeTracker(direction, + handle.setDragTracker(new ResizeTracker(direction, AbsoluteBasedSelectionEditPolicy.REQ_RESIZE)); return handle; } diff --git a/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/gef/policy/layout/form/FormSelectionEditPolicyClassic.java b/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/gef/policy/layout/form/FormSelectionEditPolicyClassic.java index 038079fa3..9d61d442e 100644 --- a/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/gef/policy/layout/form/FormSelectionEditPolicyClassic.java +++ b/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/gef/policy/layout/form/FormSelectionEditPolicyClassic.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2024 Google, Inc. and others. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -152,7 +152,7 @@ protected Color getFillColor() { return isPrimary() ? ColorConstants.lightBlue : ColorConstants.white; } }; - handle.setDragTrackerTool(new ResizeTracker(direction, + handle.setDragTracker(new ResizeTracker(direction, AbsoluteBasedSelectionEditPolicy.REQ_RESIZE)); return handle; } diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/gef/EmptyEditPartViewer.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/gef/EmptyEditPartViewer.java index ea186d49a..0432ba54e 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/gef/EmptyEditPartViewer.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/gef/EmptyEditPartViewer.java @@ -14,11 +14,9 @@ import org.eclipse.wb.gef.core.IEditPartFactory; import org.eclipse.wb.gef.core.IEditPartViewer; -import org.eclipse.wb.gef.graphical.handles.Handle; import org.eclipse.wb.internal.gef.core.AbstractEditPartViewer; import org.eclipse.wb.internal.gef.core.EditDomain; -import org.eclipse.draw2d.geometry.Point; import org.eclipse.gef.EditPart; import org.eclipse.gef.RootEditPart; import org.eclipse.jface.action.MenuManager; @@ -70,16 +68,6 @@ public org.eclipse.wb.gef.core.EditPart findTargetEditPart(int x, return null; } - @Override - public Handle findTargetHandle(Point location) { - return null; - } - - @Override - public Handle findTargetHandle(int x, int y) { - return null; - } - @Override public Control getControl() { return null; diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/gef/GefCursorTestCase.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/gef/GefCursorTestCase.java index b39023957..d82764905 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/gef/GefCursorTestCase.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/gef/GefCursorTestCase.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2023 Google, Inc. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -162,7 +162,7 @@ protected List createSelectionHandles() { private Handle createResizeHandle(int direction) { ResizeHandle handle = new ResizeHandle(getHost(), direction); - handle.setDragTrackerTool(new ResizeTracker(direction, "REQ_RESIZE")); + handle.setDragTracker(new ResizeTracker(direction, "REQ_RESIZE")); return handle; } diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/gef/GraphicalRobot.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/gef/GraphicalRobot.java index bb4b0cfd1..c2242bbb8 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/gef/GraphicalRobot.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/gef/GraphicalRobot.java @@ -188,7 +188,7 @@ public GraphicalRobot beginMove(Object object) { // find MoveHandle mouseX = bounds.x; mouseY = bounds.y; - while (!(m_viewer.findTargetHandle(mouseX, mouseY) instanceof MoveHandle)) { + while (!(m_viewer.findHandleAt(new Point(mouseX, mouseY)) instanceof MoveHandle)) { mouseX++; } mouseInSourceX = mouseX - bounds.x; @@ -222,8 +222,8 @@ public GraphicalRobot toResizeHandle(Object object, final int direction) { */ public GraphicalRobot toResizeHandle(Object object, final Object type, final int direction) { Predicate predicate = handle -> { - if (handle.getDragTrackerTool() instanceof ResizeTracker) { - ResizeTracker resizeTracker = (ResizeTracker) handle.getDragTrackerTool(); + if (handle.getDragTracker() instanceof ResizeTracker) { + ResizeTracker resizeTracker = (ResizeTracker) handle.getDragTracker(); return resizeTracker.getDirection() == direction && Objects.equals(resizeTracker.getRequestType(), type); } @@ -297,7 +297,8 @@ private Point findSideHandle(Predicate predicate, x += bounds.x; y += bounds.y; while (x < bounds.right() && y < bounds.bottom()) { - Handle handle = m_viewer.findTargetHandle(x, y); + Point p = new Point(x, y); + Handle handle = (Handle) m_viewer.findHandleAt(p); if (predicate.test(handle)) { return handle.getBounds().getCenter(); } diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/gef/SelectionToolTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/gef/SelectionToolTest.java index f1928f705..1860444e6 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/gef/SelectionToolTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/gef/SelectionToolTest.java @@ -244,7 +244,7 @@ public void test_DragTracker_MoveHandle() throws Exception { Tool tracker = getDragTracker(m_tool); assertNotNull(tracker); assertTrue(tracker.isActive()); - assertSame(handle.getDragTrackerTool(), tracker); + assertSame(handle.getDragTracker(), tracker); // actualLogger.assertEmpty(); } @@ -252,7 +252,7 @@ public void test_DragTracker_MoveHandle() throws Exception { { m_sender.dragTo(150, 150); // - assertSame(handle.getDragTrackerTool(), getDragTracker(m_tool)); + assertSame(handle.getDragTracker(), getDragTracker(m_tool)); // ChangeBoundsRequest request = new ChangeBoundsRequest(RequestConstants.REQ_MOVE); // @@ -281,7 +281,7 @@ public void test_DragTracker_MoveHandle() throws Exception { m_sender.endDrag(); // assertNull(getDragTracker(m_tool)); - assertFalse(handle.getDragTrackerTool().isActive()); + assertFalse(handle.getDragTracker().isActive()); // ChangeBoundsRequest request = new ChangeBoundsRequest(RequestConstants.REQ_MOVE); request.setEditParts(childEditPart);