diff --git a/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/gui/tracermi/RemoteMethodInvocationDialog.java b/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/gui/tracermi/RemoteMethodInvocationDialog.java index 2c4af6ab74..5d9314d92e 100644 --- a/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/gui/tracermi/RemoteMethodInvocationDialog.java +++ b/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/gui/tracermi/RemoteMethodInvocationDialog.java @@ -18,6 +18,7 @@ package ghidra.app.plugin.core.debug.gui.tracermi; import java.awt.Component; import java.beans.*; import java.util.*; +import java.util.function.BiConsumer; import javax.swing.Icon; import javax.swing.JLabel; @@ -112,11 +113,17 @@ public class RemoteMethodInvocationDialog extends AbstractDebuggerParameterDialo return arguments; } + @SuppressWarnings("unchecked") + private void withParamType(RemoteParameter parameter, ValStr value, + BiConsumer, ValStr> func) { + func.accept((Class) parameterType(parameter), (ValStr) value); + } + @Override protected void parameterSaveValue(RemoteParameter parameter, SaveState state, String key, ValStr value) { - ConfigStateField.putState(state, parameterType(parameter).asSubclass(Object.class), key, - value.val()); + withParamType(parameter, value, + (t, v) -> ConfigStateField.putState(state, t, key, v.val())); } @Override diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/objects/components/DebuggerMethodInvocationDialog.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/objects/components/DebuggerMethodInvocationDialog.java deleted file mode 100644 index 238b313753..0000000000 --- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/objects/components/DebuggerMethodInvocationDialog.java +++ /dev/null @@ -1,88 +0,0 @@ -/* ### - * IP: GHIDRA - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package ghidra.app.plugin.core.debug.gui.objects.components; - -import java.util.Map; -import java.util.Set; - -import javax.swing.Icon; - -import ghidra.app.plugin.core.debug.gui.AbstractDebuggerParameterDialog; -import ghidra.debug.api.ValStr; -import ghidra.framework.options.SaveState; -import ghidra.framework.plugintool.AutoConfigState.ConfigStateField; -import ghidra.framework.plugintool.PluginTool; -import ghidra.trace.model.target.iface.TraceMethod; -import ghidra.trace.model.target.iface.TraceMethod.ParameterDescription; - -@Deprecated(forRemoval = true, since = "11.3") -public class DebuggerMethodInvocationDialog - extends AbstractDebuggerParameterDialog> { - - public DebuggerMethodInvocationDialog(PluginTool tool, String title, String buttonText, - Icon buttonIcon) { - super(tool, title, buttonText, buttonIcon); - } - - @Override - protected String parameterName(ParameterDescription parameter) { - return parameter.name; - } - - @Override - protected Class parameterType(ParameterDescription parameter) { - return parameter.type; - } - - @Override - protected String parameterLabel(ParameterDescription parameter) { - return parameter.display; - } - - @Override - protected String parameterToolTip(ParameterDescription parameter) { - return parameter.description; - } - - @Override - protected ValStr parameterDefault(ParameterDescription parameter) { - return ValStr.from(parameter.defaultValue); - } - - @Override - protected Set parameterChoices(ParameterDescription parameter) { - return parameter.choices; - } - - @Override - protected Map> validateArguments( - Map> parameters, Map> arguments) { - Map args = ValStr.toPlainMap(arguments); - return ValStr.fromPlainMap(TraceMethod.validateArguments(parameters, args, false)); - } - - @Override - protected void parameterSaveValue(ParameterDescription parameter, SaveState state, - String key, ValStr value) { - ConfigStateField.putState(state, parameter.type.asSubclass(Object.class), key, value.val()); - } - - @Override - protected ValStr parameterLoadValue(ParameterDescription parameter, SaveState state, - String key) { - return ValStr.from(ConfigStateField.getState(state, parameter.type, key)); - } -}