Skip to content

Commit

Permalink
klighd: some pre-release polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
sailingKieler committed Feb 17, 2020
1 parent 72c8380 commit 7a5d769
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -42,7 +40,7 @@ public class ClipSelectionAction implements IAction {
* {@inheritDoc}
*/
public ActionResult execute(final ActionContext context) {
final Iterable<EObject> selection = context.getContextViewer().getDiagramSelection();
final Iterable<?> selection = context.getContextViewer().getDiagramSelection();
final IViewer contextViewer = context.getContextViewer();

final Object first = Iterables.getFirst(selection, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -832,8 +832,9 @@ public void toggleSelectionOfSemanticElements(final Set<Object> semanticElements
*/
public void toggleSelectionOfDiagramElements(final Set<? extends EObject> toBeToggled) {
final KlighdTreeSelection diagSelection = this.getDiagramSelection();
final List<EObject> theSelection = newArrayList(diagSelection != null
? diagSelection : KlighdTreeSelection.EMPTY);
final List<EObject> theSelection = newArrayList(
filter(diagSelection != null ? diagSelection : KlighdTreeSelection.EMPTY, EObject.class)
);

for (final EObject diagramElement : Sets.filter(toBeToggled, isSelectable())) {
final boolean removed = theSelection.remove(diagramElement);
Expand Down Expand Up @@ -913,7 +914,7 @@ private void updateSelection(final Iterable<? extends EObject> diagramElements)
final KlighdTreeSelection diagSelection = getDiagramSelection();

final List<EObject> currentlySelected = diagSelection != null
? newArrayList(diagSelection) : Collections.<EObject>emptyList();
? newArrayList(filter(diagSelection, EObject.class)) : Collections.<EObject>emptyList();
final List<EObject> toBeSelected = newArrayList(filter(diagramElements, Predicates.notNull()));

for (final KRendering r : concat(transform(filter(currentlySelected, notIn(toBeSelected)),
Expand Down Expand Up @@ -997,7 +998,7 @@ void notifySelectionListeners(final IKlighdSelection theSelection) {
* Resets the highlighting of the currently selected diagram elements.
*/
private void resetSelectionHighlighting() {
final Iterable<EObject> currentSelection = getDiagramSelection();
final Iterable<EObject> currentSelection = filter(getDiagramSelection(), EObject.class);
if (currentSelection != null) {
for (final KRendering r : concat(transform(currentSelection, AS_RENDERING))) {
r.setProperty(KlighdInternalProperties.SELECTED, false);
Expand Down

0 comments on commit 7a5d769

Please sign in to comment.