19 package org.sleuthkit.autopsy.datamodel;
21 import java.util.ArrayList;
22 import java.util.Collection;
23 import java.util.HashSet;
24 import java.util.List;
25 import javax.swing.Action;
27 import org.openide.util.NbBundle;
28 import org.openide.util.Utilities;
83 public static List<Action>
getActions(File file,
boolean isArtifactSource) {
84 List<Action> actionsList =
new ArrayList<>();
85 actionsList.add(
new ViewContextAction((isArtifactSource ? VIEW_SOURCE_FILE_IN_DIR : VIEW_FILE_IN_DIR), file));
87 actionsList.add(null);
89 final Collection<AbstractFile> selectedFilesList
90 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
91 if (selectedFilesList.size() == 1) {
96 actionsList.add(null);
99 actionsList.add(null);
101 if (isArtifactSource) {
104 if (selectedFilesList.size() == 1) {
107 if (isArtifactSource) {
108 final Collection<BlackboardArtifact> selectedArtifactsList
109 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class));
110 if (selectedArtifactsList.size() == 1) {
118 public static List<Action>
getActions(SlackFile slackFile,
boolean isArtifactSource) {
119 List<Action> actionsList =
new ArrayList<>();
120 actionsList.add(
new ViewContextAction((isArtifactSource ? VIEW_SOURCE_FILE_IN_DIR : VIEW_FILE_IN_DIR), slackFile));
122 actionsList.add(null);
124 actionsList.add(null);
127 actionsList.add(null);
129 if (isArtifactSource) {
132 final Collection<AbstractFile> selectedFilesList
133 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
134 if (selectedFilesList.size() == 1) {
137 if (isArtifactSource) {
138 final Collection<BlackboardArtifact> selectedArtifactsList
139 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class));
140 if (selectedArtifactsList.size() == 1) {
148 public static List<Action>
getActions(LayoutFile file,
boolean isArtifactSource) {
149 List<Action> actionsList =
new ArrayList<>();
150 actionsList.add(
new ViewContextAction((isArtifactSource ? VIEW_SOURCE_FILE_IN_DIR : VIEW_FILE_IN_DIR), file));
152 actionsList.add(null);
154 final Collection<AbstractFile> selectedFilesList
155 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
156 if (selectedFilesList.size() == 1) {
161 actionsList.add(null);
164 actionsList.add(null);
166 if (isArtifactSource) {
169 if (selectedFilesList.size() == 1) {
172 if (isArtifactSource) {
173 final Collection<BlackboardArtifact> selectedArtifactsList
174 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class));
175 if (selectedArtifactsList.size() == 1) {
183 public static List<Action>
getActions(Directory directory,
boolean isArtifactSource) {
184 List<Action> actionsList =
new ArrayList<>();
185 actionsList.add(
new ViewContextAction((isArtifactSource ? VIEW_SOURCE_FILE_IN_DIR : VIEW_FILE_IN_DIR), directory));
187 actionsList.add(null);
189 final Collection<AbstractFile> selectedFilesList
190 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
191 if (selectedFilesList.size() == 1) {
196 actionsList.add(null);
199 actionsList.add(null);
201 if (isArtifactSource) {
204 if (selectedFilesList.size() == 1) {
207 if (isArtifactSource) {
208 final Collection<BlackboardArtifact> selectedArtifactsList
209 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class));
210 if (selectedArtifactsList.size() == 1) {
218 public static List<Action>
getActions(VirtualDirectory directory,
boolean isArtifactSource) {
219 List<Action> actionsList =
new ArrayList<>();
220 actionsList.add(
new ViewContextAction((isArtifactSource ? VIEW_SOURCE_FILE_IN_DIR : VIEW_FILE_IN_DIR), directory));
222 actionsList.add(null);
224 final Collection<AbstractFile> selectedFilesList
225 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
226 if (selectedFilesList.size() == 1) {
231 actionsList.add(null);
234 actionsList.add(null);
236 if (isArtifactSource) {
239 if (selectedFilesList.size() == 1) {
242 if (isArtifactSource) {
243 final Collection<BlackboardArtifact> selectedArtifactsList
244 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class));
245 if (selectedArtifactsList.size() == 1) {
253 public static List<Action>
getActions(LocalDirectory directory,
boolean isArtifactSource) {
254 List<Action> actionsList =
new ArrayList<>();
255 actionsList.add(
new ViewContextAction((isArtifactSource ? VIEW_SOURCE_FILE_IN_DIR : VIEW_FILE_IN_DIR), directory));
257 actionsList.add(null);
259 final Collection<AbstractFile> selectedFilesList
260 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
261 if (selectedFilesList.size() == 1) {
266 actionsList.add(null);
269 actionsList.add(null);
271 if (isArtifactSource) {
274 if (selectedFilesList.size() == 1) {
277 if (isArtifactSource) {
278 final Collection<BlackboardArtifact> selectedArtifactsList
279 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class));
280 if (selectedArtifactsList.size() == 1) {
288 public static List<Action>
getActions(LocalFile file,
boolean isArtifactSource) {
289 List<Action> actionsList =
new ArrayList<>();
290 actionsList.add(
new ViewContextAction((isArtifactSource ? VIEW_SOURCE_FILE_IN_DIR : VIEW_FILE_IN_DIR), file));
292 actionsList.add(null);
294 final Collection<AbstractFile> selectedFilesList
295 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
296 if (selectedFilesList.size() == 1) {
301 actionsList.add(null);
304 actionsList.add(null);
306 if (isArtifactSource) {
309 if (selectedFilesList.size() == 1) {
312 if (isArtifactSource) {
313 final Collection<BlackboardArtifact> selectedArtifactsList
314 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class));
315 if (selectedArtifactsList.size() == 1) {
323 public static List<Action>
getActions(DerivedFile file,
boolean isArtifactSource) {
324 List<Action> actionsList =
new ArrayList<>();
325 actionsList.add(
new ViewContextAction((isArtifactSource ? VIEW_SOURCE_FILE_IN_DIR : VIEW_FILE_IN_DIR), file));
327 actionsList.add(null);
329 final Collection<AbstractFile> selectedFilesList
330 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
331 if (selectedFilesList.size() == 1) {
336 actionsList.add(null);
339 actionsList.add(null);
341 if (isArtifactSource) {
344 if (selectedFilesList.size() == 1) {
347 if (isArtifactSource) {
348 final Collection<BlackboardArtifact> selectedArtifactsList
349 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class));
350 if (selectedArtifactsList.size() == 1) {
358 public static List<Action>
getActions(Report report,
boolean isArtifactSource) {
359 List<Action> actionsList =
new ArrayList<>();
361 actionsList.add(null);
363 actionsList.add(null);
364 if (isArtifactSource) {
367 if (isArtifactSource) {
368 final Collection<BlackboardArtifact> selectedArtifactsList
369 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class));
370 if (selectedArtifactsList.size() == 1) {
378 public static List<Action>
getActions(ContentTag contentTag,
boolean isArtifactSource) {
379 List<Action> actionsList =
new ArrayList<>();
380 actionsList.add(
new ViewContextAction((isArtifactSource ? VIEW_SOURCE_FILE_IN_DIR : VIEW_FILE_IN_DIR), contentTag.getContent()));
381 final ContentTagNode tagNode =
new ContentTagNode(contentTag);
382 actionsList.add(null);
384 final Collection<AbstractFile> selectedFilesList
385 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
386 if (selectedFilesList.size() == 1) {
391 actionsList.add(null);
394 actionsList.add(null);
396 if (isArtifactSource) {
399 if (selectedFilesList.size() == 1) {
402 if (isArtifactSource) {
403 final Collection<BlackboardArtifact> selectedArtifactsList
404 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class));
405 if (selectedArtifactsList.size() == 1) {
415 public static List<Action>
getActions(BlackboardArtifactTag artifactTag,
boolean isArtifactSource) {
416 List<Action> actionsList =
new ArrayList<>();
417 actionsList.add(
new ViewContextAction((isArtifactSource ? VIEW_SOURCE_FILE_IN_DIR : VIEW_FILE_IN_DIR), artifactTag.getContent()));
419 actionsList.add(null);
421 final Collection<AbstractFile> selectedFilesList
422 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
423 if (selectedFilesList.size() == 1) {
428 actionsList.add(null);
431 actionsList.add(null);
433 if (isArtifactSource) {
436 if (selectedFilesList.size() == 1) {
439 if (isArtifactSource) {
440 final Collection<BlackboardArtifact> selectedArtifactsList
441 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class));
442 if (selectedArtifactsList.size() == 1) {
453 List<Action> actionsList =
new ArrayList<>();
456 actionsList.add(null);
458 actionsList.add(null);
464 public static List<Action>
getActions(Content content,
boolean isArtifactSource) {
465 if (content instanceof File) {
466 return getActions((File) content, isArtifactSource);
467 }
else if (content instanceof LayoutFile) {
468 return getActions((LayoutFile) content, isArtifactSource);
469 }
else if (content instanceof Directory) {
470 return getActions((Directory) content, isArtifactSource);
471 }
else if (content instanceof VirtualDirectory) {
472 return getActions((VirtualDirectory) content, isArtifactSource);
473 }
else if (content instanceof LocalFile) {
474 return getActions((LocalFile) content, isArtifactSource);
475 }
else if (content instanceof DerivedFile) {
476 return getActions((DerivedFile) content, isArtifactSource);
477 }
else if (content instanceof SlackFile) {
478 return getActions((SlackFile) content, isArtifactSource);
479 }
else if (content instanceof Report) {
480 return getActions((Report) content, isArtifactSource);
481 }
else if (content instanceof OsAccount) {
482 return getActions((OsAccount) content, isArtifactSource);
484 return new ArrayList<>();
static synchronized DeleteContentTagAction getInstance()
static final String OPEN_IN_EXTERNAL_VIEWER
static List< Action > getActions(LayoutFile file, boolean isArtifactSource)
static final String VIEW_FILE_IN_DIR
static List< Action > getActions(File file, boolean isArtifactSource)
static synchronized AddBlackboardArtifactTagAction getInstance()
static synchronized DeleteFileBlackboardArtifactTagAction getInstance()
static List< Action > getActions(Report report, boolean isArtifactSource)
static synchronized DeleteBlackboardArtifactTagAction getInstance()
static List< Action > getActions(Content content, boolean isArtifactSource)
static synchronized ReplaceContentTagAction getInstance()
static final String VIEW_IN_NEW_WINDOW
static synchronized ExportCSVAction getInstance()
static synchronized DeleteFileContentTagAction getInstance()
static List< Action > getActions(BlackboardArtifactTag artifactTag, boolean isArtifactSource)
static synchronized ReplaceBlackboardArtifactTagAction getInstance()
static List< Action > getActions(ContentTag contentTag, boolean isArtifactSource)
static List< Action > getActions(LocalFile file, boolean isArtifactSource)
static final String VIEW_SOURCE_FILE_IN_DIR
static List< Action > getActions(OsAccount osAccount)
static List< Action > getActions(SlackFile slackFile, boolean isArtifactSource)
static synchronized ExternalViewerShortcutAction getInstance()
static List< Action > getActions(DerivedFile file, boolean isArtifactSource)
static List< Action > getActions(Directory directory, boolean isArtifactSource)
static List< Action > getActions(LocalDirectory directory, boolean isArtifactSource)
static synchronized AddContentTagAction getInstance()
static List< Action > getActions(VirtualDirectory directory, boolean isArtifactSource)