Skip to content

Commit 42c983f

Browse files
committed
[GEF] Harmonize findTargetEditPart method
This renames the findTargetEditPart() to findObjectAtExcluding() to match the signature of the corresponding GEF method.
1 parent dd45bef commit 42c983f

8 files changed

Lines changed: 28 additions & 50 deletions

File tree

org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/gef/tools/TabOrderTool.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -196,18 +196,16 @@ protected boolean handleButtonDown(int button) {
196196
protected void updateTargetUnderMouse() {
197197
// find on clickable layer
198198
EditPart editPart =
199-
getCurrentViewer().findTargetEditPart(
200-
getLocation().x,
201-
getLocation().y,
199+
getCurrentViewer().findObjectAtExcluding(
200+
getLocation(),
202201
getExclusionSet(),
203202
getTargetingConditional(),
204203
IEditPartViewer.CLICKABLE_LAYER);
205204
// common find target part
206205
if (editPart == null) {
207206
editPart =
208-
getCurrentViewer().findTargetEditPart(
209-
getLocation().x,
210-
getLocation().y,
207+
getCurrentViewer().findObjectAtExcluding(
208+
getLocation(),
211209
getExclusionSet(),
212210
getTargetingConditional());
213211
}

org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/core/IEditPartViewer.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
import org.eclipse.wb.internal.gef.core.EditDomain;
1717

1818
import org.eclipse.draw2d.IFigure;
19+
import org.eclipse.draw2d.geometry.Point;
20+
import org.eclipse.gef.EditPart;
1921
import org.eclipse.jface.viewers.ISelectionProvider;
2022

2123
import java.util.Collection;
@@ -124,28 +126,19 @@ public interface IEditPartViewer extends ISelectionProvider, org.eclipse.gef.Edi
124126
* current selection. The last EditPart in the new selection is made
125127
* {@link EditPart#SELECTED_PRIMARY primary}.
126128
*/
127-
void deselect(List<? extends org.eclipse.gef.EditPart> editParts);
129+
void deselect(List<? extends EditPart> editParts);
128130

129131
////////////////////////////////////////////////////////////////////////////
130132
//
131133
// Finding
132134
//
133135
////////////////////////////////////////////////////////////////////////////
134-
/**
135-
* Returns <code>null</code> or the <code>{@link EditPart}</code> at the specified location, using
136-
* the given exclusion set and conditional.
137-
*/
138-
EditPart findTargetEditPart(int x,
139-
int y,
140-
final Collection<IFigure> exclude,
141-
final Conditional conditional);
142136

143137
/**
144138
* Returns <code>null</code> or the <code>{@link EditPart}</code> at the specified location on
145139
* specified given layer, using the given exclusion set and conditional.
146140
*/
147-
EditPart findTargetEditPart(int x,
148-
int y,
141+
EditPart findObjectAtExcluding(Point location,
149142
final Collection<IFigure> exclude,
150143
final Conditional conditional,
151144
String layer);

org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/core/tools/TargetingTool.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,8 @@ protected Conditional getTargetingConditional() {
169169
protected void updateTargetUnderMouse() {
170170
if (!m_isLockTarget) {
171171
EditPart editPart =
172-
getCurrentViewer().findTargetEditPart(
173-
getLocation().x,
174-
getLocation().y,
172+
getCurrentViewer().findObjectAtExcluding(
173+
getLocation(),
175174
getExclusionSet(),
176175
getTargetingConditional());
177176
if (editPart != null) {

org.eclipse.wb.core/src-gef/org/eclipse/wb/internal/gef/core/AbstractEditPartViewer.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2011, 2024 Google, Inc. and others.
2+
* Copyright (c) 2011, 2025 Google, Inc. and others.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License 2.0 which is available at
@@ -18,8 +18,6 @@
1818

1919
import org.eclipse.core.runtime.Assert;
2020
import org.eclipse.draw2d.EventListenerList;
21-
import org.eclipse.draw2d.IFigure;
22-
import org.eclipse.draw2d.geometry.Point;
2321
import org.eclipse.gef.EditPart;
2422
import org.eclipse.gef.RootEditPart;
2523
import org.eclipse.jface.action.MenuManager;
@@ -32,7 +30,6 @@
3230
import org.eclipse.swt.widgets.Menu;
3331

3432
import java.util.ArrayList;
35-
import java.util.Collection;
3633
import java.util.Iterator;
3734
import java.util.List;
3835

@@ -339,10 +336,6 @@ private <T extends Object> Iterator<T> getListeners(Class<T> listenerClass) {
339336
// GEF
340337
//
341338
////////////////////////////////////////////////////////////////////////////
342-
@Override
343-
public org.eclipse.wb.gef.core.EditPart findObjectAtExcluding(Point location, Collection<IFigure> exclusionSet, Conditional conditional) {
344-
return null;
345-
}
346339

347340
@Override
348341
public Control createControl(Composite parent) {

org.eclipse.wb.core/src-gef/org/eclipse/wb/internal/gef/graphical/GraphicalViewer.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,12 @@ public void setCursor(Cursor cursor) {
151151
* primary layers, using the given exclusion set and conditional.
152152
*/
153153
@Override
154-
public EditPart findTargetEditPart(int x,
155-
int y,
154+
public EditPart findObjectAtExcluding(Point location,
156155
final Collection<IFigure> exclude,
157156
final Conditional conditional) {
158-
EditPart editPart = findTargetEditPart(x, y, exclude, conditional, MENU_PRIMARY_LAYER);
157+
EditPart editPart = findObjectAtExcluding(location, exclude, conditional, MENU_PRIMARY_LAYER);
159158
if (editPart == null) {
160-
editPart = findTargetEditPart(x, y, exclude, conditional, PRIMARY_LAYER);
159+
editPart = findObjectAtExcluding(location, exclude, conditional, PRIMARY_LAYER);
161160
}
162161
return editPart;
163162
}
@@ -167,12 +166,11 @@ public EditPart findTargetEditPart(int x,
167166
* specified given layer, using the given exclusion set and conditional.
168167
*/
169168
@Override
170-
public EditPart findTargetEditPart(int x,
171-
int y,
169+
public EditPart findObjectAtExcluding(Point location,
172170
final Collection<IFigure> exclude,
173171
final Conditional conditional,
174172
String layer) {
175-
TargetEditPartFindVisitor visitor = new TargetEditPartFindVisitor(m_canvas, x, y, this) {
173+
TargetEditPartFindVisitor visitor = new TargetEditPartFindVisitor(m_canvas, location.x, location.y, this) {
176174
@Override
177175
protected boolean acceptVisit(Figure figure) {
178176
for (IFigure exclusionFigure : exclude) {

org.eclipse.wb.core/src-gef/org/eclipse/wb/internal/gef/tree/TreeViewer.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import org.eclipse.wb.internal.gef.core.EditDomain;
1919

2020
import org.eclipse.draw2d.IFigure;
21+
import org.eclipse.draw2d.geometry.Point;
2122
import org.eclipse.gef.EditPart;
2223
import org.eclipse.jface.viewers.ISelectionChangedListener;
2324
import org.eclipse.jface.viewers.SelectionChangedEvent;
@@ -220,22 +221,21 @@ public void setSelectionToTreeWidget() {
220221
* the given exclusion set and conditional.
221222
*/
222223
@Override
223-
public org.eclipse.wb.gef.core.EditPart findTargetEditPart(int x,
224-
int y,
224+
public EditPart findObjectAtExcluding(Point location,
225225
Collection<IFigure> exclude,
226226
Conditional conditional) {
227227
// simple check location
228228
Rectangle clientArea = m_tree.getClientArea();
229-
if (x < 0 || y < 0 || x > clientArea.width || y > clientArea.height) {
229+
if (location.x < 0 || location.y < 0 || location.x > clientArea.width || location.y > clientArea.height) {
230230
return null;
231231
}
232232
// find EditPart
233-
org.eclipse.wb.gef.core.EditPart result = null;
234-
TreeItem item = m_tree.getItem(new org.eclipse.swt.graphics.Point(x, y));
233+
EditPart result = null;
234+
TreeItem item = m_tree.getItem(new org.eclipse.swt.graphics.Point(location.x, location.y));
235235
if (item == null) {
236236
result = m_rootEditPart;
237237
} else {
238-
result = (org.eclipse.wb.gef.core.EditPart) item.getData();
238+
result = (EditPart) item.getData();
239239
}
240240
// apply conditional
241241
while (result != null) {
@@ -248,8 +248,7 @@ public org.eclipse.wb.gef.core.EditPart findTargetEditPart(int x,
248248
}
249249

250250
@Override
251-
public org.eclipse.wb.gef.core.EditPart findTargetEditPart(int x,
252-
int y,
251+
public EditPart findObjectAtExcluding(Point location,
253252
Collection<IFigure> exclude,
254253
Conditional conditional,
255254
String layer) {

org.eclipse.wb.core/src-gef/org/eclipse/wb/internal/gef/tree/dnd/TreeDropListener.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,8 @@ private void updateTargetEditPart() {
218218
Point location = getDropLocation();
219219
Collection<? extends EditPart> editParts = includeChildren(getDragSource());
220220
EditPart editPart =
221-
m_viewer.findTargetEditPart(
222-
location.x,
223-
location.y,
221+
m_viewer.findObjectAtExcluding(
222+
location,
224223
Collections.emptyList(),
225224
getTargetingConditional(editParts));
226225
if (editPart != null) {

org.eclipse.wb.tests/src/org/eclipse/wb/tests/gef/EmptyEditPartViewer.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import org.eclipse.wb.internal.gef.core.EditDomain;
1919

2020
import org.eclipse.draw2d.IFigure;
21+
import org.eclipse.draw2d.geometry.Point;
2122
import org.eclipse.gef.EditPart;
2223
import org.eclipse.gef.RootEditPart;
2324
import org.eclipse.jface.action.MenuManager;
@@ -53,16 +54,14 @@ public void deselectAll() {
5354
}
5455

5556
@Override
56-
public org.eclipse.wb.gef.core.EditPart findTargetEditPart(int x,
57-
int y,
57+
public EditPart findObjectAtExcluding(Point location,
5858
Collection<IFigure> exclude,
5959
Conditional conditional) {
6060
return null;
6161
}
6262

6363
@Override
64-
public org.eclipse.wb.gef.core.EditPart findTargetEditPart(int x,
65-
int y,
64+
public EditPart findObjectAtExcluding(Point location,
6665
Collection<IFigure> exclude,
6766
Conditional conditional,
6867
String layer) {

0 commit comments

Comments
 (0)