From c5f02213ca1d3264ba14c7aa75673b85dafccf7f Mon Sep 17 00:00:00 2001 From: schweinfurthl Date: Wed, 5 Nov 2025 15:41:10 -0500 Subject: [PATCH] fixing small history select bug when selecting multiple setups --- .../FilteredAndGroupedExplorerPanel.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/FilteredAndGroupedExplorerPanel.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/FilteredAndGroupedExplorerPanel.java index 291c1b297..109c3cfd6 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/FilteredAndGroupedExplorerPanel.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/FilteredAndGroupedExplorerPanel.java @@ -84,6 +84,7 @@ public abstract class FilteredAndGroupedExplorerPanel< AS extends SpimData2 > private static final List>> selectionHistory = new ArrayList<>(); private static int historyIndex = -1; private static boolean navigatingHistory = false; + private static boolean bulkSelecting = false; static { @@ -291,6 +292,11 @@ protected ListSelectionListener getSelectionListener() @Override public void valueChanged(final ListSelectionEvent arg0) { + // Skip intermediate selection changes while user is still adjusting + // (e.g., shift-clicking multiple rows). Only process when finalized. + if ( arg0.getValueIsAdjusting() ) + return; + BDVPopup b = bdvPopup(); selectedRows.clear(); @@ -695,8 +701,14 @@ protected void openSelectionDialog() final List> selectedViews = dialog.getSelectedViews(); if ( selectedViews != null && !selectedViews.isEmpty() ) { - // Select the views in the table + // Select the views in the table (disable history saving during bulk selection) + bulkSelecting = true; selectViews( selectedViews ); + bulkSelecting = false; + + // Save the final selection to history once + saveSelectionToHistory(); + IOFunctions.println( "Selected " + selectedViews.size() + " views based on criteria." ); } } @@ -724,7 +736,7 @@ protected void selectViews( final List> views ) protected void saveSelectionToHistory() { - if ( navigatingHistory ) + if ( navigatingHistory || bulkSelecting ) return; // Get current selection