use of org.zaproxy.zap.extension.alert.AlertNode in project zaproxy by zaproxy.
the class PopupMenuHistoryReference method getSelectedHistoryReference.
private HistoryReference getSelectedHistoryReference() {
HistoryReference ref = null;
try {
switch(lastInvoker) {
case sites:
SiteNode sNode = (SiteNode) treeInvoker.getLastSelectedPathComponent();
ref = sNode.getHistoryReference();
break;
case ascan:
case history:
case bruteforce:
case search:
case fuzz:
ref = hrefsTableInvoker.getSelectedHistoryReference();
break;
case alerts:
AlertNode aNode = (AlertNode) treeInvoker.getLastSelectedPathComponent();
if (aNode.getUserObject() != null) {
Alert alert = aNode.getUserObject();
ref = alert.getHistoryRef();
}
break;
case hreftable:
ref = hrefTableInvoker.getSelectedHistoryReference();
break;
}
} catch (Exception e2) {
log.error(e2.getMessage(), e2);
}
return ref;
}
use of org.zaproxy.zap.extension.alert.AlertNode in project zaproxy by zaproxy.
the class PopupMenuHistoryReference method getSelectedHistoryReferences.
private List<HistoryReference> getSelectedHistoryReferences() {
List<HistoryReference> refs = new ArrayList<>();
TreePath[] treePaths = null;
try {
switch(lastInvoker) {
case sites:
treePaths = treeInvoker.getSelectionPaths();
if (treePaths != null) {
for (TreePath path : treePaths) {
SiteNode node = (SiteNode) path.getLastPathComponent();
refs.add(node.getHistoryReference());
}
}
break;
case ascan:
case history:
case bruteforce:
case fuzz:
case search:
refs = hrefsTableInvoker.getSelectedHistoryReferences();
break;
case alerts:
// Only support single items
AlertNode aNode = (AlertNode) treeInvoker.getLastSelectedPathComponent();
if (aNode.getUserObject() != null) {
Alert alert = aNode.getUserObject();
refs.add(alert.getHistoryRef());
}
break;
case hreftable:
refs = hrefTableInvoker.getSelectedHistoryReferences();
break;
}
} catch (Exception e2) {
log.error(e2.getMessage(), e2);
}
return refs;
}