From 7a5d76949c1be0fea9f5bfe889a43acb275fb8dd Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Mon, 17 Feb 2020 14:08:21 +0100 Subject: [PATCH] klighd: some pre-release polishing --- .../src/de/cau/cs/kieler/klighd/IStyleModifier.java | 1 - .../cs/kieler/klighd/actions/ClipSelectionAction.java | 4 +--- .../de/cau/cs/kieler/klighd/viewers/ContextViewer.java | 9 +++++---- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/plugins/de.cau.cs.kieler.klighd/src/de/cau/cs/kieler/klighd/IStyleModifier.java b/plugins/de.cau.cs.kieler.klighd/src/de/cau/cs/kieler/klighd/IStyleModifier.java index 47f981c87..c35d18ad9 100644 --- a/plugins/de.cau.cs.kieler.klighd/src/de/cau/cs/kieler/klighd/IStyleModifier.java +++ b/plugins/de.cau.cs.kieler.klighd/src/de/cau/cs/kieler/klighd/IStyleModifier.java @@ -14,7 +14,6 @@ package de.cau.cs.kieler.klighd; import de.cau.cs.kieler.klighd.kgraph.KGraphElement; -import de.cau.cs.kieler.klighd.kgraph.KLayoutData; import de.cau.cs.kieler.klighd.krendering.KStyle; /** diff --git a/plugins/de.cau.cs.kieler.klighd/src/de/cau/cs/kieler/klighd/actions/ClipSelectionAction.java b/plugins/de.cau.cs.kieler.klighd/src/de/cau/cs/kieler/klighd/actions/ClipSelectionAction.java index f20eca07c..2221a60e0 100644 --- a/plugins/de.cau.cs.kieler.klighd/src/de/cau/cs/kieler/klighd/actions/ClipSelectionAction.java +++ b/plugins/de.cau.cs.kieler.klighd/src/de/cau/cs/kieler/klighd/actions/ClipSelectionAction.java @@ -13,8 +13,6 @@ */ package de.cau.cs.kieler.klighd.actions; -import org.eclipse.emf.ecore.EObject; - import com.google.common.collect.Iterables; import de.cau.cs.kieler.klighd.IAction; @@ -42,7 +40,7 @@ public class ClipSelectionAction implements IAction { * {@inheritDoc} */ public ActionResult execute(final ActionContext context) { - final Iterable selection = context.getContextViewer().getDiagramSelection(); + final Iterable selection = context.getContextViewer().getDiagramSelection(); final IViewer contextViewer = context.getContextViewer(); final Object first = Iterables.getFirst(selection, null); diff --git a/plugins/de.cau.cs.kieler.klighd/src/de/cau/cs/kieler/klighd/viewers/ContextViewer.java b/plugins/de.cau.cs.kieler.klighd/src/de/cau/cs/kieler/klighd/viewers/ContextViewer.java index 05a098793..bf1cf7aed 100644 --- a/plugins/de.cau.cs.kieler.klighd/src/de/cau/cs/kieler/klighd/viewers/ContextViewer.java +++ b/plugins/de.cau.cs.kieler.klighd/src/de/cau/cs/kieler/klighd/viewers/ContextViewer.java @@ -832,8 +832,9 @@ public void toggleSelectionOfSemanticElements(final Set semanticElements */ public void toggleSelectionOfDiagramElements(final Set toBeToggled) { final KlighdTreeSelection diagSelection = this.getDiagramSelection(); - final List theSelection = newArrayList(diagSelection != null - ? diagSelection : KlighdTreeSelection.EMPTY); + final List theSelection = newArrayList( + filter(diagSelection != null ? diagSelection : KlighdTreeSelection.EMPTY, EObject.class) + ); for (final EObject diagramElement : Sets.filter(toBeToggled, isSelectable())) { final boolean removed = theSelection.remove(diagramElement); @@ -913,7 +914,7 @@ private void updateSelection(final Iterable diagramElements) final KlighdTreeSelection diagSelection = getDiagramSelection(); final List currentlySelected = diagSelection != null - ? newArrayList(diagSelection) : Collections.emptyList(); + ? newArrayList(filter(diagSelection, EObject.class)) : Collections.emptyList(); final List toBeSelected = newArrayList(filter(diagramElements, Predicates.notNull())); for (final KRendering r : concat(transform(filter(currentlySelected, notIn(toBeSelected)), @@ -997,7 +998,7 @@ void notifySelectionListeners(final IKlighdSelection theSelection) { * Resets the highlighting of the currently selected diagram elements. */ private void resetSelectionHighlighting() { - final Iterable currentSelection = getDiagramSelection(); + final Iterable currentSelection = filter(getDiagramSelection(), EObject.class); if (currentSelection != null) { for (final KRendering r : concat(transform(currentSelection, AS_RENDERING))) { r.setProperty(KlighdInternalProperties.SELECTED, false);