Merge pull request #4836 from esaunders/5120-view-file-in-dir

Use asynchronous node creation for directory tree to support view fil…
This commit is contained in:
Richard Cordovano 2019-06-11 16:29:16 -04:00 committed by GitHub
commit 1c4c3b2524
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 17 deletions

View File

@ -301,20 +301,7 @@ public class DataResultViewerTable extends AbstractDataResultViewer {
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
try {
/*
* If the given node is not null and has children, set it as the
* root context of the child OutlineView, otherwise make an
* "empty"node the root context.
*
* IMPORTANT NOTE: This is the first of many times where a
* getChildren call on the current root node causes all of the
* children of the root node to be created and defeats lazy child
* node creation, if it is enabled. It also likely leads to many
* case database round trips.
*/
if (rootNode != null && rootNode.getChildren().getNodesCount() > 0) {
this.rootNode = rootNode;
if (rootNode != null) {
/**
* Check to see if we have previously created a paging support
* class for this node.
@ -363,6 +350,21 @@ public class DataResultViewerTable extends AbstractDataResultViewer {
// No-op
}
});
}
/*
* If the given node is not null and has children, set it as the
* root context of the child OutlineView, otherwise make an
* "empty"node the root context.
*
* IMPORTANT NOTE: This is the first of many times where a
* getChildren call on the current root node causes all of the
* children of the root node to be created and defeats lazy child
* node creation, if it is enabled. It also likely leads to many
* case database round trips.
*/
if (rootNode != null && rootNode.getChildren().getNodesCount() > 0) {
this.rootNode = rootNode;
this.getExplorerManager().setRootContext(this.rootNode);
setupTable();

View File

@ -107,7 +107,7 @@ public abstract class AbstractContentNode<T extends Content> extends ContentNode
* @param lookup The Lookup object for the node.
*/
AbstractContentNode(T content, Lookup lookup) {
super(Children.create(new ContentChildren(content), true), lookup);
super(Children.create(new ContentChildren(content), false), lookup);
this.content = content;
//super.setName(ContentUtils.getSystemName(content));
super.setName("content_" + Long.toString(content.getId())); //NON-NLS

View File

@ -57,7 +57,7 @@ public class DataSourcesNode extends DisplayableItemNode {
}
public DataSourcesNode(long dsObjId) {
super(Children.create(new DataSourcesNodeChildren(dsObjId), true), Lookups.singleton(NAME));
super(Children.create(new DataSourcesNodeChildren(dsObjId), false), Lookups.singleton(NAME));
displayName = (dsObjId > 0) ? NbBundle.getMessage(DataSourcesNode.class, "DataSourcesNode.group_by_datasource.name") : NAME;
init();
}

View File

@ -25,6 +25,7 @@ import org.openide.nodes.Children;
import org.openide.nodes.Node;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.datamodel.accounts.Accounts;
import org.sleuthkit.datamodel.SleuthkitVisitableItem;
/**
* Children implementation for the root node of a ContentNode tree. Accepts a
@ -34,6 +35,7 @@ public class RootContentChildren extends Children.Keys<Object> {
private final Collection<? extends Object> contentKeys;
private final CreateAutopsyNodeVisitor createAutopsyNodeVisitor = new CreateAutopsyNodeVisitor();
private final CreateSleuthkitNodeVisitor createSleuthkitNodeVisitor = new CreateSleuthkitNodeVisitor();
/**
* @param contentKeys root Content objects for the Node tree
@ -68,7 +70,7 @@ public class RootContentChildren extends Children.Keys<Object> {
if (key instanceof AutopsyVisitableItem) {
return new Node[] {((AutopsyVisitableItem)key).accept(createAutopsyNodeVisitor)};
} else {
return null;
return new Node[] {((SleuthkitVisitableItem)key).accept(createSleuthkitNodeVisitor)};
}
}