Skip to content

Commit

Permalink
fix: still attempt to list in DatasetSelectorDialog
Browse files Browse the repository at this point in the history
* important for incremental filling of the hierarchy tree
  • Loading branch information
bogovicj committed Dec 13, 2024
1 parent 745fe01 commit a740c63
Showing 1 changed file with 37 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ private void openContainer(final Function<String, N5Reader> n5Fun, final Supplie
parseExec = Executors.newSingleThreadExecutor();
parseExec.submit(() -> {
try {
try {
String[] datasetPaths;

if (ijProgressBar != null)
ijProgressBar.show(0.3);
Expand All @@ -754,14 +754,43 @@ private void openContainer(final Function<String, N5Reader> 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");
Expand All @@ -777,11 +806,9 @@ private void openContainer(final Function<String, N5Reader> 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
}
});

Expand Down

0 comments on commit a740c63

Please sign in to comment.