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.dataSourceFiles=Data Source Files",
 
   27     "SelectionContext.views=Views"})
 
   28 enum SelectionContext {
 
   29     DATA_SOURCES(SelectionContext_dataSources()),
 
   30     VIEWS(SelectionContext_views()),
 
   32     DATA_SOURCE_FILES(SelectionContext_dataSourceFiles()); 
 
   34     private final String displayName;
 
   36   private  SelectionContext(String displayName) {
 
   37         this.displayName = displayName;
 
   40     public static SelectionContext getContextFromName(String name) {
 
   41         if (name.equals(DATA_SOURCES.getName()) || name.equals(DATA_SOURCE_FILES.getName())) {
 
   43         } 
else if (name.equals(VIEWS.getName())) {
 
   50     private String getName() {
 
   61     public static SelectionContext getSelectionContext(Node n) {
 
   62         if (n == null || n.getParentNode() == null) {
 
   64             return SelectionContext.OTHER;
 
   65         } 
else if (n.getParentNode().getParentNode() == null) {
 
   67             return SelectionContext.getContextFromName(n.getDisplayName());
 
   72             if (n.getParentNode().getParentNode().getParentNode() == null) {
 
   73                 SelectionContext context = SelectionContext.getContextFromName(n.getDisplayName());
 
   74                 if (context != SelectionContext.OTHER) {
 
   79             return getSelectionContext(n.getParentNode());