Skip to content

Commit f2f82ef

Browse files
committed
[GEF] Switch to LayerConstants.PRIMARY_LAYER
This constant is identical to the one defined by the IEditPartViewer. No need to keep two fields that serve the same purpose.
1 parent 89c4f02 commit f2f82ef

File tree

5 files changed

+10
-14
lines changed

5 files changed

+10
-14
lines changed

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ public interface IEditPartViewer extends ISelectionProvider, org.eclipse.gef.Edi
3232
* The layer directly below {@link #PRIMARY_LAYER}.
3333
*/
3434
String PRIMARY_LAYER_SUB_1 = "Primary Layer Sub 1";
35-
/**
36-
* Identifies the layer containing the primary pieces of the application.
37-
*/
38-
String PRIMARY_LAYER = "Primary Layer";
3935
/**
4036
* The layer directly below {@link #HANDLE_LAYER}.
4137
*/

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public EditPart findObjectAtExcluding(Point location,
156156
final Conditional conditional) {
157157
EditPart editPart = findObjectAtExcluding(location, exclude, conditional, MENU_PRIMARY_LAYER);
158158
if (editPart == null) {
159-
editPart = findObjectAtExcluding(location, exclude, conditional, PRIMARY_LAYER);
159+
editPart = findObjectAtExcluding(location, exclude, conditional, LayerConstants.PRIMARY_LAYER);
160160
}
161161
return editPart;
162162
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public RootEditPart(IRootFigure rootFigure) {
5757
////////////////////////////////////////////////////////////////////////////
5858
private void createLayers() {
5959
m_rootFigure.addLayer(new Layer(IEditPartViewer.PRIMARY_LAYER_SUB_1));
60-
m_rootFigure.addLayer(new Layer(IEditPartViewer.PRIMARY_LAYER));
60+
m_rootFigure.addLayer(new Layer(LayerConstants.PRIMARY_LAYER));
6161
m_rootFigure.addLayer(new Layer(IEditPartViewer.HANDLE_LAYER_SUB_1));
6262
m_rootFigure.addLayer(new Layer(IEditPartViewer.HANDLE_LAYER_SUB_2));
6363
m_rootFigure.addLayer(new Layer(LayerConstants.HANDLE_LAYER));
@@ -106,7 +106,7 @@ public void setViewer(EditPartViewer viewer) {
106106
*/
107107
@Override
108108
public IFigure getContentPane() {
109-
return m_rootFigure.getLayer(IEditPartViewer.PRIMARY_LAYER);
109+
return m_rootFigure.getLayer(LayerConstants.PRIMARY_LAYER);
110110
}
111111

112112
/**

org.eclipse.wb.core/src/org/eclipse/wb/internal/core/gef/header/HeadersContainerEditPart.java

Lines changed: 3 additions & 3 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
@@ -16,7 +16,6 @@
1616
import org.eclipse.wb.core.gef.header.IHeadersProvider;
1717
import org.eclipse.wb.core.gef.policy.selection.EmptySelectionEditPolicy;
1818
import org.eclipse.wb.draw2d.Figure;
19-
import org.eclipse.wb.gef.core.IEditPartViewer;
2019
import org.eclipse.wb.gef.graphical.GraphicalEditPart;
2120
import org.eclipse.wb.internal.gef.graphical.GraphicalViewer;
2221

@@ -25,6 +24,7 @@
2524
import org.eclipse.draw2d.geometry.Rectangle;
2625
import org.eclipse.gef.EditPart;
2726
import org.eclipse.gef.EditPolicy;
27+
import org.eclipse.gef.LayerConstants;
2828
import org.eclipse.gef.Request;
2929
import org.eclipse.gef.RequestConstants;
3030
import org.eclipse.gef.editparts.LayerManager;
@@ -105,7 +105,7 @@ protected void refreshVisuals() {
105105
// prepare viewer size
106106
org.eclipse.swt.graphics.Point size = viewer.getControl().getSize();
107107
// prepare main viewer size
108-
Dimension mainSize = LayerManager.Helper.find(m_viewer).getLayer(IEditPartViewer.PRIMARY_LAYER).getSize();
108+
Dimension mainSize = LayerManager.Helper.find(m_viewer).getLayer(LayerConstants.PRIMARY_LAYER).getSize();
109109
// set bounds
110110
if (m_horizontal) {
111111
getFigure().setBounds(new Rectangle(0, 0, mainSize.width, size.y));

org.eclipse.wb.core/src/org/eclipse/wb/internal/core/gef/part/menu/MacMenuEditPart.java

Lines changed: 4 additions & 4 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
@@ -15,12 +15,12 @@
1515
import org.eclipse.wb.core.gef.part.menu.MenuEditPartFactory;
1616
import org.eclipse.wb.draw2d.Figure;
1717
import org.eclipse.wb.draw2d.FigureUtils;
18-
import org.eclipse.wb.gef.core.IEditPartViewer;
1918
import org.eclipse.wb.gef.graphical.GraphicalEditPart;
2019
import org.eclipse.wb.internal.core.model.menu.IMenuInfo;
2120

2221
import org.eclipse.draw2d.IFigure;
2322
import org.eclipse.draw2d.geometry.Rectangle;
23+
import org.eclipse.gef.LayerConstants;
2424
import org.eclipse.gef.editparts.LayerManager;
2525

2626
/**
@@ -67,7 +67,7 @@ protected void refreshVisuals() {
6767
@Override
6868
protected boolean addSelfVisual(int index) {
6969
if (!isSubMenu()) {
70-
LayerManager.Helper.find(getViewer()).getLayer(IEditPartViewer.PRIMARY_LAYER).add(getFigure());
70+
LayerManager.Helper.find(getViewer()).getLayer(LayerConstants.PRIMARY_LAYER).add(getFigure());
7171
m_addedSelf = true;
7272
// add invisible fake figure to the content pane to keep index right
7373
GraphicalEditPart parent = (GraphicalEditPart) getParent();
@@ -79,7 +79,7 @@ protected boolean addSelfVisual(int index) {
7979
@Override
8080
protected boolean removeSelfVisual() {
8181
if (m_addedSelf) {
82-
LayerManager.Helper.find(getViewer()).getLayer(IEditPartViewer.PRIMARY_LAYER).remove(getFigure());
82+
LayerManager.Helper.find(getViewer()).getLayer(LayerConstants.PRIMARY_LAYER).remove(getFigure());
8383
FigureUtils.removeFigure(getFakeFigure());
8484
m_addedSelf = false;
8585
return true;

0 commit comments

Comments
 (0)