mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 18:17:43 +00:00
Resolved the uniqueness problem and defaulted the group by data source option to be false instead of null
This commit is contained in:
parent
7db7f1c353
commit
b3450d09ea
@ -43,7 +43,7 @@ public final class CasePreferences {
|
|||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(CasePreferences.class.getName());
|
private static final Logger logger = Logger.getLogger(CasePreferences.class.getName());
|
||||||
|
|
||||||
private static Boolean groupItemsInTreeByDataSource = null;
|
private static Boolean groupItemsInTreeByDataSource = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prevent instantiation.
|
* Prevent instantiation.
|
||||||
@ -109,11 +109,11 @@ public final class CasePreferences {
|
|||||||
default:
|
default:
|
||||||
logger.log(Level.WARNING, String.format("Unexpected value '%s' for key '%s'. Using 'null' instead.",
|
logger.log(Level.WARNING, String.format("Unexpected value '%s' for key '%s'. Using 'null' instead.",
|
||||||
groupByDataSourceValue, KEY_GROUP_BY_DATA_SOURCE));
|
groupByDataSourceValue, KEY_GROUP_BY_DATA_SOURCE));
|
||||||
groupItemsInTreeByDataSource = null;
|
groupItemsInTreeByDataSource = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
groupItemsInTreeByDataSource = null;
|
groupItemsInTreeByDataSource = false;
|
||||||
}
|
}
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
logger.log(Level.SEVERE, "Error reading settings file", ex);
|
logger.log(Level.SEVERE, "Error reading settings file", ex);
|
||||||
|
@ -47,6 +47,7 @@ import javax.swing.tree.TreeSelectionModel;
|
|||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.openide.explorer.ExplorerManager;
|
import org.openide.explorer.ExplorerManager;
|
||||||
import org.openide.explorer.ExplorerUtils;
|
import org.openide.explorer.ExplorerUtils;
|
||||||
|
import org.openide.explorer.view.Visualizer;
|
||||||
import org.openide.nodes.AbstractNode;
|
import org.openide.nodes.AbstractNode;
|
||||||
import org.openide.nodes.Children;
|
import org.openide.nodes.Children;
|
||||||
import org.openide.nodes.Node;
|
import org.openide.nodes.Node;
|
||||||
@ -136,16 +137,9 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Node expandedNode = Visualizer.findNode(event.getPath().getLastPathComponent());
|
||||||
for(Node child : em.getRootContext().getChildren().getNodes()) {
|
for(Node child : em.getRootContext().getChildren().getNodes()) {
|
||||||
Object[] dataSourceNode = getPath(child);
|
if(child.equals(expandedNode)) {
|
||||||
|
|
||||||
if(dataSourceNode.length != event.getPath().getPathCount()) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//If the the user expanded one of the data sources node, then
|
|
||||||
//automatically expand the Views and Results for them.
|
|
||||||
if(isSameTreeNodePath(dataSourceNode, event.getPath().getPath())){
|
|
||||||
preExpandNodes(child.getChildren());
|
preExpandNodes(child.getChildren());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -190,49 +184,6 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test whether the two tree node paths are the same.
|
|
||||||
*
|
|
||||||
* @param first
|
|
||||||
* @param second
|
|
||||||
*
|
|
||||||
* @return boolean indicating equality of paths
|
|
||||||
*/
|
|
||||||
private boolean isSameTreeNodePath(Object[] first, Object[] second) {
|
|
||||||
if(first.length != second.length) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(int i = 0; i < first.length; i++) {
|
|
||||||
if(!first[i].toString().equals(second[i].toString())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Build the node's path in the Tree.
|
|
||||||
*
|
|
||||||
* @param node
|
|
||||||
* @return Path array where the first element is the root
|
|
||||||
* and the last is the node parameter.
|
|
||||||
*/
|
|
||||||
private Object[] getPath(Node node) {
|
|
||||||
List<Object> path = new ArrayList<>();
|
|
||||||
|
|
||||||
Node current = node;
|
|
||||||
path.add(node.getName());
|
|
||||||
while(current.getParentNode() != null) {
|
|
||||||
current = node.getParentNode();
|
|
||||||
path.add(current.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
Collections.reverse(path);
|
|
||||||
|
|
||||||
return path.toArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pre-expands the Views node, the Results node, and all of the children of
|
* Pre-expands the Views node, the Results node, and all of the children of
|
||||||
|
Loading…
x
Reference in New Issue
Block a user