use of org.parosproxy.paros.model.HistoryReference in project zaproxy by zaproxy.
the class AlertAddDialog method getBtnOk.
/**
* This method initializes btnStart
*
* @return javax.swing.JButton
*/
private JButton getBtnOk() {
if (btnOk == null) {
btnOk = new JButton();
btnOk.setText(Constant.messages.getString("alert.add.button.save"));
btnOk.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
Alert alert = alertViewPanel.getAlert();
try {
ExtensionAlert extAlert = (ExtensionAlert) Control.getSingleton().getExtensionLoader().getExtension(ExtensionAlert.NAME);
if (alert.getAlertId() >= 0) {
// Its an existing alert so save it
if (extAlert != null) {
extAlert.updateAlert(alert);
} else if (historyRef != null) {
// Update history tree
historyRef.updateAlert(alert);
extension.notifyHistoryItemChanged(historyRef);
}
} else {
if (httpMessage != null) {
historyRef = new HistoryReference(Model.getSingleton().getSession(), historyType, httpMessage);
}
alert.setSource(Alert.Source.MANUAL);
// Raise it
if (extAlert != null) {
extAlert.alertFound(alert, historyRef);
} else {
historyRef.addAlert(alert);
extension.notifyHistoryItemChanged(historyRef);
}
}
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
clearAndCloseDialog();
}
});
}
return btnOk;
}
Aggregations