mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 18:17:43 +00:00
Merge pull request #4850 from eugene7646/text_tab_5085
Disabled 'Text' content viewer tab for directories and empty files
This commit is contained in:
commit
67619f44f3
@ -23,6 +23,7 @@ import org.openide.nodes.Node;
|
|||||||
import org.openide.util.NbBundle.Messages;
|
import org.openide.util.NbBundle.Messages;
|
||||||
import org.openide.util.lookup.ServiceProvider;
|
import org.openide.util.lookup.ServiceProvider;
|
||||||
import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer;
|
import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer;
|
||||||
|
import org.sleuthkit.datamodel.AbstractFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A DataContentViewer that displays text with the TextViewers available.
|
* A DataContentViewer that displays text with the TextViewers available.
|
||||||
@ -90,6 +91,17 @@ public class TextContentViewer implements DataContentViewer {
|
|||||||
if (node == null) {
|
if (node == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// get the node's File, if it has one
|
||||||
|
AbstractFile file = node.getLookup().lookup(AbstractFile.class);
|
||||||
|
if (file == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// disable the text content viewer for directories and empty files
|
||||||
|
if (file.isDir() || file.getSize() == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return panel.isSupported(node);
|
return panel.isSupported(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ public class TextContentViewerPanel extends javax.swing.JPanel implements DataCo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deterime wether the content viewer which displays this panel isSupported.
|
* Determine whether the content viewer which displays this panel isSupported.
|
||||||
* This panel is supported if any of the TextViewer's displayed in it are
|
* This panel is supported if any of the TextViewer's displayed in it are
|
||||||
* supported.
|
* supported.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user