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;
81 public static List<Action>
getActions(File file,
boolean isArtifactSource) {
82 List<Action> actionsList =
new ArrayList<>();
83 actionsList.add(
new ViewContextAction((isArtifactSource ? VIEW_SOURCE_FILE_IN_DIR : VIEW_FILE_IN_DIR), file));
85 actionsList.add(null);
87 final Collection<AbstractFile> selectedFilesList
88 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
89 if (selectedFilesList.size() == 1) {
94 actionsList.add(null);
97 actionsList.add(null);
99 if (isArtifactSource) {
102 if (selectedFilesList.size() == 1) {
105 if (isArtifactSource) {
106 final Collection<BlackboardArtifact> selectedArtifactsList
107 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class));
108 if (selectedArtifactsList.size() == 1) {
116 public static List<Action>
getActions(SlackFile slackFile,
boolean isArtifactSource) {
117 List<Action> actionsList =
new ArrayList<>();
118 actionsList.add(
new ViewContextAction((isArtifactSource ? VIEW_SOURCE_FILE_IN_DIR : VIEW_FILE_IN_DIR), slackFile));
120 actionsList.add(null);
122 actionsList.add(null);
125 actionsList.add(null);
127 if (isArtifactSource) {
130 final Collection<AbstractFile> selectedFilesList
131 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
132 if (selectedFilesList.size() == 1) {
135 if (isArtifactSource) {
136 final Collection<BlackboardArtifact> selectedArtifactsList
137 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class));
138 if (selectedArtifactsList.size() == 1) {
146 public static List<Action>
getActions(LayoutFile file,
boolean isArtifactSource) {
147 List<Action> actionsList =
new ArrayList<>();
148 actionsList.add(
new ViewContextAction((isArtifactSource ? VIEW_SOURCE_FILE_IN_DIR : VIEW_FILE_IN_DIR), file));
150 actionsList.add(null);
152 final Collection<AbstractFile> selectedFilesList
153 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
154 if (selectedFilesList.size() == 1) {
159 actionsList.add(null);
162 actionsList.add(null);
164 if (isArtifactSource) {
167 if (selectedFilesList.size() == 1) {
170 if (isArtifactSource) {
171 final Collection<BlackboardArtifact> selectedArtifactsList
172 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class));
173 if (selectedArtifactsList.size() == 1) {
181 public static List<Action>
getActions(Directory directory,
boolean isArtifactSource) {
182 List<Action> actionsList =
new ArrayList<>();
183 actionsList.add(
new ViewContextAction((isArtifactSource ? VIEW_SOURCE_FILE_IN_DIR : VIEW_FILE_IN_DIR), directory));
185 actionsList.add(null);
187 final Collection<AbstractFile> selectedFilesList
188 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
189 if (selectedFilesList.size() == 1) {
194 actionsList.add(null);
197 actionsList.add(null);
199 if (isArtifactSource) {
202 if (selectedFilesList.size() == 1) {
205 if (isArtifactSource) {
206 final Collection<BlackboardArtifact> selectedArtifactsList
207 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class));
208 if (selectedArtifactsList.size() == 1) {
216 public static List<Action>
getActions(VirtualDirectory directory,
boolean isArtifactSource) {
217 List<Action> actionsList =
new ArrayList<>();
218 actionsList.add(
new ViewContextAction((isArtifactSource ? VIEW_SOURCE_FILE_IN_DIR : VIEW_FILE_IN_DIR), directory));
220 actionsList.add(null);
222 final Collection<AbstractFile> selectedFilesList
223 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
224 if (selectedFilesList.size() == 1) {
229 actionsList.add(null);
232 actionsList.add(null);
234 if (isArtifactSource) {
237 if (selectedFilesList.size() == 1) {
240 if (isArtifactSource) {
241 final Collection<BlackboardArtifact> selectedArtifactsList
242 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class));
243 if (selectedArtifactsList.size() == 1) {
251 public static List<Action>
getActions(LocalDirectory directory,
boolean isArtifactSource) {
252 List<Action> actionsList =
new ArrayList<>();
253 actionsList.add(
new ViewContextAction((isArtifactSource ? VIEW_SOURCE_FILE_IN_DIR : VIEW_FILE_IN_DIR), directory));
255 actionsList.add(null);
257 final Collection<AbstractFile> selectedFilesList
258 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
259 if (selectedFilesList.size() == 1) {
264 actionsList.add(null);
267 actionsList.add(null);
269 if (isArtifactSource) {
272 if (selectedFilesList.size() == 1) {
275 if (isArtifactSource) {
276 final Collection<BlackboardArtifact> selectedArtifactsList
277 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class));
278 if (selectedArtifactsList.size() == 1) {
286 public static List<Action>
getActions(LocalFile file,
boolean isArtifactSource) {
287 List<Action> actionsList =
new ArrayList<>();
288 actionsList.add(
new ViewContextAction((isArtifactSource ? VIEW_SOURCE_FILE_IN_DIR : VIEW_FILE_IN_DIR), file));
290 actionsList.add(null);
292 final Collection<AbstractFile> selectedFilesList
293 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
294 if (selectedFilesList.size() == 1) {
299 actionsList.add(null);
302 actionsList.add(null);
304 if (isArtifactSource) {
307 if (selectedFilesList.size() == 1) {
310 if (isArtifactSource) {
311 final Collection<BlackboardArtifact> selectedArtifactsList
312 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class));
313 if (selectedArtifactsList.size() == 1) {
321 public static List<Action>
getActions(DerivedFile file,
boolean isArtifactSource) {
322 List<Action> actionsList =
new ArrayList<>();
323 actionsList.add(
new ViewContextAction((isArtifactSource ? VIEW_SOURCE_FILE_IN_DIR : VIEW_FILE_IN_DIR), file));
325 actionsList.add(null);
327 final Collection<AbstractFile> selectedFilesList
328 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
329 if (selectedFilesList.size() == 1) {
334 actionsList.add(null);
337 actionsList.add(null);
339 if (isArtifactSource) {
342 if (selectedFilesList.size() == 1) {
345 if (isArtifactSource) {
346 final Collection<BlackboardArtifact> selectedArtifactsList
347 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class));
348 if (selectedArtifactsList.size() == 1) {
356 public static List<Action>
getActions(Report report,
boolean isArtifactSource) {
357 List<Action> actionsList =
new ArrayList<>();
359 actionsList.add(null);
361 actionsList.add(null);
362 if (isArtifactSource) {
365 if (isArtifactSource) {
366 final Collection<BlackboardArtifact> selectedArtifactsList
367 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class));
368 if (selectedArtifactsList.size() == 1) {
376 public static List<Action>
getActions(ContentTag contentTag,
boolean isArtifactSource) {
377 List<Action> actionsList =
new ArrayList<>();
378 actionsList.add(
new ViewContextAction((isArtifactSource ? VIEW_SOURCE_FILE_IN_DIR : VIEW_FILE_IN_DIR), contentTag.getContent()));
379 final ContentTagNode tagNode =
new ContentTagNode(contentTag);
380 actionsList.add(null);
382 final Collection<AbstractFile> selectedFilesList
383 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
384 if (selectedFilesList.size() == 1) {
389 actionsList.add(null);
392 actionsList.add(null);
394 if (isArtifactSource) {
397 if (selectedFilesList.size() == 1) {
400 if (isArtifactSource) {
401 final Collection<BlackboardArtifact> selectedArtifactsList
402 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class));
403 if (selectedArtifactsList.size() == 1) {
413 public static List<Action>
getActions(BlackboardArtifactTag artifactTag,
boolean isArtifactSource) {
414 List<Action> actionsList =
new ArrayList<>();
415 actionsList.add(
new ViewContextAction((isArtifactSource ? VIEW_SOURCE_FILE_IN_DIR : VIEW_FILE_IN_DIR), artifactTag.getContent()));
417 actionsList.add(null);
419 final Collection<AbstractFile> selectedFilesList
420 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class));
421 if (selectedFilesList.size() == 1) {
426 actionsList.add(null);
429 actionsList.add(null);
431 if (isArtifactSource) {
434 if (selectedFilesList.size() == 1) {
437 if (isArtifactSource) {
438 final Collection<BlackboardArtifact> selectedArtifactsList
439 =
new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class));
440 if (selectedArtifactsList.size() == 1) {
450 public static List<Action>
getActions(Content content,
boolean isArtifactSource) {
451 if (content instanceof File) {
452 return getActions((File) content, isArtifactSource);
453 }
else if (content instanceof LayoutFile) {
454 return getActions((LayoutFile) content, isArtifactSource);
455 }
else if (content instanceof Directory) {
456 return getActions((Directory) content, isArtifactSource);
457 }
else if (content instanceof VirtualDirectory) {
458 return getActions((VirtualDirectory) content, isArtifactSource);
459 }
else if (content instanceof LocalFile) {
460 return getActions((LocalFile) content, isArtifactSource);
461 }
else if (content instanceof DerivedFile) {
462 return getActions((DerivedFile) content, isArtifactSource);
463 }
else if (content instanceof SlackFile) {
464 return getActions((SlackFile) content, isArtifactSource);
465 }
else if (content instanceof Report) {
466 return getActions((Report) content, isArtifactSource);
468 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(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)