From 95c60a8fc300fe5e8e0a61a10464eda3c2645eba Mon Sep 17 00:00:00 2001 From: Alois Zoitl Date: Sun, 29 Sep 2024 20:55:36 +0200 Subject: [PATCH] Added type information to getVisualPartMap #155 https://github.com/eclipse/gef-classic/issues/155 --- org.eclipse.gef/src/org/eclipse/gef/EditPartViewer.java | 2 +- .../src/org/eclipse/gef/ui/parts/AbstractEditPartViewer.java | 5 ++--- .../src/org/eclipse/gef/ui/parts/GraphicalViewerImpl.java | 5 +++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/org.eclipse.gef/src/org/eclipse/gef/EditPartViewer.java b/org.eclipse.gef/src/org/eclipse/gef/EditPartViewer.java index d70966d32..0b8ac412e 100644 --- a/org.eclipse.gef/src/org/eclipse/gef/EditPartViewer.java +++ b/org.eclipse.gef/src/org/eclipse/gef/EditPartViewer.java @@ -413,7 +413,7 @@ interface Conditional { * * @return the visual part map */ - Map getVisualPartMap(); + Map getVisualPartMap(); /** * Used for accessibility purposes. diff --git a/org.eclipse.gef/src/org/eclipse/gef/ui/parts/AbstractEditPartViewer.java b/org.eclipse.gef/src/org/eclipse/gef/ui/parts/AbstractEditPartViewer.java index e056be416..324ff193a 100644 --- a/org.eclipse.gef/src/org/eclipse/gef/ui/parts/AbstractEditPartViewer.java +++ b/org.eclipse.gef/src/org/eclipse/gef/ui/parts/AbstractEditPartViewer.java @@ -51,7 +51,6 @@ import org.eclipse.gef.EditPart; import org.eclipse.gef.EditPartFactory; import org.eclipse.gef.EditPartViewer; -import org.eclipse.gef.GraphicalEditPart; import org.eclipse.gef.KeyHandler; import org.eclipse.gef.RootEditPart; import org.eclipse.gef.SelectionManager; @@ -98,7 +97,7 @@ public abstract class AbstractEditPartViewer implements EditPartViewer { private EditPartFactory factory; private final Map mapIDToEditPart = new HashMap<>(); - private final Map mapVisualToEditPart = new HashMap<>(); + private final Map mapVisualToEditPart = new HashMap<>(); private Map properties; private Control control; private ResourceManager resources; @@ -456,7 +455,7 @@ public SelectionManager getSelectionManager() { * @see EditPartViewer#getVisualPartMap() */ @Override - public Map getVisualPartMap() { + public Map getVisualPartMap() { return mapVisualToEditPart; } diff --git a/org.eclipse.gef/src/org/eclipse/gef/ui/parts/GraphicalViewerImpl.java b/org.eclipse.gef/src/org/eclipse/gef/ui/parts/GraphicalViewerImpl.java index cdc7416e8..21cd29192 100644 --- a/org.eclipse.gef/src/org/eclipse/gef/ui/parts/GraphicalViewerImpl.java +++ b/org.eclipse.gef/src/org/eclipse/gef/ui/parts/GraphicalViewerImpl.java @@ -97,6 +97,7 @@ protected void createDefaultRoot() { * * @return the lightweight system */ + @SuppressWarnings("static-method") protected LightweightSystem createLightweightSystem() { return new LightweightSystem(); } @@ -170,7 +171,7 @@ class ConditionalTreeSearch extends ExclusionSearch { public boolean accept(IFigure figure) { EditPart editpart = null; while (editpart == null && figure != null) { - editpart = (EditPart) getVisualPartMap().get(figure); + editpart = getVisualPartMap().get(figure); figure = figure.getParent(); } return editpart != null && (condition == null || condition.evaluate(editpart)); @@ -180,7 +181,7 @@ public boolean accept(IFigure figure) { new ConditionalTreeSearch(exclude)); EditPart part = null; while (part == null && figure != null) { - part = (EditPart) getVisualPartMap().get(figure); + part = getVisualPartMap().get(figure); figure = figure.getParent(); } if (part == null) {