From 0112fa11fafda6deaedf3ee2728fee7efb48b945 Mon Sep 17 00:00:00 2001 From: Patrick Ziegler Date: Mon, 16 Jun 2025 22:36:38 +0200 Subject: [PATCH] [GEF] Avoid overloading of getChildren() method in EditPart At some point, the GraphicalEditPart should implement the GEF interface with the same name. For this, the getChildren() method needs to be overloaded to return a list of GraphicalEditParts, which is not possible when the method already returns a list of WindowBuilder EditParts. --- .../org/eclipse/wb/gef/core/EditPart.java | 17 ++++------------- .../org/eclipse/wb/gef/tree/TreeEditPart.java | 14 +++++++------- .../wb/gef/tree/policies/LayoutEditPolicy.java | 12 ++++++------ .../gef/policy/layout/LayoutPolicyUtils.java | 7 ++++--- .../grid/AbstractGridSelectionEditPolicy.java | 6 +++--- .../core/gef/part/menu/MenuObjectEditPart.java | 16 ++++++++-------- .../AbsoluteComplexSelectionEditPolicy.java | 4 ++-- .../utils/gef/EditPartsContentProvider.java | 8 ++++---- .../group/gef/GroupSelectionEditPolicy2.java | 6 +++--- .../rcp/gef/part/widgets/DialogEditPart.java | 5 +++-- .../MigLayout/gef/MigLayoutEditPolicy.java | 2 +- .../layout/form/AnchorFiguresClassic.java | 4 ++-- .../layout/grid/GridLayoutEditPolicy.java | 4 ++-- .../rcp/model/widgets/ViewFormGefTest.java | 3 ++- .../swt/model/menu/MenuComplexTest.java | 2 +- .../swt/model/menu/MenuPopupSimpleTest.java | 10 +++++----- .../org/eclipse/wb/tests/gef/EditPartTest.java | 12 ++++++------ 17 files changed, 63 insertions(+), 69 deletions(-) diff --git a/org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/core/EditPart.java b/org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/core/EditPart.java index d146eca64..6c3b2eeff 100644 --- a/org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/core/EditPart.java +++ b/org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/core/EditPart.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 @@ -41,15 +41,6 @@ public abstract class EditPart extends org.eclipse.gef.editparts.AbstractEditPar // Parent/Children // //////////////////////////////////////////////////////////////////////////// - /** - * Returns the List of children EditParts. This method should rarely be called, and - * is only made public so that helper objects of this EditPart, such as EditPolicies, can obtain - * the children. The returned List may be by reference, and should never be modified. - */ - @Override - public List getChildren() { - return (List) super.getChildren(); - } /** * Returns the parent {@link EditPart}. This method should only be called internally * or by helpers such as EditPolicies. @@ -93,7 +84,7 @@ protected List getModelChildren() { */ public final void accept(EditPartVisitor visitor) { if (visitor.visit(this)) { - for (EditPart childPart : getChildren()) { + for (EditPart childPart : (List) getChildren()) { childPart.accept(visitor); } visitor.endVisit(this); @@ -129,7 +120,7 @@ protected void refreshVisuals() { protected void refreshChildren() { // prepare map[model, currentPart] Map modelToPart = new HashMap<>(); - List children = getChildren(); + List children = (List) getChildren(); for (EditPart editPart : children) { modelToPart.put(editPart.getModel(), editPart); } @@ -185,7 +176,7 @@ protected void refreshChildren() { removeChild(childPart); } // recurse refresh() - for (EditPart child : getChildren()) { + for (EditPart child : (List) getChildren()) { child.refresh(); } } diff --git a/org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/tree/TreeEditPart.java b/org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/tree/TreeEditPart.java index 1fe5cb29d..7c75136a8 100644 --- a/org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/tree/TreeEditPart.java +++ b/org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/tree/TreeEditPart.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 @@ -12,10 +12,10 @@ *******************************************************************************/ package org.eclipse.wb.gef.tree; -import org.eclipse.wb.gef.core.EditPart; import org.eclipse.wb.gef.core.tools.Tool; import org.eclipse.wb.internal.gef.tree.tools.DoubleClickEditPartTracker; +import org.eclipse.gef.EditPart; import org.eclipse.gef.Request; import org.eclipse.swt.SWT; import org.eclipse.swt.events.DisposeEvent; @@ -28,7 +28,7 @@ * @author lobas_av * @coverage gef.tree */ -public abstract class TreeEditPart extends EditPart { +public abstract class TreeEditPart extends org.eclipse.wb.gef.core.EditPart { private TreeItem m_widget; private boolean m_expandedShouldRestore; private boolean m_expanded; @@ -45,7 +45,7 @@ public TreeItem getWidget() { public void setWidget(TreeItem widget) { m_widget = widget; // - List children = getChildren(); + List children = getChildren(); if (m_widget == null) { for (EditPart editPart : children) { TreeEditPart treePart = (TreeEditPart) editPart; @@ -69,13 +69,13 @@ public void widgetDisposed(DisposeEvent e) { // //////////////////////////////////////////////////////////////////////////// @Override - protected void addChildVisual(org.eclipse.gef.EditPart childPart, int index) { + protected void addChildVisual(EditPart childPart, int index) { TreeEditPart treePart = (TreeEditPart) childPart; treePart.setWidget(new TreeItem(getWidget(), SWT.NONE, index)); } @Override - protected void removeChildVisual(org.eclipse.gef.EditPart childPart) { + protected void removeChildVisual(EditPart childPart) { TreeEditPart treePart = (TreeEditPart) childPart; if (treePart.getWidget() != null) { treePart.getWidget().dispose(); @@ -84,7 +84,7 @@ protected void removeChildVisual(org.eclipse.gef.EditPart childPart) { } @Override - protected void updateChildVisual(EditPart childPart, int index) { + protected void updateChildVisual(org.eclipse.wb.gef.core.EditPart childPart, int index) { TreeEditPart treePart = (TreeEditPart) childPart; if (treePart.getWidget() == null) { treePart.setWidget(new TreeItem(getWidget(), SWT.NONE, index)); diff --git a/org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/tree/policies/LayoutEditPolicy.java b/org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/tree/policies/LayoutEditPolicy.java index b112dab05..ccb8a6e0d 100644 --- a/org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/tree/policies/LayoutEditPolicy.java +++ b/org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/tree/policies/LayoutEditPolicy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2024 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 @@ -158,7 +158,7 @@ public Command getCommand(Request request) { return null; } // prepare children - List children = getReferenceChildren(request); + List children = getReferenceChildren(request); // calculate next reference Object referenceObject = null; if (targetItem == getHostWidget()) { @@ -198,11 +198,11 @@ protected boolean isGoodReferenceChild(Request request, EditPart editPart) { /** * @return the {@link List} of {@link EditPart}'s that can be used as references. */ - private List getReferenceChildren(Request request) { - List allChildren = getHost().getChildren(); - List referenceChildren = new ArrayList<>(); + private List getReferenceChildren(Request request) { + List allChildren = getHost().getChildren(); + List referenceChildren = new ArrayList<>(); // - for (org.eclipse.wb.gef.core.EditPart editPart : allChildren) { + for (EditPart editPart : allChildren) { if (isGoodReferenceChild(request, editPart)) { referenceChildren.add(editPart); } diff --git a/org.eclipse.wb.core/src/org/eclipse/wb/core/gef/policy/layout/LayoutPolicyUtils.java b/org.eclipse.wb.core/src/org/eclipse/wb/core/gef/policy/layout/LayoutPolicyUtils.java index 29733897f..01c03c377 100644 --- a/org.eclipse.wb.core/src/org/eclipse/wb/core/gef/policy/layout/LayoutPolicyUtils.java +++ b/org.eclipse.wb.core/src/org/eclipse/wb/core/gef/policy/layout/LayoutPolicyUtils.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 @@ -12,10 +12,11 @@ *******************************************************************************/ package org.eclipse.wb.core.gef.policy.layout; -import org.eclipse.wb.gef.core.EditPart; import org.eclipse.wb.gef.graphical.policies.LayoutEditPolicy; import org.eclipse.wb.internal.core.utils.external.ExternalFactoriesHelper; +import org.eclipse.gef.EditPart; + import java.util.List; /** @@ -33,7 +34,7 @@ public class LayoutPolicyUtils { /** * @return the {@link LayoutEditPolicy} for given model. */ - public static LayoutEditPolicy createLayoutEditPolicy(EditPart context, Object model) { + public static LayoutEditPolicy createLayoutEditPolicy(org.eclipse.wb.gef.core.EditPart context, Object model) { // try to create policy List factories = ExternalFactoriesHelper.getElementsInstances( 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 c1e64ae67..d0be697d4 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 @@ -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 @@ -22,7 +22,6 @@ import org.eclipse.wb.draw2d.Figure; import org.eclipse.wb.draw2d.RectangleFigure; import org.eclipse.wb.draw2d.RelativeLocator; -import org.eclipse.wb.gef.core.EditPart; import org.eclipse.wb.gef.core.IEditPartViewer; import org.eclipse.wb.gef.core.requests.ChangeBoundsRequest; import org.eclipse.wb.gef.graphical.handles.Handle; @@ -41,6 +40,7 @@ import org.eclipse.draw2d.geometry.Interval; import org.eclipse.draw2d.geometry.Point; import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.gef.EditPart; import org.eclipse.gef.Request; import org.eclipse.gef.commands.Command; import org.eclipse.swt.graphics.Color; @@ -196,7 +196,7 @@ public final void showAlignmentFigures() { m_alignmentFigures = new ArrayList<>(); // show cell figures for all children of host's parent { - Collection editParts = getHost().getParent().getChildren(); + Collection editParts = getHost().getParent().getChildren(); for (EditPart editPart : editParts) { showCellFigures(editPart); } diff --git a/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/gef/part/menu/MenuObjectEditPart.java b/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/gef/part/menu/MenuObjectEditPart.java index fcabce019..eb54d9107 100644 --- a/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/gef/part/menu/MenuObjectEditPart.java +++ b/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/gef/part/menu/MenuObjectEditPart.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 @@ -13,7 +13,6 @@ package org.eclipse.wb.internal.core.gef.part.menu; import org.eclipse.wb.core.gef.part.menu.IMenuObjectEditPart; -import org.eclipse.wb.gef.core.EditPart; import org.eclipse.wb.gef.core.requests.DragPermissionRequest; import org.eclipse.wb.gef.core.requests.PasteRequest; import org.eclipse.wb.gef.core.tools.Tool; @@ -24,6 +23,7 @@ import org.eclipse.wb.internal.gef.core.EditPartVisitor; import org.eclipse.wb.internal.gef.core.IActiveToolListener; +import org.eclipse.gef.EditPart; import org.eclipse.gef.Request; import org.eclipse.gef.RequestConstants; import org.eclipse.jface.viewers.ISelectionChangedListener; @@ -163,10 +163,10 @@ public void refresh() { @Override public void deleting(Object toolkitModel) { - EditPart objectPart = (EditPart) getViewer().getEditPartRegistry().get(toolkitModel); + EditPart objectPart = getViewer().getEditPartRegistry().get(toolkitModel); if (objectPart != null) { EditPart parentPart = objectPart.getParent(); - List siblings = parentPart.getChildren(); + List siblings = parentPart.getChildren(); int index = siblings.indexOf(objectPart); // move selection on sibling or parent item if (siblings.size() == 1) { @@ -191,9 +191,9 @@ public void deleting(Object toolkitModel) { // //////////////////////////////////////////////////////////////////////////// @Override - public EditPart getTargetEditPart(org.eclipse.gef.Request request) { + public org.eclipse.wb.gef.core.EditPart getTargetEditPart(org.eclipse.gef.Request request) { request = processRequestProcessors(request); - EditPart target = super.getTargetEditPart(request); + org.eclipse.wb.gef.core.EditPart target = super.getTargetEditPart(request); boolean isOperationRequest = request.getType() == RequestConstants.REQ_CREATE || request.getType() == PasteRequest.REQ_PASTE @@ -206,9 +206,9 @@ public EditPart getTargetEditPart(org.eclipse.gef.Request request) { public void run() { try { MenuObjectInfoUtils.m_selectingObject = m_object; - ((EditPart)getViewer().getRootEditPart()).accept(new EditPartVisitor() { + ((org.eclipse.wb.gef.core.EditPart)getViewer().getRootEditPart()).accept(new EditPartVisitor() { @Override - public boolean visit(EditPart editPart) { + public boolean visit(org.eclipse.wb.gef.core.EditPart editPart) { if (editPart instanceof MenuObjectEditPart) { editPart.refresh(); return false; diff --git a/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/gef/policy/layout/absolute/AbsoluteComplexSelectionEditPolicy.java b/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/gef/policy/layout/absolute/AbsoluteComplexSelectionEditPolicy.java index a4a658dad..3c861b0c2 100644 --- a/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/gef/policy/layout/absolute/AbsoluteComplexSelectionEditPolicy.java +++ b/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/gef/policy/layout/absolute/AbsoluteComplexSelectionEditPolicy.java @@ -20,7 +20,6 @@ import org.eclipse.wb.draw2d.Figure; import org.eclipse.wb.draw2d.FigureUtils; import org.eclipse.wb.draw2d.Polyline; -import org.eclipse.wb.gef.core.EditPart; import org.eclipse.wb.gef.core.IEditPartViewer; import org.eclipse.wb.internal.core.gef.policy.layout.absolute.actions.AnchorsActionsSupport; import org.eclipse.wb.internal.core.gef.policy.snapping.ComponentAttachmentInfo; @@ -35,6 +34,7 @@ import org.eclipse.draw2d.geometry.Point; import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.draw2d.geometry.Transposer; +import org.eclipse.gef.EditPart; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.SWT; @@ -241,7 +241,7 @@ public final void showAlignmentFigures() { m_alignmentFigures = new ArrayList<>(); // show cell figures for all children of host's parent { - Collection editParts = getHost().getParent().getChildren(); + Collection editParts = getHost().getParent().getChildren(); for (EditPart editPart : editParts) { showAlignmentFigures(editPart); } diff --git a/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/utils/gef/EditPartsContentProvider.java b/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/utils/gef/EditPartsContentProvider.java index 3a8ebbc34..01d2a4699 100644 --- a/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/utils/gef/EditPartsContentProvider.java +++ b/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/utils/gef/EditPartsContentProvider.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 @@ -12,9 +12,9 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.utils.gef; -import org.eclipse.wb.gef.core.EditPart; import org.eclipse.wb.gef.core.IEditPartViewer; +import org.eclipse.gef.EditPart; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.Viewer; @@ -64,7 +64,7 @@ public boolean hasChildren(Object parentElement) { @Override public Object[] getChildren(Object parentElement) { - EditPart parentEditPart = (EditPart) m_viewer.getEditPartRegistry().get(parentElement); + EditPart parentEditPart = m_viewer.getEditPartRegistry().get(parentElement); if (parentEditPart != null) { List children = new ArrayList<>(); for (EditPart editPart : parentEditPart.getChildren()) { @@ -77,7 +77,7 @@ public Object[] getChildren(Object parentElement) { @Override public Object getParent(Object element) { - EditPart editPart = (EditPart) m_viewer.getEditPartRegistry().get(element); + EditPart editPart = m_viewer.getEditPartRegistry().get(element); if (editPart != null) { return editPart.getParent().getModel(); } 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 c86396f00..a40e131f8 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 @@ -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 @@ -22,7 +22,6 @@ import org.eclipse.wb.core.model.ObjectInfoUtils; import org.eclipse.wb.draw2d.Figure; import org.eclipse.wb.draw2d.border.LineBorder; -import org.eclipse.wb.gef.core.EditPart; import org.eclipse.wb.gef.core.IEditPartViewer; import org.eclipse.wb.gef.core.requests.ChangeBoundsRequest; import org.eclipse.wb.gef.graphical.handles.Handle; @@ -42,6 +41,7 @@ import org.eclipse.draw2d.geometry.Point; import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.draw2d.geometry.Translatable; +import org.eclipse.gef.EditPart; import org.eclipse.gef.Request; import org.eclipse.gef.commands.Command; import org.eclipse.jface.action.IMenuManager; @@ -312,7 +312,7 @@ public final void showAlignmentFigures() { m_alignmentFigures = new ArrayList<>(); // show cell figures for all children of host's parent { - Collection editParts = getHost().getParent().getChildren(); + Collection editParts = getHost().getParent().getChildren(); for (EditPart editPart : editParts) { showAlignmentFigures(editPart); } diff --git a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gef/part/widgets/DialogEditPart.java b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gef/part/widgets/DialogEditPart.java index 94002ab5a..3a553489c 100644 --- a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gef/part/widgets/DialogEditPart.java +++ b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/gef/part/widgets/DialogEditPart.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 @@ -14,10 +14,11 @@ import org.eclipse.wb.core.gef.part.AbstractComponentEditPart; import org.eclipse.wb.core.gef.policy.selection.TopSelectionEditPolicy; -import org.eclipse.wb.gef.core.EditPart; import org.eclipse.wb.gef.core.policies.EditPolicy; import org.eclipse.wb.internal.rcp.model.widgets.DialogInfo; +import org.eclipse.gef.EditPart; + /** * {@link EditPart} for {@link DialogInfo}. * diff --git a/org.eclipse.wb.swing.MigLayout/src/org/eclipse/wb/internal/swing/MigLayout/gef/MigLayoutEditPolicy.java b/org.eclipse.wb.swing.MigLayout/src/org/eclipse/wb/internal/swing/MigLayout/gef/MigLayoutEditPolicy.java index e2d400f10..cd5c1b2a6 100644 --- a/org.eclipse.wb.swing.MigLayout/src/org/eclipse/wb/internal/swing/MigLayout/gef/MigLayoutEditPolicy.java +++ b/org.eclipse.wb.swing.MigLayout/src/org/eclipse/wb/internal/swing/MigLayout/gef/MigLayoutEditPolicy.java @@ -111,7 +111,7 @@ protected IGridInfo getGridInfo() { * different {@link SelectionEditPolicy}. */ private void decorateChildren() { - for (org.eclipse.wb.gef.core.EditPart child : getHost().getChildren()) { + for (EditPart child : getHost().getChildren()) { decorateChild(child); } } diff --git a/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/gef/policy/layout/form/AnchorFiguresClassic.java b/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/gef/policy/layout/form/AnchorFiguresClassic.java index 0055bb31e..9f6fb9800 100644 --- a/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/gef/policy/layout/form/AnchorFiguresClassic.java +++ b/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/gef/policy/layout/form/AnchorFiguresClassic.java @@ -17,7 +17,6 @@ import org.eclipse.wb.core.gef.policy.layout.generic.AbstractPopupFigure; import org.eclipse.wb.draw2d.Figure; import org.eclipse.wb.draw2d.Layer; -import org.eclipse.wb.gef.core.EditPart; import org.eclipse.wb.gef.core.IEditPartViewer; import org.eclipse.wb.gef.graphical.policies.SelectionEditPolicy; import org.eclipse.wb.internal.core.gef.policy.snapping.PlacementUtils; @@ -28,6 +27,7 @@ import org.eclipse.draw2d.geometry.Dimension; import org.eclipse.draw2d.geometry.Point; import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.gef.EditPart; import org.eclipse.gef.editparts.LayerManager; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.resource.ImageDescriptor; @@ -70,7 +70,7 @@ public final void show() { m_alignmentFigures = new ArrayList<>(); // show alignment figures for all of the children of the host's parent { - Collection editParts = m_policy.getHost().getParent().getChildren(); + Collection editParts = m_policy.getHost().getParent().getChildren(); for (EditPart editPart : editParts) { showAlignmentFigures(editPart); } diff --git a/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/gef/policy/layout/grid/GridLayoutEditPolicy.java b/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/gef/policy/layout/grid/GridLayoutEditPolicy.java index eb4ba178b..b9960ee38 100644 --- a/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/gef/policy/layout/grid/GridLayoutEditPolicy.java +++ b/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/gef/policy/layout/grid/GridLayoutEditPolicy.java @@ -125,8 +125,8 @@ protected void decorateChild(EditPart child) { @Override public void refreshEditPolicy() { - List children = getHost().getChildren(); - for (org.eclipse.wb.gef.core.EditPart child : children) { + List children = getHost().getChildren(); + for (EditPart child : children) { Object model = child.getModel(); if (isControl(model)) { // not managed: never was or excluded diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/widgets/ViewFormGefTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/widgets/ViewFormGefTest.java index 2b61aff56..842163a2c 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/widgets/ViewFormGefTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/widgets/ViewFormGefTest.java @@ -12,11 +12,12 @@ *******************************************************************************/ package org.eclipse.wb.tests.designer.rcp.model.widgets; -import org.eclipse.wb.gef.core.EditPart; import org.eclipse.wb.internal.rcp.model.widgets.ViewFormInfo; import org.eclipse.wb.internal.swt.model.widgets.ControlInfo; import org.eclipse.wb.tests.designer.rcp.RcpGefTest; +import org.eclipse.gef.EditPart; + import org.junit.jupiter.api.Test; /** diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swt/model/menu/MenuComplexTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swt/model/menu/MenuComplexTest.java index 8aae56af1..e584bbe60 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swt/model/menu/MenuComplexTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swt/model/menu/MenuComplexTest.java @@ -13,7 +13,6 @@ package org.eclipse.wb.tests.designer.swt.model.menu; import org.eclipse.wb.core.model.JavaInfo; -import org.eclipse.wb.gef.core.EditPart; import org.eclipse.wb.gef.core.tools.CreationTool; import org.eclipse.wb.gef.core.tools.PasteTool; import org.eclipse.wb.gef.graphical.GraphicalEditPart; @@ -25,6 +24,7 @@ import org.eclipse.wb.tests.designer.rcp.RcpGefTest; import org.eclipse.draw2d.PositionConstants; +import org.eclipse.gef.EditPart; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swt/model/menu/MenuPopupSimpleTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swt/model/menu/MenuPopupSimpleTest.java index f813361d7..3c1b4dc4c 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swt/model/menu/MenuPopupSimpleTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/swt/model/menu/MenuPopupSimpleTest.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 @@ -13,7 +13,6 @@ package org.eclipse.wb.tests.designer.swt.model.menu; import org.eclipse.wb.core.model.JavaInfo; -import org.eclipse.wb.gef.core.EditPart; import org.eclipse.wb.gef.core.policies.EditPolicy; import org.eclipse.wb.gef.core.tools.CreationTool; import org.eclipse.wb.gef.core.tools.SelectEditPartTracker; @@ -29,6 +28,7 @@ import org.eclipse.draw2d.PositionConstants; import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.gef.EditPart; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; @@ -133,7 +133,7 @@ public void test_clickOnIconToOpen() throws Exception { // click on "popup": drop-down appears canvas.click(popupPart); { - List children = popupPart.getChildren(); + List children = popupPart.getChildren(); assertEquals(1, children.size()); EditPart dropPart = children.get(0); // drop-down has simple "drag tracker" @@ -184,7 +184,7 @@ public void test_selectPopupInTreeToOpen() throws Exception { tree.select(popupInfo); assertEquals(EditPart.SELECTED_PRIMARY, popupPart.getSelected()); { - List children = popupPart.getChildren(); + List children = popupPart.getChildren(); assertEquals(1, children.size()); assertInstanceOf(EditPart.class, children.get(0)); } @@ -207,7 +207,7 @@ public void test_selectPopupInTreeToOpen_deselectOnCanvas() throws Exception { tree.select(popupInfo); assertEquals(EditPart.SELECTED_PRIMARY, popupPart.getSelected()); { - List children = popupPart.getChildren(); + List children = popupPart.getChildren(); assertEquals(1, children.size()); assertInstanceOf(EditPart.class, children.get(0)); } diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/gef/EditPartTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/gef/EditPartTest.java index a53af7445..940535733 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/gef/EditPartTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/gef/EditPartTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2024 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 @@ -13,7 +13,6 @@ package org.eclipse.wb.tests.gef; import org.eclipse.wb.draw2d.Figure; -import org.eclipse.wb.gef.core.EditPart; import org.eclipse.wb.gef.core.IEditPartViewer; import org.eclipse.wb.gef.core.policies.EditPolicy; import org.eclipse.wb.gef.graphical.GraphicalEditPart; @@ -21,6 +20,7 @@ import org.eclipse.draw2d.EventListenerList; import org.eclipse.draw2d.IFigure; +import org.eclipse.gef.EditPart; import org.eclipse.gef.EditPartListener; import org.eclipse.gef.EditPartViewer; import org.eclipse.gef.Request; @@ -278,7 +278,7 @@ public Command getCommand(Request request) { } @Override - public EditPart getTargetEditPart(Request request) { + public org.eclipse.wb.gef.core.EditPart getTargetEditPart(Request request) { actualLogger.log(getHost(), "getTargetEditPart", request); return getHost(); } @@ -513,7 +513,7 @@ protected List getModelChildren() { parent.test_access_addChild(child2, -1); // // check add child1 and child2 - List children = parent.getChildren(); + List children = parent.getChildren(); assertNotNull(children); assertEquals(2, children.size()); assertSame(child1, children.get(0)); @@ -557,7 +557,7 @@ protected List getModelChildren() { }; parent.activate(); parent.refresh(); - List children = parent.getChildren(); + List children = parent.getChildren(); assertEquals(4, children.size()); assertEquals("_child2_Model", children.get(0).getModel()); assertEquals("_child5_Model", children.get(1).getModel()); @@ -604,7 +604,7 @@ protected List getModelChildren() { parent.test_access_addChild(child4, -1); // // check add child1 and child2 - List children = parent.getChildren(); + List children = parent.getChildren(); assertNotNull(children); assertEquals(3, children.size()); assertSame(child1, children.get(0));