mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
removed isSupported from ContentViewer API
This commit is contained in:
parent
3f9a296a0f
commit
a5de0c23b8
@ -1,7 +1,6 @@
|
||||
Changes to make to API when we are ready to make backward incompatible changes:
|
||||
|
||||
- HTMLReport has special API for more context on columns and special handling in REportGenerator. Change all reports to the new API.
|
||||
- DataContentViewer.isPreferred does not need isSupported to be passed in
|
||||
- DataContentViewerHex and Strings can have the public setDataView methods removed in favor of the new private ones
|
||||
- Content.getUniquePath() should not thrown TskException. We should deal with it in the method.
|
||||
- Make the list of events that Case fires off to be part of an enum to group them together (like IngestManager does).
|
||||
|
@ -185,7 +185,7 @@ public class Metadata extends javax.swing.JPanel implements DataContentViewer
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isPreferred(Node node, boolean isSupported) {
|
||||
public int isPreferred(Node node) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -83,16 +83,15 @@ public interface DataContentViewer {
|
||||
* Checks whether the given viewer is preferred for the Node.
|
||||
* This is a bit subjective, but the idea is that Autopsy wants to display
|
||||
* the most relevant tab. The more generic the viewer, the lower
|
||||
* the return value should be.
|
||||
* the return value should be. This will only be called on viewers that
|
||||
* support the given node.
|
||||
*
|
||||
* @param node Node to check for preference
|
||||
* @param isSupported true if the viewer is supported by the node, false otherwise
|
||||
* as determined by a previous check
|
||||
* @return an int (0-10) higher return means the viewer has higher priority
|
||||
* 0 means not supported
|
||||
* 1 to 2 means the module will display all file types (such as the hex viewer)
|
||||
* 3-10 are prioritized by Content viewer developer. Modules that operate on very
|
||||
* few file types should be towards 10.
|
||||
*/
|
||||
public int isPreferred(Node node, boolean isSupported);
|
||||
public int isPreferred(Node node);
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ public class DataContentPanel extends javax.swing.JPanel implements DataContent,
|
||||
jTabbedPane1.setEnabledAt(i, true);
|
||||
|
||||
// remember the viewer with the highest preference value
|
||||
int currentPreferred = dcv.isPreferred(selectedNode, true);
|
||||
int currentPreferred = dcv.isPreferred(selectedNode);
|
||||
if (currentPreferred > maxPreferred) {
|
||||
preferredViewerIndex = i;
|
||||
maxPreferred = currentPreferred;
|
||||
@ -258,8 +258,8 @@ public class DataContentPanel extends javax.swing.JPanel implements DataContent,
|
||||
return this.wrapped.isSupported(node);
|
||||
}
|
||||
|
||||
int isPreferred(Node node, boolean isSupported) {
|
||||
return this.wrapped.isPreferred(node, isSupported);
|
||||
int isPreferred(Node node) {
|
||||
return this.wrapped.isPreferred(node);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -326,18 +326,13 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isPreferred(Node node, boolean isSupported) {
|
||||
public int isPreferred(Node node) {
|
||||
BlackboardArtifact artifact = node.getLookup().lookup(BlackboardArtifact.class);
|
||||
if(isSupported) {
|
||||
if(artifact == null) {
|
||||
return 3;
|
||||
}
|
||||
else {
|
||||
return 5;
|
||||
}
|
||||
if(artifact == null) {
|
||||
return 3;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -434,12 +434,8 @@ public class DataContentViewerHex extends javax.swing.JPanel implements DataCont
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isPreferred(Node node, boolean isSupported) {
|
||||
if (isSupported) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
public int isPreferred(Node node) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -226,25 +226,22 @@ public class DataContentViewerMedia extends javax.swing.JPanel implements DataCo
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isPreferred(Node node, boolean isSupported) {
|
||||
if (isSupported) {
|
||||
//special case, check if deleted video, then do not make it preferred
|
||||
AbstractFile file = node.getLookup().lookup(AbstractFile.class);
|
||||
if (file == null) {
|
||||
return 0;
|
||||
}
|
||||
String name = file.getName().toLowerCase();
|
||||
boolean deleted = file.isDirNameFlagSet(TSK_FS_NAME_FLAG_ENUM.UNALLOC);
|
||||
|
||||
if (containsExt(name, videoExtensions) && deleted) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
return 7;
|
||||
}
|
||||
} else {
|
||||
public int isPreferred(Node node) {
|
||||
//special case, check if deleted video, then do not make it preferred
|
||||
AbstractFile file = node.getLookup().lookup(AbstractFile.class);
|
||||
if (file == null) {
|
||||
return 0;
|
||||
}
|
||||
String name = file.getName().toLowerCase();
|
||||
boolean deleted = file.isDirNameFlagSet(TSK_FS_NAME_FLAG_ENUM.UNALLOC);
|
||||
|
||||
if (containsExt(name, videoExtensions) && deleted) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
return 7;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static boolean containsExt(String name, String[] exts) {
|
||||
|
@ -484,12 +484,8 @@ public class DataContentViewerString extends javax.swing.JPanel implements DataC
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isPreferred(Node node, boolean isSupported) {
|
||||
if (node != null && isSupported) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
public int isPreferred(Node node) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -166,10 +166,7 @@ public class SampleContentViewer extends javax.swing.JPanel implements DataConte
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isPreferred(Node node, boolean isSupported) {
|
||||
if (isSupported == false) {
|
||||
return 0;
|
||||
}
|
||||
public int isPreferred(Node node) {
|
||||
// we return 1 since this module will operate on nearly all files
|
||||
return 1;
|
||||
}
|
||||
|
@ -311,19 +311,15 @@ public class ExtractedContentViewer implements DataContentViewer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isPreferred(Node node,
|
||||
boolean isSupported) {
|
||||
public int isPreferred(Node node) {
|
||||
BlackboardArtifact art = node.getLookup().lookup(BlackboardArtifact.class);
|
||||
if (isSupported) {
|
||||
if (art == null) {
|
||||
return 4;
|
||||
} else if (art.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID()) {
|
||||
return 6;
|
||||
} else {
|
||||
return 4;
|
||||
}
|
||||
|
||||
if (art == null) {
|
||||
return 4;
|
||||
} else if (art.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID()) {
|
||||
return 6;
|
||||
} else {
|
||||
return 0;
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user