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.NbBundle.Messages;
29 import org.openide.util.Utilities;
84 public static List<Action>
getActions(File file,
boolean isArtifactSource) {
85 List<Action> actionsList =
new ArrayList<>();
86 actionsList.add(
new ViewContextAction((isArtifactSource ? VIEW_SOURCE_FILE_IN_DIR : VIEW_FILE_IN_DIR), file));
88 actionsList.add(null);
90 final Collection<AbstractFile> selectedFilesList
91 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
92 if (selectedFilesList.size() == 1) {
97 actionsList.add(null);
100 actionsList.add(null);
102 if (isArtifactSource) {
105 if (selectedFilesList.size() == 1) {
108 if (isArtifactSource) {
109 final Collection<BlackboardArtifact> selectedArtifactsList
110 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class));
111 if (selectedArtifactsList.size() == 1) {
119 public static List<Action>
getActions(SlackFile slackFile,
boolean isArtifactSource) {
120 List<Action> actionsList =
new ArrayList<>();
121 actionsList.add(
new ViewContextAction((isArtifactSource ? VIEW_SOURCE_FILE_IN_DIR : VIEW_FILE_IN_DIR), slackFile));
123 actionsList.add(null);
125 actionsList.add(null);
128 actionsList.add(null);
130 if (isArtifactSource) {
133 final Collection<AbstractFile> selectedFilesList
134 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
135 if (selectedFilesList.size() == 1) {
138 if (isArtifactSource) {
139 final Collection<BlackboardArtifact> selectedArtifactsList
140 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class));
141 if (selectedArtifactsList.size() == 1) {
149 public static List<Action>
getActions(LayoutFile file,
boolean isArtifactSource) {
150 List<Action> actionsList =
new ArrayList<>();
151 actionsList.add(
new ViewContextAction((isArtifactSource ? VIEW_SOURCE_FILE_IN_DIR : VIEW_FILE_IN_DIR), file));
153 actionsList.add(null);
155 final Collection<AbstractFile> selectedFilesList
156 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
157 if (selectedFilesList.size() == 1) {
162 actionsList.add(null);
165 actionsList.add(null);
167 if (isArtifactSource) {
170 if (selectedFilesList.size() == 1) {
173 if (isArtifactSource) {
174 final Collection<BlackboardArtifact> selectedArtifactsList
175 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class));
176 if (selectedArtifactsList.size() == 1) {
184 public static List<Action>
getActions(Directory directory,
boolean isArtifactSource) {
185 List<Action> actionsList =
new ArrayList<>();
186 actionsList.add(
new ViewContextAction((isArtifactSource ? VIEW_SOURCE_FILE_IN_DIR : VIEW_FILE_IN_DIR), directory));
188 actionsList.add(null);
190 final Collection<AbstractFile> selectedFilesList
191 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
192 if (selectedFilesList.size() == 1) {
197 actionsList.add(null);
200 actionsList.add(null);
202 if (isArtifactSource) {
205 if (selectedFilesList.size() == 1) {
208 if (isArtifactSource) {
209 final Collection<BlackboardArtifact> selectedArtifactsList
210 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class));
211 if (selectedArtifactsList.size() == 1) {
219 public static List<Action>
getActions(VirtualDirectory directory,
boolean isArtifactSource) {
220 List<Action> actionsList =
new ArrayList<>();
221 actionsList.add(
new ViewContextAction((isArtifactSource ? VIEW_SOURCE_FILE_IN_DIR : VIEW_FILE_IN_DIR), directory));
223 actionsList.add(null);
225 final Collection<AbstractFile> selectedFilesList
226 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
227 if (selectedFilesList.size() == 1) {
232 actionsList.add(null);
235 actionsList.add(null);
237 if (isArtifactSource) {
240 if (selectedFilesList.size() == 1) {
243 if (isArtifactSource) {
244 final Collection<BlackboardArtifact> selectedArtifactsList
245 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class));
246 if (selectedArtifactsList.size() == 1) {
254 public static List<Action>
getActions(LocalDirectory directory,
boolean isArtifactSource) {
255 List<Action> actionsList =
new ArrayList<>();
256 actionsList.add(
new ViewContextAction((isArtifactSource ? VIEW_SOURCE_FILE_IN_DIR : VIEW_FILE_IN_DIR), directory));
258 actionsList.add(null);
260 final Collection<AbstractFile> selectedFilesList
261 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
262 if (selectedFilesList.size() == 1) {
267 actionsList.add(null);
270 actionsList.add(null);
272 if (isArtifactSource) {
275 if (selectedFilesList.size() == 1) {
278 if (isArtifactSource) {
279 final Collection<BlackboardArtifact> selectedArtifactsList
280 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class));
281 if (selectedArtifactsList.size() == 1) {
289 public static List<Action>
getActions(LocalFile file,
boolean isArtifactSource) {
290 List<Action> actionsList =
new ArrayList<>();
291 actionsList.add(
new ViewContextAction((isArtifactSource ? VIEW_SOURCE_FILE_IN_DIR : VIEW_FILE_IN_DIR), file));
293 actionsList.add(null);
295 final Collection<AbstractFile> selectedFilesList
296 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
297 if (selectedFilesList.size() == 1) {
302 actionsList.add(null);
305 actionsList.add(null);
307 if (isArtifactSource) {
310 if (selectedFilesList.size() == 1) {
313 if (isArtifactSource) {
314 final Collection<BlackboardArtifact> selectedArtifactsList
315 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class));
316 if (selectedArtifactsList.size() == 1) {
324 public static List<Action>
getActions(DerivedFile file,
boolean isArtifactSource) {
325 List<Action> actionsList =
new ArrayList<>();
326 actionsList.add(
new ViewContextAction((isArtifactSource ? VIEW_SOURCE_FILE_IN_DIR : VIEW_FILE_IN_DIR), file));
328 actionsList.add(null);
330 final Collection<AbstractFile> selectedFilesList
331 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
332 if (selectedFilesList.size() == 1) {
337 actionsList.add(null);
340 actionsList.add(null);
342 if (isArtifactSource) {
345 if (selectedFilesList.size() == 1) {
348 if (isArtifactSource) {
349 final Collection<BlackboardArtifact> selectedArtifactsList
350 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class));
351 if (selectedArtifactsList.size() == 1) {
359 public static List<Action>
getActions(Report report,
boolean isArtifactSource) {
360 List<Action> actionsList =
new ArrayList<>();
362 actionsList.add(null);
364 actionsList.add(null);
365 if (isArtifactSource) {
368 if (isArtifactSource) {
369 final Collection<BlackboardArtifact> selectedArtifactsList
370 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class));
371 if (selectedArtifactsList.size() == 1) {
379 public static List<Action>
getActions(ContentTag contentTag,
boolean isArtifactSource) {
380 List<Action> actionsList =
new ArrayList<>();
381 actionsList.add(
new ViewContextAction((isArtifactSource ? VIEW_SOURCE_FILE_IN_DIR : VIEW_FILE_IN_DIR), contentTag.getContent()));
382 final ContentTagNode tagNode =
new ContentTagNode(contentTag);
383 actionsList.add(null);
385 final Collection<AbstractFile> selectedFilesList
386 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
387 if (selectedFilesList.size() == 1) {
392 actionsList.add(null);
395 actionsList.add(null);
397 if (isArtifactSource) {
400 if (selectedFilesList.size() == 1) {
403 if (isArtifactSource) {
404 final Collection<BlackboardArtifact> selectedArtifactsList
405 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class));
406 if (selectedArtifactsList.size() == 1) {
416 public static List<Action>
getActions(BlackboardArtifactTag artifactTag,
boolean isArtifactSource) {
417 List<Action> actionsList =
new ArrayList<>();
418 actionsList.add(
new ViewContextAction((isArtifactSource ? VIEW_SOURCE_FILE_IN_DIR : VIEW_FILE_IN_DIR), artifactTag.getContent()));
420 actionsList.add(null);
422 final Collection<AbstractFile> selectedFilesList
423 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
424 if (selectedFilesList.size() == 1) {
429 actionsList.add(null);
432 actionsList.add(null);
434 if (isArtifactSource) {
437 if (selectedFilesList.size() == 1) {
440 if (isArtifactSource) {
441 final Collection<BlackboardArtifact> selectedArtifactsList
442 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class));
443 if (selectedArtifactsList.size() == 1) {
454 List<Action> actionsList =
new ArrayList<>();
457 actionsList.add(null);
459 actionsList.add(null);
465 public static List<Action>
getActions(Content content,
boolean isArtifactSource) {
466 if (content instanceof File) {
467 return getActions((File) content, isArtifactSource);
468 }
else if (content instanceof LayoutFile) {
469 return getActions((LayoutFile) content, isArtifactSource);
470 }
else if (content instanceof Directory) {
471 return getActions((Directory) content, isArtifactSource);
472 }
else if (content instanceof VirtualDirectory) {
473 return getActions((VirtualDirectory) content, isArtifactSource);
474 }
else if (content instanceof LocalFile) {
475 return getActions((LocalFile) content, isArtifactSource);
476 }
else if (content instanceof DerivedFile) {
477 return getActions((DerivedFile) content, isArtifactSource);
478 }
else if (content instanceof SlackFile) {
479 return getActions((SlackFile) content, isArtifactSource);
480 }
else if (content instanceof Report) {
481 return getActions((Report) content, isArtifactSource);
482 }
else if (content instanceof OsAccount) {
483 return getActions((OsAccount) content, isArtifactSource);
485 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)