Skip to content

Commit 28f2926

Browse files
committed
[GEF] Use GEF EditPart interface where possible in WB Core
Our `EditPart` implementation has been aligned close enough to the GEF interface that we can use it directly, rather than our own type. This avoids several type-casts and should eventually allow us to mix WindowBuilder and non-WindowBuilder edit-parts.
1 parent 89c4f02 commit 28f2926

39 files changed

Lines changed: 90 additions & 83 deletions

File tree

org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/gef/GenericContainersLayoutEditPolicyFactory.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2011 Google, Inc.
2+
* Copyright (c) 2011, 2026 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
@@ -14,7 +14,6 @@
1414

1515
import org.eclipse.wb.core.gef.policy.layout.ILayoutEditPolicyFactory;
1616
import org.eclipse.wb.core.model.JavaInfo;
17-
import org.eclipse.wb.gef.core.EditPart;
1817
import org.eclipse.wb.gef.graphical.policies.LayoutEditPolicy;
1918
import org.eclipse.wb.internal.core.gef.policy.layout.generic.FlowContainerLayoutEditPolicy;
2019
import org.eclipse.wb.internal.core.gef.policy.layout.generic.SimpleContainerLayoutEditPolicy;
@@ -23,6 +22,8 @@
2322
import org.eclipse.wb.internal.core.model.generic.SimpleContainer;
2423
import org.eclipse.wb.internal.core.model.generic.SimpleContainerFactory;
2524

25+
import org.eclipse.gef.EditPart;
26+
2627
import java.util.List;
2728

2829
/**

org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/core/requests/ChangeBoundsRequest.java

Lines changed: 2 additions & 3 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, 2026 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
@@ -12,11 +12,10 @@
1212
*******************************************************************************/
1313
package org.eclipse.wb.gef.core.requests;
1414

15-
import org.eclipse.wb.gef.core.EditPart;
16-
1715
import org.eclipse.draw2d.geometry.Dimension;
1816
import org.eclipse.draw2d.geometry.Point;
1917
import org.eclipse.draw2d.geometry.Rectangle;
18+
import org.eclipse.gef.EditPart;
2019
import org.eclipse.gef.requests.DropRequest;
2120
import org.eclipse.gef.requests.GroupRequest;
2221

org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/core/requests/DragPermissionRequest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2011 Google, Inc.
2+
* Copyright (c) 2011, 2026 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
@@ -12,8 +12,7 @@
1212
*******************************************************************************/
1313
package org.eclipse.wb.gef.core.requests;
1414

15-
import org.eclipse.wb.gef.core.EditPart;
16-
15+
import org.eclipse.gef.EditPart;
1716
import org.eclipse.gef.Request;
1817

1918
/**

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2011, 2023 Google, Inc.
2+
* Copyright (c) 2011, 2026 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
@@ -12,11 +12,11 @@
1212
*******************************************************************************/
1313
package org.eclipse.wb.gef.core.tools;
1414

15-
import org.eclipse.wb.gef.core.EditPart;
1615
import org.eclipse.wb.gef.core.IEditPartViewer;
1716
import org.eclipse.wb.gef.core.requests.CreateRequest;
1817
import org.eclipse.wb.gef.core.requests.ICreationFactory;
1918

19+
import org.eclipse.gef.EditPart;
2020
import org.eclipse.gef.Request;
2121

2222
/**
@@ -87,7 +87,7 @@ protected void selectAddedObjects() {
8787
if (model != null) {
8888
IEditPartViewer viewer = getCurrentViewer();
8989
if (viewer != null) {
90-
EditPart editPart = (EditPart) viewer.getEditPartRegistry().get(model);
90+
EditPart editPart = viewer.getEditPartRegistry().get(model);
9191
if (editPart != null) {
9292
viewer.select(editPart);
9393
}

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

Lines changed: 3 additions & 3 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, 2026 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
@@ -12,10 +12,10 @@
1212
*******************************************************************************/
1313
package org.eclipse.wb.gef.core.tools;
1414

15-
import org.eclipse.wb.gef.core.EditPart;
1615
import org.eclipse.wb.gef.core.IEditPartViewer;
1716
import org.eclipse.wb.gef.core.requests.PasteRequest;
1817

18+
import org.eclipse.gef.EditPart;
1919
import org.eclipse.gef.Request;
2020
import org.eclipse.jface.viewers.StructuredSelection;
2121

@@ -74,7 +74,7 @@ protected void selectAddedObjects() {
7474
{
7575
PasteRequest request = (PasteRequest) getTargetRequest();
7676
for (Object model : request.getObjects()) {
77-
editParts.add((EditPart) viewer.getEditPartRegistry().get(model));
77+
editParts.add(viewer.getEditPartRegistry().get(model));
7878
}
7979
}
8080
// select EditPart's

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2011, 2025 Google, Inc. and others.
2+
* Copyright (c) 2011, 2026 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
@@ -12,9 +12,9 @@
1212
*******************************************************************************/
1313
package org.eclipse.wb.gef.core.tools;
1414

15-
import org.eclipse.wb.gef.core.EditPart;
1615
import org.eclipse.wb.gef.core.IEditPartViewer;
1716

17+
import org.eclipse.gef.EditPart;
1818
import org.eclipse.gef.RequestConstants;
1919
import org.eclipse.gef.requests.SelectionRequest;
2020
import org.eclipse.swt.SWT;

org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/graphical/handles/MoveHandle.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2011, 2025 Google, Inc. and others.
2+
* Copyright (c) 2011, 2026 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
@@ -13,13 +13,13 @@
1313
package org.eclipse.wb.gef.graphical.handles;
1414

1515
import org.eclipse.wb.draw2d.border.LineBorder;
16-
import org.eclipse.wb.gef.core.EditPart;
1716
import org.eclipse.wb.gef.core.tools.DragEditPartTracker;
1817
import org.eclipse.wb.gef.core.tools.Tool;
1918
import org.eclipse.wb.gef.graphical.GraphicalEditPart;
2019

2120
import org.eclipse.draw2d.Cursors;
2221
import org.eclipse.draw2d.Locator;
22+
import org.eclipse.gef.EditPart;
2323

2424
/**
2525
* A Handle used for moving {@link EditPart}s.

org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/graphical/handles/ResizeHandle.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2011, 2023 Google, Inc.
2+
* Copyright (c) 2011, 2026 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
@@ -13,11 +13,11 @@
1313
package org.eclipse.wb.gef.graphical.handles;
1414

1515
import org.eclipse.wb.draw2d.RelativeLocator;
16-
import org.eclipse.wb.gef.core.EditPart;
1716
import org.eclipse.wb.gef.graphical.GraphicalEditPart;
1817

1918
import org.eclipse.draw2d.Cursors;
2019
import org.eclipse.draw2d.Locator;
20+
import org.eclipse.gef.EditPart;
2121

2222
/**
2323
* A Handle used to resize a {@link EditPart}s.

org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/graphical/handles/SquareHandle.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2011 Google, Inc.
2+
* Copyright (c) 2011, 2026 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
@@ -12,13 +12,13 @@
1212
*******************************************************************************/
1313
package org.eclipse.wb.gef.graphical.handles;
1414

15-
import org.eclipse.wb.gef.core.EditPart;
1615
import org.eclipse.wb.gef.graphical.GraphicalEditPart;
1716

1817
import org.eclipse.draw2d.ColorConstants;
1918
import org.eclipse.draw2d.Graphics;
2019
import org.eclipse.draw2d.Locator;
2120
import org.eclipse.draw2d.geometry.Rectangle;
21+
import org.eclipse.gef.EditPart;
2222
import org.eclipse.swt.graphics.Color;
2323

2424
/**

org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/graphical/policies/GraphicalEditPolicy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
package org.eclipse.wb.gef.graphical.policies;
1414

1515
import org.eclipse.wb.draw2d.Layer;
16-
import org.eclipse.wb.gef.core.EditPart;
1716
import org.eclipse.wb.gef.core.IEditPartViewer;
1817
import org.eclipse.wb.gef.core.policies.EditPolicy;
1918
import org.eclipse.wb.gef.graphical.GraphicalEditPart;
2019

2120
import org.eclipse.draw2d.IFigure;
21+
import org.eclipse.gef.EditPart;
2222
import org.eclipse.gef.LayerConstants;
2323
import org.eclipse.gef.editparts.LayerManager;
2424

0 commit comments

Comments
 (0)