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
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 @@ -12,10 +12,7 @@
*******************************************************************************/
package org.eclipse.wb.gef.core;

import org.eclipse.wb.draw2d.Figure;
import org.eclipse.wb.draw2d.Layer;
import org.eclipse.wb.gef.graphical.handles.Handle;
import org.eclipse.wb.internal.draw2d.IRootFigure;
import org.eclipse.wb.internal.gef.core.EditDomain;

import org.eclipse.draw2d.geometry.Point;
Expand Down Expand Up @@ -112,16 +109,6 @@ public interface IEditPartViewer extends ISelectionProvider, org.eclipse.gef.Edi
*/
int getVOffset();

/**
* Returns root {@link Figure} use for access to {@link Layer}'s.
*/
IRootFigure getRootFigure();

/**
* Returns the layer identified by the <code>name</code> given in the input.
*/
Layer getLayer(String name);

/**
* Returns the {@link EditDomain EditDomain} to which this viewer belongs.
*/
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 All @@ -17,6 +17,7 @@
import org.eclipse.wb.gef.core.tools.DragEditPartTracker;
import org.eclipse.wb.gef.core.tools.Tool;

import org.eclipse.draw2d.IFigure;
import org.eclipse.gef.EditPartViewer;
import org.eclipse.gef.Request;

Expand Down Expand Up @@ -44,9 +45,9 @@ public Figure getFigure() {
}

/**
* The {@link Figure} into which childrens' {@link Figure}s will be added.
* The {@link IFigure} into which childrens' {@link IFigure}s will be added.
*/
public Figure getContentPane() {
public IFigure getContentPane() {
return getFigure();
}

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 @@ -20,6 +20,7 @@
import org.eclipse.wb.gef.graphical.GraphicalEditPart;

import org.eclipse.draw2d.IFigure;
import org.eclipse.gef.editparts.LayerManager;

/**
* @author lobas_av
Expand Down Expand Up @@ -70,7 +71,7 @@ protected final Layer getLayer(String name) {
name = IEditPartViewer.MENU_FEEDBACK_LAYER;
}
}
return getHost().getViewer().getLayer(name);
return (Layer) LayerManager.Helper.find(getHost()).getLayer(name);
}

/**
Expand Down Expand Up @@ -100,7 +101,7 @@ protected final void removeFeedback(Figure figure) {
* {@link IEditPartViewer#MENU_PRIMARY_LAYER}.
*/
private boolean isOnMenuLayer() {
Layer menuPrimaryLayer = getHost().getViewer().getLayer(IEditPartViewer.MENU_PRIMARY_LAYER);
Layer menuPrimaryLayer = (Layer) LayerManager.Helper.find(getHost()).getLayer(IEditPartViewer.MENU_PRIMARY_LAYER);
for (IFigure figure = getHostFigure(); figure != null; figure = figure.getParent()) {
if (figure == menuPrimaryLayer) {
return true;
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 @@ -21,10 +21,12 @@
import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.Cursors;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.Request;
import org.eclipse.gef.RequestConstants;
import org.eclipse.gef.editparts.LayerManager;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Cursor;
Expand Down Expand Up @@ -276,8 +278,8 @@ private void eraseMarqueeFeedback() {
/**
* Returns feedback layer.
*/
private Figure getFeedbackPane() {
return getCurrentViewer().getLayer(IEditPartViewer.FEEDBACK_LAYER);
private IFigure getFeedbackPane() {
return LayerManager.Helper.find(getCurrentViewer()).getLayer(IEditPartViewer.FEEDBACK_LAYER);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ public RootEditPart getRootEditPart() {
/**
* Returns root {@link Figure} use for access to {@link Layer}'s.
*/
@Override
public final IRootFigure getRootFigure() {
return getRootFigureInternal();
}
Expand All @@ -123,14 +122,6 @@ protected final RootFigure getRootFigureInternal() {
return m_canvas.getRootFigure();
}

/**
* Returns the layer identified by the <code>name</code> given in the input.
*/
@Override
public Layer getLayer(String name) {
return getRootFigure().getLayer(name);
}

/**
* Sets the <code>{@link EditDomain}</code> for this viewer. The Viewer will route all mouse and
* keyboard events to the {@link EditDomain}.
Expand Down Expand Up @@ -199,7 +190,7 @@ protected boolean acceptResult(Figure figure) {
return editPart != null && (conditional == null || conditional.evaluate(editPart));
}
};
getLayer(layer).accept(visitor, false);
((Layer) m_rootEditPart.getLayer(layer)).accept(visitor, false);
return visitor.getTargetEditPart();
}

Expand Down Expand Up @@ -240,7 +231,7 @@ public Handle findTargetHandle(int x, int y) {
*/
private Handle findTargetHandle(String layer, int x, int y) {
TargetFigureFindVisitor visitor = new TargetFigureFindVisitor(m_canvas, x, y);
getLayer(layer).accept(visitor, false);
((Layer) m_rootEditPart.getLayer(layer)).accept(visitor, false);
Figure targetFigure = visitor.getTargetFigure();
return targetFigure instanceof Handle ? (Handle) targetFigure : null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@
*******************************************************************************/
package org.eclipse.wb.internal.gef.tree;

import org.eclipse.wb.draw2d.Layer;
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.draw2d.IRootFigure;
import org.eclipse.wb.internal.gef.core.AbstractEditPartViewer;
import org.eclipse.wb.internal.gef.core.EditDomain;

Expand Down Expand Up @@ -113,16 +111,6 @@ public RootEditPart getRootEditPart() {
return m_rootEditPart;
}

@Override
public IRootFigure getRootFigure() {
return null;
}

@Override
public Layer getLayer(String name) {
return null;
}

/**
* Sets the <code>{@link EditDomain}</code> for this viewer. The Viewer will route all mouse and
* keyboard events to the {@link EditDomain}.
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 @@ -18,6 +18,7 @@

import org.eclipse.gef.Request;
import org.eclipse.gef.RequestConstants;
import org.eclipse.gef.editparts.LayerManager;

/**
* Abstract implementation of {@link LayoutEditPolicy} for headers. It provides additional utilities
Expand Down Expand Up @@ -57,7 +58,7 @@ protected boolean isRequestCondition(Request request) {
* @return the {@link Layer} from main {@link IEditPartViewer} with given id.
*/
protected final Layer getMainLayer(String layerId) {
return getMainViewer().getLayer(layerId);
return (Layer) LayerManager.Helper.find(getMainViewer()).getLayer(layerId);
}

/**
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 @@ -17,6 +17,8 @@
import org.eclipse.wb.gef.graphical.policies.LayoutEditPolicy;
import org.eclipse.wb.gef.graphical.policies.SelectionEditPolicy;

import org.eclipse.gef.editparts.LayerManager;

/**
* Abstract implementation of {@link SelectionEditPolicy} for headers. It provides additional
* utilities for interacting with main {@link LayoutEditPolicy} and main {@link IEditPartViewer}.
Expand Down Expand Up @@ -45,7 +47,7 @@ public AbstractHeaderSelectionEditPolicy(LayoutEditPolicy mainPolicy) {
* @return the {@link Layer} from main {@link IEditPartViewer} with given id.
*/
protected final Layer getMainLayer(String layerId) {
return getMainViewer().getLayer(layerId);
return (Layer) LayerManager.Helper.find(getMainViewer()).getLayer(layerId);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.draw2d.geometry.Translatable;
import org.eclipse.gef.editparts.LayerManager;

import java.lang.reflect.Method;
import java.util.Objects;
Expand Down Expand Up @@ -66,7 +67,7 @@ public static void showBorderTargetFeedback(final GraphicalEditPolicy policy) {
* Shows border around given {@link GraphicalEditPart} figure.
*/
public static void showBorderTargetFeedback(GraphicalEditPart part) {
Layer feedbackLayer = part.getViewer().getLayer(IEditPartViewer.FEEDBACK_LAYER);
Layer feedbackLayer = (Layer) LayerManager.Helper.find(part.getViewer()).getLayer(IEditPartViewer.FEEDBACK_LAYER);
showBorderTargetFeedback(feedbackLayer, part);
}

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 Down Expand Up @@ -36,6 +36,7 @@
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.draw2d.geometry.Translatable;
import org.eclipse.gef.editparts.LayerManager;
import org.eclipse.swt.graphics.Color;

import java.lang.reflect.Field;
Expand Down Expand Up @@ -247,7 +248,7 @@ public final void showGridFeedback() {
prepareHostClientArea();
translateModelToFeedback(hostClientArea);
m_gridFigure.setBounds(hostClientArea);
getHost().getViewer().getLayer(IEditPartViewer.HANDLE_LAYER_SUB_2).add(m_gridFigure);
LayerManager.Helper.find(getHost()).getLayer(IEditPartViewer.HANDLE_LAYER_SUB_2).add(m_gridFigure);
}

/**
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 @@ -26,6 +26,7 @@
import org.eclipse.gef.EditPolicy;
import org.eclipse.gef.Request;
import org.eclipse.gef.RequestConstants;
import org.eclipse.gef.editparts.LayerManager;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
Expand Down Expand Up @@ -103,7 +104,7 @@ protected void refreshVisuals() {
// prepare viewer size
org.eclipse.swt.graphics.Point size = viewer.getControl().getSize();
// prepare main viewer size
Dimension mainSize = m_viewer.getLayer(IEditPartViewer.PRIMARY_LAYER).getSize();
Dimension mainSize = LayerManager.Helper.find(m_viewer).getLayer(IEditPartViewer.PRIMARY_LAYER).getSize();
// set bounds
if (m_horizontal) {
getFigure().setBounds(new Rectangle(0, 0, mainSize.width, size.y));
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 @@ -20,6 +20,7 @@
import org.eclipse.wb.internal.core.model.menu.IMenuInfo;

import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gef.editparts.LayerManager;

/**
* {@link MenuEditPart} for MacOSX which does special handling for OSX menu bar.
Expand Down Expand Up @@ -65,7 +66,7 @@ protected void refreshVisuals() {
@Override
protected boolean addSelfVisual(int index) {
if (!isSubMenu()) {
getViewer().getLayer(IEditPartViewer.PRIMARY_LAYER).add(getFigure());
LayerManager.Helper.find(getViewer()).getLayer(IEditPartViewer.PRIMARY_LAYER).add(getFigure());
m_addedSelf = true;
// add invisible fake figure to the content pane to keep index right
GraphicalEditPart parent = (GraphicalEditPart) getParent();
Expand All @@ -77,7 +78,7 @@ protected boolean addSelfVisual(int index) {
@Override
protected boolean removeSelfVisual() {
if (m_addedSelf) {
getViewer().getLayer(IEditPartViewer.PRIMARY_LAYER).remove(getFigure());
LayerManager.Helper.find(getViewer()).getLayer(IEditPartViewer.PRIMARY_LAYER).remove(getFigure());
FigureUtils.removeFigure(getFakeFigure());
m_addedSelf = false;
return true;
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 @@ -21,9 +21,11 @@
import org.eclipse.wb.internal.core.model.menu.IMenuObjectInfo;
import org.eclipse.wb.internal.core.model.menu.MenuObjectInfoUtils;

import org.eclipse.draw2d.IFigure;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPartViewer;
import org.eclipse.gef.EditPolicy;
import org.eclipse.gef.editparts.LayerManager;

import java.util.Collections;
import java.util.List;
Expand Down Expand Up @@ -54,8 +56,8 @@ public SubmenuAwareEditPart(Object toolkitModel, IMenuObjectInfo menuModel) {
//
/////////////////////////////////////////////////////////////////////
@Override
public final Figure getContentPane() {
return getViewer().getLayer(IEditPartViewer.MENU_PRIMARY_LAYER);
public final IFigure getContentPane() {
return LayerManager.Helper.find(getViewer()).getLayer(IEditPartViewer.MENU_PRIMARY_LAYER);
}

@Override
Expand Down
Loading
Loading