mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
Merge branch 'new-features-20120503' of https://github.com/sleuthkit/autopsy into new-features-20120503
This commit is contained in:
commit
f29b106967
@ -74,8 +74,11 @@ public interface DataContentViewer {
|
|||||||
* @param node Node to check for preference
|
* @param node Node to check for preference
|
||||||
* @param isSupported, true if the viewer is supported by the node
|
* @param isSupported, true if the viewer is supported by the node
|
||||||
* as determined by a previous check
|
* as determined by a previous check
|
||||||
* @return True if viewer preferred, else false
|
* @return an int (0-10) higher return means the viewer has higher priority
|
||||||
|
* 0 means not supported
|
||||||
|
* 1/2 means will display all supported
|
||||||
|
* 3-10 are prioritized by Content viewer developer
|
||||||
*/
|
*/
|
||||||
public boolean isPreferred(Node node, boolean isSupported);
|
public int isPreferred(Node node, boolean isSupported);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ public final class DataContentTopComponent extends TopComponent implements DataC
|
|||||||
return this.wrapped.isSupported(node);
|
return this.wrapped.isSupported(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isPreferred(Node node, boolean isSupported) {
|
int isPreferred(Node node, boolean isSupported) {
|
||||||
return this.wrapped.isPreferred(node, isSupported);
|
return this.wrapped.isPreferred(node, isSupported);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -293,17 +293,10 @@ public final class DataContentTopComponent extends TopComponent implements DataC
|
|||||||
|
|
||||||
int totalTabs = dataContentTabbedPane.getTabCount();
|
int totalTabs = dataContentTabbedPane.getTabCount();
|
||||||
|
|
||||||
List<DataContentViewer> dcvs = new ArrayList<DataContentViewer>();
|
int maxPreferred = 0;
|
||||||
dcvs.addAll(Lookup.getDefault().lookupAll(DataContentViewer.class));
|
int indexOfPreferred = 0;
|
||||||
for (int i = 0; i<dcvs.size(); i++){
|
|
||||||
DataContentViewer dcv = dcvs.get(i);
|
|
||||||
if(dcv.getTitle().equals("String View") && dataContentTabbedPane.getTabCount() > i){
|
|
||||||
dataContentTabbedPane.setSelectedIndex(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (totalTabs > 0) { // make sure there are tabs to reset
|
if (totalTabs > 0) { // make sure there are tabs to reset
|
||||||
int tempIndex = dataContentTabbedPane.getSelectedIndex();
|
|
||||||
for (int i = 0; i < totalTabs; i++) {
|
for (int i = 0; i < totalTabs; i++) {
|
||||||
UpdateWrapper dcv = viewers.get(i);
|
UpdateWrapper dcv = viewers.get(i);
|
||||||
dcv.resetComponent();
|
dcv.resetComponent();
|
||||||
@ -312,25 +305,19 @@ public final class DataContentTopComponent extends TopComponent implements DataC
|
|||||||
boolean dcvSupported = dcv.isSupported(selectedNode);
|
boolean dcvSupported = dcv.isSupported(selectedNode);
|
||||||
if (! dcvSupported) {
|
if (! dcvSupported) {
|
||||||
dataContentTabbedPane.setEnabledAt(i, false);
|
dataContentTabbedPane.setEnabledAt(i, false);
|
||||||
|
|
||||||
// change the tab selection if it's the current selection
|
|
||||||
if (tempIndex == i) {
|
|
||||||
if (i > 0) {
|
|
||||||
dataContentTabbedPane.setSelectedIndex(0);
|
|
||||||
} else {
|
|
||||||
dataContentTabbedPane.setSelectedIndex(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
dataContentTabbedPane.setEnabledAt(i, true);
|
dataContentTabbedPane.setEnabledAt(i, true);
|
||||||
if (dcv.isPreferred(selectedNode, dcvSupported))
|
int currentPreferred = dcv.isPreferred(selectedNode, dcvSupported);
|
||||||
dataContentTabbedPane.setSelectedIndex(i);
|
if (currentPreferred > maxPreferred) {
|
||||||
|
indexOfPreferred = i;
|
||||||
|
maxPreferred = currentPreferred;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int newIndex = dataContentTabbedPane.getSelectedIndex();
|
|
||||||
// set the display of the tab
|
// set the display of the tab
|
||||||
viewers.get(newIndex).setNode(selectedNode);
|
dataContentTabbedPane.setSelectedIndex(indexOfPreferred);
|
||||||
|
viewers.get(indexOfPreferred).setNode(selectedNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ import org.sleuthkit.datamodel.TskException;
|
|||||||
/**
|
/**
|
||||||
* Viewer displays Artifacts associated with Contents
|
* Viewer displays Artifacts associated with Contents
|
||||||
*/
|
*/
|
||||||
@ServiceProvider(service = DataContentViewer.class)
|
@ServiceProvider(service = DataContentViewer.class, position=3)
|
||||||
public class DataContentViewerArtifact extends javax.swing.JPanel implements DataContentViewer{
|
public class DataContentViewerArtifact extends javax.swing.JPanel implements DataContentViewer{
|
||||||
|
|
||||||
private static int currentPage = 1;
|
private static int currentPage = 1;
|
||||||
@ -314,12 +314,17 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPreferred(Node node, boolean isSupported) {
|
public int isPreferred(Node node, boolean isSupported) {
|
||||||
BlackboardArtifact art = node.getLookup().lookup(BlackboardArtifact.class);
|
BlackboardArtifact art = node.getLookup().lookup(BlackboardArtifact.class);
|
||||||
if(art != null && art.getArtifactTypeID() != BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID())
|
if(isSupported) {
|
||||||
return true;
|
if(art == null) {
|
||||||
else
|
return 3;
|
||||||
return false;
|
} else {
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void customizeComponents(){
|
private void customizeComponents(){
|
||||||
|
@ -39,7 +39,7 @@ import org.sleuthkit.datamodel.TskException;
|
|||||||
/**
|
/**
|
||||||
* Hex view of file contents.
|
* Hex view of file contents.
|
||||||
*/
|
*/
|
||||||
@ServiceProvider(service = DataContentViewer.class)
|
@ServiceProvider(service = DataContentViewer.class, position=1)
|
||||||
public class DataContentViewerHex extends javax.swing.JPanel implements DataContentViewer {
|
public class DataContentViewerHex extends javax.swing.JPanel implements DataContentViewer {
|
||||||
|
|
||||||
private static long currentOffset = 0;
|
private static long currentOffset = 0;
|
||||||
@ -257,7 +257,7 @@ public class DataContentViewerHex extends javax.swing.JPanel implements DataCont
|
|||||||
private void goToPageTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_goToPageTextFieldActionPerformed
|
private void goToPageTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_goToPageTextFieldActionPerformed
|
||||||
String pageNumberStr = goToPageTextField.getText();
|
String pageNumberStr = goToPageTextField.getText();
|
||||||
int pageNumber = 0;
|
int pageNumber = 0;
|
||||||
int maxPage = (int) (dataSource.getSize() / pageLength) + 1;
|
int maxPage = Math.round(dataSource.getSize() / pageLength);
|
||||||
try {
|
try {
|
||||||
pageNumber = Integer.parseInt(pageNumberStr);
|
pageNumber = Integer.parseInt(pageNumberStr);
|
||||||
} catch (NumberFormatException ex) {
|
} catch (NumberFormatException ex) {
|
||||||
@ -333,7 +333,7 @@ public class DataContentViewerHex extends javax.swing.JPanel implements DataCont
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (setVisible) {
|
if (setVisible) {
|
||||||
int totalPage = (int) (dataSource.getSize() / pageLength) + 1;
|
int totalPage = Math.round(dataSource.getSize() / pageLength);
|
||||||
totalPageLabel.setText(Integer.toString(totalPage));
|
totalPageLabel.setText(Integer.toString(totalPage));
|
||||||
currentPageLabel.setText(Integer.toString(currentPage));
|
currentPageLabel.setText(Integer.toString(currentPage));
|
||||||
setComponentsVisibility(true); // shows the components that not needed
|
setComponentsVisibility(true); // shows the components that not needed
|
||||||
@ -361,6 +361,10 @@ public class DataContentViewerHex extends javax.swing.JPanel implements DataCont
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setNode(Node selectedNode) {
|
public void setNode(Node selectedNode) {
|
||||||
|
if(!isSupported(selectedNode)) {
|
||||||
|
setDataView(null, 0, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (selectedNode != null) {
|
if (selectedNode != null) {
|
||||||
Content content = (selectedNode).getLookup().lookup(Content.class);
|
Content content = (selectedNode).getLookup().lookup(Content.class);
|
||||||
if (content != null) {
|
if (content != null) {
|
||||||
@ -413,6 +417,8 @@ public class DataContentViewerHex extends javax.swing.JPanel implements DataCont
|
|||||||
nextPageButton.setVisible(isVisible);
|
nextPageButton.setVisible(isVisible);
|
||||||
pageLabel.setVisible(isVisible);
|
pageLabel.setVisible(isVisible);
|
||||||
pageLabel2.setVisible(isVisible);
|
pageLabel2.setVisible(isVisible);
|
||||||
|
goToPageTextField.setVisible(isVisible);
|
||||||
|
goToPageLabel.setVisible(isVisible);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -430,8 +436,12 @@ public class DataContentViewerHex extends javax.swing.JPanel implements DataCont
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPreferred(Node node, boolean isSupported) {
|
public int isPreferred(Node node, boolean isSupported) {
|
||||||
return false;
|
if(isSupported) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -45,7 +45,7 @@ import org.sleuthkit.datamodel.TskData;
|
|||||||
*
|
*
|
||||||
* @author dfickling
|
* @author dfickling
|
||||||
*/
|
*/
|
||||||
@ServiceProvider(service = DataContentViewer.class)
|
@ServiceProvider(service = DataContentViewer.class, position=5)
|
||||||
public class DataContentViewerMedia extends javax.swing.JPanel implements DataContentViewer {
|
public class DataContentViewerMedia extends javax.swing.JPanel implements DataContentViewer {
|
||||||
|
|
||||||
private static final String[] IMAGES = new String[]{ ".jpg", ".jpeg", ".png", ".gif", ".jpe", ".bmp"};
|
private static final String[] IMAGES = new String[]{ ".jpg", ".jpeg", ".png", ".gif", ".jpe", ".bmp"};
|
||||||
@ -172,6 +172,9 @@ public class DataContentViewerMedia extends javax.swing.JPanel implements DataCo
|
|||||||
}
|
}
|
||||||
File file = selectedNode.getLookup().lookup(File.class);
|
File file = selectedNode.getLookup().lookup(File.class);
|
||||||
setDataView(file);
|
setDataView(file);
|
||||||
|
if(file == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
boolean isVidOrAud = containsExt(file.getName(), VIDEOS) || containsExt(file.getName(), AUDIOS);
|
boolean isVidOrAud = containsExt(file.getName(), VIDEOS) || containsExt(file.getName(), AUDIOS);
|
||||||
pauseButton.setVisible(isVidOrAud);
|
pauseButton.setVisible(isVidOrAud);
|
||||||
progressLabel.setVisible(isVidOrAud);
|
progressLabel.setVisible(isVidOrAud);
|
||||||
@ -179,8 +182,12 @@ public class DataContentViewerMedia extends javax.swing.JPanel implements DataCo
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setDataView(File file) {
|
private void setDataView(File file) {
|
||||||
if(file == null)
|
if(file == null) {
|
||||||
|
setComponentsVisibility(false);
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
setComponentsVisibility(true);
|
||||||
|
}
|
||||||
this.currentFile = file;
|
this.currentFile = file;
|
||||||
|
|
||||||
if (containsExt(file.getName(), IMAGES)) {
|
if (containsExt(file.getName(), IMAGES)) {
|
||||||
@ -196,6 +203,17 @@ public class DataContentViewerMedia extends javax.swing.JPanel implements DataCo
|
|||||||
playbin2.play();
|
playbin2.play();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* To set the visibility of specific components in this class.
|
||||||
|
*
|
||||||
|
* @param isVisible whether to show or hide the specific components
|
||||||
|
*/
|
||||||
|
private void setComponentsVisibility(boolean isVisible) {
|
||||||
|
pauseButton.setVisible(isVisible);
|
||||||
|
progressLabel.setVisible(isVisible);
|
||||||
|
progressSlider.setVisible(isVisible);
|
||||||
|
videoPanel.setVisible(isVisible);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
@ -283,8 +301,12 @@ public class DataContentViewerMedia extends javax.swing.JPanel implements DataCo
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPreferred(Node node, boolean isSupported) {
|
public int isPreferred(Node node, boolean isSupported) {
|
||||||
return isSupported;
|
if(isSupported) {
|
||||||
|
return 7;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean containsExt(String name, String[] exts) {
|
private static boolean containsExt(String name, String[] exts) {
|
||||||
|
@ -178,8 +178,12 @@ public class DataContentViewerPicture extends javax.swing.JPanel implements Data
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPreferred(Node node, boolean isSupported) {
|
public int isPreferred(Node node, boolean isSupported) {
|
||||||
return isSupported;
|
if(isSupported) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -40,7 +40,7 @@ import org.sleuthkit.datamodel.TskException;
|
|||||||
/**
|
/**
|
||||||
* Viewer displays strings extracted from contents.
|
* Viewer displays strings extracted from contents.
|
||||||
*/
|
*/
|
||||||
@ServiceProvider(service = DataContentViewer.class)
|
@ServiceProvider(service = DataContentViewer.class, position=2)
|
||||||
public class DataContentViewerString extends javax.swing.JPanel implements DataContentViewer {
|
public class DataContentViewerString extends javax.swing.JPanel implements DataContentViewer {
|
||||||
|
|
||||||
private static long currentOffset = 0;
|
private static long currentOffset = 0;
|
||||||
@ -241,7 +241,7 @@ public class DataContentViewerString extends javax.swing.JPanel implements DataC
|
|||||||
private void goToPageTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_goToPageTextFieldActionPerformed
|
private void goToPageTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_goToPageTextFieldActionPerformed
|
||||||
String pageNumberStr = goToPageTextField.getText();
|
String pageNumberStr = goToPageTextField.getText();
|
||||||
int pageNumber = 0;
|
int pageNumber = 0;
|
||||||
int maxPage = (int) (dataSource.getSize() / pageLength) + 1;
|
int maxPage = Math.round(dataSource.getSize() / pageLength);
|
||||||
try {
|
try {
|
||||||
pageNumber = Integer.parseInt(pageNumberStr);
|
pageNumber = Integer.parseInt(pageNumberStr);
|
||||||
} catch (NumberFormatException ex) {
|
} catch (NumberFormatException ex) {
|
||||||
@ -320,7 +320,7 @@ public class DataContentViewerString extends javax.swing.JPanel implements DataC
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (setVisible) {
|
if (setVisible) {
|
||||||
int totalPage = (int) (dataSource.getSize() / pageLength) + 1;
|
int totalPage = Math.round(dataSource.getSize() / pageLength);
|
||||||
totalPageLabel.setText(Integer.toString(totalPage));
|
totalPageLabel.setText(Integer.toString(totalPage));
|
||||||
currentPageLabel.setText(Integer.toString(currentPage));
|
currentPageLabel.setText(Integer.toString(currentPage));
|
||||||
outputViewPane.setText(text); // set the output view
|
outputViewPane.setText(text); // set the output view
|
||||||
@ -355,10 +355,16 @@ public class DataContentViewerString extends javax.swing.JPanel implements DataC
|
|||||||
nextPageButton.setVisible(isVisible);
|
nextPageButton.setVisible(isVisible);
|
||||||
pageLabel.setVisible(isVisible);
|
pageLabel.setVisible(isVisible);
|
||||||
pageLabel2.setVisible(isVisible);
|
pageLabel2.setVisible(isVisible);
|
||||||
|
goToPageTextField.setVisible(isVisible);
|
||||||
|
goToPageLabel.setVisible(isVisible);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setNode(Node selectedNode) {
|
public void setNode(Node selectedNode) {
|
||||||
|
if(!isSupported(selectedNode)) {
|
||||||
|
setDataView(null, 0, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (selectedNode != null) {
|
if (selectedNode != null) {
|
||||||
Lookup lookup = selectedNode.getLookup();
|
Lookup lookup = selectedNode.getLookup();
|
||||||
Content content = lookup.lookup(Content.class);
|
Content content = lookup.lookup(Content.class);
|
||||||
@ -421,14 +427,12 @@ public class DataContentViewerString extends javax.swing.JPanel implements DataC
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPreferred(Node node, boolean isSupported) {
|
public int isPreferred(Node node, boolean isSupported) {
|
||||||
if(node != null && isSupported){
|
if(node != null && isSupported){
|
||||||
StringContent scontent = node.getLookup().lookup(StringContent.class);
|
return 2;
|
||||||
if(scontent != null){
|
} else {
|
||||||
return true;
|
return 0;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -186,6 +186,7 @@ public abstract class AbstractFsContentNode<T extends FsContent> extends Abstrac
|
|||||||
// selecting a file filter (e.g. 'type' or 'recent'), it is false
|
// selecting a file filter (e.g. 'type' or 'recent'), it is false
|
||||||
AbstractFsContentNode(T fsContent, boolean directoryBrowseMode) {
|
AbstractFsContentNode(T fsContent, boolean directoryBrowseMode) {
|
||||||
super(fsContent);
|
super(fsContent);
|
||||||
|
this.setDisplayName(AbstractFsContentNode.getFsContentName(fsContent));
|
||||||
this.directoryBrowseMode = directoryBrowseMode;
|
this.directoryBrowseMode = directoryBrowseMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,7 +227,7 @@ public abstract class AbstractFsContentNode<T extends FsContent> extends Abstrac
|
|||||||
* @param content to extract properties from
|
* @param content to extract properties from
|
||||||
*/
|
*/
|
||||||
public static void fillPropertyMap(Map<String, Object> map, FsContent content) {
|
public static void fillPropertyMap(Map<String, Object> map, FsContent content) {
|
||||||
map.put(FsContentPropertyType.NAME.toString(), content.getName());
|
map.put(FsContentPropertyType.NAME.toString(), getFsContentName(content));
|
||||||
map.put(FsContentPropertyType.LOCATION.toString(), DataConversion.getformattedPath(ContentUtils.getDisplayPath(content), 0, 1));
|
map.put(FsContentPropertyType.LOCATION.toString(), DataConversion.getformattedPath(ContentUtils.getDisplayPath(content), 0, 1));
|
||||||
map.put(FsContentPropertyType.MOD_TIME.toString(), ContentUtils.getStringTime(content.getMtime(), content));
|
map.put(FsContentPropertyType.MOD_TIME.toString(), ContentUtils.getStringTime(content.getMtime(), content));
|
||||||
map.put(FsContentPropertyType.CHANGED_TIME.toString(), ContentUtils.getStringTime(content.getCtime(), content));
|
map.put(FsContentPropertyType.CHANGED_TIME.toString(), ContentUtils.getStringTime(content.getCtime(), content));
|
||||||
@ -245,4 +246,14 @@ public abstract class AbstractFsContentNode<T extends FsContent> extends Abstrac
|
|||||||
map.put(FsContentPropertyType.KNOWN.toString(), content.getKnown().getName());
|
map.put(FsContentPropertyType.KNOWN.toString(), content.getKnown().getName());
|
||||||
map.put(FsContentPropertyType.MD5HASH.toString(), content.getMd5Hash() == null ? "" : content.getMd5Hash());
|
map.put(FsContentPropertyType.MD5HASH.toString(), content.getMd5Hash() == null ? "" : content.getMd5Hash());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static String getFsContentName(FsContent fsContent) {
|
||||||
|
String name = fsContent.getName();
|
||||||
|
if(name.equals("..")) {
|
||||||
|
name = DirectoryNode.DOTDOTDIR;
|
||||||
|
} else if(name.equals(".")) {
|
||||||
|
name = DirectoryNode.DOTDIR;
|
||||||
|
}
|
||||||
|
return name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,16 +27,9 @@ import org.sleuthkit.datamodel.TskData;
|
|||||||
* Its children are more directories.
|
* Its children are more directories.
|
||||||
*/
|
*/
|
||||||
public class DirectoryNode extends AbstractFsContentNode<Directory> {
|
public class DirectoryNode extends AbstractFsContentNode<Directory> {
|
||||||
|
|
||||||
/**
|
public static final String DOTDOTDIR = "[parent folder]";
|
||||||
* Helper so that the display name and the name used in building the path
|
public static final String DOTDIR = "[current folder]";
|
||||||
* are determined the same way.
|
|
||||||
* @param d Directory to get the name of
|
|
||||||
* @return short name for the directory
|
|
||||||
*/
|
|
||||||
static String nameForDirectory(Directory d) {
|
|
||||||
return d.getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
public DirectoryNode(Directory dir) {
|
public DirectoryNode(Directory dir) {
|
||||||
this(dir, true);
|
this(dir, true);
|
||||||
@ -50,8 +43,6 @@ public class DirectoryNode extends AbstractFsContentNode<Directory> {
|
|||||||
super(dir, directoryBrowseMode);
|
super(dir, directoryBrowseMode);
|
||||||
|
|
||||||
// set name, display name, and icon
|
// set name, display name, and icon
|
||||||
String dirName = nameForDirectory(dir);
|
|
||||||
this.setDisplayName(dirName);
|
|
||||||
if (Directory.dirFlagToValue(dir.getDir_flags()).equals(TskData.TSK_FS_NAME_FLAG_ENUM.TSK_FS_NAME_FLAG_UNALLOC.toString())) {
|
if (Directory.dirFlagToValue(dir.getDir_flags()).equals(TskData.TSK_FS_NAME_FLAG_ENUM.TSK_FS_NAME_FLAG_UNALLOC.toString())) {
|
||||||
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/folder-icon-deleted.png");
|
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/folder-icon-deleted.png");
|
||||||
} else {
|
} else {
|
||||||
|
@ -30,16 +30,6 @@ import org.sleuthkit.datamodel.TskData;
|
|||||||
*/
|
*/
|
||||||
public class FileNode extends AbstractFsContentNode<File> {
|
public class FileNode extends AbstractFsContentNode<File> {
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper so that the display name and the name used in building the path
|
|
||||||
* are determined the same way.
|
|
||||||
* @param f File to get the name of
|
|
||||||
* @return short name for the File
|
|
||||||
*/
|
|
||||||
static String nameForFile(File f) {
|
|
||||||
return f.getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param file underlying Content
|
* @param file underlying Content
|
||||||
@ -52,8 +42,6 @@ public class FileNode extends AbstractFsContentNode<File> {
|
|||||||
super(file, directoryBrowseMode);
|
super(file, directoryBrowseMode);
|
||||||
|
|
||||||
// set name, display name, and icon
|
// set name, display name, and icon
|
||||||
String fileName = nameForFile(file);
|
|
||||||
this.setDisplayName(fileName);
|
|
||||||
if (File.dirFlagToValue(file.getDir_flags()).equals(TskData.TSK_FS_NAME_FLAG_ENUM.TSK_FS_NAME_FLAG_UNALLOC.toString())) {
|
if (File.dirFlagToValue(file.getDir_flags()).equals(TskData.TSK_FS_NAME_FLAG_ENUM.TSK_FS_NAME_FLAG_UNALLOC.toString())) {
|
||||||
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/file-icon-deleted.png");
|
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/file-icon-deleted.png");
|
||||||
} else {
|
} else {
|
||||||
|
@ -30,7 +30,7 @@ import org.sleuthkit.autopsy.coreutils.Log;
|
|||||||
*
|
*
|
||||||
* @author jantonius
|
* @author jantonius
|
||||||
*/
|
*/
|
||||||
public class CollapseAction extends AbstractAction {
|
class CollapseAction extends AbstractAction {
|
||||||
|
|
||||||
CollapseAction(String title) {
|
CollapseAction(String title) {
|
||||||
super(title);
|
super(title);
|
||||||
|
@ -46,6 +46,7 @@ import org.sleuthkit.autopsy.datamodel.ExtractedContentNode;
|
|||||||
import org.sleuthkit.autopsy.datamodel.FileNode;
|
import org.sleuthkit.autopsy.datamodel.FileNode;
|
||||||
import org.sleuthkit.autopsy.datamodel.FileSearchFilterNode;
|
import org.sleuthkit.autopsy.datamodel.FileSearchFilterNode;
|
||||||
import org.sleuthkit.autopsy.datamodel.HashsetHits.HashsetHitsRootNode;
|
import org.sleuthkit.autopsy.datamodel.HashsetHits.HashsetHitsRootNode;
|
||||||
|
import org.sleuthkit.autopsy.datamodel.HashsetHits.HashsetHitsSetNode;
|
||||||
import org.sleuthkit.autopsy.datamodel.ImageNode;
|
import org.sleuthkit.autopsy.datamodel.ImageNode;
|
||||||
import org.sleuthkit.autopsy.datamodel.KeywordHits.KeywordHitsKeywordNode;
|
import org.sleuthkit.autopsy.datamodel.KeywordHits.KeywordHitsKeywordNode;
|
||||||
import org.sleuthkit.autopsy.datamodel.KeywordHits.KeywordHitsListNode;
|
import org.sleuthkit.autopsy.datamodel.KeywordHits.KeywordHitsListNode;
|
||||||
@ -154,7 +155,6 @@ public class DataResultFilterNode extends FilterNode{
|
|||||||
List<Action> actions = new ArrayList<Action>();
|
List<Action> actions = new ArrayList<Action>();
|
||||||
actions.add(new NewWindowViewAction("View in New Window", vol));
|
actions.add(new NewWindowViewAction("View in New Window", vol));
|
||||||
actions.addAll(ShowDetailActionVisitor.getActions(vol.getLookup().lookup(Content.class)));
|
actions.addAll(ShowDetailActionVisitor.getActions(vol.getLookup().lookup(Content.class)));
|
||||||
actions.add(new ChangeViewAction("View", 0, vol));
|
|
||||||
|
|
||||||
return actions;
|
return actions;
|
||||||
}
|
}
|
||||||
@ -271,6 +271,11 @@ public class DataResultFilterNode extends FilterNode{
|
|||||||
return openChild(hhrn);
|
return openChild(hhrn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AbstractAction visit(HashsetHitsSetNode hhsn) {
|
||||||
|
return openChild(hhsn);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AbstractAction visit(EmailExtractedRootNode eern) {
|
public AbstractAction visit(EmailExtractedRootNode eern) {
|
||||||
return openChild(eern);
|
return openChild(eern);
|
||||||
@ -303,9 +308,9 @@ public class DataResultFilterNode extends FilterNode{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AbstractAction visit(DirectoryNode dn){
|
public AbstractAction visit(DirectoryNode dn){
|
||||||
if(dn.getDisplayName().equals(".."))
|
if(dn.getDisplayName().equals(DirectoryNode.DOTDOTDIR))
|
||||||
return openParent(dn);
|
return openParent(dn);
|
||||||
else if(!dn.getDisplayName().equals("."))
|
else if(!dn.getDisplayName().equals(DirectoryNode.DOTDIR))
|
||||||
return openChild(dn);
|
return openChild(dn);
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
|
@ -89,11 +89,10 @@ class DirectoryTreeFilterChildren extends FilterNode.Children {
|
|||||||
|| arg0 instanceof HashsetHitsRootNode
|
|| arg0 instanceof HashsetHitsRootNode
|
||||||
|| arg0 instanceof EmailExtractedRootNode
|
|| arg0 instanceof EmailExtractedRootNode
|
||||||
|| arg0 instanceof EmailExtractedAccountNode
|
|| arg0 instanceof EmailExtractedAccountNode
|
||||||
|| arg0 instanceof EmailExtractedFolderNode
|
|
||||||
|| arg0 instanceof ImagesNode
|
|| arg0 instanceof ImagesNode
|
||||||
|| arg0 instanceof ViewsNode
|
|| arg0 instanceof ViewsNode
|
||||||
|| arg0 instanceof ResultsNode)) {
|
|| arg0 instanceof ResultsNode)) {
|
||||||
return new Node[]{this.copyNode(arg0)};
|
return new Node[]{this.copyNode(arg0, true)};
|
||||||
} else if (arg0 != null
|
} else if (arg0 != null
|
||||||
&& (arg0 instanceof KeywordHitsKeywordNode
|
&& (arg0 instanceof KeywordHitsKeywordNode
|
||||||
|| (arg0 instanceof DirectoryNode
|
|| (arg0 instanceof DirectoryNode
|
||||||
@ -102,8 +101,6 @@ class DirectoryTreeFilterChildren extends FilterNode.Children {
|
|||||||
|| arg0 instanceof RecentFilesFilterNode
|
|| arg0 instanceof RecentFilesFilterNode
|
||||||
|| arg0 instanceof FileSearchFilterNode
|
|| arg0 instanceof FileSearchFilterNode
|
||||||
|| arg0 instanceof HashsetHitsSetNode
|
|| arg0 instanceof HashsetHitsSetNode
|
||||||
|| arg0 instanceof EmailExtractedRootNode
|
|
||||||
|| arg0 instanceof EmailExtractedAccountNode
|
|
||||||
|| arg0 instanceof EmailExtractedFolderNode
|
|| arg0 instanceof EmailExtractedFolderNode
|
||||||
)) {
|
)) {
|
||||||
return new Node[]{this.copyNode(arg0, false)};
|
return new Node[]{this.copyNode(arg0, false)};
|
||||||
@ -142,7 +139,7 @@ class DirectoryTreeFilterChildren extends FilterNode.Children {
|
|||||||
*/
|
*/
|
||||||
private static boolean isDotDirectory(DirectoryNode dir) {
|
private static boolean isDotDirectory(DirectoryNode dir) {
|
||||||
String name = dir.getDisplayName();
|
String name = dir.getDisplayName();
|
||||||
return name.equals(".") || name.equals("..");
|
return name.equals(DirectoryNode.DOTDIR) || name.equals(DirectoryNode.DOTDOTDIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -63,7 +63,6 @@ class DirectoryTreeFilterNode extends FilterNode {
|
|||||||
Content c = this.getLookup().lookup(Content.class);
|
Content c = this.getLookup().lookup(Content.class);
|
||||||
if (c != null) {
|
if (c != null) {
|
||||||
actions.addAll(DirectoryTreeFilterNode.getDetailActions(c));
|
actions.addAll(DirectoryTreeFilterNode.getDetailActions(c));
|
||||||
actions.add(collapseAll);
|
|
||||||
|
|
||||||
Directory dir = this.getLookup().lookup(Directory.class);
|
Directory dir = this.getLookup().lookup(Directory.class);
|
||||||
if (dir != null) {
|
if (dir != null) {
|
||||||
@ -83,6 +82,7 @@ class DirectoryTreeFilterNode extends FilterNode {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
actions.add(collapseAll);
|
||||||
return actions.toArray(new Action[actions.size()]);
|
return actions.toArray(new Action[actions.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ import org.sleuthkit.datamodel.Directory;
|
|||||||
* MarkupSource items in the selected Node's lookup, plus the content that
|
* MarkupSource items in the selected Node's lookup, plus the content that
|
||||||
* Solr extracted (if there is any).
|
* Solr extracted (if there is any).
|
||||||
*/
|
*/
|
||||||
@ServiceProvider(service = DataContentViewer.class)
|
@ServiceProvider(service = DataContentViewer.class, position=4)
|
||||||
public class ExtractedContentViewer implements DataContentViewer {
|
public class ExtractedContentViewer implements DataContentViewer {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(ExtractedContentViewer.class.getName());
|
private static final Logger logger = Logger.getLogger(ExtractedContentViewer.class.getName());
|
||||||
@ -304,10 +304,20 @@ public class ExtractedContentViewer implements DataContentViewer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPreferred(Node node,
|
public int isPreferred(Node node,
|
||||||
boolean isSupported) {
|
boolean isSupported) {
|
||||||
BlackboardArtifact art = node.getLookup().lookup(BlackboardArtifact.class);
|
BlackboardArtifact art = node.getLookup().lookup(BlackboardArtifact.class);
|
||||||
return isSupported && (art == null || art.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID());
|
if(isSupported) {
|
||||||
|
if(art == null) {
|
||||||
|
return 4;
|
||||||
|
} else if(art.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID()) {
|
||||||
|
return 6;
|
||||||
|
} else {
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user