use of org.zaproxy.zap.view.ZapMenuItem in project zaproxy by zaproxy.
the class ExtensionBreak method getMenuAddHttpBreakpoint.
private ZapMenuItem getMenuAddHttpBreakpoint() {
if (menuHttpBreakpoint == null) {
menuHttpBreakpoint = new ZapMenuItem("menu.tools.brk.custom", getView().getMenuShortcutKeyStroke(KeyEvent.VK_A, 0, false));
menuHttpBreakpoint.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
// Check to see if anything is selected in the main tabs
String url = "";
Component c = getView().getMainFrame().getFocusOwner();
if (c != null) {
if (c instanceof JList) {
// Handles the history list and similar
@SuppressWarnings("rawtypes") Object sel = ((JList) c).getSelectedValue();
try {
if (sel != null && sel instanceof HistoryReference && ((HistoryReference) sel).getURI() != null) {
url = ((HistoryReference) sel).getURI().toString();
}
} catch (Exception e1) {
// Ignore
}
} else if (c instanceof JTree) {
// Handles the Sites tree
TreePath path = ((JTree) c).getSelectionPath();
try {
if (path != null && path.getLastPathComponent() instanceof SiteNode) {
url = ((SiteNode) path.getLastPathComponent()).getHistoryReference().getURI().toString();
}
} catch (Exception e1) {
// Ignore
}
}
}
httpBreakpoints.handleAddBreakpoint(url);
}
});
}
return menuHttpBreakpoint;
}
use of org.zaproxy.zap.view.ZapMenuItem in project zaproxy by zaproxy.
the class ExtensionEdit method getMenuFind.
/**
* This method initializes menuFind
*
* @return the 'Find' menu item.
*/
private ZapMenuItem getMenuFind() {
if (menuFind == null) {
menuFind = new ZapMenuItem("menu.edit.find", getFindDefaultKeyStroke());
menuFind.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
showFindDialog(getView().getMainFrame(), null);
}
});
}
return menuFind;
}
use of org.zaproxy.zap.view.ZapMenuItem in project zaproxy by zaproxy.
the class ExtensionActiveScan method getMenuItemPolicy.
/**
* This method initializes menuItemPolicy
*
* @return javax.swing.JMenuItem
*/
private ZapMenuItem getMenuItemPolicy() {
if (menuItemPolicy == null) {
menuItemPolicy = new ZapMenuItem("menu.analyse.scanPolicy", getView().getMenuShortcutKeyStroke(KeyEvent.VK_P, 0, false));
menuItemPolicy.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
showPolicyManagerDialog();
}
});
}
return menuItemPolicy;
}
use of org.zaproxy.zap.view.ZapMenuItem in project zaproxy by zaproxy.
the class ExtensionActiveScan method getMenuItemCustomScan.
private ZapMenuItem getMenuItemCustomScan() {
if (menuItemCustomScan == null) {
menuItemCustomScan = new ZapMenuItem("menu.tools.ascanadv", getView().getMenuShortcutKeyStroke(KeyEvent.VK_A, KeyEvent.ALT_DOWN_MASK, false));
menuItemCustomScan.setEnabled(Control.getSingleton().getMode() != Mode.safe);
menuItemCustomScan.addActionListener(e -> showCustomScanDialog((Target) null));
}
return menuItemCustomScan;
}
use of org.zaproxy.zap.view.ZapMenuItem in project zaproxy by zaproxy.
the class ExtensionKeyboard method addAllMenuItems.
private void addAllMenuItems(List<KeyboardShortcut> kss, JMenu menu, boolean reset) {
for (Component c : menu.getMenuComponents()) {
if (c instanceof ZapMenuItem) {
kss.add(menuToShortcut((ZapMenuItem) c, reset));
} else if (c instanceof JMenu) {
addAllMenuItems(kss, (JMenu) c, reset);
} else if (c instanceof JMenuItem) {
JMenuItem menuItem = (JMenuItem) c;
logger.debug("Unable to set accelerators on menu " + menuItem.getText());
}
}
}
Aggregations