use of org.zaproxy.zap.view.ZapMenuItem in project zaproxy by zaproxy.
the class ExtensionAPI method getMenuAPI.
private ZapMenuItem getMenuAPI() {
if (menuAPI == null) {
menuAPI = new ZapMenuItem("api.menu.tools.url");
menuAPI.setEnabled(DesktopUtils.canOpenUrlInBrowser());
menuAPI.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
if (!API.getInstance().isEnabled()) {
String title = Constant.messages.getString("api.dialogue.browseApiNotEnabled.title");
String message = Constant.messages.getString("api.dialogue.browseApiNotEnabled.message");
String confirmButtonLabel = Constant.messages.getString("api.dialogue.browseApiNotEnabled.button.confirm.label");
String cancelButtonLabel = Constant.messages.getString("api.dialogue.browseApiNotEnabled.button.cancel.label");
int option = JOptionPane.showOptionDialog(getView().getMainFrame(), message, title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, new String[] { confirmButtonLabel, cancelButtonLabel }, null);
if (option != JOptionPane.YES_OPTION) {
return;
}
Model.getSingleton().getOptionsParam().getApiParam().setEnabled(true);
}
DesktopUtils.openUrlInBrowser(API.getInstance().getBaseURL(false));
}
});
}
return menuAPI;
}
use of org.zaproxy.zap.view.ZapMenuItem in project zaproxy by zaproxy.
the class ExtensionBreak method getMenuToggleBreakOnRequests.
private ZapMenuItem getMenuToggleBreakOnRequests() {
if (menuBreakOnRequests == null) {
menuBreakOnRequests = new ZapMenuItem("menu.tools.brk.req", getView().getMenuShortcutKeyStroke(KeyEvent.VK_B, 0, false));
menuBreakOnRequests.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
if (getOptionsParam().getButtonMode() == BreakpointsParam.BUTTON_MODE_SIMPLE) {
// Single button mode - toggle break on all
breakpointManagementInterface.setBreakAll(!breakpointManagementInterface.isBreakAll());
} else {
// Toggle break on requests
breakpointManagementInterface.setBreakAllRequests(!breakpointManagementInterface.isBreakRequest());
}
}
});
}
return menuBreakOnRequests;
}
use of org.zaproxy.zap.view.ZapMenuItem in project zaproxy by zaproxy.
the class ExtensionBreak method getMenuStep.
private ZapMenuItem getMenuStep() {
if (menuStep == null) {
menuStep = new ZapMenuItem("menu.tools.brk.step", getView().getMenuShortcutKeyStroke(KeyEvent.VK_S, 0, false));
menuStep.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
if (breakpointManagementInterface.isHoldMessage(null)) {
// Menu currently always enabled, but dont do anything unless a
// message is being held
breakpointManagementInterface.step();
}
}
});
}
return menuStep;
}
use of org.zaproxy.zap.view.ZapMenuItem in project zaproxy by zaproxy.
the class ExtensionBreak method getMenuContinue.
private ZapMenuItem getMenuContinue() {
if (menuContinue == null) {
menuContinue = new ZapMenuItem("menu.tools.brk.cont", getView().getMenuShortcutKeyStroke(KeyEvent.VK_C, 0, false));
menuContinue.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
if (breakpointManagementInterface.isHoldMessage(null)) {
// Menu currently always enabled, but dont do anything unless a
// message is being held
breakpointManagementInterface.cont();
}
}
});
}
return menuContinue;
}
use of org.zaproxy.zap.view.ZapMenuItem in project zaproxy by zaproxy.
the class ExtensionBreak method getMenuToggleBreakOnResponses.
private ZapMenuItem getMenuToggleBreakOnResponses() {
if (menuBreakOnResponses == null) {
menuBreakOnResponses = new ZapMenuItem("menu.tools.brk.resp", getView().getMenuShortcutKeyStroke(KeyEvent.VK_B, KeyEvent.ALT_DOWN_MASK, false));
menuBreakOnResponses.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
if (getOptionsParam().getButtonMode() == BreakpointsParam.BUTTON_MODE_SIMPLE) {
// Single button mode - toggle break on all
breakpointManagementInterface.setBreakAll(!breakpointManagementInterface.isBreakAll());
} else {
// Toggle break on Responses
breakpointManagementInterface.setBreakAllResponses(!breakpointManagementInterface.isBreakResponse());
}
}
});
}
return menuBreakOnResponses;
}
Aggregations