From: Tuukka Lehtonen Date: Thu, 13 Dec 2018 11:45:53 +0000 (+0200) Subject: Revert "Fixed GraphExplorerImpl to set selection upon keyboard-based selection" X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=aa4590836792c68ad2df4708bcd4d344804938fd;p=simantics%2Fplatform.git Revert "Fixed GraphExplorerImpl to set selection upon keyboard-based selection" This reverts commit 75dc26dacf421e7027e959643963af1efdf10986. --- 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(); } }); }