Search in sources :

Example 41 with ZapMenuItem

use of org.zaproxy.zap.view.ZapMenuItem in project zaproxy by zaproxy.

the class ManualHttpRequestEditorDialog method getMenuItem.

@Override
public ZapMenuItem getMenuItem() {
    if (menuItem == null) {
        menuItem = new ZapMenuItem("menu.tools.manReq", View.getSingleton().getMenuShortcutKeyStroke(KeyEvent.VK_M, 0, false));
        menuItem.setIcon(ExtensionManualRequestEditor.getIcon());
        menuItem.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                Message message = getMessage();
                if (message == null) {
                    setDefaultMessage();
                } else if (message instanceof HttpMessage && ((HttpMessage) message).getRequestHeader().isEmpty()) {
                    setDefaultMessage();
                }
                setVisible(true);
            }
        });
    }
    return menuItem;
}
Also used : ActionListener(java.awt.event.ActionListener) Message(org.zaproxy.zap.extension.httppanel.Message) HttpMessage(org.parosproxy.paros.network.HttpMessage) ActionEvent(java.awt.event.ActionEvent) ZapMenuItem(org.zaproxy.zap.view.ZapMenuItem) HttpMessage(org.parosproxy.paros.network.HttpMessage)

Example 42 with ZapMenuItem

use of org.zaproxy.zap.view.ZapMenuItem in project zaproxy by zaproxy.

the class ExtensionLog4j method getMenuGarbageCollect.

private ZapMenuItem getMenuGarbageCollect() {
    if (menuGarbageCollect == null) {
        menuGarbageCollect = new ZapMenuItem("log4j.tools.menu.gc");
        menuGarbageCollect.addActionListener(new java.awt.event.ActionListener() {

            @Override
            public void actionPerformed(java.awt.event.ActionEvent e) {
                Runtime.getRuntime().gc();
            }
        });
    }
    return menuGarbageCollect;
}
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