Skip to content

Commit

Permalink
set break options handler in core
Browse files Browse the repository at this point in the history
Signed-off-by: Aryan Gupta <[email protected]>
  • Loading branch information
aryangupta701 committed Mar 25, 2024
1 parent 04f3dbb commit 55c4428
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions addOns/brk/src/main/java/org/zaproxy/addon/brk/ExtensionBreak.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 55c4428

Please sign in to comment.