Search in sources :

Example 36 with ZapMenuItem

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;
}
Also used : ZapMenuItem(org.zaproxy.zap.view.ZapMenuItem)

Example 37 with ZapMenuItem

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;
}
Also used : ZapMenuItem(org.zaproxy.zap.view.ZapMenuItem)

Example 38 with ZapMenuItem

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;
}
Also used : ZapMenuItem(org.zaproxy.zap.view.ZapMenuItem)

Example 39 with ZapMenuItem

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;
}
Also used : ZapMenuItem(org.zaproxy.zap.view.ZapMenuItem)

Example 40 with ZapMenuItem

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;
}
Also used : ZapMenuItem(org.zaproxy.zap.view.ZapMenuItem)

Aggregations

ZapMenuItem (org.zaproxy.zap.view.ZapMenuItem)42 ActionEvent (java.awt.event.ActionEvent)14 Component (java.awt.Component)3 ActionListener (java.awt.event.ActionListener)2 JMenu (javax.swing.JMenu)2 JMenuItem (javax.swing.JMenuItem)2 Target (org.zaproxy.zap.model.Target)2 File (java.io.File)1 IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 FileAlreadyExistsException (java.nio.file.FileAlreadyExistsException)1 JFileChooser (javax.swing.JFileChooser)1 JList (javax.swing.JList)1 JTree (javax.swing.JTree)1 FileFilter (javax.swing.filechooser.FileFilter)1 TreePath (javax.swing.tree.TreePath)1 ConfigurationException (org.apache.commons.configuration.ConfigurationException)1 HistoryReference (org.parosproxy.paros.model.HistoryReference)1 SiteNode (org.parosproxy.paros.model.SiteNode)1 HttpMessage (org.parosproxy.paros.network.HttpMessage)1