GP-4527: improvements to traceRMI dialogs

This commit is contained in:
d-millar 2024-04-16 17:46:25 +00:00
parent 20f5bd9bec
commit 73d656d6b1
4 changed files with 34 additions and 9 deletions

View File

@ -15,13 +15,31 @@
*/
package ghidra.app.plugin.core.debug.gui.tracermi;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.beans.*;
import java.util.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyEditor;
import java.beans.PropertyEditorManager;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import javax.swing.*;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.border.EmptyBorder;
import org.apache.commons.collections4.BidiMap;
@ -32,6 +50,7 @@ import org.jdom.Element;
import docking.DialogComponentProvider;
import ghidra.app.plugin.core.debug.gui.DebuggerResources;
import ghidra.app.plugin.core.debug.service.tracermi.TraceRmiTarget;
import ghidra.app.plugin.core.debug.utils.MiscellaneousUtils;
import ghidra.dbg.target.schema.SchemaContext;
import ghidra.debug.api.tracermi.RemoteParameter;
@ -289,13 +308,18 @@ public class RemoteMethodInvocationDialog extends DialogComponentProvider
pairPanel.removeAll();
paramEditors.clear();
for (RemoteParameter param : parameters.values()) {
JLabel label = new JLabel(param.display());
String text = param.display().equals("") ? param.name() : param.display();
JLabel label = new JLabel(text);
label.setToolTipText(param.description());
pairPanel.add(label);
PropertyEditor editor = createEditor(param);
Object val = computeMemorizedValue(param);
editor.setValue(val);
if (val == null || val.equals(TraceRmiTarget.Missing.MISSING)) {
editor.setValue("");
} else {
editor.setValue(val);
}
editor.addPropertyChangeListener(this);
pairPanel.add(MiscellaneousUtils.getEditorComponent(editor));
paramEditors.put(param, editor);

View File

@ -232,7 +232,7 @@ public class TraceRmiTarget extends AbstractTarget {
return null;
}
private enum Missing {
public enum Missing {
MISSING; // The argument requires a prompt
}

View File

@ -135,7 +135,8 @@ public class DebuggerMethodActionsPlugin extends Plugin implements PopupActionPr
List<DockingActionIf> result = new ArrayList<>();
for (ActionEntry entry : target.collectActions(null, context).values()) {
if (entry.requiresPrompt() || entry.builtIn()) {
//if (entry.requiresPrompt() || entry.builtIn()) {
if (!entry.isEnabled() || entry.builtIn()) {
continue;
}
result.add(new InvokeActionEntryAction(entry));

View File

@ -166,7 +166,7 @@ public class TargetActionTask extends Task {
@Override
public void run(TaskMonitor monitor) throws CancelledException {
try {
entry.run(false);
entry.run(entry.requiresPrompt());
}
catch (Throwable e) {
reportError(e);