From 658c9c352359bb3bbf9ad6d9f1726f8bab025b25 Mon Sep 17 00:00:00 2001 From: thc202 Date: Sun, 15 Dec 2024 10:15:08 +0000 Subject: [PATCH] websocket: fix duplicated New Context menu item Override the "new" method that makes use of weights to return the proper menu item implementation, which corrects both the location it appears in and its functionality. Remove the "old" method as it's no longer used/needed. Signed-off-by: thc202 --- addOns/websocket/CHANGELOG.md | 3 +++ .../websocket/ui/PopupIncludeWebSocketContextMenu.java | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/addOns/websocket/CHANGELOG.md b/addOns/websocket/CHANGELOG.md index 478a1af545a..5eaea933633 100644 --- a/addOns/websocket/CHANGELOG.md +++ b/addOns/websocket/CHANGELOG.md @@ -7,6 +7,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Changed - Update minimum ZAP version to 2.16.0. +### Fixed +- Correct location/function of New Context context menu item. + ## [31] - 2024-05-07 ### Added - Support for menu weights (Issue 8369) diff --git a/addOns/websocket/src/main/java/org/zaproxy/zap/extension/websocket/ui/PopupIncludeWebSocketContextMenu.java b/addOns/websocket/src/main/java/org/zaproxy/zap/extension/websocket/ui/PopupIncludeWebSocketContextMenu.java index 37fa908096d..6f531e21817 100644 --- a/addOns/websocket/src/main/java/org/zaproxy/zap/extension/websocket/ui/PopupIncludeWebSocketContextMenu.java +++ b/addOns/websocket/src/main/java/org/zaproxy/zap/extension/websocket/ui/PopupIncludeWebSocketContextMenu.java @@ -54,8 +54,10 @@ public boolean isEnableForComponent(Component invoker) { } @Override - protected ExtensionPopupMenuItem createPopupIncludeInContextMenu() { - return new PopupIncludeWebSocketInContextMenu(); + protected ExtensionPopupMenuItem createPopupIncludeInContextMenu(int weight) { + PopupIncludeWebSocketInContextMenu menu = new PopupIncludeWebSocketInContextMenu(); + menu.setWeight(weight); + return menu; } @Override