From dfd710b04c7d7cdfab7747ba9a650b2cdc650092 Mon Sep 17 00:00:00 2001 From: Tuukka Lehtonen Date: Thu, 13 Dec 2018 13:43:37 +0200 Subject: [PATCH] Revert "Fixed GraphExplorerImpl to set selection upon keyboard-based selection" This reverts commit 75dc26dacf421e7027e959643963af1efdf10986. --- .../browsing/ui/swt/GraphExplorerImpl.java | 36 ++++--------------- 1 file changed, 7 insertions(+), 29 deletions(-) diff --git a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/GraphExplorerImpl.java b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/GraphExplorerImpl.java index df4860d42..0168ad864 100644 --- a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/GraphExplorerImpl.java +++ b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/GraphExplorerImpl.java @@ -1552,12 +1552,10 @@ class GraphExplorerImpl extends GraphExplorerImplBase implements Listener, Graph }); OpenStrategy os = new OpenStrategy(tree); - os.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> { - resetSelectionFromWidget(); - })); os.addPostSelectionListener(SelectionListener.widgetSelectedAdapter(e -> { //System.out.println("OPENSTRATEGY: post selection changed: " + e); - resetSelectionFromWidgetAndFirePostSelection(true); + resetSelection(); + selectionProvider.firePostSelection(selectionProvider.getSelection()); })); // This listener takes care of updating the set of currently selected @@ -1580,32 +1578,12 @@ class GraphExplorerImpl extends GraphExplorerImplBase implements Listener, Graph }); } - /** - * @return the new selection if it was different from the old selection in - * {@link #selectionProvider} - */ - private ISelection resetSelectionFromWidget() { - ISelection widgetSelection = getWidgetSelection(); + private void resetSelection() { + final ISelection selection = getWidgetSelection(); // System.out.println("resetSelection()"); // System.out.println(" provider selection: " + selectionProvider.getSelection()); -// System.out.println(" widget selection: " + widgetSelection); - boolean equals = selectionProvider.selectionEquals(widgetSelection); - selectionProvider.setSelectionWithoutFiring(widgetSelection); - return equals ? null : widgetSelection; - } - - /** - * @return the new selection if it was different from the old selection in - * {@link #selectionProvider} - */ - private boolean resetSelectionFromWidgetAndFirePostSelection(boolean force) { - ISelection s = resetSelectionFromWidget(); - boolean fire = s != null || force; - if (fire) { - //System.out.println("FIRING POST-SELECTION: " + selectionProvider.getSelection()); - selectionProvider.firePostSelection(selectionProvider.getSelection()); - } - return fire; +// System.out.println(" widget selection: " + selection); + selectionProvider.setAndFireNonEqualSelection(selection); } protected void setDefaultProcessors() { @@ -2322,7 +2300,7 @@ class GraphExplorerImpl extends GraphExplorerImplBase implements Listener, Graph // System.out.println("MODCOUNT: " + modCount + " vs. " + count); if (modCount != count) return; - resetSelectionFromWidgetAndFirePostSelection(false); + resetSelection(); } }); } -- 2.43.2