@@ -739,7 +739,10 @@ protected void done() {
739739 swcTypeMenu .addSeparator ();
740740 swcTypeMenu .add (jmi );
741741 if (applyPromptOptions && pathAndFillManager .size () > 0 && guiUtils
742- .getConfirmation ("Apply new color options to all paths?" , "Apply Colors" ))
742+ .getConfirmation (plugin .isTreeIsolationActive ()
743+ ? "Apply new color options to all paths, including structures currently hidden by "
744+ + "the isolation filter?"
745+ : "Apply new color options to all paths?" , "Apply Colors" ))
743746 {
744747 final List <Path > allPaths = pathAndFillManager .getPathsFiltered ();
745748 if (assignColors ) {
@@ -4390,8 +4393,15 @@ private class DeleteCommand implements PathCommand {
43904393 @ Override
43914394 public void execute (List <Path > selectedPaths , String cmd ) {
43924395 boolean assumeAll = tree .getSelectionCount () == 0 || tree .getSelectionCount () == tree .getNumberOfNodes ();
4393- String message = assumeAll ? "Are you really sure you want to delete all paths?"
4394- : "Delete the selected " + selectedPaths .size () + " path(s)?" ;
4396+ String message ;
4397+ if (!assumeAll ) {
4398+ message = "Delete the selected " + selectedPaths .size () + " path(s)?" ;
4399+ } else if (plugin .isTreeIsolationActive ()) {
4400+ message = "Delete all " + selectedPaths .size () + " listed path(s)? (Structures currently "
4401+ + "hidden will <i>not</i> be affected.)" ;
4402+ } else {
4403+ message = "Are you really sure you want to delete all paths?" ;
4404+ }
43954405 if (guiUtils .getConfirmation (message , "Confirm Deletion?" )) {
43964406 deletePaths (selectedPaths );
43974407 }
@@ -6289,6 +6299,7 @@ void restoreFullModelState() {
62896299 arborChoice = null ;
62906300 tree .setModel (fullTreeModel );
62916301 hideOthersButton .setSelected (false );
6302+ plugin .clearIsolatedTreeID (); // undo any active canvas/Bdv/Bvv isolation from applyHideOthers(true)
62926303 // Re-enable sorting now that the full (multi-arbor) model is restored:
62936304 // applyHideOthers(true) disables it while a single arbor is isolated, and
62946305 // this path (e.g. the "show all structures" button) must undo that.
@@ -6383,7 +6394,11 @@ private void expandAndRevealTree(final String label) {
63836394 }
63846395 }
63856396
6386- /** Show only the chosen arbor or restore the full list. */
6397+ /**
6398+ * Show only the chosen arbor (in both the JTree and every tracing viewer - classic canvas,
6399+ * legacy 3D viewer, and Bdv/Bvv, via {@link SNT#setIsolatedTreeID(int)}) or restore the full
6400+ * list/display.
6401+ */
63876402 private void applyHideOthers (final boolean hide ) {
63886403 if (fullTreeModel == null || arborChoice == null ) return ;
63896404
@@ -6394,10 +6409,17 @@ private void applyHideOthers(final boolean hide) {
63946409 final Path [] primaryPaths = pathAndFillManager .getPathsStructured ();
63956410 tree .setModel (new HelpfulTreeModel (primaryPaths , arborChoice ));
63966411 sortArborsButton .setEnabled (false );
6412+ // Mirror the JTree's own filtering in the tracing viewers: getTree(String) returns
6413+ // null if arborChoice no longer matches any tree (e.g. deleted between UI updates),
6414+ // in which case clearing isolation is the safer fallback over isolating a stale ID
6415+ final Tree isolatedTree = pathAndFillManager .getTree (arborChoice );
6416+ plugin .setIsolatedTreeID ((isolatedTree != null ) ? isolatedTree .getTreeID () : -1 );
6417+ if (isolatedTree != null ) zoomToBoundingBox (isolatedTree .list ()); // zoom to selected choice
63976418 } else {
63986419 hideOthersButton .setSelected (false ); // ensure sync
63996420 tree .setModel (fullTreeModel ); // will call reload
64006421 sortArborsButton .setEnabled (true );
6422+ plugin .clearIsolatedTreeID ();
64016423 }
64026424 GuiUtils .JTrees .expandAllNodes (tree );
64036425 // 3) Restore selection if that exists in the new model
0 commit comments