cleanup, comments, delete dead code

This commit is contained in:
millmanorama 2017-02-15 15:59:58 +01:00
parent 17897e0bc8
commit b68428cb51
2 changed files with 14 additions and 57 deletions

View File

@ -454,13 +454,6 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
forLookup.add(content); forLookup.add(content);
} }
// // if there is a text highlighted version, of the content, add it too
// // currently happens from keyword search module
// TextMarkupLookup highlight = getHighlightLookup(artifact, content);
// if (highlight != null) {
// forLookup.add(highlight);
// }
return Lookups.fixed(forLookup.toArray(new Object[forLookup.size()])); return Lookups.fixed(forLookup.toArray(new Object[forLookup.size()]));
} }
@ -474,35 +467,6 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
NbBundle.getMessage(BlackboardArtifactNode.class, "BlackboardArtifactNode.getAssocCont.exception.msg")); NbBundle.getMessage(BlackboardArtifactNode.class, "BlackboardArtifactNode.getAssocCont.exception.msg"));
} }
// private static TextMarkupLookup getHighlightLookup(BlackboardArtifact artifact, Content content) {
// if (artifact.getArtifactTypeID() != BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID()) {
// return null;
// }
//
// Lookup lookup = Lookup.getDefault();
// TextMarkupLookup highlightFactory = lookup.lookup(TextMarkupLookup.class);
// try {
// List<BlackboardAttribute> attributes = artifact.getAttributes();
// String keyword = null;
// String regexp = null;
// for (BlackboardAttribute att : attributes) {
// final int attributeTypeID = att.getAttributeType().getTypeID();
// if (attributeTypeID == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD.getTypeID()) {
// keyword = att.getValueString();
// } else if (attributeTypeID == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD_REGEXP.getTypeID()) {
// regexp = att.getValueString();
// }
// }
// if (keyword != null) {
// boolean isRegexp = StringUtils.isNotBlank(regexp);
// String origQuery = isRegexp ? regexp : keyword;
// return highlightFactory.createInstance(artifact.getArtifactID(), keyword, isRegexp, origQuery);
// }
// } catch (TskCoreException ex) {
// LOGGER.log(Level.WARNING, "Failed to retrieve Blackboard Attributes", ex); //NON-NLS
// }
// return null;
// }
@Override @Override
public boolean isLeafTypeNode() { public boolean isLeafTypeNode() {

View File

@ -30,7 +30,6 @@ import java.util.Set;
import java.util.logging.Level; import java.util.logging.Level;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.openide.nodes.Node; import org.openide.nodes.Node;
import org.openide.util.Exceptions;
import org.openide.util.Lookup; import org.openide.util.Lookup;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.openide.util.lookup.ServiceProvider; import org.openide.util.lookup.ServiceProvider;
@ -98,8 +97,8 @@ public class ExtractedContentViewer implements DataContentViewer {
Content content = nodeLookup.lookup(Content.class); Content content = nodeLookup.lookup(Content.class);
/* /*
* Assemble a collection of all of the indexed text "sources" associated * Assemble a collection of all of the indexed text "sources" for the
* with the node. * node.
*/ */
List<IndexedText> indexedTextSources = new ArrayList<>(); List<IndexedText> indexedTextSources = new ArrayList<>();
IndexedText highlightedHitText = null; IndexedText highlightedHitText = null;
@ -109,15 +108,21 @@ public class ExtractedContentViewer implements DataContentViewer {
QueryResults hits = nodeLookup.lookup(QueryResults.class); QueryResults hits = nodeLookup.lookup(QueryResults.class);
BlackboardArtifact artifact = nodeLookup.lookup(BlackboardArtifact.class); BlackboardArtifact artifact = nodeLookup.lookup(BlackboardArtifact.class);
if (hits != null) { if (hits != null) {
/*
* if there is a QueryReslt object, in the lookup use that. This
* happens when a user selects a row in an ad-hoc search result
*/
highlightedHitText = new HighlightedText(content.getId(), hits); highlightedHitText = new HighlightedText(content.getId(), hits);
} else if (artifact != null && artifact.getArtifactTypeID() } else if (artifact != null
== BlackboardArtifact.ARTIFACT_TYPE.TSK_ACCOUNT.getTypeID()) { && artifact.getArtifactTypeID() == TSK_ACCOUNT.getTypeID()) {
// if the artifact is an account artifact, get an account text . // if the artifact is an account artifact, get an account text .
highlightedHitText = getAccountsText(content, nodeLookup); highlightedHitText = getAccountsText(content, nodeLookup);
} else if (artifact != null && artifact.getArtifactTypeID() } else if (artifact != null
== BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID()) { && artifact.getArtifactTypeID() == TSK_KEYWORD_HIT.getTypeID()) {
//if there is kwh artifact use that to construct the HighlightedText
highlightedHitText = new HighlightedText(artifact); highlightedHitText = new HighlightedText(artifact);
} }
if (highlightedHitText != null) { if (highlightedHitText != null) {
indexedTextSources.add(highlightedHitText); indexedTextSources.add(highlightedHitText);
} }
@ -130,6 +135,7 @@ public class ExtractedContentViewer implements DataContentViewer {
rawContentText = new RawText(content, content.getId()); rawContentText = new RawText(content, content.getId());
indexedTextSources.add(rawContentText); indexedTextSources.add(rawContentText);
} }
/* /*
* Finally, add the "raw" (not highlighted) text, if any, for any * Finally, add the "raw" (not highlighted) text, if any, for any
* artifact associated with the node. * artifact associated with the node.
@ -148,7 +154,6 @@ public class ExtractedContentViewer implements DataContentViewer {
currentSource = rawArtifactText; currentSource = rawArtifactText;
} }
//JMTODO: What is this supposed to do?
// Push the text sources into the panel. // Push the text sources into the panel.
for (IndexedText source : indexedTextSources) { for (IndexedText source : indexedTextSources) {
int currentPage = source.getCurrentPage(); int currentPage = source.getCurrentPage();
@ -251,7 +256,6 @@ public class ExtractedContentViewer implements DataContentViewer {
} }
panel.scrollToAnchor(source.getAnchorPrefix() + Integer.toString(source.currentItem())); panel.scrollToAnchor(source.getAnchorPrefix() + Integer.toString(source.currentItem()));
} }
@Override @Override
@ -296,17 +300,6 @@ public class ExtractedContentViewer implements DataContentViewer {
return false; return false;
} }
// /**
// * Is there any marked up indexed text in the look up of this node? This
// * will be the case if the node is for a keyword hit artifact produced
// * by either an ad hoc keyword search result (keyword search toolbar
// * widgets) or a keyword search by the keyword search ingest module.
// */
// Collection<? extends IndexedText> sources = node.getLookup().lookupAll(IndexedText.class);
// if (sources.isEmpty() == false) {
// return true;
// }
/* /*
* Is there a credit card artifact in the lookup * Is there a credit card artifact in the lookup
*/ */
@ -585,7 +578,7 @@ public class ExtractedContentViewer implements DataContentViewer {
} }
} }
class NextPageActionListener implements ActionListener { private class NextPageActionListener implements ActionListener {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {