Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 4 additions & 13 deletions org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/core/EditPart.java
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -41,15 +41,6 @@ public abstract class EditPart extends org.eclipse.gef.editparts.AbstractEditPar
// Parent/Children
//
////////////////////////////////////////////////////////////////////////////
/**
* Returns the List of children <code>EditParts</code>. 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<EditPart> getChildren() {
return (List<EditPart>) super.getChildren();
}
/**
* Returns the parent <code>{@link EditPart}</code>. This method should only be called internally
* or by helpers such as EditPolicies.
Expand Down Expand Up @@ -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<EditPart>) getChildren()) {
childPart.accept(visitor);
}
visitor.endVisit(this);
Expand Down Expand Up @@ -129,7 +120,7 @@ protected void refreshVisuals() {
protected void refreshChildren() {
// prepare map[model, currentPart]
Map<Object, EditPart> modelToPart = new HashMap<>();
List<EditPart> children = getChildren();
List<EditPart> children = (List<EditPart>) getChildren();
for (EditPart editPart : children) {
modelToPart.put(editPart.getModel(), editPart);
}
Expand Down Expand Up @@ -185,7 +176,7 @@ protected void refreshChildren() {
removeChild(childPart);
}
// recurse refresh()
for (EditPart child : getChildren()) {
for (EditPart child : (List<EditPart>) getChildren()) {
child.refresh();
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -45,7 +45,7 @@ public TreeItem getWidget() {
public void setWidget(TreeItem widget) {
m_widget = widget;
//
List<EditPart> children = getChildren();
List<? extends EditPart> children = getChildren();
if (m_widget == null) {
for (EditPart editPart : children) {
TreeEditPart treePart = (TreeEditPart) editPart;
Expand All @@ -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();
Expand All @@ -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));
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -158,7 +158,7 @@ public Command getCommand(Request request) {
return null;
}
// prepare children
List<org.eclipse.wb.gef.core.EditPart> children = getReferenceChildren(request);
List<EditPart> children = getReferenceChildren(request);
// calculate next reference
Object referenceObject = null;
if (targetItem == getHostWidget()) {
Expand Down Expand Up @@ -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<org.eclipse.wb.gef.core.EditPart> getReferenceChildren(Request request) {
List<org.eclipse.wb.gef.core.EditPart> allChildren = getHost().getChildren();
List<org.eclipse.wb.gef.core.EditPart> referenceChildren = new ArrayList<>();
private List<EditPart> getReferenceChildren(Request request) {
List<? extends EditPart> allChildren = getHost().getChildren();
List<EditPart> referenceChildren = new ArrayList<>();
//
for (org.eclipse.wb.gef.core.EditPart editPart : allChildren) {
for (EditPart editPart : allChildren) {
if (isGoodReferenceChild(request, editPart)) {
referenceChildren.add(editPart);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;

/**
Expand All @@ -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<ILayoutEditPolicyFactory> factories =
ExternalFactoriesHelper.getElementsInstances(
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -196,7 +196,7 @@ public final void showAlignmentFigures() {
m_alignmentFigures = new ArrayList<>();
// show cell figures for all children of host's parent
{
Collection<EditPart> editParts = getHost().getParent().getChildren();
Collection<? extends EditPart> editParts = getHost().getParent().getChildren();
for (EditPart editPart : editParts) {
showCellFigures(editPart);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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<EditPart> siblings = parentPart.getChildren();
List<? extends EditPart> siblings = parentPart.getChildren();
int index = siblings.indexOf(objectPart);
// move selection on sibling or parent item
if (siblings.size() == 1) {
Expand All @@ -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
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -241,7 +241,7 @@ public final void showAlignmentFigures() {
m_alignmentFigures = new ArrayList<>();
// show cell figures for all children of host's parent
{
Collection<EditPart> editParts = getHost().getParent().getChildren();
Collection<? extends EditPart> editParts = getHost().getParent().getChildren();
for (EditPart editPart : editParts) {
showAlignmentFigures(editPart);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;

Expand Down Expand Up @@ -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<Object> children = new ArrayList<>();
for (EditPart editPart : parentEditPart.getChildren()) {
Expand All @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -312,7 +312,7 @@ public final void showAlignmentFigures() {
m_alignmentFigures = new ArrayList<>();
// show cell figures for all children of host's parent
{
Collection<EditPart> editParts = getHost().getParent().getChildren();
Collection<? extends EditPart> editParts = getHost().getParent().getChildren();
for (EditPart editPart : editParts) {
showAlignmentFigures(editPart);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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}.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
Loading
Loading