use of org.zaproxy.zap.view.ZapMenuItem in project zaproxy by zaproxy.
the class ExtensionAutoUpdate method getMenuItemCheckUpdate.
/**
* This method initializes menuItemEncoder
*
* @return javax.swing.JMenuItem
*/
private ZapMenuItem getMenuItemCheckUpdate() {
if (menuItemCheckUpdate == null) {
menuItemCheckUpdate = new ZapMenuItem("cfu.help.menu.check", getView().getMenuShortcutKeyStroke(KeyEvent.VK_U, 0, false));
menuItemCheckUpdate.setText(Constant.messages.getString("cfu.help.menu.check"));
menuItemCheckUpdate.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
checkForUpdates(false);
}
});
}
return menuItemCheckUpdate;
}
use of org.zaproxy.zap.view.ZapMenuItem in project zaproxy by zaproxy.
the class ExtensionAutoUpdate method getMenuItemLoadAddOn.
private ZapMenuItem getMenuItemLoadAddOn() {
if (menuItemLoadAddOn == null) {
menuItemLoadAddOn = new ZapMenuItem("cfu.file.menu.loadaddon", getView().getMenuShortcutKeyStroke(KeyEvent.VK_L, 0, false));
menuItemLoadAddOn.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
try {
JFileChooser chooser = new JFileChooser(Model.getSingleton().getOptionsParam().getUserDirectory());
File file = null;
chooser.setFileFilter(new FileFilter() {
@Override
public boolean accept(File file) {
return file.isDirectory() || (file.isFile() && AddOn.isAddOnFileName(file.getName()));
}
@Override
public String getDescription() {
return Constant.messages.getString("file.format.zap.addon");
}
});
int rc = chooser.showOpenDialog(getView().getMainFrame());
if (rc == JFileChooser.APPROVE_OPTION) {
file = chooser.getSelectedFile();
if (file == null) {
return;
}
installLocalAddOn(file.toPath());
}
} catch (Exception e1) {
logger.error(e1.getMessage(), e1);
}
}
});
}
return menuItemLoadAddOn;
}
use of org.zaproxy.zap.view.ZapMenuItem in project zaproxy by zaproxy.
the class MainMenuBar method getMenuFileExitAndDelete.
private javax.swing.JMenuItem getMenuFileExitAndDelete() {
if (menuFileExitAndDelete == null) {
menuFileExitAndDelete = new ZapMenuItem("menu.file.exit.delete");
menuFileExitAndDelete.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
int ans = View.getSingleton().showConfirmDialog(Constant.messages.getString("menu.file.exit.delete.warning"));
if (ans == JOptionPane.OK_OPTION) {
Control.getSingleton().exitAndDeleteSession(Model.getSingleton().getSession().getFileName());
}
}
});
}
return menuFileExitAndDelete;
}
use of org.zaproxy.zap.view.ZapMenuItem in project zaproxy by zaproxy.
the class MainMenuBar method getMenuFileExit.
private JMenuItem getMenuFileExit() {
if (menuFileExit == null) {
menuFileExit = new ZapMenuItem("menu.file.exit");
menuFileExit.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
getMenuFileControl().exit();
}
});
}
return menuFileExit;
}
use of org.zaproxy.zap.view.ZapMenuItem in project zaproxy by zaproxy.
the class MainMenuBar method getMenuFileSaveAs.
private JMenuItem getMenuFileSaveAs() {
if (menuFileSaveAs == null) {
menuFileSaveAs = new ZapMenuItem("menu.file.persistSession");
menuFileSaveAs.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
if (Model.getSingleton().getSession().isNewState()) {
getMenuFileControl().saveAsSession();
} else {
View.getSingleton().showWarningDialog(Constant.messages.getString("menu.file.sessionExists.error"));
}
if (!Model.getSingleton().getSession().isNewState()) {
toggleSnapshotState(true);
}
}
});
}
return menuFileSaveAs;
}
Aggregations