From a740c63c6ab39731c881a6fbf7d0e51868f161e3 Mon Sep 17 00:00:00 2001 From: John Bogovic Date: Fri, 13 Dec 2024 13:14:47 -0500 Subject: [PATCH] fix: still attempt to list in DatasetSelectorDialog * important for incremental filling of the hierarchy tree --- .../n5/ui/DatasetSelectorDialog.java | 47 +++++++++++++++---- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/janelia/saalfeldlab/n5/ui/DatasetSelectorDialog.java b/src/main/java/org/janelia/saalfeldlab/n5/ui/DatasetSelectorDialog.java index cbe81b4..e55ac1f 100644 --- a/src/main/java/org/janelia/saalfeldlab/n5/ui/DatasetSelectorDialog.java +++ b/src/main/java/org/janelia/saalfeldlab/n5/ui/DatasetSelectorDialog.java @@ -744,7 +744,7 @@ private void openContainer(final Function n5Fun, final Supplie parseExec = Executors.newSingleThreadExecutor(); parseExec.submit(() -> { try { - try { + String[] datasetPaths; if (ijProgressBar != null) ijProgressBar.show(0.3); @@ -754,14 +754,43 @@ private void openContainer(final Function n5Fun, final Supplie messageLabel.repaint(); }); + datasetDiscoverer.discoverShallow(tmpRootNode, callback); + callback.accept(tmpRootNode); + sortRecursive(rootNode); + + if (ijProgressBar != null) + ijProgressBar.show(0.4); + + SwingUtilities.invokeLater(() -> { + messageLabel.setText("Listing..."); + messageLabel.repaint(); + }); + + try { + // build a temporary tree + datasetPaths = n5.deepList(rootPath, loaderExecutor); + N5SwingTreeNode.fromFlatList(tmpRootNode, datasetPaths, "/"); + for (final String p : datasetPaths) + rootNode.addPath(rootPath + "/" + p); + } catch(ExecutionException ignore){ } + + sortRecursive(rootNode); + containerTree.expandRow(0); + + if (ijProgressBar != null) + ijProgressBar.show(0.6); + + SwingUtilities.invokeLater(() -> { + messageLabel.setText("Parsing deep..."); + messageLabel.repaint(); + }); + // callback copies values from temporary tree into the ui // when metadata is parsed - try { - datasetDiscoverer.discoverAndParseRecursive(tmpRootNode, callback); - } catch (IOException e) { } + datasetDiscoverer.parseMetadataRecursive(tmpRootNode, callback, true); if (ijProgressBar != null) - ijProgressBar.show(0.8); + ijProgressBar.show(0.9); SwingUtilities.invokeLater(() -> { messageLabel.setText("Done"); @@ -777,11 +806,9 @@ private void openContainer(final Function n5Fun, final Supplie messageLabel.setVisible(false); messageLabel.repaint(); }); - } catch (final InterruptedException e) { - // can ignore - } - } catch (final N5Exception e) { - e.printStackTrace(); + + } catch (final InterruptedException e) { + // can ignore } });