use of javax.swing.JButton in project zaproxy by zaproxy.
the class ManageAddOnsDialog method getUninstallButton.
private JButton getUninstallButton() {
if (uninstallButton == null) {
uninstallButton = new JButton();
uninstallButton.setText(Constant.messages.getString("cfu.button.addons.uninstall"));
// Nothing will be selected initially
uninstallButton.setEnabled(false);
uninstallButton.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
Set<AddOn> selectedAddOns = installedAddOnsModel.getSelectedAddOns();
if (selectedAddOns.isEmpty()) {
return;
}
Set<AddOn> addOnsBeingDownloaded = installedAddOnsModel.getDownloadingAddOns();
addOnsBeingDownloaded.addAll(uninstalledAddOnsModel.getDownloadingAddOns());
AddOnDependencyChecker calc = new AddOnDependencyChecker(installedAddOns, latestInfo);
AddOnDependencyChecker.UninstallationResult changes = calc.calculateUninstallChanges(selectedAddOns);
if (!calc.confirmUninstallChanges(ManageAddOnsDialog.this, changes, addOnsBeingDownloaded)) {
return;
}
Set<AddOn> addOns = changes.getUninstallations();
Set<Extension> extensions = changes.getExtensions();
if (!extension.warnUnsavedResourcesOrActiveActions(ManageAddOnsDialog.this, addOns, extensions, false)) {
return;
}
extension.uninstallAddOnsWithView(ManageAddOnsDialog.this, addOns, false, new HashSet<AddOn>());
}
});
}
return uninstallButton;
}
use of javax.swing.JButton in project zaproxy by zaproxy.
the class CertificateView method initComponents.
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
private void initComponents() {
closeButton = new JButton();
certificateScrollPane = new JScrollPane();
certificateTextArea = new ZapTextArea();
//TODO: Constant for messages.properties
setTitle("Certificate");
//TODO: Constant for messages.properties
closeButton.setText("Close");
closeButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
closeButtonActionPerformed(evt);
}
});
certificateScrollPane.setViewportView(certificateTextArea);
GroupLayout layout = new GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING).addComponent(closeButton, GroupLayout.PREFERRED_SIZE, 93, GroupLayout.PREFERRED_SIZE).addComponent(certificateScrollPane, GroupLayout.DEFAULT_SIZE, 658, Short.MAX_VALUE)).addContainerGap()));
layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addContainerGap().addComponent(certificateScrollPane, GroupLayout.DEFAULT_SIZE, 439, Short.MAX_VALUE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(closeButton).addContainerGap()));
pack();
}
use of javax.swing.JButton in project zaproxy by zaproxy.
the class ExtensionAutoUpdate method getAddonsButton.
private JButton getAddonsButton() {
if (addonsButton == null) {
addonsButton = new JButton();
addonsButton.setIcon(new ImageIcon(ExtensionAutoUpdate.class.getResource("/resource/icon/fugue/block.png")));
addonsButton.setToolTipText(Constant.messages.getString("cfu.button.addons.browse"));
addonsButton.setEnabled(true);
addonsButton.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
getAddOnsDialog().setVisible(true);
}
});
}
return this.addonsButton;
}
use of javax.swing.JButton in project zaproxy by zaproxy.
the class PolicyManagerDialog method getExportButton.
private JButton getExportButton() {
if (this.exportButton == null) {
this.exportButton = new JButton(Constant.messages.getString("ascan.policymgr.button.export"));
this.exportButton.setEnabled(false);
this.exportButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String name = (String) getParamsModel().getValueAt(getParamsTable().getSelectedRow(), 0);
if (name != null) {
JFileChooser chooser = new JFileChooser(Constant.getPoliciesDir());
File file = new File(Constant.getZapHome(), name + PolicyManager.POLICY_EXTENSION);
chooser.setSelectedFile(file);
chooser.setFileFilter(new FileFilter() {
@Override
public boolean accept(File file) {
if (file.isDirectory()) {
return true;
} else if (file.isFile() && file.getName().endsWith(".policy")) {
return true;
}
return false;
}
@Override
public String getDescription() {
return Constant.messages.getString("file.format.zap.policy");
}
});
int rc = chooser.showSaveDialog(View.getSingleton().getMainFrame());
if (rc == JFileChooser.APPROVE_OPTION) {
file = chooser.getSelectedFile();
if (file == null) {
return;
}
try {
ScanPolicy policy = extension.getPolicyManager().getPolicy(name);
if (policy != null) {
extension.getPolicyManager().exportPolicy(policy, file);
}
} catch (ConfigurationException e1) {
logger.error(e1.getMessage(), e1);
View.getSingleton().showWarningDialog(Constant.messages.getString("ascan.policy.load.error"));
}
}
}
}
});
}
return this.exportButton;
}
use of javax.swing.JButton in project zaproxy by zaproxy.
the class PolicyManagerDialog method getRemoveButton.
private JButton getRemoveButton() {
if (this.removeButton == null) {
this.removeButton = new JButton(Constant.messages.getString("ascan.policymgr.button.remove"));
this.removeButton.setEnabled(false);
this.removeButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String name = (String) getParamsModel().getValueAt(getParamsTable().getSelectedRow(), 0);
if (name != null) {
if (View.getSingleton().showConfirmDialog(PolicyManagerDialog.this, Constant.messages.getString("ascan.policymgr.warn.delete")) == JOptionPane.OK_OPTION) {
extension.getPolicyManager().deletePolicy(name);
policyNamesChanged();
}
}
}
});
}
return this.removeButton;
}
Aggregations