use of org.parosproxy.paros.extension.ExtensionPopupMenuItem in project zaproxy by zaproxy.
the class PopupMenuItemContextDataDriven method reCreateSubMenu.
protected void reCreateSubMenu(SiteNode sn) {
final List<JMenuItem> mainPopupMenuItems = View.getSingleton().getPopupList();
for (ExtensionPopupMenuItem menu : subMenus) {
mainPopupMenuItems.remove(menu);
}
subMenus.clear();
Session session = Model.getSingleton().getSession();
List<Context> contexts = session.getContexts();
for (Context context : contexts) {
if (context.isIncluded(sn)) {
ExtensionPopupMenuItem piicm = createPopupDataDrivenNodeMenu(context);
piicm.setMenuIndex(this.getMenuIndex());
mainPopupMenuItems.add(piicm);
this.subMenus.add(piicm);
}
}
}
use of org.parosproxy.paros.extension.ExtensionPopupMenuItem in project zaproxy by zaproxy.
the class PopupMenuItemContextExclude method reCreateSubMenu.
protected void reCreateSubMenu() {
final List<JMenuItem> mainPopupMenuItems = View.getSingleton().getPopupList();
for (ExtensionPopupMenuItem menu : subMenus) {
mainPopupMenuItems.remove(menu);
}
subMenus.clear();
Session session = Model.getSingleton().getSession();
List<Context> contexts = session.getContexts();
for (Context context : contexts) {
ExtensionPopupMenuItem piicm = createPopupExcludeFromContextMenu(context);
piicm.setMenuIndex(this.getMenuIndex());
mainPopupMenuItems.add(piicm);
this.subMenus.add(piicm);
}
}
use of org.parosproxy.paros.extension.ExtensionPopupMenuItem in project zaproxy by zaproxy.
the class MainPopupMenu method showImpl.
private synchronized void showImpl(PopupMenuInvokerWrapper invoker, final int x, final int y) {
for (int i = 0; i < getComponentCount(); i++) {
final Component component = getComponent(i);
try {
if (component != null && component instanceof ExtensionPopupMenuItem) {
ExtensionPopupMenuItem menuItem = (ExtensionPopupMenuItem) component;
// ZAP: prevents a NullPointerException when the treeSite doesn't have a node selected and a popup menu option (Delete/Purge) is selected
menuItem.setVisible(invoker.isEnable(menuItem));
if (Control.getSingleton().getMode().equals(Mode.safe) && !menuItem.isSafe()) {
// Safe mode, disable all nor safe menu items
menuItem.setEnabled(false);
}
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
for (int i = 0; i < itemList.size(); i++) {
final JMenuItem menuItem = itemList.get(i);
if (menuItem instanceof ExtensionPopupMenuItem) {
handleMenuItem(invoker, (ExtensionPopupMenuItem) menuItem);
} else if (menuItem instanceof ExtensionPopupMenu) {
ExtensionPopupMenu item = (ExtensionPopupMenu) menuItem;
prepareShow(item);
handleMenu(invoker, item);
}
}
PopupMenuUtils.removeTopAndBottomSeparators(this);
if (PopupMenuUtils.isAtLeastOneChildComponentVisible(this)) {
super.show(invoker.getComponent(), x, y);
}
}
Aggregations