Skip to content

Commit ac29528

Browse files
authored
Merge pull request #7325 from gdicristofaro/8074-adhocIssues
8074 improve context menu for ad hoc search
2 parents c49f039 + 22ca11b commit ac29528

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/AdHocSearchFilterNode.java

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@
5252

5353
/**
5454
* FilterNode containing properties and actions for keyword search.
55-
*
55+
*
5656
* Wraps the generic KeyValue node and customizes the property sheet and lookup
5757
*/
5858
class AdHocSearchFilterNode extends FilterNode {
5959

6060
/**
6161
* Instantiate a KeywordSearchFilterNode.
62-
*
63-
* @param original The original source node.
62+
*
63+
* @param original The original source node.
6464
*/
6565
AdHocSearchFilterNode(Node original) {
6666
super(original, null, new ProxyLookup(original.getLookup()));
@@ -160,10 +160,20 @@ public List<Action> visit(VirtualDirectory dir) {
160160

161161
private List<Action> getFileActions() {
162162
List<Action> actionsList = new ArrayList<>();
163+
164+
boolean hasAbstractFile = getOriginal().getLookup().lookup(AbstractFile.class) != null;
165+
163166
actionsList.add(new NewWindowViewAction(NbBundle.getMessage(this.getClass(), "KeywordSearchFilterNode.getFileActions.viewInNewWinActionLbl"), AdHocSearchFilterNode.this));
164-
actionsList.add(new ExternalViewerAction(NbBundle.getMessage(this.getClass(), "KeywordSearchFilterNode.getFileActions.openExternViewActLbl"), getOriginal()));
167+
168+
if (hasAbstractFile) {
169+
actionsList.add(new ExternalViewerAction(NbBundle.getMessage(this.getClass(), "KeywordSearchFilterNode.getFileActions.openExternViewActLbl"), getOriginal()));
170+
}
171+
165172
actionsList.add(null);
166-
actionsList.add(ExtractAction.getInstance());
173+
if (hasAbstractFile) {
174+
actionsList.add(ExtractAction.getInstance());
175+
}
176+
167177
actionsList.add(ExportCSVAction.getInstance());
168178
actionsList.add(null); // creates a menu separator
169179
actionsList.add(AddContentTagAction.getInstance());

0 commit comments

Comments
 (0)