Autopsy  4.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
DirectoryNode.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011 - 2013 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.datamodel;
20 
21 import java.util.ArrayList;
22 import java.util.List;
23 import javax.swing.Action;
24 import org.openide.util.NbBundle;
31 import org.sleuthkit.datamodel.AbstractFile;
32 import org.sleuthkit.datamodel.Directory;
33 import org.sleuthkit.datamodel.TskData.TSK_FS_NAME_FLAG_ENUM;
34 
39 public class DirectoryNode extends AbstractFsContentNode<AbstractFile> {
40 
41  public static final String DOTDOTDIR = NbBundle.getMessage(DirectoryNode.class, "DirectoryNode.parFolder.text");
42  public static final String DOTDIR = NbBundle.getMessage(DirectoryNode.class, "DirectoryNode.curFolder.text");
43 
44  public DirectoryNode(Directory dir) {
45  this(dir, true);
46 
47  setIcon(dir);
48  }
49 
50  public DirectoryNode(AbstractFile dir, boolean directoryBrowseMode) {
51  super(dir, directoryBrowseMode);
52 
53  setIcon(dir);
54  }
55 
56  private void setIcon(AbstractFile dir) {
57  // set name, display name, and icon
58  if (dir.isDirNameFlagSet(TSK_FS_NAME_FLAG_ENUM.UNALLOC)) {
59  this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/folder-icon-deleted.png"); //NON-NLS
60  } else {
61  this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/Folder-icon.png"); //NON-NLS
62  }
63  }
64 
72  @Override
73  public Action[] getActions(boolean popup) {
74  List<Action> actions = new ArrayList<>();
75  for (Action a : super.getActions(true)) {
76  actions.add(a);
77  }
78  if (!getDirectoryBrowseMode()) {
79  actions.add(new ViewContextAction(
80  NbBundle.getMessage(this.getClass(), "DirectoryNode.getActions.viewFileInDir.text"), this));
81  actions.add(null); // creates a menu separator
82  }
83  actions.add(new NewWindowViewAction(NbBundle.getMessage(this.getClass(), "DirectoryNode.viewInNewWin.text"), this));
84  actions.add(ViewFileInTimelineAction.createViewFileAction(getContent()));
85  actions.add(null); // creates a menu separator
86  actions.add(ExtractAction.getInstance());
87  actions.add(null); // creates a menu separator
88  actions.add(AddContentTagAction.getInstance());
89  actions.addAll(ContextMenuExtensionPoint.getActions());
90  return actions.toArray(new Action[actions.size()]);
91  }
92 
93  @Override
94  public <T> T accept(ContentNodeVisitor<T> v) {
95  return v.visit(this);
96  }
97 
98  @Override
99  public <T> T accept(DisplayableItemNodeVisitor<T> v) {
100  return v.visit(this);
101  }
102 
103  @Override
104  public boolean isLeafTypeNode() {
105  return false;
106  }
107 
108  /*
109  * TODO (AUT-1849): Correct or remove peristent column reordering code
110  *
111  * Added to support this feature.
112  */
113 // @Override
114 // public String getItemType() {
115 // return "Directory"; //NON-NLS
116 // }
117 }
DirectoryNode(AbstractFile dir, boolean directoryBrowseMode)
static synchronized ExtractAction getInstance()
static ViewFileInTimelineAction createViewFileAction(AbstractFile file)
static synchronized AddContentTagAction getInstance()

Copyright © 2012-2016 Basis Technology. Generated on: Tue Oct 25 2016
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.