19 package org.sleuthkit.autopsy.directorytree;
21 import org.openide.nodes.Node;
22 import org.openide.util.NbBundle;
25 @NbBundle.
Messages({
"SelectionContext.dataSources=Data Sources",
26 "SelectionContext.views=Views"})
27 enum SelectionContext {
28 DATA_SOURCES(SelectionContext_dataSources()),
29 VIEWS(SelectionContext_views()),
32 private final String displayName;
34 private SelectionContext(String displayName) {
35 this.displayName = displayName;
38 public static SelectionContext getContextFromName(String name) {
39 if (name.equals(DATA_SOURCES.getName())) {
41 }
else if (name.equals(VIEWS.getName())) {
48 private String getName() {
59 public static SelectionContext getSelectionContext(Node n) {
60 if (n == null || n.getParentNode() == null) {
62 return SelectionContext.OTHER;
63 }
else if (n.getParentNode().getParentNode() == null) {
65 return SelectionContext.getContextFromName(n.getDisplayName());
67 return getSelectionContext(n.getParentNode());