From 55c442800f525a8f95dfbbfc2fd7422959c894a7 Mon Sep 17 00:00:00 2001 From: Aryan Gupta Date: Sat, 23 Mar 2024 17:50:31 +0100 Subject: [PATCH] set break options handler in core Signed-off-by: Aryan Gupta --- .../org/zaproxy/addon/brk/ExtensionBreak.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/addOns/brk/src/main/java/org/zaproxy/addon/brk/ExtensionBreak.java b/addOns/brk/src/main/java/org/zaproxy/addon/brk/ExtensionBreak.java index 07a98a58374..ee895ff5c31 100644 --- a/addOns/brk/src/main/java/org/zaproxy/addon/brk/ExtensionBreak.java +++ b/addOns/brk/src/main/java/org/zaproxy/addon/brk/ExtensionBreak.java @@ -22,6 +22,9 @@ import java.awt.Component; import java.awt.EventQueue; import java.awt.event.KeyEvent; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -43,6 +46,7 @@ import org.parosproxy.paros.extension.ExtensionHookView; import org.parosproxy.paros.extension.OptionsChangedListener; import org.parosproxy.paros.extension.SessionChangedListener; +import org.parosproxy.paros.extension.option.ExtensionOption; import org.parosproxy.paros.model.HistoryReference; import org.parosproxy.paros.model.OptionsParam; import org.parosproxy.paros.model.Session; @@ -115,6 +119,32 @@ public String getUIName() { @Override public void init() { serialisationRequiredListeners = Collections.synchronizedList(new ArrayList<>(1)); + try { + ExtensionOption extOption = + Control.getSingleton().getExtensionLoader().getExtension(ExtensionOption.class); + Class breakOptionsHandlerClass = + getClass() + .getClassLoader() + .loadClass("org.parosproxy.paros.extension.option.BreakOptionsHandler"); + Method method = + extOption + .getClass() + .getDeclaredMethod("setBreakOptionsHandler", breakOptionsHandlerClass); + method.invoke( + extOption, + Proxy.newProxyInstance( + breakOptionsHandlerClass.getClassLoader(), + new Class[] {breakOptionsHandlerClass}, + (proxy, m, args) -> { + getOptionsParam().setShowIgnoreFilesButtons((Boolean) args[0]); + return null; + })); + } catch (NoSuchMethodException + | IllegalAccessException + | InvocationTargetException + | ClassNotFoundException e) { + throw new RuntimeException(e); + } } public BreakpointManagementInterface getBreakpointManagementInterface() {