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);
}
// // 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()]));
}
@ -474,35 +467,6 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
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
public boolean isLeafTypeNode() {

View File

@ -30,7 +30,6 @@ import java.util.Set;
import java.util.logging.Level;
import org.apache.commons.lang.StringUtils;
import org.openide.nodes.Node;
import org.openide.util.Exceptions;
import org.openide.util.Lookup;
import org.openide.util.NbBundle;
import org.openide.util.lookup.ServiceProvider;
@ -98,8 +97,8 @@ public class ExtractedContentViewer implements DataContentViewer {
Content content = nodeLookup.lookup(Content.class);
/*
* Assemble a collection of all of the indexed text "sources" associated
* with the node.
* Assemble a collection of all of the indexed text "sources" for the
* node.
*/
List<IndexedText> indexedTextSources = new ArrayList<>();
IndexedText highlightedHitText = null;
@ -109,15 +108,21 @@ public class ExtractedContentViewer implements DataContentViewer {
QueryResults hits = nodeLookup.lookup(QueryResults.class);
BlackboardArtifact artifact = nodeLookup.lookup(BlackboardArtifact.class);
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);
} else if (artifact != null && artifact.getArtifactTypeID()
== BlackboardArtifact.ARTIFACT_TYPE.TSK_ACCOUNT.getTypeID()) {
} else if (artifact != null
&& artifact.getArtifactTypeID() == TSK_ACCOUNT.getTypeID()) {
// if the artifact is an account artifact, get an account text .
highlightedHitText = getAccountsText(content, nodeLookup);
} else if (artifact != null && artifact.getArtifactTypeID()
== BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID()) {
} else if (artifact != null
&& artifact.getArtifactTypeID() == TSK_KEYWORD_HIT.getTypeID()) {
//if there is kwh artifact use that to construct the HighlightedText
highlightedHitText = new HighlightedText(artifact);
}
if (highlightedHitText != null) {
indexedTextSources.add(highlightedHitText);
}
@ -130,6 +135,7 @@ public class ExtractedContentViewer implements DataContentViewer {
rawContentText = new RawText(content, content.getId());
indexedTextSources.add(rawContentText);
}
/*
* Finally, add the "raw" (not highlighted) text, if any, for any
* artifact associated with the node.
@ -148,7 +154,6 @@ public class ExtractedContentViewer implements DataContentViewer {
currentSource = rawArtifactText;
}
//JMTODO: What is this supposed to do?
// Push the text sources into the panel.
for (IndexedText source : indexedTextSources) {
int currentPage = source.getCurrentPage();
@ -251,7 +256,6 @@ public class ExtractedContentViewer implements DataContentViewer {
}
panel.scrollToAnchor(source.getAnchorPrefix() + Integer.toString(source.currentItem()));
}
@Override
@ -296,17 +300,6 @@ public class ExtractedContentViewer implements DataContentViewer {
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
*/
@ -585,7 +578,7 @@ public class ExtractedContentViewer implements DataContentViewer {
}
}
class NextPageActionListener implements ActionListener {
private class NextPageActionListener implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {