mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 02:09:44 +02:00
GP-3349 added support for mulitple default action context providers. Previously, all default (non-focused) context was provided by the Listing. Now the default provider is registered for each ActionContext class.
This commit is contained in:
parent
8aa9c8be3a
commit
5da5af23fb
149 changed files with 1354 additions and 1232 deletions
|
@ -15,10 +15,10 @@
|
||||||
*/
|
*/
|
||||||
package ghidra.app.plugin.core.debug.gui;
|
package ghidra.app.plugin.core.debug.gui;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
import ghidra.trace.model.Trace;
|
import ghidra.trace.model.Trace;
|
||||||
|
|
||||||
public class DebuggerSnapActionContext extends ActionContext {
|
public class DebuggerSnapActionContext extends DefaultActionContext {
|
||||||
private final Trace trace;
|
private final Trace trace;
|
||||||
private final long snap;
|
private final long snap;
|
||||||
|
|
||||||
|
|
|
@ -18,10 +18,10 @@ package ghidra.app.plugin.core.debug.gui.breakpoint;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
import ghidra.trace.model.breakpoint.TraceBreakpoint;
|
import ghidra.trace.model.breakpoint.TraceBreakpoint;
|
||||||
|
|
||||||
public class DebuggerBreakpointLocationsActionContext extends ActionContext {
|
public class DebuggerBreakpointLocationsActionContext extends DefaultActionContext {
|
||||||
private final Collection<BreakpointLocationRow> selection;
|
private final Collection<BreakpointLocationRow> selection;
|
||||||
|
|
||||||
public DebuggerBreakpointLocationsActionContext(Collection<BreakpointLocationRow> selection) {
|
public DebuggerBreakpointLocationsActionContext(Collection<BreakpointLocationRow> selection) {
|
||||||
|
|
|
@ -18,10 +18,10 @@ package ghidra.app.plugin.core.debug.gui.breakpoint;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
import ghidra.app.services.LogicalBreakpoint;
|
import ghidra.app.services.LogicalBreakpoint;
|
||||||
|
|
||||||
public class DebuggerLogicalBreakpointsActionContext extends ActionContext {
|
public class DebuggerLogicalBreakpointsActionContext extends DefaultActionContext {
|
||||||
private final Collection<LogicalBreakpointRow> selection;
|
private final Collection<LogicalBreakpointRow> selection;
|
||||||
|
|
||||||
public DebuggerLogicalBreakpointsActionContext(Collection<LogicalBreakpointRow> selection) {
|
public DebuggerLogicalBreakpointsActionContext(Collection<LogicalBreakpointRow> selection) {
|
||||||
|
@ -34,7 +34,7 @@ public class DebuggerLogicalBreakpointsActionContext extends ActionContext {
|
||||||
|
|
||||||
public Collection<LogicalBreakpoint> getBreakpoints() {
|
public Collection<LogicalBreakpoint> getBreakpoints() {
|
||||||
return selection.stream()
|
return selection.stream()
|
||||||
.map(row -> row.getLogicalBreakpoint())
|
.map(row -> row.getLogicalBreakpoint())
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,9 +15,9 @@
|
||||||
*/
|
*/
|
||||||
package ghidra.app.plugin.core.debug.gui.breakpoint;
|
package ghidra.app.plugin.core.debug.gui.breakpoint;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
|
|
||||||
// TODO: Any granularity, or just one suggested action on the global tool?
|
// TODO: Any granularity, or just one suggested action on the global tool?
|
||||||
public class DebuggerMakeBreakpointsEffectiveActionContext extends ActionContext {
|
public class DebuggerMakeBreakpointsEffectiveActionContext extends DefaultActionContext {
|
||||||
// Nothing to add
|
// Nothing to add
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package ghidra.app.plugin.core.debug.gui.console;
|
package ghidra.app.plugin.core.debug.gui.console;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
|
|
||||||
public class LogRowConsoleActionContext extends ActionContext {
|
public class LogRowConsoleActionContext extends DefaultActionContext {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,10 +17,10 @@ package ghidra.app.plugin.core.debug.gui.listing;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
import ghidra.framework.model.DomainFile;
|
import ghidra.framework.model.DomainFile;
|
||||||
|
|
||||||
public class DebuggerOpenProgramActionContext extends ActionContext {
|
public class DebuggerOpenProgramActionContext extends DefaultActionContext {
|
||||||
private final DomainFile df;
|
private final DomainFile df;
|
||||||
private final int hashCode;
|
private final int hashCode;
|
||||||
|
|
||||||
|
|
|
@ -18,10 +18,10 @@ package ghidra.app.plugin.core.debug.gui.memory;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
import docking.widgets.table.GTable;
|
import docking.widgets.table.GTable;
|
||||||
|
|
||||||
public class DebuggerRegionActionContext extends ActionContext {
|
public class DebuggerRegionActionContext extends DefaultActionContext {
|
||||||
private final Set<RegionRow> selectedRegions;
|
private final Set<RegionRow> selectedRegions;
|
||||||
|
|
||||||
public DebuggerRegionActionContext(DebuggerRegionsProvider provider,
|
public DebuggerRegionActionContext(DebuggerRegionsProvider provider,
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.util.List;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
|
import docking.DefaultActionContext;
|
||||||
import docking.action.DockingAction;
|
import docking.action.DockingAction;
|
||||||
import docking.action.builder.ToggleActionBuilder;
|
import docking.action.builder.ToggleActionBuilder;
|
||||||
import ghidra.app.plugin.core.debug.DebuggerPluginPackage;
|
import ghidra.app.plugin.core.debug.DebuggerPluginPackage;
|
||||||
|
@ -96,27 +97,27 @@ public class MemviewProvider extends ComponentProviderAdapter {
|
||||||
tool.addLocalAction(this, zoomOutTAction);
|
tool.addLocalAction(this, zoomOutTAction);
|
||||||
|
|
||||||
new ToggleActionBuilder("Toggle Layout", plugin.getName()) //
|
new ToggleActionBuilder("Toggle Layout", plugin.getName()) //
|
||||||
//.menuPath("&Toggle layout") //
|
//.menuPath("&Toggle layout") //
|
||||||
.toolBarIcon(AbstractRefreshAction.ICON)
|
.toolBarIcon(AbstractRefreshAction.ICON)
|
||||||
.helpLocation(new HelpLocation(plugin.getName(), "toggle_layout")) //
|
.helpLocation(new HelpLocation(plugin.getName(), "toggle_layout")) //
|
||||||
.onAction(ctx -> performToggleLayout(ctx))
|
.onAction(ctx -> performToggleLayout(ctx))
|
||||||
.buildAndInstallLocal(this);
|
.buildAndInstallLocal(this);
|
||||||
|
|
||||||
new ToggleActionBuilder("Toggle Process Trace", plugin.getName()) //
|
new ToggleActionBuilder("Toggle Process Trace", plugin.getName()) //
|
||||||
//.menuPath("&Toggle layout") //
|
//.menuPath("&Toggle layout") //
|
||||||
.toolBarIcon(DebuggerResources.ICON_SYNC)
|
.toolBarIcon(DebuggerResources.ICON_SYNC)
|
||||||
.helpLocation(new HelpLocation(plugin.getName(), "toggle_process_trace")) //
|
.helpLocation(new HelpLocation(plugin.getName(), "toggle_process_trace")) //
|
||||||
.onAction(ctx -> performToggleTrace(ctx))
|
.onAction(ctx -> performToggleTrace(ctx))
|
||||||
.selected(false)
|
.selected(false)
|
||||||
.buildAndInstallLocal(this);
|
.buildAndInstallLocal(this);
|
||||||
|
|
||||||
new ToggleActionBuilder("Apply Filter To Panel", plugin.getName()) //
|
new ToggleActionBuilder("Apply Filter To Panel", plugin.getName()) //
|
||||||
//.menuPath("&Toggle layout") //
|
//.menuPath("&Toggle layout") //
|
||||||
.toolBarIcon(DebuggerResources.ICON_FILTER)
|
.toolBarIcon(DebuggerResources.ICON_FILTER)
|
||||||
.helpLocation(new HelpLocation(plugin.getName(), "apply_to_panel")) //
|
.helpLocation(new HelpLocation(plugin.getName(), "apply_to_panel")) //
|
||||||
.onAction(ctx -> performApplyFilterToPanel(ctx))
|
.onAction(ctx -> performApplyFilterToPanel(ctx))
|
||||||
.selected(true)
|
.selected(true)
|
||||||
.buildAndInstallLocal(this);
|
.buildAndInstallLocal(this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,10 +177,10 @@ public class MemviewProvider extends ComponentProviderAdapter {
|
||||||
@Override
|
@Override
|
||||||
public ActionContext getActionContext(MouseEvent event) {
|
public ActionContext getActionContext(MouseEvent event) {
|
||||||
if (event != null && event.getSource() == mainPanel) {
|
if (event != null && event.getSource() == mainPanel) {
|
||||||
return new ActionContext(this, mainPanel);
|
return new DefaultActionContext(this, mainPanel);
|
||||||
}
|
}
|
||||||
if (event != null && event.getSource() == memviewPanel) {
|
if (event != null && event.getSource() == memviewPanel) {
|
||||||
return new ActionContext(this, memviewPanel);
|
return new DefaultActionContext(this, memviewPanel);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -217,7 +218,7 @@ public class MemviewProvider extends ComponentProviderAdapter {
|
||||||
public void goTo(int x, int y) {
|
public void goTo(int x, int y) {
|
||||||
Rectangle bounds = scrollPane.getBounds();
|
Rectangle bounds = scrollPane.getBounds();
|
||||||
scrollPane.getViewport()
|
scrollPane.getViewport()
|
||||||
.scrollRectToVisible(new Rectangle(x, y, bounds.width, bounds.height));
|
.scrollRectToVisible(new Rectangle(x, y, bounds.width, bounds.height));
|
||||||
scrollPane.getViewport().doLayout();
|
scrollPane.getViewport().doLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,11 +19,11 @@ import java.awt.Component;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import docking.ActionContext;
|
|
||||||
import docking.ComponentProvider;
|
import docking.ComponentProvider;
|
||||||
|
import docking.DefaultActionContext;
|
||||||
import ghidra.trace.model.target.TraceObjectValue;
|
import ghidra.trace.model.target.TraceObjectValue;
|
||||||
|
|
||||||
public class DebuggerObjectActionContext extends ActionContext {
|
public class DebuggerObjectActionContext extends DefaultActionContext {
|
||||||
private final List<TraceObjectValue> objectValues;
|
private final List<TraceObjectValue> objectValues;
|
||||||
|
|
||||||
public DebuggerObjectActionContext(Collection<TraceObjectValue> objectValues,
|
public DebuggerObjectActionContext(Collection<TraceObjectValue> objectValues,
|
||||||
|
|
|
@ -17,10 +17,10 @@ package ghidra.app.plugin.core.debug.gui.modules;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
import ghidra.trace.model.modules.TraceModule;
|
import ghidra.trace.model.modules.TraceModule;
|
||||||
|
|
||||||
public class DebuggerMissingModuleActionContext extends ActionContext {
|
public class DebuggerMissingModuleActionContext extends DefaultActionContext {
|
||||||
private final TraceModule module;
|
private final TraceModule module;
|
||||||
private final int hashCode;
|
private final int hashCode;
|
||||||
|
|
||||||
|
|
|
@ -18,10 +18,10 @@ package ghidra.app.plugin.core.debug.gui.modules;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
import docking.widgets.table.GTable;
|
import docking.widgets.table.GTable;
|
||||||
|
|
||||||
public class DebuggerModuleActionContext extends ActionContext {
|
public class DebuggerModuleActionContext extends DefaultActionContext {
|
||||||
private final Set<ModuleRow> selectedModules;
|
private final Set<ModuleRow> selectedModules;
|
||||||
|
|
||||||
public DebuggerModuleActionContext(DebuggerModulesProvider provider,
|
public DebuggerModuleActionContext(DebuggerModulesProvider provider,
|
||||||
|
|
|
@ -18,10 +18,10 @@ package ghidra.app.plugin.core.debug.gui.modules;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
import docking.widgets.table.GTable;
|
import docking.widgets.table.GTable;
|
||||||
|
|
||||||
public class DebuggerSectionActionContext extends ActionContext {
|
public class DebuggerSectionActionContext extends DefaultActionContext {
|
||||||
private final Set<SectionRow> selectedSections;
|
private final Set<SectionRow> selectedSections;
|
||||||
//private final Set<ModuleRecord> involvedModules;
|
//private final Set<ModuleRecord> involvedModules;
|
||||||
|
|
||||||
|
|
|
@ -18,10 +18,10 @@ package ghidra.app.plugin.core.debug.gui.modules;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
import docking.widgets.table.GTable;
|
import docking.widgets.table.GTable;
|
||||||
|
|
||||||
public class DebuggerStaticMappingActionContext extends ActionContext {
|
public class DebuggerStaticMappingActionContext extends DefaultActionContext {
|
||||||
private final Collection<StaticMappingRow> selected;
|
private final Collection<StaticMappingRow> selected;
|
||||||
|
|
||||||
public DebuggerStaticMappingActionContext(DebuggerStaticMappingProvider provider,
|
public DebuggerStaticMappingActionContext(DebuggerStaticMappingProvider provider,
|
||||||
|
|
|
@ -20,14 +20,8 @@ import java.awt.Color;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.lang.invoke.MethodHandles;
|
import java.lang.invoke.MethodHandles;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
@ -40,12 +34,8 @@ import javax.swing.tree.TreePath;
|
||||||
import org.apache.commons.collections4.map.LinkedMap;
|
import org.apache.commons.collections4.map.LinkedMap;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.*;
|
||||||
import docking.WindowPosition;
|
import docking.action.*;
|
||||||
import docking.action.DockingAction;
|
|
||||||
import docking.action.DockingActionIf;
|
|
||||||
import docking.action.MenuData;
|
|
||||||
import docking.action.ToggleDockingAction;
|
|
||||||
import docking.action.builder.ActionBuilder;
|
import docking.action.builder.ActionBuilder;
|
||||||
import docking.action.builder.ToggleActionBuilder;
|
import docking.action.builder.ToggleActionBuilder;
|
||||||
import docking.widgets.OptionDialog;
|
import docking.widgets.OptionDialog;
|
||||||
|
@ -56,107 +46,30 @@ import generic.theme.GColor;
|
||||||
import ghidra.app.plugin.core.debug.DebuggerCoordinates;
|
import ghidra.app.plugin.core.debug.DebuggerCoordinates;
|
||||||
import ghidra.app.plugin.core.debug.DebuggerPluginPackage;
|
import ghidra.app.plugin.core.debug.DebuggerPluginPackage;
|
||||||
import ghidra.app.plugin.core.debug.gui.DebuggerResources;
|
import ghidra.app.plugin.core.debug.gui.DebuggerResources;
|
||||||
import ghidra.app.plugin.core.debug.gui.DebuggerResources.AbstractAttachAction;
|
import ghidra.app.plugin.core.debug.gui.DebuggerResources.*;
|
||||||
import ghidra.app.plugin.core.debug.gui.DebuggerResources.AbstractConsoleAction;
|
import ghidra.app.plugin.core.debug.gui.objects.actions.*;
|
||||||
import ghidra.app.plugin.core.debug.gui.DebuggerResources.AbstractDetachAction;
|
import ghidra.app.plugin.core.debug.gui.objects.components.*;
|
||||||
import ghidra.app.plugin.core.debug.gui.DebuggerResources.AbstractInterruptAction;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.DebuggerResources.AbstractKillAction;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.DebuggerResources.AbstractLaunchAction;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.DebuggerResources.AbstractQuickLaunchAction;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.DebuggerResources.AbstractRecordAction;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.DebuggerResources.AbstractRefreshAction;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.DebuggerResources.AbstractResumeAction;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.DebuggerResources.AbstractSetBreakpointAction;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.DebuggerResources.AbstractStepFinishAction;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.DebuggerResources.AbstractStepIntoAction;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.DebuggerResources.AbstractStepLastAction;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.DebuggerResources.AbstractStepOverAction;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.DebuggerResources.AbstractToggleAction;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.objects.actions.DisplayAsGraphAction;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.objects.actions.DisplayAsTableAction;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.objects.actions.DisplayAsTreeAction;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.objects.actions.DisplayAsXMLAction;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.objects.actions.DisplayFilteredGraphAction;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.objects.actions.DisplayFilteredTableAction;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.objects.actions.DisplayFilteredTreeAction;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.objects.actions.DisplayFilteredXMLAction;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.objects.actions.DisplayMethodsAction;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.objects.actions.ExportAsFactsAction;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.objects.actions.ExportAsXMLAction;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.objects.actions.ImportFromFactsAction;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.objects.actions.ImportFromXMLAction;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.objects.actions.OpenWinDbgTraceAction;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.objects.actions.SetTimeoutAction;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.objects.components.DebuggerAttachDialog;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.objects.components.DebuggerBreakpointDialog;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.objects.components.DebuggerMethodInvocationDialog;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.objects.components.DummyTargetObject;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.objects.components.GenericDebuggerProgramLaunchOffer;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.objects.components.ObjectAttributeColumn;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.objects.components.ObjectAttributeRow;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.objects.components.ObjectElementColumn;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.objects.components.ObjectElementRow;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.objects.components.ObjectEnumeratedColumnTableModel;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.objects.components.ObjectNode;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.objects.components.ObjectPane;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.objects.components.ObjectTable;
|
|
||||||
import ghidra.app.plugin.core.debug.gui.objects.components.ObjectTree;
|
|
||||||
import ghidra.app.plugin.core.debug.mapping.DebuggerMemoryMapper;
|
import ghidra.app.plugin.core.debug.mapping.DebuggerMemoryMapper;
|
||||||
import ghidra.app.script.GhidraScript;
|
import ghidra.app.script.*;
|
||||||
import ghidra.app.script.GhidraScriptLoadException;
|
import ghidra.app.services.*;
|
||||||
import ghidra.app.script.GhidraScriptProvider;
|
|
||||||
import ghidra.app.script.GhidraScriptUtil;
|
|
||||||
import ghidra.app.script.GhidraState;
|
|
||||||
import ghidra.app.services.ConsoleService;
|
|
||||||
import ghidra.app.services.DebuggerListingService;
|
|
||||||
import ghidra.app.services.DebuggerModelService;
|
|
||||||
import ghidra.app.services.DebuggerStaticMappingService;
|
|
||||||
import ghidra.app.services.DebuggerTraceManagerService;
|
|
||||||
import ghidra.app.services.DebuggerTraceManagerService.ActivationCause;
|
import ghidra.app.services.DebuggerTraceManagerService.ActivationCause;
|
||||||
import ghidra.app.services.GraphDisplayBroker;
|
import ghidra.async.*;
|
||||||
import ghidra.app.services.TraceRecorder;
|
import ghidra.dbg.*;
|
||||||
import ghidra.async.AsyncFence;
|
|
||||||
import ghidra.async.AsyncUtils;
|
|
||||||
import ghidra.async.TypeSpec;
|
|
||||||
import ghidra.dbg.AnnotatedDebuggerAttributeListener;
|
|
||||||
import ghidra.dbg.DebugModelConventions;
|
|
||||||
import ghidra.dbg.DebuggerModelListener;
|
|
||||||
import ghidra.dbg.DebuggerObjectModel;
|
|
||||||
import ghidra.dbg.DebuggerObjectModel.RefreshBehavior;
|
import ghidra.dbg.DebuggerObjectModel.RefreshBehavior;
|
||||||
import ghidra.dbg.error.DebuggerMemoryAccessException;
|
import ghidra.dbg.error.DebuggerMemoryAccessException;
|
||||||
import ghidra.dbg.target.TargetAccessConditioned;
|
import ghidra.dbg.target.*;
|
||||||
import ghidra.dbg.target.TargetAttachable;
|
|
||||||
import ghidra.dbg.target.TargetAttacher;
|
|
||||||
import ghidra.dbg.target.TargetBreakpointSpec;
|
|
||||||
import ghidra.dbg.target.TargetBreakpointSpecContainer;
|
|
||||||
import ghidra.dbg.target.TargetConfigurable;
|
|
||||||
import ghidra.dbg.target.TargetConsole.Channel;
|
import ghidra.dbg.target.TargetConsole.Channel;
|
||||||
import ghidra.dbg.target.TargetDetachable;
|
|
||||||
import ghidra.dbg.target.TargetExecutionStateful;
|
|
||||||
import ghidra.dbg.target.TargetExecutionStateful.TargetExecutionState;
|
import ghidra.dbg.target.TargetExecutionStateful.TargetExecutionState;
|
||||||
import ghidra.dbg.target.TargetFocusScope;
|
|
||||||
import ghidra.dbg.target.TargetInterpreter;
|
|
||||||
import ghidra.dbg.target.TargetInterruptible;
|
|
||||||
import ghidra.dbg.target.TargetKillable;
|
|
||||||
import ghidra.dbg.target.TargetLauncher;
|
|
||||||
import ghidra.dbg.target.TargetMethod;
|
|
||||||
import ghidra.dbg.target.TargetMethod.ParameterDescription;
|
import ghidra.dbg.target.TargetMethod.ParameterDescription;
|
||||||
import ghidra.dbg.target.TargetMethod.TargetParameterMap;
|
import ghidra.dbg.target.TargetMethod.TargetParameterMap;
|
||||||
import ghidra.dbg.target.TargetObject;
|
|
||||||
import ghidra.dbg.target.TargetProcess;
|
|
||||||
import ghidra.dbg.target.TargetResumable;
|
|
||||||
import ghidra.dbg.target.TargetSteppable;
|
|
||||||
import ghidra.dbg.target.TargetSteppable.TargetStepKind;
|
import ghidra.dbg.target.TargetSteppable.TargetStepKind;
|
||||||
import ghidra.dbg.target.TargetTogglable;
|
|
||||||
import ghidra.dbg.util.DebuggerCallbackReorderer;
|
import ghidra.dbg.util.DebuggerCallbackReorderer;
|
||||||
import ghidra.dbg.util.PathUtils;
|
import ghidra.dbg.util.PathUtils;
|
||||||
import ghidra.framework.model.Project;
|
import ghidra.framework.model.Project;
|
||||||
import ghidra.framework.options.AutoOptions;
|
import ghidra.framework.options.AutoOptions;
|
||||||
import ghidra.framework.options.SaveState;
|
import ghidra.framework.options.SaveState;
|
||||||
import ghidra.framework.options.annotation.AutoOptionDefined;
|
import ghidra.framework.options.annotation.AutoOptionDefined;
|
||||||
import ghidra.framework.plugintool.AutoConfigState;
|
import ghidra.framework.plugintool.*;
|
||||||
import ghidra.framework.plugintool.AutoService;
|
|
||||||
import ghidra.framework.plugintool.ComponentProviderAdapter;
|
|
||||||
import ghidra.framework.plugintool.annotation.AutoConfigStateField;
|
import ghidra.framework.plugintool.annotation.AutoConfigStateField;
|
||||||
import ghidra.framework.plugintool.annotation.AutoServiceConsumed;
|
import ghidra.framework.plugintool.annotation.AutoServiceConsumed;
|
||||||
import ghidra.program.model.address.Address;
|
import ghidra.program.model.address.Address;
|
||||||
|
@ -166,9 +79,7 @@ import ghidra.program.util.ProgramLocation;
|
||||||
import ghidra.program.util.ProgramSelection;
|
import ghidra.program.util.ProgramSelection;
|
||||||
import ghidra.trace.model.Trace;
|
import ghidra.trace.model.Trace;
|
||||||
import ghidra.trace.model.thread.TraceThread;
|
import ghidra.trace.model.thread.TraceThread;
|
||||||
import ghidra.util.HelpLocation;
|
import ghidra.util.*;
|
||||||
import ghidra.util.Msg;
|
|
||||||
import ghidra.util.Swing;
|
|
||||||
import ghidra.util.datastruct.PrivatelyQueuedListener;
|
import ghidra.util.datastruct.PrivatelyQueuedListener;
|
||||||
import ghidra.util.table.GhidraTable;
|
import ghidra.util.table.GhidraTable;
|
||||||
import ghidra.util.task.TaskMonitor;
|
import ghidra.util.task.TaskMonitor;
|
||||||
|
@ -793,7 +704,7 @@ public class DebuggerObjectsProvider extends ComponentProviderAdapter
|
||||||
plugin.fireObjectUpdated(object);
|
plugin.fireObjectUpdated(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
class ObjectActionContext extends ActionContext {
|
class ObjectActionContext extends DefaultActionContext {
|
||||||
|
|
||||||
private DebuggerObjectsProvider provider;
|
private DebuggerObjectsProvider provider;
|
||||||
|
|
||||||
|
@ -1766,7 +1677,7 @@ public class DebuggerObjectsProvider extends ComponentProviderAdapter
|
||||||
TargetObject result = null;
|
TargetObject result = null;
|
||||||
try {
|
try {
|
||||||
result = DebugModelConventions.findSuitable(TargetExecutionStateful.class, object)
|
result = DebugModelConventions.findSuitable(TargetExecutionStateful.class, object)
|
||||||
.get(100, TimeUnit.MILLISECONDS);
|
.get(100, TimeUnit.MILLISECONDS);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
// IGNORE
|
// IGNORE
|
||||||
|
|
|
@ -17,9 +17,9 @@ package ghidra.app.plugin.core.debug.gui.register;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
|
|
||||||
public class DebuggerAvailableRegistersActionContext extends ActionContext {
|
public class DebuggerAvailableRegistersActionContext extends DefaultActionContext {
|
||||||
private final Collection<AvailableRegisterRow> selection;
|
private final Collection<AvailableRegisterRow> selection;
|
||||||
|
|
||||||
public DebuggerAvailableRegistersActionContext(Collection<AvailableRegisterRow> selection) {
|
public DebuggerAvailableRegistersActionContext(Collection<AvailableRegisterRow> selection) {
|
||||||
|
|
|
@ -15,10 +15,10 @@
|
||||||
*/
|
*/
|
||||||
package ghidra.app.plugin.core.debug.gui.register;
|
package ghidra.app.plugin.core.debug.gui.register;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
import docking.widgets.table.GTable;
|
import docking.widgets.table.GTable;
|
||||||
|
|
||||||
public class DebuggerRegisterActionContext extends ActionContext {
|
public class DebuggerRegisterActionContext extends DefaultActionContext {
|
||||||
private final RegisterRow selected;
|
private final RegisterRow selected;
|
||||||
|
|
||||||
public DebuggerRegisterActionContext(DebuggerRegistersProvider provider, RegisterRow selected,
|
public DebuggerRegisterActionContext(DebuggerRegistersProvider provider, RegisterRow selected,
|
||||||
|
|
|
@ -17,9 +17,9 @@ package ghidra.app.plugin.core.debug.gui.stack;
|
||||||
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
|
|
||||||
public class DebuggerStackActionContext extends ActionContext {
|
public class DebuggerStackActionContext extends DefaultActionContext {
|
||||||
|
|
||||||
private final StackFrameRow frame;
|
private final StackFrameRow frame;
|
||||||
|
|
||||||
|
|
|
@ -19,14 +19,14 @@ import java.util.function.Function;
|
||||||
|
|
||||||
import javax.swing.tree.TreePath;
|
import javax.swing.tree.TreePath;
|
||||||
|
|
||||||
import docking.ActionContext;
|
|
||||||
import docking.ComponentProvider;
|
import docking.ComponentProvider;
|
||||||
|
import docking.DefaultActionContext;
|
||||||
import docking.widgets.tree.GTree;
|
import docking.widgets.tree.GTree;
|
||||||
import docking.widgets.tree.GTreeNode;
|
import docking.widgets.tree.GTreeNode;
|
||||||
import ghidra.app.services.DebuggerModelService;
|
import ghidra.app.services.DebuggerModelService;
|
||||||
import ghidra.dbg.DebuggerObjectModel;
|
import ghidra.dbg.DebuggerObjectModel;
|
||||||
|
|
||||||
public class DebuggerModelActionContext extends ActionContext {
|
public class DebuggerModelActionContext extends DefaultActionContext {
|
||||||
private final TreePath path;
|
private final TreePath path;
|
||||||
|
|
||||||
DebuggerModelActionContext(ComponentProvider provider, TreePath path, GTree tree) {
|
DebuggerModelActionContext(ComponentProvider provider, TreePath path, GTree tree) {
|
||||||
|
|
|
@ -15,11 +15,11 @@
|
||||||
*/
|
*/
|
||||||
package ghidra.app.plugin.core.debug.gui.thread;
|
package ghidra.app.plugin.core.debug.gui.thread;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
import ghidra.trace.model.Trace;
|
import ghidra.trace.model.Trace;
|
||||||
import ghidra.trace.model.thread.TraceThread;
|
import ghidra.trace.model.thread.TraceThread;
|
||||||
|
|
||||||
public class DebuggerThreadActionContext extends ActionContext {
|
public class DebuggerThreadActionContext extends DefaultActionContext {
|
||||||
private final Trace trace;
|
private final Trace trace;
|
||||||
private final TraceThread thread;
|
private final TraceThread thread;
|
||||||
|
|
||||||
|
|
|
@ -15,16 +15,16 @@
|
||||||
*/
|
*/
|
||||||
package ghidra.app.plugin.core.debug.gui.thread;
|
package ghidra.app.plugin.core.debug.gui.thread;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
import ghidra.trace.model.Trace;
|
import ghidra.trace.model.Trace;
|
||||||
|
|
||||||
public class DebuggerTraceFileActionContext extends ActionContext {
|
public class DebuggerTraceFileActionContext extends DefaultActionContext {
|
||||||
private final Trace trace;
|
private final Trace trace;
|
||||||
|
|
||||||
public DebuggerTraceFileActionContext(Trace trace) {
|
public DebuggerTraceFileActionContext(Trace trace) {
|
||||||
this.trace = trace;
|
this.trace = trace;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Trace getTrace() {
|
public Trace getTrace() {
|
||||||
return trace;
|
return trace;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,9 +19,9 @@ import java.awt.Component;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
|
|
||||||
public class DebuggerWatchActionContext extends ActionContext {
|
public class DebuggerWatchActionContext extends DefaultActionContext {
|
||||||
private final Set<WatchRow> sel;
|
private final Set<WatchRow> sel;
|
||||||
|
|
||||||
public DebuggerWatchActionContext(DebuggerWatchesProvider provider,
|
public DebuggerWatchActionContext(DebuggerWatchesProvider provider,
|
||||||
|
|
|
@ -15,12 +15,13 @@
|
||||||
*/
|
*/
|
||||||
package ghidra.app.plugin.core.debug.gui.console;
|
package ghidra.app.plugin.core.debug.gui.console;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
import org.junit.rules.TestName;
|
import org.junit.rules.TestName;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
|
import docking.DefaultActionContext;
|
||||||
import docking.action.builder.ActionBuilder;
|
import docking.action.builder.ActionBuilder;
|
||||||
import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest;
|
import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest;
|
||||||
import ghidra.app.plugin.core.debug.gui.DebuggerResources;
|
import ghidra.app.plugin.core.debug.gui.DebuggerResources;
|
||||||
|
@ -29,7 +30,7 @@ import help.screenshot.GhidraScreenShotGenerator;
|
||||||
|
|
||||||
public class DebuggerConsolePluginScreenShots extends GhidraScreenShotGenerator {
|
public class DebuggerConsolePluginScreenShots extends GhidraScreenShotGenerator {
|
||||||
|
|
||||||
public static class ScreenShotActionContext extends ActionContext {
|
public static class ScreenShotActionContext extends DefaultActionContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
DebuggerConsolePlugin consolePlugin;
|
DebuggerConsolePlugin consolePlugin;
|
||||||
|
@ -44,21 +45,21 @@ public class DebuggerConsolePluginScreenShots extends GhidraScreenShotGenerator
|
||||||
consoleProvider = waitForComponentProvider(DebuggerConsoleProvider.class);
|
consoleProvider = waitForComponentProvider(DebuggerConsoleProvider.class);
|
||||||
|
|
||||||
consolePlugin.addResolutionAction(new ActionBuilder("Import", name.getMethodName())
|
consolePlugin.addResolutionAction(new ActionBuilder("Import", name.getMethodName())
|
||||||
.toolBarIcon(DebuggerResources.ICON_IMPORT)
|
.toolBarIcon(DebuggerResources.ICON_IMPORT)
|
||||||
.popupMenuIcon(DebuggerResources.ICON_IMPORT)
|
.popupMenuIcon(DebuggerResources.ICON_IMPORT)
|
||||||
.popupMenuPath("Map")
|
.popupMenuPath("Map")
|
||||||
.description("Import")
|
.description("Import")
|
||||||
.withContext(ScreenShotActionContext.class)
|
.withContext(ScreenShotActionContext.class)
|
||||||
.onAction(ctx -> Msg.info(this, "Import clicked"))
|
.onAction(ctx -> Msg.info(this, "Import clicked"))
|
||||||
.build());
|
.build());
|
||||||
consolePlugin.addResolutionAction(new ActionBuilder("Map", name.getMethodName())
|
consolePlugin.addResolutionAction(new ActionBuilder("Map", name.getMethodName())
|
||||||
.toolBarIcon(DebuggerResources.ICON_MODULES)
|
.toolBarIcon(DebuggerResources.ICON_MODULES)
|
||||||
.popupMenuIcon(DebuggerResources.ICON_MODULES)
|
.popupMenuIcon(DebuggerResources.ICON_MODULES)
|
||||||
.popupMenuPath("Map")
|
.popupMenuPath("Map")
|
||||||
.description("Map")
|
.description("Map")
|
||||||
.withContext(ScreenShotActionContext.class)
|
.withContext(ScreenShotActionContext.class)
|
||||||
.onAction(ctx -> Msg.info(this, "Map clicked"))
|
.onAction(ctx -> Msg.info(this, "Map clicked"))
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -70,7 +71,7 @@ public class DebuggerConsolePluginScreenShots extends GhidraScreenShotGenerator
|
||||||
new ScreenShotActionContext());
|
new ScreenShotActionContext());
|
||||||
|
|
||||||
AbstractGhidraHeadedDebuggerGUITest
|
AbstractGhidraHeadedDebuggerGUITest
|
||||||
.waitForPass(() -> assertEquals(3, consolePlugin.getRowCount(ActionContext.class)));
|
.waitForPass(() -> assertEquals(3, consolePlugin.getRowCount(ActionContext.class)));
|
||||||
|
|
||||||
captureIsolatedProvider(consoleProvider, 600, 300);
|
captureIsolatedProvider(consoleProvider, 600, 300);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ import org.junit.runner.Description;
|
||||||
|
|
||||||
import db.Transaction;
|
import db.Transaction;
|
||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
|
import docking.DefaultActionContext;
|
||||||
import docking.action.ActionContextProvider;
|
import docking.action.ActionContextProvider;
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import docking.widgets.table.DynamicTableColumn;
|
import docking.widgets.table.DynamicTableColumn;
|
||||||
|
@ -222,7 +223,7 @@ public abstract class AbstractGhidraHeadedDebuggerGUITest
|
||||||
public static Language getToyBE64Language() {
|
public static Language getToyBE64Language() {
|
||||||
try {
|
try {
|
||||||
return DefaultLanguageService.getLanguageService()
|
return DefaultLanguageService.getLanguageService()
|
||||||
.getLanguage(new LanguageID(LANGID_TOYBE64));
|
.getLanguage(new LanguageID(LANGID_TOYBE64));
|
||||||
}
|
}
|
||||||
catch (LanguageNotFoundException e) {
|
catch (LanguageNotFoundException e) {
|
||||||
throw new AssertionError("Why is the Toy language missing?", e);
|
throw new AssertionError("Why is the Toy language missing?", e);
|
||||||
|
@ -477,7 +478,7 @@ public abstract class AbstractGhidraHeadedDebuggerGUITest
|
||||||
DockingActionIf action, boolean wait) {
|
DockingActionIf action, boolean wait) {
|
||||||
ActionContext context = waitForValue(() -> {
|
ActionContext context = waitForValue(() -> {
|
||||||
ActionContext ctx = provider == null
|
ActionContext ctx = provider == null
|
||||||
? new ActionContext()
|
? new DefaultActionContext()
|
||||||
: provider.getActionContext(null);
|
: provider.getActionContext(null);
|
||||||
if (!action.isEnabledForContext(ctx)) {
|
if (!action.isEnabledForContext(ctx)) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -676,8 +677,8 @@ public abstract class AbstractGhidraHeadedDebuggerGUITest
|
||||||
protected void intoProject(DomainObject obj) {
|
protected void intoProject(DomainObject obj) {
|
||||||
waitForDomainObject(obj);
|
waitForDomainObject(obj);
|
||||||
DomainFolder rootFolder = tool.getProject()
|
DomainFolder rootFolder = tool.getProject()
|
||||||
.getProjectData()
|
.getProjectData()
|
||||||
.getRootFolder();
|
.getRootFolder();
|
||||||
waitForCondition(() -> {
|
waitForCondition(() -> {
|
||||||
try {
|
try {
|
||||||
rootFolder.createFile(obj.getName(), obj, monitor);
|
rootFolder.createFile(obj.getName(), obj, monitor);
|
||||||
|
@ -818,8 +819,8 @@ public abstract class AbstractGhidraHeadedDebuggerGUITest
|
||||||
// get() is not my favorite, but it'll do for testing
|
// get() is not my favorite, but it'll do for testing
|
||||||
// can't remove listener until observedTraceChange has completed.
|
// can't remove listener until observedTraceChange has completed.
|
||||||
bank.writeRegistersNamed(values)
|
bank.writeRegistersNamed(values)
|
||||||
.thenCompose(__ -> observedTraceChange)
|
.thenCompose(__ -> observedTraceChange)
|
||||||
.get(timeoutMillis, TimeUnit.MILLISECONDS);
|
.get(timeoutMillis, TimeUnit.MILLISECONDS);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
trace.removeListener(listener);
|
trace.removeListener(listener);
|
||||||
|
@ -835,8 +836,8 @@ public abstract class AbstractGhidraHeadedDebuggerGUITest
|
||||||
|
|
||||||
protected DomainFile unpack(File pack) throws Exception {
|
protected DomainFile unpack(File pack) throws Exception {
|
||||||
return tool.getProject()
|
return tool.getProject()
|
||||||
.getProjectData()
|
.getProjectData()
|
||||||
.getRootFolder()
|
.getRootFolder()
|
||||||
.createFile("Restored", pack, monitor);
|
.createFile("Restored", pack, monitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,12 +15,12 @@
|
||||||
*/
|
*/
|
||||||
package ghidra.app.plugin.core.debug.gui.console;
|
package ghidra.app.plugin.core.debug.gui.console;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
import docking.action.builder.ActionBuilder;
|
import docking.action.builder.ActionBuilder;
|
||||||
import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest;
|
import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest;
|
||||||
import ghidra.app.plugin.core.debug.gui.DebuggerResources;
|
import ghidra.app.plugin.core.debug.gui.DebuggerResources;
|
||||||
|
@ -36,25 +36,25 @@ public class DebuggerConsoleProviderTest extends AbstractGhidraHeadedDebuggerGUI
|
||||||
consoleProvider = waitForComponentProvider(DebuggerConsoleProvider.class);
|
consoleProvider = waitForComponentProvider(DebuggerConsoleProvider.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TestConsoleActionContext extends ActionContext {
|
public static class TestConsoleActionContext extends DefaultActionContext {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testActions() throws Exception {
|
public void testActions() throws Exception {
|
||||||
consolePlugin.addResolutionAction(new ActionBuilder("Add", name.getMethodName())
|
consolePlugin.addResolutionAction(new ActionBuilder("Add", name.getMethodName())
|
||||||
.toolBarIcon(DebuggerResources.ICON_ADD)
|
.toolBarIcon(DebuggerResources.ICON_ADD)
|
||||||
.description("Add")
|
.description("Add")
|
||||||
.withContext(TestConsoleActionContext.class)
|
.withContext(TestConsoleActionContext.class)
|
||||||
.onAction(ctx -> Msg.info(this, "Add clicked"))
|
.onAction(ctx -> Msg.info(this, "Add clicked"))
|
||||||
.build());
|
.build());
|
||||||
consolePlugin.addResolutionAction(new ActionBuilder("Delete", name.getMethodName())
|
consolePlugin.addResolutionAction(new ActionBuilder("Delete", name.getMethodName())
|
||||||
.popupMenuIcon(DebuggerResources.ICON_DELETE)
|
.popupMenuIcon(DebuggerResources.ICON_DELETE)
|
||||||
.popupMenuPath("Delete")
|
.popupMenuPath("Delete")
|
||||||
.description("Delete")
|
.description("Delete")
|
||||||
.withContext(TestConsoleActionContext.class)
|
.withContext(TestConsoleActionContext.class)
|
||||||
.onAction(ctx -> Msg.info(this, "Delete clicked"))
|
.onAction(ctx -> Msg.info(this, "Delete clicked"))
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
consolePlugin.log(DebuggerResources.ICON_DEBUGGER, "<html><b>Test message</b></html>",
|
consolePlugin.log(DebuggerResources.ICON_DEBUGGER, "<html><b>Test message</b></html>",
|
||||||
new TestConsoleActionContext());
|
new TestConsoleActionContext());
|
||||||
|
|
|
@ -205,17 +205,16 @@ public class RandomForestFunctionFinderPlugin extends ProgramPlugin
|
||||||
private void createActions() {
|
private void createActions() {
|
||||||
|
|
||||||
new ActionBuilder(ACTION_NAME, getName())
|
new ActionBuilder(ACTION_NAME, getName())
|
||||||
.menuPath(ToolConstants.MENU_SEARCH, MENU_PATH_ENTRY)
|
.menuPath(ToolConstants.MENU_SEARCH, MENU_PATH_ENTRY)
|
||||||
.menuGroup("search for", null)
|
.menuGroup("search for", null)
|
||||||
.description("Train models to search for function starts")
|
.description("Train models to search for function starts")
|
||||||
.helpLocation(new HelpLocation(getName(), getName()))
|
.helpLocation(new HelpLocation(getName(), getName()))
|
||||||
.withContext(NavigatableActionContext.class)
|
.withContext(NavigatableActionContext.class, true)
|
||||||
.validContextWhen(c -> !(c instanceof RestrictedAddressSetContext))
|
.validContextWhen(c -> !(c instanceof RestrictedAddressSetContext))
|
||||||
.supportsDefaultToolContext(true)
|
.onAction(c -> {
|
||||||
.onAction(c -> {
|
displayDialog(c);
|
||||||
displayDialog(c);
|
})
|
||||||
})
|
.buildAndInstall(tool);
|
||||||
.buildAndInstall(tool);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayDialog(NavigatableActionContext c) {
|
private void displayDialog(NavigatableActionContext c) {
|
||||||
|
|
|
@ -20,8 +20,7 @@ import java.awt.event.*;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.*;
|
||||||
import docking.WindowPosition;
|
|
||||||
import docking.action.*;
|
import docking.action.*;
|
||||||
import docking.widgets.EmptyBorderButton;
|
import docking.widgets.EmptyBorderButton;
|
||||||
import generic.theme.GIcon;
|
import generic.theme.GIcon;
|
||||||
|
@ -132,7 +131,7 @@ public class HelloWorldComponentProvider extends ComponentProviderAdapter {
|
||||||
if (event != null) {
|
if (event != null) {
|
||||||
Object source = event.getSource();
|
Object source = event.getSource();
|
||||||
if (source == activeButtonObj) {
|
if (source == activeButtonObj) {
|
||||||
return new ActionContext(this, activeButtonObj);
|
return new DefaultActionContext(this, activeButtonObj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -45,7 +45,7 @@ public abstract class NavigatableContextAction extends DockingAction {
|
||||||
public NavigatableContextAction(String name, String owner,
|
public NavigatableContextAction(String name, String owner,
|
||||||
boolean supportsRestrictedAddressSetContext) {
|
boolean supportsRestrictedAddressSetContext) {
|
||||||
super(name, owner);
|
super(name, owner);
|
||||||
setSupportsDefaultToolContext(true);
|
setContextClass(NavigatableActionContext.class, true);
|
||||||
this.supportsRestrictedAddressSetContext = supportsRestrictedAddressSetContext;
|
this.supportsRestrictedAddressSetContext = supportsRestrictedAddressSetContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ public abstract class NavigatableContextAction extends DockingAction {
|
||||||
*/
|
*/
|
||||||
public NavigatableContextAction(String name, String owner, KeyBindingType type) {
|
public NavigatableContextAction(String name, String owner, KeyBindingType type) {
|
||||||
super(name, owner, type);
|
super(name, owner, type);
|
||||||
setSupportsDefaultToolContext(true);
|
setContextClass(NavigatableActionContext.class, true);
|
||||||
this.supportsRestrictedAddressSetContext = true;
|
this.supportsRestrictedAddressSetContext = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,11 +18,11 @@ package ghidra.app.context;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.KeyboardFocusManager;
|
import java.awt.KeyboardFocusManager;
|
||||||
|
|
||||||
import docking.ActionContext;
|
|
||||||
import docking.ComponentProvider;
|
import docking.ComponentProvider;
|
||||||
|
import docking.DefaultActionContext;
|
||||||
import ghidra.program.model.listing.Program;
|
import ghidra.program.model.listing.Program;
|
||||||
|
|
||||||
public class ProgramActionContext extends ActionContext {
|
public class ProgramActionContext extends DefaultActionContext {
|
||||||
protected final Program program;
|
protected final Program program;
|
||||||
|
|
||||||
public ProgramActionContext(ComponentProvider provider, Program program) {
|
public ProgramActionContext(ComponentProvider provider, Program program) {
|
||||||
|
|
|
@ -105,28 +105,28 @@ public class AutoAnalysisPlugin extends Plugin implements AutoAnalysisManagerLis
|
||||||
// they are inserted
|
// they are inserted
|
||||||
int subGroupIndex = 0;
|
int subGroupIndex = 0;
|
||||||
|
|
||||||
//@formatter:off
|
autoAnalyzeAction = new ActionBuilder("Auto Analyze", getName())
|
||||||
autoAnalyzeAction =
|
.menuPath("&Analysis", "&Auto Analyze...")
|
||||||
new ActionBuilder("Auto Analyze", getName())
|
.menuGroup(ANALYZE_GROUP_NAME, "" + subGroupIndex++)
|
||||||
.supportsDefaultToolContext(true)
|
.keyBinding("A")
|
||||||
.menuPath("&Analysis", "&Auto Analyze...")
|
.withContext(ListingActionContext.class, true)
|
||||||
.menuGroup(ANALYZE_GROUP_NAME, "" + subGroupIndex++)
|
.onAction(this::analyzeCallback)
|
||||||
.keyBinding("A")
|
.buildAndInstall(tool);
|
||||||
.validContextWhen(ac -> {
|
|
||||||
updateActionName(ac);
|
// we need to specially override the validContextWhen so that as a side effect, we
|
||||||
return ac instanceof ListingActionContext;
|
// can change the action name to not include a program name when the action is
|
||||||
})
|
// actually invalid.
|
||||||
.onAction(this::analyzeCallback)
|
autoAnalyzeAction.validContextWhen(ac -> {
|
||||||
.buildAndInstall(tool);
|
updateActionName(ac);
|
||||||
|
return ac instanceof ListingActionContext;
|
||||||
|
});
|
||||||
|
|
||||||
new ActionBuilder("Analyze All Open", getName())
|
new ActionBuilder("Analyze All Open", getName())
|
||||||
.supportsDefaultToolContext(true)
|
.menuPath("&Analysis", "Analyze All &Open...")
|
||||||
.menuPath("&Analysis", "Analyze All &Open...")
|
.menuGroup(ANALYZE_GROUP_NAME, "" + subGroupIndex++)
|
||||||
.menuGroup(ANALYZE_GROUP_NAME, "" + subGroupIndex++)
|
.withContext(ListingActionContext.class, true)
|
||||||
.onAction(c -> analyzeAllCallback())
|
.onAction(c -> analyzeAllCallback())
|
||||||
.validContextWhen(ac -> ac instanceof ListingActionContext)
|
.buildAndInstall(tool);
|
||||||
.buildAndInstall(tool);
|
|
||||||
//@formatter:on
|
|
||||||
|
|
||||||
tool.setMenuGroup(new String[] { "Analysis", "One Shot" }, ANALYZE_GROUP_NAME);
|
tool.setMenuGroup(new String[] { "Analysis", "One Shot" }, ANALYZE_GROUP_NAME);
|
||||||
|
|
||||||
|
@ -263,8 +263,8 @@ public class AutoAnalysisPlugin extends Plugin implements AutoAnalysisManagerLis
|
||||||
|
|
||||||
private void programActivated(Program program) {
|
private void programActivated(Program program) {
|
||||||
program.getOptions(StoredAnalyzerTimes.OPTIONS_LIST)
|
program.getOptions(StoredAnalyzerTimes.OPTIONS_LIST)
|
||||||
.registerOption(StoredAnalyzerTimes.OPTION_NAME, OptionType.CUSTOM_TYPE, null, null,
|
.registerOption(StoredAnalyzerTimes.OPTION_NAME, OptionType.CUSTOM_TYPE, null, null,
|
||||||
"Cumulative analysis task times", new StoredAnalyzerTimesPropertyEditor());
|
"Cumulative analysis task times", new StoredAnalyzerTimesPropertyEditor());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,7 +326,7 @@ public class AutoAnalysisPlugin extends Plugin implements AutoAnalysisManagerLis
|
||||||
null, ANALYZE_GROUP_NAME));
|
null, ANALYZE_GROUP_NAME));
|
||||||
setHelpLocation(new HelpLocation("AutoAnalysisPlugin", "Auto_Analyzers"));
|
setHelpLocation(new HelpLocation("AutoAnalysisPlugin", "Auto_Analyzers"));
|
||||||
|
|
||||||
setSupportsDefaultToolContext(true);
|
setContextClass(ListingActionContext.class, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -25,6 +25,7 @@ import docking.action.MenuData;
|
||||||
import docking.action.builder.ActionBuilder;
|
import docking.action.builder.ActionBuilder;
|
||||||
import docking.tool.ToolConstants;
|
import docking.tool.ToolConstants;
|
||||||
import ghidra.app.CorePluginPackage;
|
import ghidra.app.CorePluginPackage;
|
||||||
|
import ghidra.app.context.ListingActionContext;
|
||||||
import ghidra.app.context.NavigatableActionContext;
|
import ghidra.app.context.NavigatableActionContext;
|
||||||
import ghidra.app.events.ProgramClosedPluginEvent;
|
import ghidra.app.events.ProgramClosedPluginEvent;
|
||||||
import ghidra.app.events.ProgramSelectionPluginEvent;
|
import ghidra.app.events.ProgramSelectionPluginEvent;
|
||||||
|
@ -98,16 +99,15 @@ public class FindPossibleReferencesPlugin extends Plugin {
|
||||||
|
|
||||||
private void createActions() {
|
private void createActions() {
|
||||||
action = new ActionBuilder(SEARCH_DIRECT_REFS_ACTION_NAME, getName())
|
action = new ActionBuilder(SEARCH_DIRECT_REFS_ACTION_NAME, getName())
|
||||||
.menuPath(ToolConstants.MENU_SEARCH, "For Direct References")
|
.menuPath(ToolConstants.MENU_SEARCH, "For Direct References")
|
||||||
.menuGroup("search for")
|
.menuGroup("search for")
|
||||||
.supportsDefaultToolContext(true)
|
.helpLocation(new HelpLocation(HelpTopics.SEARCH, SEARCH_DIRECT_REFS_ACTION_NAME))
|
||||||
.helpLocation(new HelpLocation(HelpTopics.SEARCH, SEARCH_DIRECT_REFS_ACTION_NAME))
|
.description(getPluginDescription().getDescription())
|
||||||
.description(getPluginDescription().getDescription())
|
.withContext(ListingActionContext.class, true)
|
||||||
.withContext(NavigatableActionContext.class)
|
.inWindow(ActionBuilder.When.CONTEXT_MATCHES)
|
||||||
.inWindow(ActionBuilder.When.CONTEXT_MATCHES)
|
.onAction(this::findReferences)
|
||||||
.onAction(this::findReferences)
|
.enabledWhen(this::hasCorrectAddressSize)
|
||||||
.enabledWhen(this::hasCorrectAddressSize)
|
.buildAndInstall(tool);
|
||||||
.buildAndInstall(tool);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,9 +194,9 @@ public class FindPossibleReferencesPlugin extends Plugin {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (currentProgram.getMemory()
|
if (currentProgram.getMemory()
|
||||||
.getBlock(
|
.getBlock(
|
||||||
fromAddr)
|
fromAddr)
|
||||||
.getType() == MemoryBlockType.BIT_MAPPED) {
|
.getType() == MemoryBlockType.BIT_MAPPED) {
|
||||||
Msg.showWarn(getClass(), null, "Search For Direct References",
|
Msg.showWarn(getClass(), null, "Search For Direct References",
|
||||||
"Cannot search for direct references on bit memory!");
|
"Cannot search for direct references on bit memory!");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -23,8 +23,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.tree.TreePath;
|
import javax.swing.tree.TreePath;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.*;
|
||||||
import docking.WindowPosition;
|
|
||||||
import docking.action.*;
|
import docking.action.*;
|
||||||
import docking.resources.icons.NumberIcon;
|
import docking.resources.icons.NumberIcon;
|
||||||
import docking.widgets.dialogs.NumberInputDialog;
|
import docking.widgets.dialogs.NumberInputDialog;
|
||||||
|
@ -352,7 +351,7 @@ public class CallTreeProvider extends ComponentProviderAdapter implements Domain
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
goToSourceAction
|
goToSourceAction
|
||||||
.setPopupMenuData(new MenuData(new String[] { "Go To Call Source" }, goToMenu));
|
.setPopupMenuData(new MenuData(new String[] { "Go To Call Source" }, goToMenu));
|
||||||
goToSourceAction.setHelpLocation(
|
goToSourceAction.setHelpLocation(
|
||||||
new HelpLocation(plugin.getName(), "Call_Tree_Context_Action_Goto_Source"));
|
new HelpLocation(plugin.getName(), "Call_Tree_Context_Action_Goto_Source"));
|
||||||
tool.addLocalAction(this, goToSourceAction);
|
tool.addLocalAction(this, goToSourceAction);
|
||||||
|
@ -367,11 +366,11 @@ public class CallTreeProvider extends ComponentProviderAdapter implements Domain
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
filterDuplicates
|
filterDuplicates
|
||||||
.setToolBarData(new ToolBarData(new GIcon("icon.plugin.calltree.filter.duplicates"),
|
.setToolBarData(new ToolBarData(new GIcon("icon.plugin.calltree.filter.duplicates"),
|
||||||
filterOptionsToolbarGroup, "1"));
|
filterOptionsToolbarGroup, "1"));
|
||||||
filterDuplicates.setSelected(true);
|
filterDuplicates.setSelected(true);
|
||||||
filterDuplicates
|
filterDuplicates
|
||||||
.setHelpLocation(new HelpLocation(plugin.getName(), "Call_Tree_Action_Filter"));
|
.setHelpLocation(new HelpLocation(plugin.getName(), "Call_Tree_Action_Filter"));
|
||||||
tool.addLocalAction(this, filterDuplicates);
|
tool.addLocalAction(this, filterDuplicates);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -395,7 +394,7 @@ public class CallTreeProvider extends ComponentProviderAdapter implements Domain
|
||||||
"<br> will go. Example operations include <b>Expand All</b> and filtering");
|
"<br> will go. Example operations include <b>Expand All</b> and filtering");
|
||||||
recurseIcon = new NumberIcon(recurseDepth.get());
|
recurseIcon = new NumberIcon(recurseDepth.get());
|
||||||
recurseDepthAction
|
recurseDepthAction
|
||||||
.setToolBarData(new ToolBarData(recurseIcon, filterOptionsToolbarGroup, "2"));
|
.setToolBarData(new ToolBarData(recurseIcon, filterOptionsToolbarGroup, "2"));
|
||||||
recurseDepthAction.setHelpLocation(
|
recurseDepthAction.setHelpLocation(
|
||||||
new HelpLocation(plugin.getName(), "Call_Tree_Action_Recurse_Depth"));
|
new HelpLocation(plugin.getName(), "Call_Tree_Action_Recurse_Depth"));
|
||||||
|
|
||||||
|
@ -416,7 +415,7 @@ public class CallTreeProvider extends ComponentProviderAdapter implements Domain
|
||||||
navigationOutgoingAction.setToolBarData(new ToolBarData(
|
navigationOutgoingAction.setToolBarData(new ToolBarData(
|
||||||
Icons.NAVIGATE_ON_OUTGOING_EVENT_ICON, navigationOptionsToolbarGroup, "1"));
|
Icons.NAVIGATE_ON_OUTGOING_EVENT_ICON, navigationOptionsToolbarGroup, "1"));
|
||||||
navigationOutgoingAction
|
navigationOutgoingAction
|
||||||
.setHelpLocation(new HelpLocation(plugin.getName(), "Call_Tree_Action_Navigation"));
|
.setHelpLocation(new HelpLocation(plugin.getName(), "Call_Tree_Action_Navigation"));
|
||||||
tool.addLocalAction(this, navigationOutgoingAction);
|
tool.addLocalAction(this, navigationOutgoingAction);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -597,7 +596,7 @@ public class CallTreeProvider extends ComponentProviderAdapter implements Domain
|
||||||
refreshAction.setDescription("<html>Push at any time to refresh the current trees.<br>" +
|
refreshAction.setDescription("<html>Push at any time to refresh the current trees.<br>" +
|
||||||
"This is highlighted when the data <i>may</i> be stale.<br>");
|
"This is highlighted when the data <i>may</i> be stale.<br>");
|
||||||
refreshAction
|
refreshAction
|
||||||
.setHelpLocation(new HelpLocation(plugin.getName(), "Call_Tree_Action_Refresh"));
|
.setHelpLocation(new HelpLocation(plugin.getName(), "Call_Tree_Action_Refresh"));
|
||||||
tool.addLocalAction(this, refreshAction);
|
tool.addLocalAction(this, refreshAction);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -712,7 +711,7 @@ public class CallTreeProvider extends ComponentProviderAdapter implements Domain
|
||||||
@Override
|
@Override
|
||||||
public ActionContext getActionContext(MouseEvent e) {
|
public ActionContext getActionContext(MouseEvent e) {
|
||||||
if (e == null) {
|
if (e == null) {
|
||||||
return new ActionContext(this, getActiveComponent());
|
return new DefaultActionContext(this, getActiveComponent());
|
||||||
}
|
}
|
||||||
|
|
||||||
Object source = e.getSource();
|
Object source = e.getSource();
|
||||||
|
@ -722,7 +721,7 @@ public class CallTreeProvider extends ComponentProviderAdapter implements Domain
|
||||||
if (outgoingTree.isMyJTree(jTree)) {
|
if (outgoingTree.isMyJTree(jTree)) {
|
||||||
gTree = outgoingTree;
|
gTree = outgoingTree;
|
||||||
}
|
}
|
||||||
return new ActionContext(this, gTree);
|
return new DefaultActionContext(this, gTree);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -114,7 +114,6 @@ public abstract class AbstractCodeBrowserPlugin<P extends CodeViewerProvider> ex
|
||||||
initMiscellaneousOptions();
|
initMiscellaneousOptions();
|
||||||
displayOptions.addOptionsChangeListener(this);
|
displayOptions.addOptionsChangeListener(this);
|
||||||
fieldOptions.addOptionsChangeListener(this);
|
fieldOptions.addOptionsChangeListener(this);
|
||||||
tool.setDefaultComponent(connectedProvider);
|
|
||||||
markerChangeListener = new MarkerChangeListener(connectedProvider);
|
markerChangeListener = new MarkerChangeListener(connectedProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -775,7 +774,7 @@ public abstract class AbstractCodeBrowserPlugin<P extends CodeViewerProvider> ex
|
||||||
public boolean goTo(ProgramLocation location, boolean centerOnScreen) {
|
public boolean goTo(ProgramLocation location, boolean centerOnScreen) {
|
||||||
|
|
||||||
return Swing
|
return Swing
|
||||||
.runNow(() -> connectedProvider.getListingPanel().goTo(location, centerOnScreen));
|
.runNow(() -> connectedProvider.getListingPanel().goTo(location, centerOnScreen));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -23,6 +23,7 @@ import docking.widgets.fieldpanel.FieldPanel;
|
||||||
import docking.widgets.fieldpanel.support.FieldSelection;
|
import docking.widgets.fieldpanel.support.FieldSelection;
|
||||||
import docking.widgets.fieldpanel.support.ViewerPosition;
|
import docking.widgets.fieldpanel.support.ViewerPosition;
|
||||||
import ghidra.app.CorePluginPackage;
|
import ghidra.app.CorePluginPackage;
|
||||||
|
import ghidra.app.context.*;
|
||||||
import ghidra.app.events.*;
|
import ghidra.app.events.*;
|
||||||
import ghidra.app.plugin.PluginCategoryNames;
|
import ghidra.app.plugin.PluginCategoryNames;
|
||||||
import ghidra.app.services.*;
|
import ghidra.app.services.*;
|
||||||
|
@ -37,6 +38,7 @@ import ghidra.program.model.listing.Program;
|
||||||
import ghidra.program.util.ProgramLocation;
|
import ghidra.program.util.ProgramLocation;
|
||||||
import ghidra.program.util.ProgramSelection;
|
import ghidra.program.util.ProgramSelection;
|
||||||
|
|
||||||
|
//@formatter:off
|
||||||
@PluginInfo(
|
@PluginInfo(
|
||||||
status = PluginStatus.RELEASED,
|
status = PluginStatus.RELEASED,
|
||||||
packageName = CorePluginPackage.NAME,
|
packageName = CorePluginPackage.NAME,
|
||||||
|
@ -59,6 +61,7 @@ import ghidra.program.util.ProgramSelection;
|
||||||
ProgramClosedPluginEvent.class, ProgramLocationPluginEvent.class,
|
ProgramClosedPluginEvent.class, ProgramLocationPluginEvent.class,
|
||||||
ViewChangedPluginEvent.class, ProgramHighlightPluginEvent.class },
|
ViewChangedPluginEvent.class, ProgramHighlightPluginEvent.class },
|
||||||
eventsProduced = { ProgramLocationPluginEvent.class, ProgramSelectionPluginEvent.class })
|
eventsProduced = { ProgramLocationPluginEvent.class, ProgramSelectionPluginEvent.class })
|
||||||
|
//@formatter:on
|
||||||
public class CodeBrowserPlugin extends AbstractCodeBrowserPlugin<CodeViewerProvider> {
|
public class CodeBrowserPlugin extends AbstractCodeBrowserPlugin<CodeViewerProvider> {
|
||||||
|
|
||||||
public CodeBrowserPlugin(PluginTool tool) {
|
public CodeBrowserPlugin(PluginTool tool) {
|
||||||
|
@ -66,6 +69,25 @@ public class CodeBrowserPlugin extends AbstractCodeBrowserPlugin<CodeViewerProvi
|
||||||
|
|
||||||
registerServiceProvided(FieldMouseHandlerService.class,
|
registerServiceProvided(FieldMouseHandlerService.class,
|
||||||
connectedProvider.getFieldNavigator());
|
connectedProvider.getFieldNavigator());
|
||||||
|
|
||||||
|
// sets the primary code viewer window as the default component to get focus
|
||||||
|
tool.setDefaultComponent(connectedProvider);
|
||||||
|
|
||||||
|
// sets the primary code viewer window as the default context provider for actions
|
||||||
|
// that use the specified context types.
|
||||||
|
tool.registerDefaultContextProvider(ProgramActionContext.class, connectedProvider);
|
||||||
|
tool.registerDefaultContextProvider(NavigatableActionContext.class, connectedProvider);
|
||||||
|
tool.registerDefaultContextProvider(CodeViewerActionContext.class, connectedProvider);
|
||||||
|
tool.registerDefaultContextProvider(ListingActionContext.class, connectedProvider);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void dispose() {
|
||||||
|
tool.unregisterDefaultContextProvider(ProgramActionContext.class, connectedProvider);
|
||||||
|
tool.unregisterDefaultContextProvider(NavigatableActionContext.class, connectedProvider);
|
||||||
|
tool.unregisterDefaultContextProvider(CodeViewerActionContext.class, connectedProvider);
|
||||||
|
tool.unregisterDefaultContextProvider(ListingActionContext.class, connectedProvider);
|
||||||
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -65,48 +65,44 @@ public class CodeBrowserSelectionPlugin extends Plugin {
|
||||||
|
|
||||||
private void createActions() {
|
private void createActions() {
|
||||||
new ActionBuilder("Select All", getName())
|
new ActionBuilder("Select All", getName())
|
||||||
.menuPath(ToolConstants.MENU_SELECTION, "&All in View")
|
.menuPath(ToolConstants.MENU_SELECTION, "&All in View")
|
||||||
.menuGroup(SELECT_GROUP, "a")
|
.menuGroup(SELECT_GROUP, "a")
|
||||||
.keyBinding("ctrl A")
|
.keyBinding("ctrl A")
|
||||||
.supportsDefaultToolContext(true)
|
.helpLocation(new HelpLocation(HelpTopics.SELECTION, "Select All"))
|
||||||
.helpLocation(new HelpLocation(HelpTopics.SELECTION, "Select All"))
|
.withContext(CodeViewerActionContext.class, true)
|
||||||
.withContext(CodeViewerActionContext.class)
|
.inWindow(ActionBuilder.When.CONTEXT_MATCHES)
|
||||||
.inWindow(ActionBuilder.When.CONTEXT_MATCHES)
|
.onAction(c -> ((CodeViewerProvider) c.getComponentProvider()).selectAll())
|
||||||
.onAction(c -> ((CodeViewerProvider) c.getComponentProvider()).selectAll())
|
.buildAndInstall(tool);
|
||||||
.buildAndInstall(tool);
|
|
||||||
|
|
||||||
new ActionBuilder("Clear Selection", getName())
|
new ActionBuilder("Clear Selection", getName())
|
||||||
.menuPath(ToolConstants.MENU_SELECTION, "&Clear Selection")
|
.menuPath(ToolConstants.MENU_SELECTION, "&Clear Selection")
|
||||||
.menuGroup(SELECT_GROUP, "b")
|
.menuGroup(SELECT_GROUP, "b")
|
||||||
.supportsDefaultToolContext(true)
|
.helpLocation(new HelpLocation(HelpTopics.SELECTION, "Clear Selection"))
|
||||||
.helpLocation(new HelpLocation(HelpTopics.SELECTION, "Clear Selection"))
|
.withContext(CodeViewerActionContext.class, true)
|
||||||
.withContext(CodeViewerActionContext.class)
|
.inWindow(ActionBuilder.When.CONTEXT_MATCHES)
|
||||||
.inWindow(ActionBuilder.When.CONTEXT_MATCHES)
|
.onAction(c -> ((CodeViewerProvider) c.getComponentProvider())
|
||||||
.onAction(c -> ((CodeViewerProvider) c.getComponentProvider())
|
.setSelection(new ProgramSelection()))
|
||||||
.setSelection(new ProgramSelection()))
|
.buildAndInstall(tool);
|
||||||
.buildAndInstall(tool);
|
|
||||||
|
|
||||||
new ActionBuilder("Select Complement", getName())
|
new ActionBuilder("Select Complement", getName())
|
||||||
.menuPath(ToolConstants.MENU_SELECTION, "&Complement")
|
.menuPath(ToolConstants.MENU_SELECTION, "&Complement")
|
||||||
.menuGroup(SELECT_GROUP, "c")
|
.menuGroup(SELECT_GROUP, "c")
|
||||||
.supportsDefaultToolContext(true)
|
.helpLocation(new HelpLocation(HelpTopics.SELECTION, "Select Complement"))
|
||||||
.helpLocation(new HelpLocation(HelpTopics.SELECTION, "Select Complement"))
|
.withContext(CodeViewerActionContext.class, true)
|
||||||
.withContext(CodeViewerActionContext.class)
|
.inWindow(ActionBuilder.When.CONTEXT_MATCHES)
|
||||||
.inWindow(ActionBuilder.When.CONTEXT_MATCHES)
|
.onAction(c -> ((CodeViewerProvider) c.getComponentProvider()).selectComplement())
|
||||||
.onAction(c -> ((CodeViewerProvider) c.getComponentProvider()).selectComplement())
|
.buildAndInstall(tool);
|
||||||
.buildAndInstall(tool);
|
|
||||||
|
|
||||||
tool.addAction(new MarkAndSelectionAction(getName(), SELECT_GROUP, "d"));
|
tool.addAction(new MarkAndSelectionAction(getName(), SELECT_GROUP, "d"));
|
||||||
|
|
||||||
new ActionBuilder("Create Table From Selection", getName())
|
new ActionBuilder("Create Table From Selection", getName())
|
||||||
.menuPath(ToolConstants.MENU_SELECTION, "Create Table From Selection")
|
.menuPath(ToolConstants.MENU_SELECTION, "Create Table From Selection")
|
||||||
.menuGroup("SelectUtils")
|
.menuGroup("SelectUtils")
|
||||||
.helpLocation(new HelpLocation("CodeBrowserPlugin", "Selection_Table"))
|
.helpLocation(new HelpLocation("CodeBrowserPlugin", "Selection_Table"))
|
||||||
.supportsDefaultToolContext(true)
|
.withContext(CodeViewerActionContext.class, true)
|
||||||
.withContext(CodeViewerActionContext.class)
|
.inWindow(ActionBuilder.When.CONTEXT_MATCHES)
|
||||||
.inWindow(ActionBuilder.When.CONTEXT_MATCHES)
|
.onAction(c -> createTable((CodeViewerProvider) c.getComponentProvider()))
|
||||||
.onAction(c -> createTable((CodeViewerProvider) c.getComponentProvider()))
|
.buildAndInstall(tool);
|
||||||
.buildAndInstall(tool);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class MarkAndSelectionAction extends ToggleDockingAction {
|
||||||
new ToolBarData(unarmedIcon, ToolConstants.TOOLBAR_GROUP_THREE, "Z"));
|
new ToolBarData(unarmedIcon, ToolConstants.TOOLBAR_GROUP_THREE, "Z"));
|
||||||
|
|
||||||
setHelpLocation((new HelpLocation(HelpTopics.SELECTION, "Mark_And_Select")));
|
setHelpLocation((new HelpLocation(HelpTopics.SELECTION, "Mark_And_Select")));
|
||||||
setSupportsDefaultToolContext(true);
|
setContextClass(NavigatableActionContext.class, true);
|
||||||
addToWindowWhen(NavigatableActionContext.class);
|
addToWindowWhen(NavigatableActionContext.class);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,13 +15,13 @@
|
||||||
*/
|
*/
|
||||||
package ghidra.app.plugin.core.commentwindow;
|
package ghidra.app.plugin.core.commentwindow;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
import ghidra.util.table.GhidraTable;
|
import ghidra.util.table.GhidraTable;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This the action context for actions invoked from the Comment Window
|
* This the action context for actions invoked from the Comment Window
|
||||||
*/
|
*/
|
||||||
public class CommentWindowContext extends ActionContext {
|
public class CommentWindowContext extends DefaultActionContext {
|
||||||
|
|
||||||
CommentWindowContext(CommentWindowProvider provider, GhidraTable commentTable) {
|
CommentWindowContext(CommentWindowProvider provider, GhidraTable commentTable) {
|
||||||
super(provider, commentTable);
|
super(provider, commentTable);
|
||||||
|
|
|
@ -26,6 +26,7 @@ import javax.swing.plaf.UIResource;
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
|
import docking.DefaultActionContext;
|
||||||
import docking.widgets.DropDownSelectionTextField;
|
import docking.widgets.DropDownSelectionTextField;
|
||||||
import docking.widgets.OptionDialog;
|
import docking.widgets.OptionDialog;
|
||||||
import docking.widgets.button.GButton;
|
import docking.widgets.button.GButton;
|
||||||
|
@ -757,7 +758,7 @@ public class BitFieldEditorPanel extends JPanel {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
class BitFieldEditorContext extends ActionContext {
|
class BitFieldEditorContext extends DefaultActionContext {
|
||||||
|
|
||||||
private int selectedBitOffset;
|
private int selectedBitOffset;
|
||||||
private DataTypeComponent selectedDtc;
|
private DataTypeComponent selectedDtc;
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
package ghidra.app.plugin.core.compositeeditor;
|
package ghidra.app.plugin.core.compositeeditor;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
import ghidra.program.model.data.*;
|
import ghidra.program.model.data.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,7 +23,7 @@ import ghidra.program.model.data.*;
|
||||||
* composite with a single selected component, and the composite is associated with a
|
* composite with a single selected component, and the composite is associated with a
|
||||||
* stand-alone archive.
|
* stand-alone archive.
|
||||||
*/
|
*/
|
||||||
public class ComponentStandAloneActionContext extends ActionContext
|
public class ComponentStandAloneActionContext extends DefaultActionContext
|
||||||
implements ComponentContext {
|
implements ComponentContext {
|
||||||
|
|
||||||
private DataTypeComponent component;
|
private DataTypeComponent component;
|
||||||
|
|
|
@ -19,8 +19,7 @@ import java.awt.event.MouseEvent;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.*;
|
||||||
import docking.ComponentProvider;
|
|
||||||
import docking.widgets.OptionDialog;
|
import docking.widgets.OptionDialog;
|
||||||
import generic.theme.GIcon;
|
import generic.theme.GIcon;
|
||||||
import ghidra.app.context.ProgramActionContext;
|
import ghidra.app.context.ProgramActionContext;
|
||||||
|
@ -189,7 +188,7 @@ public abstract class CompositeEditorProvider extends ComponentProviderAdapter
|
||||||
else if (componentAt != null && (originalDTM instanceof StandAloneDataTypeManager)) {
|
else if (componentAt != null && (originalDTM instanceof StandAloneDataTypeManager)) {
|
||||||
return new ComponentStandAloneActionContext(this, componentAt);
|
return new ComponentStandAloneActionContext(this, componentAt);
|
||||||
}
|
}
|
||||||
return new ActionContext(this, null);
|
return new DefaultActionContext(this, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -26,8 +26,7 @@ import javax.swing.event.*;
|
||||||
import javax.swing.event.HyperlinkEvent.EventType;
|
import javax.swing.event.HyperlinkEvent.EventType;
|
||||||
import javax.swing.tree.TreePath;
|
import javax.swing.tree.TreePath;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.*;
|
||||||
import docking.DockingWindowManager;
|
|
||||||
import docking.action.DockingAction;
|
import docking.action.DockingAction;
|
||||||
import docking.action.ToggleDockingAction;
|
import docking.action.ToggleDockingAction;
|
||||||
import docking.event.mouse.GMouseListenerAdapter;
|
import docking.event.mouse.GMouseListenerAdapter;
|
||||||
|
@ -348,7 +347,7 @@ public class DataTypesProvider extends ComponentProviderAdapter {
|
||||||
Object source = event.getSource();
|
Object source = event.getSource();
|
||||||
if (source instanceof JTextField || source instanceof JTextPane) {
|
if (source instanceof JTextField || source instanceof JTextPane) {
|
||||||
Component component = (Component) source;
|
Component component = (Component) source;
|
||||||
return new ActionContext(this, source, component);
|
return new DefaultActionContext(this, source, component);
|
||||||
}
|
}
|
||||||
|
|
||||||
Point point = event.getPoint();
|
Point point = event.getPoint();
|
||||||
|
@ -493,8 +492,8 @@ public class DataTypesProvider extends ComponentProviderAdapter {
|
||||||
previewScrollPane = new JScrollPane(previewPane);
|
previewScrollPane = new JScrollPane(previewPane);
|
||||||
|
|
||||||
DockingWindowManager.getHelpService()
|
DockingWindowManager.getHelpService()
|
||||||
.registerHelp(previewScrollPane,
|
.registerHelp(previewScrollPane,
|
||||||
new HelpLocation("DataTypeManagerPlugin", "Preview_Window"));
|
new HelpLocation("DataTypeManagerPlugin", "Preview_Window"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private DataType locateDataType(HyperlinkEvent event) {
|
private DataType locateDataType(HyperlinkEvent event) {
|
||||||
|
|
|
@ -27,8 +27,7 @@ import javax.swing.table.TableCellEditor;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.*;
|
||||||
import docking.ComponentProvider;
|
|
||||||
import docking.action.*;
|
import docking.action.*;
|
||||||
import docking.action.builder.ToggleActionBuilder;
|
import docking.action.builder.ToggleActionBuilder;
|
||||||
import docking.widgets.OptionDialog;
|
import docking.widgets.OptionDialog;
|
||||||
|
@ -152,7 +151,7 @@ public class EnumEditorProvider extends ComponentProviderAdapter
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionContext getActionContext(MouseEvent event) {
|
public ActionContext getActionContext(MouseEvent event) {
|
||||||
return new ActionContext(this, editorPanel.getTable());
|
return new DefaultActionContext(this, editorPanel.getTable());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
/* ###
|
/* ###
|
||||||
* IP: GHIDRA
|
* IP: GHIDRA
|
||||||
* REVIEWED: YES
|
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -16,16 +15,16 @@
|
||||||
*/
|
*/
|
||||||
package ghidra.app.plugin.core.datawindow;
|
package ghidra.app.plugin.core.datawindow;
|
||||||
|
|
||||||
|
import docking.DefaultActionContext;
|
||||||
import ghidra.util.table.GhidraTable;
|
import ghidra.util.table.GhidraTable;
|
||||||
import docking.ActionContext;
|
|
||||||
|
|
||||||
public class DataWindowContext extends ActionContext {
|
public class DataWindowContext extends DefaultActionContext {
|
||||||
|
|
||||||
DataWindowContext( DataWindowProvider provider, GhidraTable dataTable ) {
|
DataWindowContext(DataWindowProvider provider, GhidraTable dataTable) {
|
||||||
super( provider, dataTable );
|
super(provider, dataTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
GhidraTable getDataTable() {
|
GhidraTable getDataTable() {
|
||||||
return (GhidraTable) getContextObject();
|
return (GhidraTable) getContextObject();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,8 +26,7 @@ import javax.swing.event.DocumentListener;
|
||||||
import javax.swing.text.Document;
|
import javax.swing.text.Document;
|
||||||
import javax.swing.undo.UndoableEdit;
|
import javax.swing.undo.UndoableEdit;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.*;
|
||||||
import docking.ComponentProvider;
|
|
||||||
import docking.action.*;
|
import docking.action.*;
|
||||||
import docking.actions.KeyBindingUtils;
|
import docking.actions.KeyBindingUtils;
|
||||||
import docking.options.editor.FontEditor;
|
import docking.options.editor.FontEditor;
|
||||||
|
@ -256,7 +255,7 @@ public class TextEditorComponentProvider extends ComponentProviderAdapter {
|
||||||
|
|
||||||
ActionContextProvider acp = e -> {
|
ActionContextProvider acp = e -> {
|
||||||
ComponentProvider p = TextEditorComponentProvider.this;
|
ComponentProvider p = TextEditorComponentProvider.this;
|
||||||
return new ActionContext(p);
|
return new DefaultActionContext(p);
|
||||||
};
|
};
|
||||||
|
|
||||||
KeyBindingUtils.registerAction(textarea, saveAction, acp);
|
KeyBindingUtils.registerAction(textarea, saveAction, acp);
|
||||||
|
|
|
@ -25,6 +25,7 @@ import javax.swing.*;
|
||||||
import javax.swing.table.*;
|
import javax.swing.table.*;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
|
import docking.DefaultActionContext;
|
||||||
import generic.theme.GIcon;
|
import generic.theme.GIcon;
|
||||||
import ghidra.app.services.GoToService;
|
import ghidra.app.services.GoToService;
|
||||||
import ghidra.framework.plugintool.ComponentProviderAdapter;
|
import ghidra.framework.plugintool.ComponentProviderAdapter;
|
||||||
|
@ -77,7 +78,7 @@ public class FunctionWindowProvider extends ComponentProviderAdapter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionContext getActionContext(MouseEvent event) {
|
public ActionContext getActionContext(MouseEvent event) {
|
||||||
return new ActionContext(this, functionTable);
|
return new DefaultActionContext(this, functionTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -116,7 +116,8 @@ public class AboutProgramPlugin extends Plugin implements ApplicationLevelPlugin
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
aboutAction.addToWindowWhen(ProgramActionContext.class);
|
aboutAction.addToWindowWhen(ProgramActionContext.class);
|
||||||
aboutAction.setSupportsDefaultToolContext(true);
|
// use the CodeBrowser as a backup context provider
|
||||||
|
aboutAction.setContextClass(ProgramActionContext.class, true);
|
||||||
|
|
||||||
aboutAction.setMenuBarData(
|
aboutAction.setMenuBarData(
|
||||||
new MenuData(new String[] { ToolConstants.MENU_HELP, ACTION_NAME }, null, "ZZZ"));
|
new MenuData(new String[] { ToolConstants.MENU_HELP, ACTION_NAME }, null, "ZZZ"));
|
||||||
|
|
|
@ -53,8 +53,6 @@ public abstract class AbstractNextPreviousAction extends NavigatableContextActio
|
||||||
public AbstractNextPreviousAction(PluginTool tool, String name, String owner, String subGroup) {
|
public AbstractNextPreviousAction(PluginTool tool, String name, String owner, String subGroup) {
|
||||||
super(name, owner);
|
super(name, owner);
|
||||||
this.tool = tool;
|
this.tool = tool;
|
||||||
setSupportsDefaultToolContext(true);
|
|
||||||
|
|
||||||
ToolBarData toolBarData =
|
ToolBarData toolBarData =
|
||||||
new ToolBarData(getIcon(), ToolConstants.TOOLBAR_GROUP_FOUR);
|
new ToolBarData(getIcon(), ToolConstants.TOOLBAR_GROUP_FOUR);
|
||||||
toolBarData.setToolBarSubGroup(subGroup);
|
toolBarData.setToolBarSubGroup(subGroup);
|
||||||
|
|
|
@ -66,8 +66,7 @@ public class NextPreviousBookmarkAction extends MultiStateDockingAction<String>
|
||||||
public NextPreviousBookmarkAction(PluginTool tool, String owner, String subGroup) {
|
public NextPreviousBookmarkAction(PluginTool tool, String owner, String subGroup) {
|
||||||
super("Next Bookmark", owner);
|
super("Next Bookmark", owner);
|
||||||
this.tool = tool;
|
this.tool = tool;
|
||||||
|
setContextClass(NavigatableActionContext.class, true);
|
||||||
setSupportsDefaultToolContext(true);
|
|
||||||
|
|
||||||
ToolBarData toolBarData =
|
ToolBarData toolBarData =
|
||||||
new ToolBarData(BOOKMARK_ICON, ToolConstants.TOOLBAR_GROUP_FOUR);
|
new ToolBarData(BOOKMARK_ICON, ToolConstants.TOOLBAR_GROUP_FOUR);
|
||||||
|
|
|
@ -23,6 +23,7 @@ import javax.swing.*;
|
||||||
import javax.swing.event.ChangeListener;
|
import javax.swing.event.ChangeListener;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
|
import docking.DefaultActionContext;
|
||||||
import docking.action.*;
|
import docking.action.*;
|
||||||
import docking.widgets.table.GTable;
|
import docking.widgets.table.GTable;
|
||||||
import generic.theme.GIcon;
|
import generic.theme.GIcon;
|
||||||
|
@ -402,7 +403,7 @@ public class LocationReferencesProvider extends ComponentProviderAdapter
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionContext getActionContext(MouseEvent event) {
|
public ActionContext getActionContext(MouseEvent event) {
|
||||||
return new ActionContext(this, referencesPanel.getTable());
|
return new DefaultActionContext(this, referencesPanel.getTable());
|
||||||
}
|
}
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
|
|
|
@ -23,6 +23,7 @@ import javax.swing.JComponent;
|
||||||
import javax.swing.event.ChangeEvent;
|
import javax.swing.event.ChangeEvent;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
|
import docking.DefaultActionContext;
|
||||||
import docking.action.DockingAction;
|
import docking.action.DockingAction;
|
||||||
import ghidra.app.events.ViewChangedPluginEvent;
|
import ghidra.app.events.ViewChangedPluginEvent;
|
||||||
import ghidra.app.services.GoToService;
|
import ghidra.app.services.GoToService;
|
||||||
|
@ -102,7 +103,7 @@ class TreeViewProvider implements ViewProviderService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionContext getActionContext(MouseEvent event) {
|
public ActionContext getActionContext(MouseEvent event) {
|
||||||
return new ActionContext().setContextObject(getActivePopupObject(event));
|
return new DefaultActionContext().setContextObject(getActivePopupObject(event));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -24,6 +24,7 @@ import javax.swing.*;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
|
import docking.DefaultActionContext;
|
||||||
import docking.action.builder.ActionBuilder;
|
import docking.action.builder.ActionBuilder;
|
||||||
import docking.widgets.dialogs.InputDialog;
|
import docking.widgets.dialogs.InputDialog;
|
||||||
import docking.widgets.table.AbstractSortedTableModel;
|
import docking.widgets.table.AbstractSortedTableModel;
|
||||||
|
@ -83,36 +84,36 @@ public class ExternalReferencesProvider extends ComponentProviderAdapter {
|
||||||
|
|
||||||
private void createActions() {
|
private void createActions() {
|
||||||
new ActionBuilder("Add External Program Name", getOwner())
|
new ActionBuilder("Add External Program Name", getOwner())
|
||||||
.popupMenuPath("Add External Program")
|
.popupMenuPath("Add External Program")
|
||||||
.popupMenuIcon(ADD_ICON)
|
.popupMenuIcon(ADD_ICON)
|
||||||
.toolBarIcon(ADD_ICON)
|
.toolBarIcon(ADD_ICON)
|
||||||
.enabledWhen(ac -> program != null)
|
.enabledWhen(ac -> program != null)
|
||||||
.onAction(ac -> addExternalProgram())
|
.onAction(ac -> addExternalProgram())
|
||||||
.buildAndInstallLocal(this);
|
.buildAndInstallLocal(this);
|
||||||
|
|
||||||
new ActionBuilder("Delete External Program Name", getOwner())
|
new ActionBuilder("Delete External Program Name", getOwner())
|
||||||
.popupMenuPath("Delete External Program")
|
.popupMenuPath("Delete External Program")
|
||||||
.popupMenuIcon(DELETE_ICON)
|
.popupMenuIcon(DELETE_ICON)
|
||||||
.toolBarIcon(DELETE_ICON)
|
.toolBarIcon(DELETE_ICON)
|
||||||
.enabledWhen(ac -> hasSelectedRows())
|
.enabledWhen(ac -> hasSelectedRows())
|
||||||
.onAction(ac -> deleteExternalProgram())
|
.onAction(ac -> deleteExternalProgram())
|
||||||
.buildAndInstallLocal(this);
|
.buildAndInstallLocal(this);
|
||||||
|
|
||||||
new ActionBuilder("Set External Name Association", getOwner())
|
new ActionBuilder("Set External Name Association", getOwner())
|
||||||
.popupMenuPath("Set External Name Association")
|
.popupMenuPath("Set External Name Association")
|
||||||
.popupMenuIcon(EDIT_ICON)
|
.popupMenuIcon(EDIT_ICON)
|
||||||
.toolBarIcon(EDIT_ICON)
|
.toolBarIcon(EDIT_ICON)
|
||||||
.enabledWhen(ac -> isSingleRowSelected())
|
.enabledWhen(ac -> isSingleRowSelected())
|
||||||
.onAction(ac -> setExternalProgramAssociation())
|
.onAction(ac -> setExternalProgramAssociation())
|
||||||
.buildAndInstallLocal(this);
|
.buildAndInstallLocal(this);
|
||||||
|
|
||||||
new ActionBuilder("Clear External Name Association", getOwner())
|
new ActionBuilder("Clear External Name Association", getOwner())
|
||||||
.popupMenuPath("Clear External Name Association")
|
.popupMenuPath("Clear External Name Association")
|
||||||
.popupMenuIcon(CLEAR_ICON)
|
.popupMenuIcon(CLEAR_ICON)
|
||||||
.toolBarIcon(CLEAR_ICON)
|
.toolBarIcon(CLEAR_ICON)
|
||||||
.enabledWhen(ac -> hasSelectedRows())
|
.enabledWhen(ac -> hasSelectedRows())
|
||||||
.onAction(ac -> clearExternalAssociation())
|
.onAction(ac -> clearExternalAssociation())
|
||||||
.buildAndInstallLocal(this);
|
.buildAndInstallLocal(this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +149,7 @@ public class ExternalReferencesProvider extends ComponentProviderAdapter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionContext getActionContext(MouseEvent event) {
|
public ActionContext getActionContext(MouseEvent event) {
|
||||||
return new ActionContext(this, table);
|
return new DefaultActionContext(this, table);
|
||||||
}
|
}
|
||||||
|
|
||||||
private JPanel buildMainPanel() {
|
private JPanel buildMainPanel() {
|
||||||
|
@ -452,7 +453,7 @@ public class ExternalReferencesProvider extends ComponentProviderAdapter {
|
||||||
// there are lots of empty path values.
|
// there are lots of empty path values.
|
||||||
Comparator<ExternalNamesRow> c1 =
|
Comparator<ExternalNamesRow> c1 =
|
||||||
(r1, r2) -> Objects.requireNonNullElse(r1.getPath(), "")
|
(r1, r2) -> Objects.requireNonNullElse(r1.getPath(), "")
|
||||||
.compareTo(Objects.requireNonNullElse(r2.getPath(), ""));
|
.compareTo(Objects.requireNonNullElse(r2.getPath(), ""));
|
||||||
return c1.thenComparing((r1, r2) -> r1.getName().compareTo(r2.getName()));
|
return c1.thenComparing((r1, r2) -> r1.getName().compareTo(r2.getName()));
|
||||||
}
|
}
|
||||||
return super.createSortComparator(columnIndex);
|
return super.createSortComparator(columnIndex);
|
||||||
|
|
|
@ -15,19 +15,19 @@
|
||||||
*/
|
*/
|
||||||
package ghidra.app.plugin.core.scalartable;
|
package ghidra.app.plugin.core.scalartable;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
import ghidra.util.table.GhidraTable;
|
import ghidra.util.table.GhidraTable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plugin context for the scalar plugin that will initialize an instance of ActionContext with the scalarTable
|
* Plugin context for the scalar plugin that will initialize an instance of ActionContext with the scalarTable
|
||||||
*/
|
*/
|
||||||
public class ScalarSearchContext extends ActionContext {
|
public class ScalarSearchContext extends DefaultActionContext {
|
||||||
|
|
||||||
ScalarSearchContext(ScalarSearchProvider provider, GhidraTable scalarTable) {
|
ScalarSearchContext(ScalarSearchProvider provider, GhidraTable scalarTable) {
|
||||||
super(provider, scalarTable);
|
super(provider, scalarTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
GhidraTable getScalarTable() {
|
GhidraTable getScalarTable() {
|
||||||
return (GhidraTable) getContextObject();
|
return (GhidraTable) getContextObject();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,17 +15,16 @@
|
||||||
*/
|
*/
|
||||||
package ghidra.app.plugin.core.script;
|
package ghidra.app.plugin.core.script;
|
||||||
|
|
||||||
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.Rectangle;
|
||||||
|
import java.awt.event.*;
|
||||||
|
import java.io.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
|
||||||
import java.awt.Rectangle;
|
|
||||||
import java.awt.event.*;
|
|
||||||
import java.io.*;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.event.ChangeEvent;
|
import javax.swing.event.ChangeEvent;
|
||||||
import javax.swing.event.ChangeListener;
|
import javax.swing.event.ChangeListener;
|
||||||
|
@ -38,6 +37,7 @@ import javax.swing.tree.TreeSelectionModel;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
|
import docking.DefaultActionContext;
|
||||||
import docking.action.KeyBindingData;
|
import docking.action.KeyBindingData;
|
||||||
import docking.event.mouse.GMouseListenerAdapter;
|
import docking.event.mouse.GMouseListenerAdapter;
|
||||||
import docking.widgets.OptionDialog;
|
import docking.widgets.OptionDialog;
|
||||||
|
@ -176,7 +176,7 @@ public class GhidraScriptComponentProvider extends ComponentProviderAdapter {
|
||||||
});
|
});
|
||||||
|
|
||||||
scriptCategoryTree.getSelectionModel()
|
scriptCategoryTree.getSelectionModel()
|
||||||
.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
|
.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void build() {
|
private void build() {
|
||||||
|
@ -475,11 +475,11 @@ public class GhidraScriptComponentProvider extends ComponentProviderAdapter {
|
||||||
*/
|
*/
|
||||||
public List<ResourceFile> getScriptDirectories() {
|
public List<ResourceFile> getScriptDirectories() {
|
||||||
return bundleHost.getGhidraBundles()
|
return bundleHost.getGhidraBundles()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(GhidraSourceBundle.class::isInstance)
|
.filter(GhidraSourceBundle.class::isInstance)
|
||||||
.filter(GhidraBundle::isEnabled)
|
.filter(GhidraBundle::isEnabled)
|
||||||
.map(GhidraBundle::getFile)
|
.map(GhidraBundle::getFile)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -487,12 +487,12 @@ public class GhidraScriptComponentProvider extends ComponentProviderAdapter {
|
||||||
*/
|
*/
|
||||||
public List<ResourceFile> getWritableScriptDirectories() {
|
public List<ResourceFile> getWritableScriptDirectories() {
|
||||||
return bundleHost.getGhidraBundles()
|
return bundleHost.getGhidraBundles()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(GhidraSourceBundle.class::isInstance)
|
.filter(GhidraSourceBundle.class::isInstance)
|
||||||
.filter(Predicate.not(GhidraBundle::isSystemBundle))
|
.filter(Predicate.not(GhidraBundle::isSystemBundle))
|
||||||
.filter(GhidraBundle::isEnabled)
|
.filter(GhidraBundle::isEnabled)
|
||||||
.map(GhidraBundle::getFile)
|
.map(GhidraBundle::getFile)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isEditorOpen(ResourceFile script) {
|
boolean isEditorOpen(ResourceFile script) {
|
||||||
|
@ -647,9 +647,9 @@ public class GhidraScriptComponentProvider extends ComponentProviderAdapter {
|
||||||
|
|
||||||
AtomicReference<GhidraScript> ref = new AtomicReference<>();
|
AtomicReference<GhidraScript> ref = new AtomicReference<>();
|
||||||
TaskBuilder.withRunnable(monitor -> ref.set(scriptSupplier.get()))
|
TaskBuilder.withRunnable(monitor -> ref.set(scriptSupplier.get()))
|
||||||
.setTitle("Compiling Script Directory")
|
.setTitle("Compiling Script Directory")
|
||||||
.setLaunchDelay(1000)
|
.setLaunchDelay(1000)
|
||||||
.launchModal();
|
.launchModal();
|
||||||
|
|
||||||
return ref.get();
|
return ref.get();
|
||||||
}
|
}
|
||||||
|
@ -1132,11 +1132,11 @@ public class GhidraScriptComponentProvider extends ComponentProviderAdapter {
|
||||||
|
|
||||||
int[] selectedRows = scriptTable.getSelectedRows();
|
int[] selectedRows = scriptTable.getSelectedRows();
|
||||||
if (selectedRows.length != 1) {
|
if (selectedRows.length != 1) {
|
||||||
return new ActionContext(this, scriptTable); // can only work on one selection at a time
|
return new DefaultActionContext(this, scriptTable); // can only work on one selection at a time
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourceFile script = tableModel.getRowObject(selectedRows[0]);
|
ResourceFile script = tableModel.getRowObject(selectedRows[0]);
|
||||||
return new ActionContext(this, script, scriptTable);
|
return new DefaultActionContext(this, script, scriptTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -379,36 +379,34 @@ public class SearchTextPlugin extends ProgramPlugin implements OptionsChangeList
|
||||||
String subGroup = getClass().getName();
|
String subGroup = getClass().getName();
|
||||||
|
|
||||||
new ActionBuilder("Search Text", getName())
|
new ActionBuilder("Search Text", getName())
|
||||||
.menuPath("&Search", "Program &Text...")
|
.menuPath("&Search", "Program &Text...")
|
||||||
.menuGroup("search", subGroup)
|
.menuGroup("search", subGroup)
|
||||||
.keyBinding("ctrl shift E")
|
.keyBinding("ctrl shift E")
|
||||||
.description(DESCRIPTION)
|
.description(DESCRIPTION)
|
||||||
.helpLocation(new HelpLocation(HelpTopics.SEARCH, "Search Text"))
|
.helpLocation(new HelpLocation(HelpTopics.SEARCH, "Search Text"))
|
||||||
.withContext(NavigatableActionContext.class)
|
.withContext(NavigatableActionContext.class, true)
|
||||||
.validContextWhen(c -> !(c instanceof RestrictedAddressSetContext))
|
.validContextWhen(c -> !(c instanceof RestrictedAddressSetContext))
|
||||||
.inWindow(ActionBuilder.When.CONTEXT_MATCHES)
|
.inWindow(ActionBuilder.When.CONTEXT_MATCHES)
|
||||||
.supportsDefaultToolContext(true)
|
.onAction(c -> {
|
||||||
.onAction(c -> {
|
setNavigatable(c.getNavigatable());
|
||||||
setNavigatable(c.getNavigatable());
|
displayDialog(c);
|
||||||
displayDialog(c);
|
})
|
||||||
})
|
.buildAndInstall(tool);
|
||||||
.buildAndInstall(tool);
|
|
||||||
|
|
||||||
new ActionBuilder("Repeat Text Search", getName())
|
new ActionBuilder("Repeat Text Search", getName())
|
||||||
.menuPath("&Search", "Repeat Text Search")
|
.menuPath("&Search", "Repeat Text Search")
|
||||||
.menuGroup("search", subGroup)
|
.menuGroup("search", subGroup)
|
||||||
.keyBinding("ctrl shift F3")
|
.keyBinding("ctrl shift F3")
|
||||||
.description(DESCRIPTION)
|
.description(DESCRIPTION)
|
||||||
.supportsDefaultToolContext(true)
|
.helpLocation(new HelpLocation(HelpTopics.SEARCH, "Repeat Text Search"))
|
||||||
.helpLocation(new HelpLocation(HelpTopics.SEARCH, "Repeat Text Search"))
|
.withContext(NavigatableActionContext.class, true)
|
||||||
.withContext(NavigatableActionContext.class)
|
.inWindow(ActionBuilder.When.CONTEXT_MATCHES)
|
||||||
.inWindow(ActionBuilder.When.CONTEXT_MATCHES)
|
.enabledWhen(c -> searchedOnce)
|
||||||
.enabledWhen(c -> searchedOnce)
|
.onAction(c -> {
|
||||||
.onAction(c -> {
|
setNavigatable(c.getNavigatable());
|
||||||
setNavigatable(c.getNavigatable());
|
searchDialog.repeatSearch();
|
||||||
searchDialog.repeatSearch();
|
})
|
||||||
})
|
.buildAndInstall(tool);
|
||||||
.buildAndInstall(tool);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateNavigatable(ActionContext context) {
|
protected void updateNavigatable(ActionContext context) {
|
||||||
|
|
|
@ -62,9 +62,7 @@ class SelectByFlowAction extends ListingContextAction {
|
||||||
super(name, plugin.getName());
|
super(name, plugin.getName());
|
||||||
this.selectByFlowPlugin = plugin;
|
this.selectByFlowPlugin = plugin;
|
||||||
this.selectionType = selectionType;
|
this.selectionType = selectionType;
|
||||||
|
setContextClass(ListingActionContext.class, true);
|
||||||
// this is in the main tool menu, so make it a tool action
|
|
||||||
setSupportsDefaultToolContext(true);
|
|
||||||
|
|
||||||
String[] menuPath = null;
|
String[] menuPath = null;
|
||||||
if (selectionType == SelectByFlowPlugin.SELECT_FUNCTIONS) {
|
if (selectionType == SelectByFlowPlugin.SELECT_FUNCTIONS) {
|
||||||
|
|
|
@ -18,14 +18,14 @@ package ghidra.app.plugin.core.strings;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
import ghidra.app.context.DataLocationListContext;
|
import ghidra.app.context.DataLocationListContext;
|
||||||
import ghidra.program.model.listing.Data;
|
import ghidra.program.model.listing.Data;
|
||||||
import ghidra.program.model.listing.Program;
|
import ghidra.program.model.listing.Program;
|
||||||
import ghidra.program.util.ProgramLocation;
|
import ghidra.program.util.ProgramLocation;
|
||||||
import ghidra.util.table.GhidraTable;
|
import ghidra.util.table.GhidraTable;
|
||||||
|
|
||||||
public class ViewStringsContext extends ActionContext implements DataLocationListContext {
|
public class ViewStringsContext extends DefaultActionContext implements DataLocationListContext {
|
||||||
|
|
||||||
private ViewStringsProvider viewStringsProvider;
|
private ViewStringsProvider viewStringsProvider;
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,7 @@ import javax.swing.*;
|
||||||
import javax.swing.event.TableModelEvent;
|
import javax.swing.event.TableModelEvent;
|
||||||
import javax.swing.event.TableModelListener;
|
import javax.swing.event.TableModelListener;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.*;
|
||||||
import docking.ComponentProviderActivationListener;
|
|
||||||
import docking.action.DockingAction;
|
import docking.action.DockingAction;
|
||||||
import docking.action.MenuData;
|
import docking.action.MenuData;
|
||||||
import docking.widgets.table.AbstractSortedTableModel;
|
import docking.widgets.table.AbstractSortedTableModel;
|
||||||
|
@ -156,7 +155,7 @@ public class TableComponentProvider<T> extends ComponentProviderAdapter
|
||||||
|
|
||||||
selectionNavigationAction = new SelectionNavigationAction(plugin, table);
|
selectionNavigationAction = new SelectionNavigationAction(plugin, table);
|
||||||
selectionNavigationAction
|
selectionNavigationAction
|
||||||
.setHelpLocation(new HelpLocation(HelpTopics.SEARCH, "Selection_Navigation"));
|
.setHelpLocation(new HelpLocation(HelpTopics.SEARCH, "Selection_Navigation"));
|
||||||
|
|
||||||
DockingAction externalGotoAction = new DockingAction("Go to External Location", getName()) {
|
DockingAction externalGotoAction = new DockingAction("Go to External Location", getName()) {
|
||||||
@Override
|
@Override
|
||||||
|
@ -394,7 +393,7 @@ public class TableComponentProvider<T> extends ComponentProviderAdapter
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionContext getActionContext(MouseEvent event) {
|
public ActionContext getActionContext(MouseEvent event) {
|
||||||
return new ActionContext(this, threadedPanel.getTable());
|
return new DefaultActionContext(this, threadedPanel.getTable());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,6 @@ import ghidra.program.util.ProgramSelection;
|
||||||
*/
|
*/
|
||||||
@ServiceInfo(defaultProvider = CodeBrowserPlugin.class)
|
@ServiceInfo(defaultProvider = CodeBrowserPlugin.class)
|
||||||
public interface CodeViewerService {
|
public interface CodeViewerService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a provider that shows an overview of the program.
|
* Add a provider that shows an overview of the program.
|
||||||
* @param overviewProvider provider to add
|
* @param overviewProvider provider to add
|
||||||
|
|
|
@ -1561,8 +1561,8 @@ public class ListingCodeComparisonPanel
|
||||||
if (programs[LEFT] != null) {
|
if (programs[LEFT] != null) {
|
||||||
AddressIndexMap indexMap = listingPanels[LEFT].getAddressIndexMap();
|
AddressIndexMap indexMap = listingPanels[LEFT].getAddressIndexMap();
|
||||||
listingPanels[LEFT].getFieldPanel()
|
listingPanels[LEFT].getFieldPanel()
|
||||||
.setBackgroundColorModel(new MarkerServiceBackgroundColorModel(
|
.setBackgroundColorModel(new MarkerServiceBackgroundColorModel(
|
||||||
markerManagers[LEFT], programs[LEFT], indexMap));
|
markerManagers[LEFT], programs[LEFT], indexMap));
|
||||||
unmatchedCodeMarkers[LEFT] =
|
unmatchedCodeMarkers[LEFT] =
|
||||||
markerManagers[LEFT].createAreaMarker("Listing1 Unmatched Code",
|
markerManagers[LEFT].createAreaMarker("Listing1 Unmatched Code",
|
||||||
"Instructions that are not matched to an instruction in the other function.",
|
"Instructions that are not matched to an instruction in the other function.",
|
||||||
|
@ -1575,8 +1575,8 @@ public class ListingCodeComparisonPanel
|
||||||
if (programs[RIGHT] != null) {
|
if (programs[RIGHT] != null) {
|
||||||
AddressIndexMap rightIndexMap = listingPanels[RIGHT].getAddressIndexMap();
|
AddressIndexMap rightIndexMap = listingPanels[RIGHT].getAddressIndexMap();
|
||||||
listingPanels[RIGHT].getFieldPanel()
|
listingPanels[RIGHT].getFieldPanel()
|
||||||
.setBackgroundColorModel(new MarkerServiceBackgroundColorModel(
|
.setBackgroundColorModel(new MarkerServiceBackgroundColorModel(
|
||||||
markerManagers[RIGHT], programs[RIGHT], rightIndexMap));
|
markerManagers[RIGHT], programs[RIGHT], rightIndexMap));
|
||||||
unmatchedCodeMarkers[RIGHT] =
|
unmatchedCodeMarkers[RIGHT] =
|
||||||
markerManagers[RIGHT].createAreaMarker("Listing2 Unmatched Code",
|
markerManagers[RIGHT].createAreaMarker("Listing2 Unmatched Code",
|
||||||
"Instructions that are not matched to an instruction in the other function.",
|
"Instructions that are not matched to an instruction in the other function.",
|
||||||
|
@ -1676,8 +1676,8 @@ public class ListingCodeComparisonPanel
|
||||||
indexMaps[LEFT] = new AddressIndexMap(addressSets[LEFT]);
|
indexMaps[LEFT] = new AddressIndexMap(addressSets[LEFT]);
|
||||||
markerManagers[LEFT].getOverviewProvider().setProgram(getLeftProgram(), indexMaps[LEFT]);
|
markerManagers[LEFT].getOverviewProvider().setProgram(getLeftProgram(), indexMaps[LEFT]);
|
||||||
listingPanels[LEFT].getFieldPanel()
|
listingPanels[LEFT].getFieldPanel()
|
||||||
.setBackgroundColorModel(new MarkerServiceBackgroundColorModel(markerManagers[LEFT],
|
.setBackgroundColorModel(new MarkerServiceBackgroundColorModel(markerManagers[LEFT],
|
||||||
programs[LEFT], indexMaps[LEFT]));
|
programs[LEFT], indexMaps[LEFT]));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateRightAddressSet(Function rightFunction) {
|
private void updateRightAddressSet(Function rightFunction) {
|
||||||
|
@ -1693,8 +1693,8 @@ public class ListingCodeComparisonPanel
|
||||||
indexMaps[RIGHT] = new AddressIndexMap(addressSets[RIGHT]);
|
indexMaps[RIGHT] = new AddressIndexMap(addressSets[RIGHT]);
|
||||||
markerManagers[RIGHT].getOverviewProvider().setProgram(getRightProgram(), indexMaps[RIGHT]);
|
markerManagers[RIGHT].getOverviewProvider().setProgram(getRightProgram(), indexMaps[RIGHT]);
|
||||||
listingPanels[RIGHT].getFieldPanel()
|
listingPanels[RIGHT].getFieldPanel()
|
||||||
.setBackgroundColorModel(new MarkerServiceBackgroundColorModel(
|
.setBackgroundColorModel(new MarkerServiceBackgroundColorModel(
|
||||||
markerManagers[RIGHT], programs[RIGHT], indexMaps[RIGHT]));
|
markerManagers[RIGHT], programs[RIGHT], indexMaps[RIGHT]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2085,18 +2085,18 @@ public class ListingCodeComparisonPanel
|
||||||
|
|
||||||
Object leftMarginContext = getContextForMarginPanels(leftPanel, event);
|
Object leftMarginContext = getContextForMarginPanels(leftPanel, event);
|
||||||
if (leftMarginContext != null) {
|
if (leftMarginContext != null) {
|
||||||
return new ActionContext(provider).setContextObject(leftMarginContext);
|
return new DefaultActionContext(provider).setContextObject(leftMarginContext);
|
||||||
}
|
}
|
||||||
Object rightMarginContext = getContextForMarginPanels(rightPanel, event);
|
Object rightMarginContext = getContextForMarginPanels(rightPanel, event);
|
||||||
if (rightMarginContext != null) {
|
if (rightMarginContext != null) {
|
||||||
return new ActionContext(provider).setContextObject(rightMarginContext);
|
return new DefaultActionContext(provider).setContextObject(rightMarginContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
Object source = event.getSource();
|
Object source = event.getSource();
|
||||||
if (source instanceof FieldHeaderComp) {
|
if (source instanceof FieldHeaderComp) {
|
||||||
FieldHeaderLocation fieldHeaderLocation =
|
FieldHeaderLocation fieldHeaderLocation =
|
||||||
leftPanel.getFieldHeader().getFieldHeaderLocation(event.getPoint());
|
leftPanel.getFieldHeader().getFieldHeaderLocation(event.getPoint());
|
||||||
return new ActionContext(provider).setContextObject(fieldHeaderLocation);
|
return new DefaultActionContext(provider).setContextObject(fieldHeaderLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
Navigatable focusedNavigatable = dualListingPanel.getFocusedNavigatable();
|
Navigatable focusedNavigatable = dualListingPanel.getFocusedNavigatable();
|
||||||
|
@ -2689,13 +2689,15 @@ public class ListingCodeComparisonPanel
|
||||||
// Are we on a marker margin of the left listing? Return that margin's context.
|
// Are we on a marker margin of the left listing? Return that margin's context.
|
||||||
Object sourceMarginContextObject = getContextObjectForMarginPanels(sourcePanel, event);
|
Object sourceMarginContextObject = getContextObjectForMarginPanels(sourcePanel, event);
|
||||||
if (sourceMarginContextObject != null) {
|
if (sourceMarginContextObject != null) {
|
||||||
return new ActionContext(provider).setContextObject(sourceMarginContextObject);
|
return new DefaultActionContext(provider)
|
||||||
|
.setContextObject(sourceMarginContextObject);
|
||||||
}
|
}
|
||||||
// Are we on a marker margin of the right listing? Return that margin's context.
|
// Are we on a marker margin of the right listing? Return that margin's context.
|
||||||
Object destinationMarginContextObject =
|
Object destinationMarginContextObject =
|
||||||
getContextObjectForMarginPanels(destinationPanel, event);
|
getContextObjectForMarginPanels(destinationPanel, event);
|
||||||
if (destinationMarginContextObject != null) {
|
if (destinationMarginContextObject != null) {
|
||||||
return new ActionContext(provider).setContextObject(destinationMarginContextObject);
|
return new DefaultActionContext(provider)
|
||||||
|
.setContextObject(destinationMarginContextObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the action is on the Field Header of the left listing panel return an
|
// If the action is on the Field Header of the left listing panel return an
|
||||||
|
@ -2703,7 +2705,7 @@ public class ListingCodeComparisonPanel
|
||||||
if (sourceComponent instanceof FieldHeaderComp) {
|
if (sourceComponent instanceof FieldHeaderComp) {
|
||||||
FieldHeaderLocation fieldHeaderLocation =
|
FieldHeaderLocation fieldHeaderLocation =
|
||||||
sourcePanel.getFieldHeader().getFieldHeaderLocation(event.getPoint());
|
sourcePanel.getFieldHeader().getFieldHeaderLocation(event.getPoint());
|
||||||
return new ActionContext(provider).setContextObject(fieldHeaderLocation);
|
return new DefaultActionContext(provider).setContextObject(fieldHeaderLocation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -25,6 +25,7 @@ import java.util.List;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
|
import docking.DefaultActionContext;
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import docking.event.mouse.GMouseListenerAdapter;
|
import docking.event.mouse.GMouseListenerAdapter;
|
||||||
import docking.widgets.table.*;
|
import docking.widgets.table.*;
|
||||||
|
@ -163,7 +164,7 @@ public class OpenVersionedFileDialog<T extends DomainObject> extends DataTreeDia
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected JPanel buildMainPanel() {
|
protected JPanel buildMainPanel() {
|
||||||
|
|
||||||
mainPanel = new JPanel(new BorderLayout());
|
mainPanel = new JPanel(new BorderLayout());
|
||||||
mainPanel.add(super.buildMainPanel(), BorderLayout.CENTER);
|
mainPanel.add(super.buildMainPanel(), BorderLayout.CENTER);
|
||||||
JPanel historyButtonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
|
JPanel historyButtonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
|
||||||
|
@ -244,7 +245,7 @@ public class OpenVersionedFileDialog<T extends DomainObject> extends DataTreeDia
|
||||||
openObjectsTable = new GFilterTable<>(new OpenObjectsTableModel());
|
openObjectsTable = new GFilterTable<>(new OpenObjectsTableModel());
|
||||||
GTable table = openObjectsTable.getTable();
|
GTable table = openObjectsTable.getTable();
|
||||||
table.getSelectionModel()
|
table.getSelectionModel()
|
||||||
.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||||
openObjectsTable.addSelectionListener(e -> {
|
openObjectsTable.addSelectionListener(e -> {
|
||||||
setOkEnabled(true);
|
setOkEnabled(true);
|
||||||
okButton.setToolTipText("Use the selected " + domainObjectClass.getSimpleName());
|
okButton.setToolTipText("Use the selected " + domainObjectClass.getSimpleName());
|
||||||
|
@ -402,7 +403,7 @@ public class OpenVersionedFileDialog<T extends DomainObject> extends DataTreeDia
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionContext actionContext = new ActionContext(null, this, event.getComponent());
|
ActionContext actionContext = new DefaultActionContext(null, this, event.getComponent());
|
||||||
actionContext.setMouseEvent(event);
|
actionContext.setMouseEvent(event);
|
||||||
|
|
||||||
return actionContext;
|
return actionContext;
|
||||||
|
|
|
@ -22,7 +22,7 @@ import java.util.List;
|
||||||
|
|
||||||
import javax.swing.tree.TreePath;
|
import javax.swing.tree.TreePath;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
import docking.widgets.tree.GTree;
|
import docking.widgets.tree.GTree;
|
||||||
import docking.widgets.tree.GTreeNode;
|
import docking.widgets.tree.GTreeNode;
|
||||||
import ghidra.formats.gfilesystem.*;
|
import ghidra.formats.gfilesystem.*;
|
||||||
|
@ -30,7 +30,7 @@ import ghidra.formats.gfilesystem.*;
|
||||||
/**
|
/**
|
||||||
* {@link FileSystemBrowserPlugin}-specific action.
|
* {@link FileSystemBrowserPlugin}-specific action.
|
||||||
*/
|
*/
|
||||||
public class FSBActionContext extends ActionContext {
|
public class FSBActionContext extends DefaultActionContext {
|
||||||
|
|
||||||
private GTree gTree;
|
private GTree gTree;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ import javax.swing.text.JTextComponent;
|
||||||
|
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import docking.widgets.filter.FilterOptions;
|
import docking.widgets.filter.FilterOptions;
|
||||||
import docking.widgets.table.*;
|
import docking.widgets.table.*;
|
||||||
|
@ -300,7 +300,7 @@ public class BookmarkPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
||||||
selectRow(5, true);
|
selectRow(5, true);
|
||||||
|
|
||||||
DockingActionIf action = getAction(plugin, "Select Bookmark Locations");
|
DockingActionIf action = getAction(plugin, "Select Bookmark Locations");
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
|
|
||||||
AddressSet set = new AddressSet();
|
AddressSet set = new AddressSet();
|
||||||
|
|
||||||
|
@ -311,7 +311,7 @@ public class BookmarkPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
||||||
|
|
||||||
selectRow(0, false);
|
selectRow(0, false);
|
||||||
selectRow(3, true);
|
selectRow(3, true);
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
sel = cbPlugin.getCurrentSelection();
|
sel = cbPlugin.getCurrentSelection();
|
||||||
set.clear();
|
set.clear();
|
||||||
set.addRange(addr("0x01001010"), addr("0x01001011"));
|
set.addRange(addr("0x01001010"), addr("0x01001011"));
|
||||||
|
|
|
@ -30,6 +30,7 @@ import org.apache.commons.collections4.map.LazyMap;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
|
import docking.DefaultActionContext;
|
||||||
import docking.action.*;
|
import docking.action.*;
|
||||||
import docking.widgets.tree.*;
|
import docking.widgets.tree.*;
|
||||||
import generic.test.AbstractGenericTest;
|
import generic.test.AbstractGenericTest;
|
||||||
|
@ -497,7 +498,7 @@ public class CallTreePluginTest extends AbstractGhidraHeadedIntegrationTest {
|
||||||
outgoingTree.setSelectedNode(child1);
|
outgoingTree.setSelectedNode(child1);
|
||||||
waitForTree(outgoingTree);
|
waitForTree(outgoingTree);
|
||||||
|
|
||||||
ActionContext actionContext = new ActionContext(provider, outgoingTree);
|
ActionContext actionContext = new DefaultActionContext(provider, outgoingTree);
|
||||||
DockingActionIf goToAction = getAction("Go To Destination");
|
DockingActionIf goToAction = getAction("Go To Destination");
|
||||||
performAction(goToAction, actionContext, true);
|
performAction(goToAction, actionContext, true);
|
||||||
|
|
||||||
|
@ -517,7 +518,7 @@ public class CallTreePluginTest extends AbstractGhidraHeadedIntegrationTest {
|
||||||
setProviderFunction("0x5000");
|
setProviderFunction("0x5000");
|
||||||
|
|
||||||
DockingActionIf selectSourceAction = getAction("Select Call Source");
|
DockingActionIf selectSourceAction = getAction("Select Call Source");
|
||||||
ActionContext context = new ActionContext(provider, outgoingTree);
|
ActionContext context = new DefaultActionContext(provider, outgoingTree);
|
||||||
|
|
||||||
assertTrue("The selection action was enabled when no node was selected",
|
assertTrue("The selection action was enabled when no node was selected",
|
||||||
!selectSourceAction.isEnabledForContext(context));
|
!selectSourceAction.isEnabledForContext(context));
|
||||||
|
@ -605,7 +606,7 @@ public class CallTreePluginTest extends AbstractGhidraHeadedIntegrationTest {
|
||||||
|
|
||||||
ToggleDockingAction filterDuplicatesAction =
|
ToggleDockingAction filterDuplicatesAction =
|
||||||
(ToggleDockingAction) getAction("Filter Duplicates");
|
(ToggleDockingAction) getAction("Filter Duplicates");
|
||||||
setToggleActionSelected(filterDuplicatesAction, new ActionContext(), true);
|
setToggleActionSelected(filterDuplicatesAction, new DefaultActionContext(), true);
|
||||||
waitForTree(outgoingTree);
|
waitForTree(outgoingTree);
|
||||||
|
|
||||||
GTreeNode rootNode = getRootNode(outgoingTree);
|
GTreeNode rootNode = getRootNode(outgoingTree);
|
||||||
|
@ -638,7 +639,7 @@ public class CallTreePluginTest extends AbstractGhidraHeadedIntegrationTest {
|
||||||
ToggleDockingAction filterDuplicatesAction =
|
ToggleDockingAction filterDuplicatesAction =
|
||||||
(ToggleDockingAction) getAction("Filter Duplicates");
|
(ToggleDockingAction) getAction("Filter Duplicates");
|
||||||
|
|
||||||
setToggleActionSelected(filterDuplicatesAction, new ActionContext(), true);
|
setToggleActionSelected(filterDuplicatesAction, new DefaultActionContext(), true);
|
||||||
|
|
||||||
waitForTree(outgoingTree);
|
waitForTree(outgoingTree);
|
||||||
GTreeNode rootNode = getRootNode(outgoingTree);
|
GTreeNode rootNode = getRootNode(outgoingTree);
|
||||||
|
@ -671,7 +672,7 @@ public class CallTreePluginTest extends AbstractGhidraHeadedIntegrationTest {
|
||||||
|
|
||||||
ToggleDockingAction filterDuplicatesAction =
|
ToggleDockingAction filterDuplicatesAction =
|
||||||
(ToggleDockingAction) getAction("Filter Duplicates");
|
(ToggleDockingAction) getAction("Filter Duplicates");
|
||||||
setToggleActionSelected(filterDuplicatesAction, new ActionContext(), true);
|
setToggleActionSelected(filterDuplicatesAction, new DefaultActionContext(), true);
|
||||||
waitForTree(outgoingTree);
|
waitForTree(outgoingTree);
|
||||||
|
|
||||||
GTreeNode rootNode = getRootNode(outgoingTree);
|
GTreeNode rootNode = getRootNode(outgoingTree);
|
||||||
|
@ -714,7 +715,7 @@ public class CallTreePluginTest extends AbstractGhidraHeadedIntegrationTest {
|
||||||
|
|
||||||
ToggleDockingAction filterDuplicatesAction =
|
ToggleDockingAction filterDuplicatesAction =
|
||||||
(ToggleDockingAction) getAction("Filter Duplicates");
|
(ToggleDockingAction) getAction("Filter Duplicates");
|
||||||
setToggleActionSelected(filterDuplicatesAction, new ActionContext(), true);
|
setToggleActionSelected(filterDuplicatesAction, new DefaultActionContext(), true);
|
||||||
waitForTree(incomingTree);
|
waitForTree(incomingTree);
|
||||||
|
|
||||||
// copy the names of the children into a map so that we can verify no duplicates
|
// copy the names of the children into a map so that we can verify no duplicates
|
||||||
|
@ -1071,13 +1072,13 @@ public class CallTreePluginTest extends AbstractGhidraHeadedIntegrationTest {
|
||||||
|
|
||||||
private void fullyExpandIncomingNode(GTreeNode node) {
|
private void fullyExpandIncomingNode(GTreeNode node) {
|
||||||
DockingActionIf expandAction = getLocalAction(provider, "Fully Expand Selected Nodes");
|
DockingActionIf expandAction = getLocalAction(provider, "Fully Expand Selected Nodes");
|
||||||
performAction(expandAction, new ActionContext(provider, incomingTree), false);
|
performAction(expandAction, new DefaultActionContext(provider, incomingTree), false);
|
||||||
waitForTree(node.getTree());
|
waitForTree(node.getTree());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fullyExpandOutgoingNode(GTreeNode node) {
|
private void fullyExpandOutgoingNode(GTreeNode node) {
|
||||||
DockingActionIf expandAction = getLocalAction(provider, "Fully Expand Selected Nodes");
|
DockingActionIf expandAction = getLocalAction(provider, "Fully Expand Selected Nodes");
|
||||||
performAction(expandAction, new ActionContext(provider, outgoingTree), false);
|
performAction(expandAction, new DefaultActionContext(provider, outgoingTree), false);
|
||||||
waitForTree(node.getTree());
|
waitForTree(node.getTree());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ import java.util.List;
|
||||||
|
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
import ghidra.GhidraOptions;
|
import ghidra.GhidraOptions;
|
||||||
import ghidra.app.cmd.data.CreateDataCmd;
|
import ghidra.app.cmd.data.CreateDataCmd;
|
||||||
import ghidra.app.plugin.core.navigation.NextPrevAddressPlugin;
|
import ghidra.app.plugin.core.navigation.NextPrevAddressPlugin;
|
||||||
|
@ -275,13 +275,13 @@ public class HeaderTest extends AbstractGhidraHeadedIntegrationTest {
|
||||||
public void testInsertDeleteRow() {
|
public void testInsertDeleteRow() {
|
||||||
FieldFormatModel model = header.getHeaderTab().getModel();
|
FieldFormatModel model = header.getHeaderTab().getModel();
|
||||||
InsertRowAction act = new InsertRowAction("Test", header);
|
InsertRowAction act = new InsertRowAction("Test", header);
|
||||||
act.isEnabledForContext(new ActionContext(cb.getProvider()).setContextObject(
|
act.isEnabledForContext(new DefaultActionContext(cb.getProvider()).setContextObject(
|
||||||
new FieldHeaderLocation(model, null, 0, 0)));
|
new FieldHeaderLocation(model, null, 0, 0)));
|
||||||
performAction(act, true);
|
performAction(act, true);
|
||||||
assertEquals(8, model.getNumRows());
|
assertEquals(8, model.getNumRows());
|
||||||
assertEquals(0, model.getNumFactorys(0));
|
assertEquals(0, model.getNumFactorys(0));
|
||||||
RemoveRowAction act2 = new RemoveRowAction("Test", header);
|
RemoveRowAction act2 = new RemoveRowAction("Test", header);
|
||||||
act2.isEnabledForContext(new ActionContext(cb.getProvider()).setContextObject(
|
act2.isEnabledForContext(new DefaultActionContext(cb.getProvider()).setContextObject(
|
||||||
new FieldHeaderLocation(model, null, 0, 0)));
|
new FieldHeaderLocation(model, null, 0, 0)));
|
||||||
performAction(act2, true);
|
performAction(act2, true);
|
||||||
assertEquals(7, model.getNumRows());
|
assertEquals(7, model.getNumRows());
|
||||||
|
@ -294,7 +294,7 @@ public class HeaderTest extends AbstractGhidraHeadedIntegrationTest {
|
||||||
ListingField bf = cb.getCurrentField();
|
ListingField bf = cb.getCurrentField();
|
||||||
int startX = bf.getStartX();
|
int startX = bf.getStartX();
|
||||||
InsertRowAction act = new InsertRowAction("Test", header);
|
InsertRowAction act = new InsertRowAction("Test", header);
|
||||||
act.isEnabledForContext(new ActionContext(cb.getProvider()).setContextObject(
|
act.isEnabledForContext(new DefaultActionContext(cb.getProvider()).setContextObject(
|
||||||
new FieldHeaderLocation(model, null, 0, 0)));
|
new FieldHeaderLocation(model, null, 0, 0)));
|
||||||
performAction(act, true);
|
performAction(act, true);
|
||||||
int width = bf.getWidth();
|
int width = bf.getWidth();
|
||||||
|
|
|
@ -27,6 +27,7 @@ import javax.swing.JButton;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
|
import docking.DefaultActionContext;
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import docking.options.editor.GhidraColorChooser;
|
import docking.options.editor.GhidraColorChooser;
|
||||||
import docking.widgets.EventTrigger;
|
import docking.widgets.EventTrigger;
|
||||||
|
@ -635,7 +636,7 @@ public class ColorizingPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
||||||
private ActionContext getActionContext() {
|
private ActionContext getActionContext() {
|
||||||
ActionContext context = cb.getProvider().getActionContext(null);
|
ActionContext context = cb.getProvider().getActionContext(null);
|
||||||
if (context == null) {
|
if (context == null) {
|
||||||
context = new ActionContext();
|
context = new DefaultActionContext();
|
||||||
}
|
}
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ import javax.swing.tree.TreePath;
|
||||||
|
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
import docking.DockingDialog;
|
import docking.DockingDialog;
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import docking.widgets.dialogs.NumberInputDialog;
|
import docking.widgets.dialogs.NumberInputDialog;
|
||||||
|
@ -320,7 +320,7 @@ public abstract class AbstractEditorTest extends AbstractGhidraHeadedIntegration
|
||||||
Msg.debug(this, "Calling actionPerformed() on a disabled action: " + action.getName(),
|
Msg.debug(this, "Calling actionPerformed() on a disabled action: " + action.getName(),
|
||||||
ReflectionUtilities.createJavaFilteredThrowable());
|
ReflectionUtilities.createJavaFilteredThrowable());
|
||||||
}
|
}
|
||||||
runSwing(() -> action.actionPerformed(new ActionContext()), wait);
|
runSwing(() -> action.actionPerformed(new DefaultActionContext()), wait);
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ import java.awt.Window;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import docking.action.ToggleDockingActionIf;
|
import docking.action.ToggleDockingActionIf;
|
||||||
import ghidra.framework.options.Options;
|
import ghidra.framework.options.Options;
|
||||||
|
@ -118,7 +118,7 @@ public class StructureEditorProviderTest extends AbstractStructureEditorTest {
|
||||||
runSwingLater(() -> {
|
runSwingLater(() -> {
|
||||||
getTable().requestFocus();
|
getTable().requestFocus();
|
||||||
setSelection(new int[] { 4, 5 });
|
setSelection(new int[] { 4, 5 });
|
||||||
deleteAction.actionPerformed(new ActionContext());
|
deleteAction.actionPerformed(new DefaultActionContext());
|
||||||
try {
|
try {
|
||||||
model.add(new WordDataType());
|
model.add(new WordDataType());
|
||||||
}
|
}
|
||||||
|
@ -137,8 +137,8 @@ public class StructureEditorProviderTest extends AbstractStructureEditorTest {
|
||||||
runSwingLater(() -> {
|
runSwingLater(() -> {
|
||||||
getTable().requestFocus();
|
getTable().requestFocus();
|
||||||
setSelection(new int[] { 1 });
|
setSelection(new int[] { 1 });
|
||||||
clearAction.actionPerformed(new ActionContext());
|
clearAction.actionPerformed(new DefaultActionContext());
|
||||||
deleteAction.actionPerformed(new ActionContext());// Must be undefined before it can delete.
|
deleteAction.actionPerformed(new DefaultActionContext());// Must be undefined before it can delete.
|
||||||
});
|
});
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
assertFalse(complexStructure.isEquivalent(model.viewComposite));
|
assertFalse(complexStructure.isEquivalent(model.viewComposite));
|
||||||
|
@ -454,7 +454,7 @@ public class StructureEditorProviderTest extends AbstractStructureEditorTest {
|
||||||
runSwingLater(() -> {
|
runSwingLater(() -> {
|
||||||
getTable().requestFocus();
|
getTable().requestFocus();
|
||||||
setSelection(new int[] { 4, 5 });
|
setSelection(new int[] { 4, 5 });
|
||||||
deleteAction.actionPerformed(new ActionContext());
|
deleteAction.actionPerformed(new DefaultActionContext());
|
||||||
try {
|
try {
|
||||||
model.add(new WordDataType());
|
model.add(new WordDataType());
|
||||||
}
|
}
|
||||||
|
@ -509,7 +509,7 @@ public class StructureEditorProviderTest extends AbstractStructureEditorTest {
|
||||||
runSwingLater(() -> {
|
runSwingLater(() -> {
|
||||||
getTable().requestFocus();
|
getTable().requestFocus();
|
||||||
setSelection(new int[] { 4, 5 });
|
setSelection(new int[] { 4, 5 });
|
||||||
deleteAction.actionPerformed(new ActionContext());
|
deleteAction.actionPerformed(new DefaultActionContext());
|
||||||
try {
|
try {
|
||||||
model.add(new WordDataType());
|
model.add(new WordDataType());
|
||||||
}
|
}
|
||||||
|
@ -545,7 +545,7 @@ public class StructureEditorProviderTest extends AbstractStructureEditorTest {
|
||||||
runSwing(() -> {
|
runSwing(() -> {
|
||||||
getTable().requestFocus();
|
getTable().requestFocus();
|
||||||
setSelection(new int[] { 4, 5 });
|
setSelection(new int[] { 4, 5 });
|
||||||
deleteAction.actionPerformed(new ActionContext());
|
deleteAction.actionPerformed(new DefaultActionContext());
|
||||||
try {
|
try {
|
||||||
model.add(new WordDataType());
|
model.add(new WordDataType());
|
||||||
}
|
}
|
||||||
|
@ -571,7 +571,7 @@ public class StructureEditorProviderTest extends AbstractStructureEditorTest {
|
||||||
runSwingLater(() -> {
|
runSwingLater(() -> {
|
||||||
getTable().requestFocus();
|
getTable().requestFocus();
|
||||||
setSelection(new int[] { 4, 5 });
|
setSelection(new int[] { 4, 5 });
|
||||||
deleteAction.actionPerformed(new ActionContext());
|
deleteAction.actionPerformed(new DefaultActionContext());
|
||||||
try {
|
try {
|
||||||
model.add(new WordDataType());
|
model.add(new WordDataType());
|
||||||
}
|
}
|
||||||
|
@ -705,7 +705,7 @@ public class StructureEditorProviderTest extends AbstractStructureEditorTest {
|
||||||
assertEquals("0x145", model.getLengthAsString());
|
assertEquals("0x145", model.getLengthAsString());
|
||||||
|
|
||||||
DockingActionIf action = getAction(plugin, "Editor: Show Numbers In Hex");
|
DockingActionIf action = getAction(plugin, "Editor: Show Numbers In Hex");
|
||||||
setToggleActionSelected((ToggleDockingActionIf) action, new ActionContext(), false);
|
setToggleActionSelected((ToggleDockingActionIf) action, new DefaultActionContext(), false);
|
||||||
|
|
||||||
assertEquals(false, model.isShowingNumbersInHex());
|
assertEquals(false, model.isShowingNumbersInHex());
|
||||||
assertEquals("47", model.getValueAt(15, model.getOffsetColumn()));
|
assertEquals("47", model.getValueAt(15, model.getOffsetColumn()));
|
||||||
|
|
|
@ -22,7 +22,7 @@ import java.awt.Window;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import docking.action.ToggleDockingActionIf;
|
import docking.action.ToggleDockingActionIf;
|
||||||
import ghidra.framework.options.Options;
|
import ghidra.framework.options.Options;
|
||||||
|
@ -346,7 +346,7 @@ public class UnionEditorProviderTest extends AbstractUnionEditorTest {
|
||||||
assertEquals("0x57", model.getLengthAsString());
|
assertEquals("0x57", model.getLengthAsString());
|
||||||
|
|
||||||
DockingActionIf action = getAction(plugin, "Editor: Show Numbers In Hex");
|
DockingActionIf action = getAction(plugin, "Editor: Show Numbers In Hex");
|
||||||
setToggleActionSelected((ToggleDockingActionIf) action, new ActionContext(), false);
|
setToggleActionSelected((ToggleDockingActionIf) action, new DefaultActionContext(), false);
|
||||||
|
|
||||||
assertEquals(false, model.isShowingNumbersInHex());
|
assertEquals(false, model.isShowingNumbersInHex());
|
||||||
assertEquals("29", model.getValueAt(15, model.getLengthColumn()));
|
assertEquals("29", model.getValueAt(15, model.getLengthColumn()));
|
||||||
|
@ -358,7 +358,7 @@ public class UnionEditorProviderTest extends AbstractUnionEditorTest {
|
||||||
|
|
||||||
getTable().requestFocus();
|
getTable().requestFocus();
|
||||||
model.setSelection(rows);
|
model.setSelection(rows);
|
||||||
deleteAction.actionPerformed(new ActionContext());
|
deleteAction.actionPerformed(new DefaultActionContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected UnionEditorProvider edit(DataType dt) {
|
protected UnionEditorProvider edit(DataType dt) {
|
||||||
|
|
|
@ -27,6 +27,7 @@ import javax.swing.table.TableCellEditor;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
|
import docking.DefaultActionContext;
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import docking.action.MenuData;
|
import docking.action.MenuData;
|
||||||
import docking.widgets.combobox.GhidraComboBox;
|
import docking.widgets.combobox.GhidraComboBox;
|
||||||
|
@ -1528,8 +1529,8 @@ public abstract class AbstractDataActionTest extends AbstractGhidraHeadedIntegra
|
||||||
}
|
}
|
||||||
// assumes returned set may be modified
|
// assumes returned set may be modified
|
||||||
return actions.stream()
|
return actions.stream()
|
||||||
.filter(a -> a.isValidContext(context))
|
.filter(a -> a.isValidContext(context))
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1634,7 +1635,7 @@ public abstract class AbstractDataActionTest extends AbstractGhidraHeadedIntegra
|
||||||
cb.updateNow();
|
cb.updateNow();
|
||||||
ActionContext context = cb.getProvider().getActionContext(null);
|
ActionContext context = cb.getProvider().getActionContext(null);
|
||||||
if (context == null) {
|
if (context == null) {
|
||||||
context = new ActionContext();
|
context = new DefaultActionContext();
|
||||||
}
|
}
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ import javax.swing.table.TableCellEditor;
|
||||||
|
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import docking.widgets.OptionDialog;
|
import docking.widgets.OptionDialog;
|
||||||
import generic.stl.Pair;
|
import generic.stl.Pair;
|
||||||
|
@ -167,7 +167,7 @@ public class EnumEditor1Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
assertEquals(5L, model.getValueAt(2, VALUE_COL));
|
assertEquals(5L, model.getValueAt(2, VALUE_COL));
|
||||||
|
|
||||||
// apply the change
|
// apply the change
|
||||||
runSwing(() -> applyAction.actionPerformed(new ActionContext()));
|
runSwing(() -> applyAction.actionPerformed(new DefaultActionContext()));
|
||||||
program.flushEvents();
|
program.flushEvents();
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
|
|
||||||
|
@ -390,7 +390,7 @@ public class EnumEditor1Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
int lastRow = model.getRowCount() - 1;
|
int lastRow = model.getRowCount() - 1;
|
||||||
table.addRowSelectionInterval(lastRow, lastRow);
|
table.addRowSelectionInterval(lastRow, lastRow);
|
||||||
DockingActionIf addAction = getAction(plugin, "Add Enum Value");
|
DockingActionIf addAction = getAction(plugin, "Add Enum Value");
|
||||||
addAction.actionPerformed(new ActionContext());
|
addAction.actionPerformed(new DefaultActionContext());
|
||||||
});
|
});
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
|
|
||||||
|
@ -1166,7 +1166,7 @@ public class EnumEditor1Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
private void apply() {
|
private void apply() {
|
||||||
runSwing(() -> {
|
runSwing(() -> {
|
||||||
DockingActionIf applyAction = getAction(plugin, "Apply Enum Changes");
|
DockingActionIf applyAction = getAction(plugin, "Apply Enum Changes");
|
||||||
applyAction.actionPerformed(new ActionContext());
|
applyAction.actionPerformed(new DefaultActionContext());
|
||||||
}, false);
|
}, false);
|
||||||
program.flushEvents();
|
program.flushEvents();
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
|
@ -1332,7 +1332,7 @@ public class EnumEditor1Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
private void addEnumValue() {
|
private void addEnumValue() {
|
||||||
runSwing(() -> {
|
runSwing(() -> {
|
||||||
DockingActionIf addAction = getAction(plugin, "Add Enum Value");
|
DockingActionIf addAction = getAction(plugin, "Add Enum Value");
|
||||||
addAction.actionPerformed(new ActionContext());
|
addAction.actionPerformed(new DefaultActionContext());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -275,14 +275,14 @@ public class EnumEditor2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
final DockingActionIf deleteAction = getAction(plugin, "Delete Enum Value");
|
final DockingActionIf deleteAction = getAction(plugin, "Delete Enum Value");
|
||||||
assertTrue(deleteAction.isEnabled());
|
assertTrue(deleteAction.isEnabled());
|
||||||
|
|
||||||
runSwing(() -> deleteAction.actionPerformed(new ActionContext()));
|
runSwing(() -> deleteAction.actionPerformed(new DefaultActionContext()));
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
assertTrue(table.isRowSelected(3));
|
assertTrue(table.isRowSelected(3));
|
||||||
|
|
||||||
final DockingActionIf applyAction = getAction(plugin, "Apply Enum Changes");
|
final DockingActionIf applyAction = getAction(plugin, "Apply Enum Changes");
|
||||||
assertTrue(applyAction.isEnabled());
|
assertTrue(applyAction.isEnabled());
|
||||||
|
|
||||||
runSwing(() -> applyAction.actionPerformed(new ActionContext()));
|
runSwing(() -> applyAction.actionPerformed(new DefaultActionContext()));
|
||||||
program.flushEvents();
|
program.flushEvents();
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
|
|
||||||
|
@ -304,7 +304,7 @@ public class EnumEditor2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
|
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
|
|
||||||
runSwing(() -> deleteAction.actionPerformed(new ActionContext()));
|
runSwing(() -> deleteAction.actionPerformed(new DefaultActionContext()));
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
}
|
}
|
||||||
assertEquals(0, model.getRowCount());
|
assertEquals(0, model.getRowCount());
|
||||||
|
@ -326,7 +326,7 @@ public class EnumEditor2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
|
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
|
|
||||||
runSwing(() -> deleteAction.actionPerformed(new ActionContext()));
|
runSwing(() -> deleteAction.actionPerformed(new DefaultActionContext()));
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
}
|
}
|
||||||
applyChanges(true);
|
applyChanges(true);
|
||||||
|
@ -352,7 +352,7 @@ public class EnumEditor2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
|
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
|
|
||||||
runSwing(() -> deleteAction.actionPerformed(new ActionContext()));
|
runSwing(() -> deleteAction.actionPerformed(new DefaultActionContext()));
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -387,7 +387,7 @@ public class EnumEditor2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
|
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
|
|
||||||
runSwing(() -> deleteAction.actionPerformed(new ActionContext()));
|
runSwing(() -> deleteAction.actionPerformed(new DefaultActionContext()));
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,7 +416,7 @@ public class EnumEditor2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
|
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
|
|
||||||
runSwing(() -> deleteAction.actionPerformed(new ActionContext()));
|
runSwing(() -> deleteAction.actionPerformed(new DefaultActionContext()));
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -448,7 +448,7 @@ public class EnumEditor2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
final DockingActionIf deleteAction = getAction(plugin, "Delete Enum Value");
|
final DockingActionIf deleteAction = getAction(plugin, "Delete Enum Value");
|
||||||
assertTrue(deleteAction.isEnabled());
|
assertTrue(deleteAction.isEnabled());
|
||||||
|
|
||||||
runSwing(() -> deleteAction.actionPerformed(new ActionContext()));
|
runSwing(() -> deleteAction.actionPerformed(new DefaultActionContext()));
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
|
|
||||||
assertTrue(table.isRowSelected(0));
|
assertTrue(table.isRowSelected(0));
|
||||||
|
@ -456,7 +456,7 @@ public class EnumEditor2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
final DockingActionIf applyAction = getAction(plugin, "Apply Enum Changes");
|
final DockingActionIf applyAction = getAction(plugin, "Apply Enum Changes");
|
||||||
assertTrue(applyAction.isEnabled());
|
assertTrue(applyAction.isEnabled());
|
||||||
|
|
||||||
runSwing(() -> applyAction.actionPerformed(new ActionContext()));
|
runSwing(() -> applyAction.actionPerformed(new DefaultActionContext()));
|
||||||
program.flushEvents();
|
program.flushEvents();
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
|
|
||||||
|
@ -635,7 +635,7 @@ public class EnumEditor2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
table.setRowSelectionInterval(0, 0);
|
table.setRowSelectionInterval(0, 0);
|
||||||
runSwing(() -> {
|
runSwing(() -> {
|
||||||
DockingActionIf action = getAction(plugin, "Delete Enum Value");
|
DockingActionIf action = getAction(plugin, "Delete Enum Value");
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
});
|
});
|
||||||
applyChanges(true);
|
applyChanges(true);
|
||||||
assertNull(enumDt.getName(0));
|
assertNull(enumDt.getName(0));
|
||||||
|
@ -660,16 +660,16 @@ public class EnumEditor2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
int origRowCount = model.getRowCount();
|
int origRowCount = model.getRowCount();
|
||||||
runSwing(() -> {
|
runSwing(() -> {
|
||||||
DockingActionIf action = getAction(plugin, "Add Enum Value");
|
DockingActionIf action = getAction(plugin, "Add Enum Value");
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
});
|
});
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
applyChanges(true);
|
applyChanges(true);
|
||||||
// make more changes
|
// make more changes
|
||||||
runSwing(() -> {
|
runSwing(() -> {
|
||||||
DockingActionIf action = getAction(plugin, "Add Enum Value");
|
DockingActionIf action = getAction(plugin, "Add Enum Value");
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
});
|
});
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
undo(false);
|
undo(false);
|
||||||
|
@ -698,8 +698,8 @@ public class EnumEditor2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
table.addRowSelectionInterval(lastRow, lastRow);
|
table.addRowSelectionInterval(lastRow, lastRow);
|
||||||
}
|
}
|
||||||
DockingActionIf action = getAction(plugin, "Add Enum Value");
|
DockingActionIf action = getAction(plugin, "Add Enum Value");
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
});
|
});
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
applyChanges(true);
|
applyChanges(true);
|
||||||
|
@ -710,8 +710,8 @@ public class EnumEditor2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
table.addRowSelectionInterval(lastRow, lastRow);
|
table.addRowSelectionInterval(lastRow, lastRow);
|
||||||
}
|
}
|
||||||
DockingActionIf action = getAction(plugin, "Add Enum Value");
|
DockingActionIf action = getAction(plugin, "Add Enum Value");
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
});
|
});
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
int rowCount = model.getRowCount();
|
int rowCount = model.getRowCount();
|
||||||
|
@ -784,7 +784,7 @@ public class EnumEditor2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
table.addRowSelectionInterval(lastRow, lastRow);
|
table.addRowSelectionInterval(lastRow, lastRow);
|
||||||
}
|
}
|
||||||
DockingActionIf addAction = getAction(plugin, "Add Enum Value");
|
DockingActionIf addAction = getAction(plugin, "Add Enum Value");
|
||||||
addAction.actionPerformed(new ActionContext());
|
addAction.actionPerformed(new DefaultActionContext());
|
||||||
});
|
});
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
final int newRow = model.getRowCount() - 1;
|
final int newRow = model.getRowCount() - 1;
|
||||||
|
@ -823,7 +823,7 @@ public class EnumEditor2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
|
|
||||||
final DockingActionIf applyAction = getAction(plugin, "Apply Enum Changes");
|
final DockingActionIf applyAction = getAction(plugin, "Apply Enum Changes");
|
||||||
assertTrue(applyAction.isEnabled());
|
assertTrue(applyAction.isEnabled());
|
||||||
Runnable r = () -> applyAction.actionPerformed(new ActionContext());
|
Runnable r = () -> applyAction.actionPerformed(new DefaultActionContext());
|
||||||
if (doWait) {
|
if (doWait) {
|
||||||
runSwing(r);
|
runSwing(r);
|
||||||
program.flushEvents();
|
program.flushEvents();
|
||||||
|
|
|
@ -24,8 +24,7 @@ import javax.swing.*;
|
||||||
|
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.*;
|
||||||
import docking.DialogComponentProvider;
|
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import docking.widgets.fieldpanel.*;
|
import docking.widgets.fieldpanel.*;
|
||||||
import docking.widgets.fieldpanel.field.Field;
|
import docking.widgets.fieldpanel.field.Field;
|
||||||
|
@ -179,7 +178,7 @@ public class ClearTest extends AbstractGhidraHeadedIntegrationTest {
|
||||||
closeProgram();
|
closeProgram();
|
||||||
|
|
||||||
assertFalse(isEnabled(clearAction, cb.getProvider()));
|
assertFalse(isEnabled(clearAction, cb.getProvider()));
|
||||||
assertFalse(clearAction.isEnabledForContext(new ActionContext()));
|
assertFalse(clearAction.isEnabledForContext(new DefaultActionContext()));
|
||||||
|
|
||||||
showTool(tool);
|
showTool(tool);
|
||||||
loadProgram("notepad");
|
loadProgram("notepad");
|
||||||
|
|
|
@ -20,6 +20,7 @@ import static org.junit.Assert.*;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
|
import docking.DefaultActionContext;
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import docking.widgets.EventTrigger;
|
import docking.widgets.EventTrigger;
|
||||||
import docking.widgets.fieldpanel.FieldPanel;
|
import docking.widgets.fieldpanel.FieldPanel;
|
||||||
|
@ -453,7 +454,7 @@ public class DisassemblerPluginTest extends AbstractGhidraHeadedIntegrationTest
|
||||||
|
|
||||||
private ActionContext getContext() {
|
private ActionContext getContext() {
|
||||||
ActionContext context = cb.getProvider().getActionContext(null);
|
ActionContext context = cb.getProvider().getActionContext(null);
|
||||||
return context == null ? new ActionContext() : context;
|
return context == null ? new DefaultActionContext() : context;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setSelection(FieldPanel fp, FieldSelection sel) {
|
private void setSelection(FieldPanel fp, FieldSelection sel) {
|
||||||
|
|
|
@ -25,8 +25,7 @@ import javax.swing.table.TableModel;
|
||||||
|
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.*;
|
||||||
import docking.ComponentProvider;
|
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import docking.action.MenuData;
|
import docking.action.MenuData;
|
||||||
import docking.widgets.OptionDialog;
|
import docking.widgets.OptionDialog;
|
||||||
|
@ -673,7 +672,7 @@ public class EquatePlugin1Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
|
|
||||||
env.close(program);
|
env.close(program);
|
||||||
|
|
||||||
assertFalse(setAction.isEnabledForContext(new ActionContext()));
|
assertFalse(setAction.isEnabledForContext(new DefaultActionContext()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -15,13 +15,14 @@
|
||||||
*/
|
*/
|
||||||
package ghidra.app.plugin.core.fallthrough;
|
package ghidra.app.plugin.core.fallthrough;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
|
import docking.DefaultActionContext;
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import ghidra.app.LocationCallback;
|
import ghidra.app.LocationCallback;
|
||||||
import ghidra.app.SampleLocationGenerator;
|
import ghidra.app.SampleLocationGenerator;
|
||||||
|
@ -138,7 +139,7 @@ public class FallThroughActionTest extends AbstractGhidraHeadedIntegrationTest
|
||||||
if (actionName.equals(name)) {
|
if (actionName.equals(name)) {
|
||||||
ActionContext actionContext = cb.getProvider().getActionContext(null);
|
ActionContext actionContext = cb.getProvider().getActionContext(null);
|
||||||
if (actionContext == null) {
|
if (actionContext == null) {
|
||||||
actionContext = new ActionContext();
|
actionContext = new DefaultActionContext();
|
||||||
}
|
}
|
||||||
boolean validContext = action.isAddToPopup(actionContext);
|
boolean validContext = action.isAddToPopup(actionContext);
|
||||||
assertEquals("Enablement: actionName = " + actionName + " [case: " + caseName + "]",
|
assertEquals("Enablement: actionName = " + actionName + " [case: " + caseName + "]",
|
||||||
|
|
|
@ -26,6 +26,7 @@ import javax.swing.*;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
|
import docking.DefaultActionContext;
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import docking.widgets.OptionDialog;
|
import docking.widgets.OptionDialog;
|
||||||
import docking.widgets.combobox.GhidraComboBox;
|
import docking.widgets.combobox.GhidraComboBox;
|
||||||
|
@ -100,7 +101,7 @@ public class Function1Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
public void testEnablement() throws Exception {
|
public void testEnablement() throws Exception {
|
||||||
ActionContext actionContext = cb.getProvider().getActionContext(null);
|
ActionContext actionContext = cb.getProvider().getActionContext(null);
|
||||||
assertNull(actionContext);
|
assertNull(actionContext);
|
||||||
actionContext = new ActionContext();
|
actionContext = new DefaultActionContext();
|
||||||
assertFalse(createFunction.isEnabledForContext(actionContext));
|
assertFalse(createFunction.isEnabledForContext(actionContext));
|
||||||
assertFalse(createThunk.isEnabledForContext(actionContext));
|
assertFalse(createThunk.isEnabledForContext(actionContext));
|
||||||
assertFalse(editThunk.isEnabledForContext(actionContext));
|
assertFalse(editThunk.isEnabledForContext(actionContext));
|
||||||
|
@ -176,7 +177,7 @@ public class Function1Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
closeProgram();
|
closeProgram();
|
||||||
actionContext = cb.getProvider().getActionContext(null);
|
actionContext = cb.getProvider().getActionContext(null);
|
||||||
assertNull(actionContext);
|
assertNull(actionContext);
|
||||||
actionContext = new ActionContext();
|
actionContext = new DefaultActionContext();
|
||||||
assertFalse(createFunction.isEnabledForContext(actionContext));
|
assertFalse(createFunction.isEnabledForContext(actionContext));
|
||||||
assertFalse(deleteFunction.isEnabledForContext(actionContext));
|
assertFalse(deleteFunction.isEnabledForContext(actionContext));
|
||||||
assertFalse(editThunk.isEnabledForContext(actionContext));
|
assertFalse(editThunk.isEnabledForContext(actionContext));
|
||||||
|
@ -885,8 +886,8 @@ public class Function1Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
Variable[] vars = function.getLocalVariables(VariableFilter.STACK_VARIABLE_FILTER);
|
Variable[] vars = function.getLocalVariables(VariableFilter.STACK_VARIABLE_FILTER);
|
||||||
tx(program, () -> {
|
tx(program, () -> {
|
||||||
DataType byteDT = program.getDataTypeManager()
|
DataType byteDT = program.getDataTypeManager()
|
||||||
.addDataType(new ByteDataType(),
|
.addDataType(new ByteDataType(),
|
||||||
DataTypeConflictHandler.DEFAULT_HANDLER);
|
DataTypeConflictHandler.DEFAULT_HANDLER);
|
||||||
vars[1].setDataType(byteDT, SourceType.ANALYSIS);
|
vars[1].setDataType(byteDT, SourceType.ANALYSIS);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,7 @@ import javax.swing.table.*;
|
||||||
|
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.*;
|
||||||
import docking.ComponentProvider;
|
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import docking.tool.ToolConstants;
|
import docking.tool.ToolConstants;
|
||||||
import docking.widgets.combobox.GComboBox;
|
import docking.widgets.combobox.GComboBox;
|
||||||
|
@ -148,7 +147,7 @@ public class FunctionWindowPluginTest extends AbstractGhidraHeadedIntegrationTes
|
||||||
String signatureText = getRenderedTableCellValue(functionTable, row, column);
|
String signatureText = getRenderedTableCellValue(functionTable, row, column);
|
||||||
|
|
||||||
DockingActionIf copyAction = getAction(tool, ToolConstants.SHARED_OWNER, "Table Data Copy");
|
DockingActionIf copyAction = getAction(tool, ToolConstants.SHARED_OWNER, "Table Data Copy");
|
||||||
ActionContext context = new ActionContext(provider, functionTable);
|
ActionContext context = new DefaultActionContext(provider, functionTable);
|
||||||
performAction(copyAction, context, true);
|
performAction(copyAction, context, true);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -23,8 +23,7 @@ import javax.swing.table.TableModel;
|
||||||
|
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.*;
|
||||||
import docking.DialogComponentProvider;
|
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import generic.test.TestUtils;
|
import generic.test.TestUtils;
|
||||||
import ghidra.app.LocationCallback;
|
import ghidra.app.LocationCallback;
|
||||||
|
@ -135,7 +134,7 @@ public class LabelActionTest extends AbstractGhidraHeadedIntegrationTest
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNotepadLocations() {
|
public void testNotepadLocations() {
|
||||||
ActionContext context = new ActionContext();
|
ActionContext context = new DefaultActionContext();
|
||||||
assertFalse(addLabel.isEnabledForContext(context));
|
assertFalse(addLabel.isEnabledForContext(context));
|
||||||
|
|
||||||
assertFalse(editLabel.isEnabledForContext(context));
|
assertFalse(editLabel.isEnabledForContext(context));
|
||||||
|
|
|
@ -28,6 +28,7 @@ import javax.swing.table.TableModel;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
|
import docking.DefaultActionContext;
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import ghidra.app.cmd.memory.*;
|
import ghidra.app.cmd.memory.*;
|
||||||
import ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin;
|
import ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin;
|
||||||
|
@ -139,7 +140,7 @@ public class MemoryMapPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
||||||
private ActionContext getActionContext() {
|
private ActionContext getActionContext() {
|
||||||
ActionContext context = provider.getActionContext(null);
|
ActionContext context = provider.getActionContext(null);
|
||||||
if (context == null) {
|
if (context == null) {
|
||||||
return new ActionContext();
|
return new DefaultActionContext();
|
||||||
}
|
}
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ import javax.swing.JCheckBox;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
|
import docking.DefaultActionContext;
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import docking.widgets.combobox.GhidraComboBox;
|
import docking.widgets.combobox.GhidraComboBox;
|
||||||
import docking.widgets.table.GTable;
|
import docking.widgets.table.GTable;
|
||||||
|
@ -689,7 +690,7 @@ public class GoToAddressLabelPluginTest extends AbstractGhidraHeadedIntegrationT
|
||||||
performOkCallback();
|
performOkCallback();
|
||||||
assertEquals(addr("100493b"), cbPlugin.getCurrentAddress());
|
assertEquals(addr("100493b"), cbPlugin.getCurrentAddress());
|
||||||
|
|
||||||
clear.actionPerformed(new ActionContext());
|
clear.actionPerformed(new DefaultActionContext());
|
||||||
assertFalse(clear.isEnabledForContext(provider.getActionContext(null)));
|
assertFalse(clear.isEnabledForContext(provider.getActionContext(null)));
|
||||||
assertFalse(next.isEnabledForContext(provider.getActionContext(null)));
|
assertFalse(next.isEnabledForContext(provider.getActionContext(null)));
|
||||||
assertFalse(prev.isEnabledForContext(provider.getActionContext(null)));
|
assertFalse(prev.isEnabledForContext(provider.getActionContext(null)));
|
||||||
|
@ -702,13 +703,13 @@ public class GoToAddressLabelPluginTest extends AbstractGhidraHeadedIntegrationT
|
||||||
assertFalse(next.isEnabledForContext(provider.getActionContext(null)));
|
assertFalse(next.isEnabledForContext(provider.getActionContext(null)));
|
||||||
assertTrue(prev.isEnabledForContext(provider.getActionContext(null)));
|
assertTrue(prev.isEnabledForContext(provider.getActionContext(null)));
|
||||||
|
|
||||||
prev.actionPerformed(new ActionContext());
|
prev.actionPerformed(new DefaultActionContext());
|
||||||
assertEquals(addr("100493b"), cbPlugin.getCurrentAddress());
|
assertEquals(addr("100493b"), cbPlugin.getCurrentAddress());
|
||||||
|
|
||||||
assertTrue(next.isEnabledForContext(provider.getActionContext(null)));
|
assertTrue(next.isEnabledForContext(provider.getActionContext(null)));
|
||||||
assertFalse(prev.isEnabledForContext(provider.getActionContext(null)));
|
assertFalse(prev.isEnabledForContext(provider.getActionContext(null)));
|
||||||
|
|
||||||
next.actionPerformed(new ActionContext());
|
next.actionPerformed(new DefaultActionContext());
|
||||||
assertEquals(addr("1001000"), cbPlugin.getCurrentAddress());
|
assertEquals(addr("1001000"), cbPlugin.getCurrentAddress());
|
||||||
|
|
||||||
setText("1001010");
|
setText("1001010");
|
||||||
|
@ -718,8 +719,8 @@ public class GoToAddressLabelPluginTest extends AbstractGhidraHeadedIntegrationT
|
||||||
assertFalse(next.isEnabledForContext(provider.getActionContext(null)));
|
assertFalse(next.isEnabledForContext(provider.getActionContext(null)));
|
||||||
assertTrue(prev.isEnabledForContext(provider.getActionContext(null)));
|
assertTrue(prev.isEnabledForContext(provider.getActionContext(null)));
|
||||||
|
|
||||||
prev.actionPerformed(new ActionContext());
|
prev.actionPerformed(new DefaultActionContext());
|
||||||
prev.actionPerformed(new ActionContext());
|
prev.actionPerformed(new DefaultActionContext());
|
||||||
|
|
||||||
assertEquals(addr("100493b"), cbPlugin.getCurrentAddress());
|
assertEquals(addr("100493b"), cbPlugin.getCurrentAddress());
|
||||||
assertTrue(next.isEnabledForContext(provider.getActionContext(null)));
|
assertTrue(next.isEnabledForContext(provider.getActionContext(null)));
|
||||||
|
@ -1029,7 +1030,7 @@ public class GoToAddressLabelPluginTest extends AbstractGhidraHeadedIntegrationT
|
||||||
private ActionContext getActionContext() {
|
private ActionContext getActionContext() {
|
||||||
ActionContext context = runSwing(() -> cbPlugin.getProvider().getActionContext(null));
|
ActionContext context = runSwing(() -> cbPlugin.getProvider().getActionContext(null));
|
||||||
if (context == null) {
|
if (context == null) {
|
||||||
context = new ActionContext();
|
context = new DefaultActionContext();
|
||||||
}
|
}
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
@ -1052,7 +1053,7 @@ public class GoToAddressLabelPluginTest extends AbstractGhidraHeadedIntegrationT
|
||||||
TableComponentProvider<?>[] providers = getProviders();
|
TableComponentProvider<?>[] providers = getProviders();
|
||||||
if (providers.length > 0) {
|
if (providers.length > 0) {
|
||||||
GThreadedTablePanel<?> panel = (GThreadedTablePanel<?>) TestUtils
|
GThreadedTablePanel<?> panel = (GThreadedTablePanel<?>) TestUtils
|
||||||
.getInstanceField("threadedPanel", providers[0]);
|
.getInstanceField("threadedPanel", providers[0]);
|
||||||
GTable table = panel.getTable();
|
GTable table = panel.getTable();
|
||||||
while (panel.isBusy()) {
|
while (panel.isBusy()) {
|
||||||
Thread.sleep(50);
|
Thread.sleep(50);
|
||||||
|
|
|
@ -15,12 +15,12 @@
|
||||||
*/
|
*/
|
||||||
package ghidra.app.plugin.core.navigation;
|
package ghidra.app.plugin.core.navigation;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.*;
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
|
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
|
import docking.DefaultActionContext;
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import docking.widgets.EventTrigger;
|
import docking.widgets.EventTrigger;
|
||||||
import docking.widgets.fieldpanel.FieldPanel;
|
import docking.widgets.fieldpanel.FieldPanel;
|
||||||
|
@ -310,7 +310,7 @@ public class NextPrevSelectionHighlightTest extends AbstractGhidraHeadedIntegrat
|
||||||
ActionContext getActionContext() {
|
ActionContext getActionContext() {
|
||||||
ActionContext context = cb.getProvider().getActionContext(null);
|
ActionContext context = cb.getProvider().getActionContext(null);
|
||||||
if (context == null) {
|
if (context == null) {
|
||||||
context = new ActionContext();
|
context = new DefaultActionContext();
|
||||||
}
|
}
|
||||||
return context;
|
return context;
|
||||||
|
|
||||||
|
|
|
@ -129,14 +129,14 @@ public class ProviderNavigationPluginTest extends AbstractProgramBasedTest {
|
||||||
assertTrue(
|
assertTrue(
|
||||||
"'" + ProviderNavigationPlugin.GO_TO_LAST_ACTIVE_COMPONENT_ACTION_NAME + "'" +
|
"'" + ProviderNavigationPlugin.GO_TO_LAST_ACTIVE_COMPONENT_ACTION_NAME + "'" +
|
||||||
" should be enabled when there is a previous provider set",
|
" should be enabled when there is a previous provider set",
|
||||||
previousProviderAction.isEnabledForContext(new ActionContext()));
|
previousProviderAction.isEnabledForContext(new DefaultActionContext()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertPreviousProviderActionNotEnabled() {
|
private void assertPreviousProviderActionNotEnabled() {
|
||||||
assertFalse(
|
assertFalse(
|
||||||
"'" + ProviderNavigationPlugin.GO_TO_LAST_ACTIVE_COMPONENT_ACTION_NAME + "'" +
|
"'" + ProviderNavigationPlugin.GO_TO_LAST_ACTIVE_COMPONENT_ACTION_NAME + "'" +
|
||||||
" should not be enabled when there is no previous provider set",
|
" should not be enabled when there is no previous provider set",
|
||||||
previousProviderAction.isEnabledForContext(new ActionContext()));
|
previousProviderAction.isEnabledForContext(new DefaultActionContext()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private ComponentProvider activateProvider(String name) {
|
private ComponentProvider activateProvider(String name) {
|
||||||
|
@ -152,7 +152,7 @@ public class ProviderNavigationPluginTest extends AbstractProgramBasedTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void forceActivate(ComponentProvider provider) {
|
private void forceActivate(ComponentProvider provider) {
|
||||||
ActionContext context = new ActionContext(provider);
|
ActionContext context = new DefaultActionContext(provider);
|
||||||
for (DockingContextListener l : testContextListeners) {
|
for (DockingContextListener l : testContextListeners) {
|
||||||
l.contextChanged(context);
|
l.contextChanged(context);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ import javax.swing.tree.TreePath;
|
||||||
|
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import generic.theme.GIcon;
|
import generic.theme.GIcon;
|
||||||
import ghidra.program.database.ProgramBuilder;
|
import ghidra.program.database.ProgramBuilder;
|
||||||
|
@ -721,7 +721,7 @@ public class ProgramTreePlugin2Test extends AbstractProgramTreePluginTest {
|
||||||
setSelectionPaths(new TreePath[] { rsrcNode.getTreePath(), textNode.getTreePath() });
|
setSelectionPaths(new TreePath[] { rsrcNode.getTreePath(), textNode.getTreePath() });
|
||||||
|
|
||||||
// cut Strings
|
// cut Strings
|
||||||
runSwing(() -> cutAction.actionPerformed(new ActionContext()));
|
runSwing(() -> cutAction.actionPerformed(new DefaultActionContext()));
|
||||||
|
|
||||||
// select Strings (has no fragments)
|
// select Strings (has no fragments)
|
||||||
ProgramNode stringsNode = root.getChild("Strings");
|
ProgramNode stringsNode = root.getChild("Strings");
|
||||||
|
|
|
@ -25,7 +25,7 @@ import javax.swing.*;
|
||||||
|
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
import docking.EditWindow;
|
import docking.EditWindow;
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin;
|
import ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin;
|
||||||
|
@ -124,7 +124,8 @@ public class ViewManagerPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
||||||
public void testCreateDefaultView() throws Exception {
|
public void testCreateDefaultView() throws Exception {
|
||||||
ProgramTreePlugin treePlugin = env.getPlugin(ProgramTreePlugin.class);
|
ProgramTreePlugin treePlugin = env.getPlugin(ProgramTreePlugin.class);
|
||||||
final DockingActionIf createTreeAction = getAction(treePlugin, "Create Default Tree View");
|
final DockingActionIf createTreeAction = getAction(treePlugin, "Create Default Tree View");
|
||||||
SwingUtilities.invokeAndWait(() -> createTreeAction.actionPerformed(new ActionContext()));
|
SwingUtilities
|
||||||
|
.invokeAndWait(() -> createTreeAction.actionPerformed(new DefaultActionContext()));
|
||||||
program.flushEvents();
|
program.flushEvents();
|
||||||
|
|
||||||
ViewProviderService vps = provider.getCurrentViewProvider();
|
ViewProviderService vps = provider.getCurrentViewProvider();
|
||||||
|
@ -134,7 +135,8 @@ public class ViewManagerPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
||||||
assertEquals(treeNames.length, tabbedPane.getTabCount());
|
assertEquals(treeNames.length, tabbedPane.getTabCount());
|
||||||
assertEquals(PluginConstants.DEFAULT_TREE_NAME + "(1)", vps.getViewName());
|
assertEquals(PluginConstants.DEFAULT_TREE_NAME + "(1)", vps.getViewName());
|
||||||
assertEquals(tabbedPane.getSelectedComponent(), vps.getViewComponent());
|
assertEquals(tabbedPane.getSelectedComponent(), vps.getViewComponent());
|
||||||
SwingUtilities.invokeAndWait(() -> createTreeAction.actionPerformed(new ActionContext()));
|
SwingUtilities
|
||||||
|
.invokeAndWait(() -> createTreeAction.actionPerformed(new DefaultActionContext()));
|
||||||
program.flushEvents();
|
program.flushEvents();
|
||||||
vps = provider.getCurrentViewProvider();
|
vps = provider.getCurrentViewProvider();
|
||||||
treeNames = program.getListing().getTreeNames();
|
treeNames = program.getListing().getTreeNames();
|
||||||
|
@ -149,7 +151,8 @@ public class ViewManagerPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
||||||
public void testUndoRedo() throws Exception {
|
public void testUndoRedo() throws Exception {
|
||||||
ProgramTreePlugin treePlugin = env.getPlugin(ProgramTreePlugin.class);
|
ProgramTreePlugin treePlugin = env.getPlugin(ProgramTreePlugin.class);
|
||||||
final DockingActionIf createTreeAction = getAction(treePlugin, "Create Default Tree View");
|
final DockingActionIf createTreeAction = getAction(treePlugin, "Create Default Tree View");
|
||||||
SwingUtilities.invokeAndWait(() -> createTreeAction.actionPerformed(new ActionContext()));
|
SwingUtilities
|
||||||
|
.invokeAndWait(() -> createTreeAction.actionPerformed(new DefaultActionContext()));
|
||||||
program.flushEvents();
|
program.flushEvents();
|
||||||
env.showTool();
|
env.showTool();
|
||||||
ViewProviderService vps = provider.getCurrentViewProvider();
|
ViewProviderService vps = provider.getCurrentViewProvider();
|
||||||
|
@ -159,7 +162,8 @@ public class ViewManagerPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
||||||
assertEquals(treeNames.length, tabbedPane.getTabCount());
|
assertEquals(treeNames.length, tabbedPane.getTabCount());
|
||||||
assertEquals(PluginConstants.DEFAULT_TREE_NAME + "(1)", vps.getViewName());
|
assertEquals(PluginConstants.DEFAULT_TREE_NAME + "(1)", vps.getViewName());
|
||||||
assertEquals(tabbedPane.getSelectedComponent(), vps.getViewComponent());
|
assertEquals(tabbedPane.getSelectedComponent(), vps.getViewComponent());
|
||||||
SwingUtilities.invokeAndWait(() -> createTreeAction.actionPerformed(new ActionContext()));
|
SwingUtilities
|
||||||
|
.invokeAndWait(() -> createTreeAction.actionPerformed(new DefaultActionContext()));
|
||||||
program.flushEvents();
|
program.flushEvents();
|
||||||
vps = provider.getCurrentViewProvider();
|
vps = provider.getCurrentViewProvider();
|
||||||
treeNames = program.getListing().getTreeNames();
|
treeNames = program.getListing().getTreeNames();
|
||||||
|
@ -232,7 +236,7 @@ public class ViewManagerPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
||||||
public void testCloseView() throws Exception {
|
public void testCloseView() throws Exception {
|
||||||
// close "Program Tree"
|
// close "Program Tree"
|
||||||
final DockingActionIf closeAction = getAction(plugin, "Close Tree View");
|
final DockingActionIf closeAction = getAction(plugin, "Close Tree View");
|
||||||
SwingUtilities.invokeAndWait(() -> closeAction.actionPerformed(new ActionContext()));
|
SwingUtilities.invokeAndWait(() -> closeAction.actionPerformed(new DefaultActionContext()));
|
||||||
|
|
||||||
String[] treeNames = program.getListing().getTreeNames();
|
String[] treeNames = program.getListing().getTreeNames();
|
||||||
assertEquals(treeNames.length - 1, tabbedPane.getTabCount());
|
assertEquals(treeNames.length - 1, tabbedPane.getTabCount());
|
||||||
|
@ -251,7 +255,8 @@ public class ViewManagerPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
||||||
setCurrentViewProvider("Tree Two");
|
setCurrentViewProvider("Tree Two");
|
||||||
|
|
||||||
final DockingActionIf deleteAction = getAction(plugin, "Delete Tree View");
|
final DockingActionIf deleteAction = getAction(plugin, "Delete Tree View");
|
||||||
SwingUtilities.invokeAndWait(() -> deleteAction.actionPerformed(new ActionContext()));
|
SwingUtilities
|
||||||
|
.invokeAndWait(() -> deleteAction.actionPerformed(new DefaultActionContext()));
|
||||||
program.flushEvents();
|
program.flushEvents();
|
||||||
assertNull(program.getListing().getRootModule("Tree Two"));
|
assertNull(program.getListing().getRootModule("Tree Two"));
|
||||||
String[] treeNames = program.getListing().getTreeNames();
|
String[] treeNames = program.getListing().getTreeNames();
|
||||||
|
@ -285,26 +290,31 @@ public class ViewManagerPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
||||||
|
|
||||||
setCurrentViewProvider("Main Tree");
|
setCurrentViewProvider("Main Tree");
|
||||||
|
|
||||||
SwingUtilities.invokeAndWait(() -> deleteAction.actionPerformed(new ActionContext()));
|
SwingUtilities
|
||||||
|
.invokeAndWait(() -> deleteAction.actionPerformed(new DefaultActionContext()));
|
||||||
program.flushEvents();
|
program.flushEvents();
|
||||||
|
|
||||||
setCurrentViewProvider("Tree One");
|
setCurrentViewProvider("Tree One");
|
||||||
|
|
||||||
SwingUtilities.invokeAndWait(() -> deleteAction.actionPerformed(new ActionContext()));
|
SwingUtilities
|
||||||
|
.invokeAndWait(() -> deleteAction.actionPerformed(new DefaultActionContext()));
|
||||||
program.flushEvents();
|
program.flushEvents();
|
||||||
|
|
||||||
setCurrentViewProvider("Tree Two");
|
setCurrentViewProvider("Tree Two");
|
||||||
|
|
||||||
SwingUtilities.invokeAndWait(() -> deleteAction.actionPerformed(new ActionContext()));
|
SwingUtilities
|
||||||
|
.invokeAndWait(() -> deleteAction.actionPerformed(new DefaultActionContext()));
|
||||||
program.flushEvents();
|
program.flushEvents();
|
||||||
|
|
||||||
setCurrentViewProvider("Tree Three");
|
setCurrentViewProvider("Tree Three");
|
||||||
|
|
||||||
SwingUtilities.invokeAndWait(() -> deleteAction.actionPerformed(new ActionContext()));
|
SwingUtilities
|
||||||
|
.invokeAndWait(() -> deleteAction.actionPerformed(new DefaultActionContext()));
|
||||||
program.flushEvents();
|
program.flushEvents();
|
||||||
|
|
||||||
// attempt to delete the last view
|
// attempt to delete the last view
|
||||||
SwingUtilities.invokeAndWait(() -> deleteAction.actionPerformed(new ActionContext()));
|
SwingUtilities
|
||||||
|
.invokeAndWait(() -> deleteAction.actionPerformed(new DefaultActionContext()));
|
||||||
program.flushEvents();
|
program.flushEvents();
|
||||||
|
|
||||||
ViewProviderService vps = provider.getCurrentViewProvider();
|
ViewProviderService vps = provider.getCurrentViewProvider();
|
||||||
|
@ -321,18 +331,18 @@ public class ViewManagerPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
||||||
final DockingActionIf closeAction = getAction(plugin, "Close Tree View");
|
final DockingActionIf closeAction = getAction(plugin, "Close Tree View");
|
||||||
|
|
||||||
setCurrentViewProvider(PluginConstants.DEFAULT_TREE_NAME);
|
setCurrentViewProvider(PluginConstants.DEFAULT_TREE_NAME);
|
||||||
SwingUtilities.invokeAndWait(() -> closeAction.actionPerformed(new ActionContext()));
|
SwingUtilities.invokeAndWait(() -> closeAction.actionPerformed(new DefaultActionContext()));
|
||||||
|
|
||||||
setCurrentViewProvider("Main Tree");
|
setCurrentViewProvider("Main Tree");
|
||||||
SwingUtilities.invokeAndWait(() -> {
|
SwingUtilities.invokeAndWait(() -> {
|
||||||
closeAction.actionPerformed(new ActionContext());
|
closeAction.actionPerformed(new DefaultActionContext());
|
||||||
provider.setCurrentViewProvider("Tree One");
|
provider.setCurrentViewProvider("Tree One");
|
||||||
closeAction.actionPerformed(new ActionContext());
|
closeAction.actionPerformed(new DefaultActionContext());
|
||||||
provider.setCurrentViewProvider("Tree Two");
|
provider.setCurrentViewProvider("Tree Two");
|
||||||
closeAction.actionPerformed(new ActionContext());
|
closeAction.actionPerformed(new DefaultActionContext());
|
||||||
provider.setCurrentViewProvider("Tree Three");
|
provider.setCurrentViewProvider("Tree Three");
|
||||||
DockingActionIf deleteAction = getAction(plugin, "Delete Tree View");
|
DockingActionIf deleteAction = getAction(plugin, "Delete Tree View");
|
||||||
deleteAction.actionPerformed(new ActionContext());
|
deleteAction.actionPerformed(new DefaultActionContext());
|
||||||
});
|
});
|
||||||
// cannot delete the last view
|
// cannot delete the last view
|
||||||
ViewProviderService vps = provider.getCurrentViewProvider();
|
ViewProviderService vps = provider.getCurrentViewProvider();
|
||||||
|
@ -355,7 +365,8 @@ public class ViewManagerPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
||||||
waitForPostedSwingRunnables();
|
waitForPostedSwingRunnables();
|
||||||
|
|
||||||
setCurrentViewProvider(PluginConstants.DEFAULT_TREE_NAME);
|
setCurrentViewProvider(PluginConstants.DEFAULT_TREE_NAME);
|
||||||
SwingUtilities.invokeAndWait(() -> renameAction.actionPerformed(new ActionContext()));
|
SwingUtilities
|
||||||
|
.invokeAndWait(() -> renameAction.actionPerformed(new DefaultActionContext()));
|
||||||
|
|
||||||
EditWindow editWindow = findEditWindow(tool.getToolFrame());
|
EditWindow editWindow = findEditWindow(tool.getToolFrame());
|
||||||
assertNotNull(editWindow);
|
assertNotNull(editWindow);
|
||||||
|
@ -397,7 +408,8 @@ public class ViewManagerPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
||||||
waitForPostedSwingRunnables();
|
waitForPostedSwingRunnables();
|
||||||
|
|
||||||
setCurrentViewProvider(PluginConstants.DEFAULT_TREE_NAME);
|
setCurrentViewProvider(PluginConstants.DEFAULT_TREE_NAME);
|
||||||
SwingUtilities.invokeAndWait(() -> renameAction.actionPerformed(new ActionContext()));
|
SwingUtilities
|
||||||
|
.invokeAndWait(() -> renameAction.actionPerformed(new DefaultActionContext()));
|
||||||
EditWindow editWindow = findEditWindow(tool.getToolFrame());
|
EditWindow editWindow = findEditWindow(tool.getToolFrame());
|
||||||
assertNotNull(editWindow);
|
assertNotNull(editWindow);
|
||||||
final JTextField textField = (JTextField) getInstanceField("textField", editWindow);
|
final JTextField textField = (JTextField) getInstanceField("textField", editWindow);
|
||||||
|
|
|
@ -36,7 +36,7 @@ import javax.swing.undo.UndoableEdit;
|
||||||
|
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import docking.widgets.OptionDialog;
|
import docking.widgets.OptionDialog;
|
||||||
import docking.widgets.filter.FilterTextField;
|
import docking.widgets.filter.FilterTextField;
|
||||||
|
@ -307,7 +307,7 @@ public abstract class AbstractGhidraScriptMgrPluginTest
|
||||||
|
|
||||||
DockingActionIf runLastAction = getRunLastScriptAction();
|
DockingActionIf runLastAction = getRunLastScriptAction();
|
||||||
final AtomicReference<Boolean> ref = new AtomicReference<>();
|
final AtomicReference<Boolean> ref = new AtomicReference<>();
|
||||||
runSwing(() -> ref.set(runLastAction.isEnabledForContext(new ActionContext())));
|
runSwing(() -> ref.set(runLastAction.isEnabledForContext(new DefaultActionContext())));
|
||||||
assertEquals("Run Last Action not enabled as expected", enabled, ref.get());
|
assertEquals("Run Last Action not enabled as expected", enabled, ref.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -988,10 +988,10 @@ public abstract class AbstractGhidraScriptMgrPluginTest
|
||||||
|
|
||||||
// destroy any NewScriptxxx files...and Temp ones too
|
// destroy any NewScriptxxx files...and Temp ones too
|
||||||
List<ResourceFile> paths = provider.getBundleHost()
|
List<ResourceFile> paths = provider.getBundleHost()
|
||||||
.getBundleFiles()
|
.getBundleFiles()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(ResourceFile::isDirectory)
|
.filter(ResourceFile::isDirectory)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
for (ResourceFile path : paths) {
|
for (ResourceFile path : paths) {
|
||||||
File file = path.getFile(false);
|
File file = path.getFile(false);
|
||||||
|
|
|
@ -25,6 +25,7 @@ import javax.swing.*;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
|
import docking.DefaultActionContext;
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import docking.widgets.textfield.IntegerTextField;
|
import docking.widgets.textfield.IntegerTextField;
|
||||||
import ghidra.app.plugin.core.blockmodel.BlockModelServicePlugin;
|
import ghidra.app.plugin.core.blockmodel.BlockModelServicePlugin;
|
||||||
|
@ -113,7 +114,7 @@ public class SelectBlockPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
||||||
private ActionContext getContext() {
|
private ActionContext getContext() {
|
||||||
ActionContext context = browser.getProvider().getActionContext(null);
|
ActionContext context = browser.getProvider().getActionContext(null);
|
||||||
if (context == null) {
|
if (context == null) {
|
||||||
context = new ActionContext();
|
context = new DefaultActionContext();
|
||||||
}
|
}
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
|
@ -237,7 +237,7 @@ public class SymbolTablePluginTest extends AbstractGhidraHeadedIntegrationTest {
|
||||||
public void testFilter() throws Exception {
|
public void testFilter() throws Exception {
|
||||||
openProgram("sample");
|
openProgram("sample");
|
||||||
|
|
||||||
performAction(setFilterAction, new ActionContext(), false);
|
performAction(setFilterAction, new DefaultActionContext(), false);
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
|
|
||||||
final FilterDialog filterDialog1 = waitForDialogComponent(FilterDialog.class);
|
final FilterDialog filterDialog1 = waitForDialogComponent(FilterDialog.class);
|
||||||
|
@ -694,7 +694,7 @@ public class SymbolTablePluginTest extends AbstractGhidraHeadedIntegrationTest {
|
||||||
public void testDefaultFunctionToNamedFunctionWithFilterOn() throws Exception {
|
public void testDefaultFunctionToNamedFunctionWithFilterOn() throws Exception {
|
||||||
openProgram("sample");
|
openProgram("sample");
|
||||||
|
|
||||||
performAction(setFilterAction, new ActionContext(), false);
|
performAction(setFilterAction, new DefaultActionContext(), false);
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
|
|
||||||
final FilterDialog filterDialog1 = waitForDialogComponent(FilterDialog.class);
|
final FilterDialog filterDialog1 = waitForDialogComponent(FilterDialog.class);
|
||||||
|
|
|
@ -24,6 +24,7 @@ import javax.swing.*;
|
||||||
import javax.swing.tree.TreePath;
|
import javax.swing.tree.TreePath;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
|
import docking.DefaultActionContext;
|
||||||
import docking.action.DockingAction;
|
import docking.action.DockingAction;
|
||||||
import docking.action.MenuData;
|
import docking.action.MenuData;
|
||||||
import docking.tool.ToolConstants;
|
import docking.tool.ToolConstants;
|
||||||
|
@ -488,7 +489,7 @@ public class FunctionBitPatternsMainProvider extends ComponentProviderAdapter
|
||||||
return super.getActionContext(event);
|
return super.getActionContext(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
class EvaluateContext extends ActionContext {
|
class EvaluateContext extends DefaultActionContext {
|
||||||
List<PatternInfoRowObject> selectedRows;
|
List<PatternInfoRowObject> selectedRows;
|
||||||
|
|
||||||
public EvaluateContext(List<PatternInfoRowObject> selectedRowObjects) {
|
public EvaluateContext(List<PatternInfoRowObject> selectedRowObjects) {
|
||||||
|
@ -510,7 +511,7 @@ public class FunctionBitPatternsMainProvider extends ComponentProviderAdapter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ByteSequenceContext extends ActionContext {
|
class ByteSequenceContext extends DefaultActionContext {
|
||||||
ByteSequencePanelBuilder builder;
|
ByteSequencePanelBuilder builder;
|
||||||
List<ByteSequenceRowObject> selectedRows;
|
List<ByteSequenceRowObject> selectedRows;
|
||||||
|
|
||||||
|
@ -532,7 +533,7 @@ public class FunctionBitPatternsMainProvider extends ComponentProviderAdapter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class InstructionTreeContext extends ActionContext {
|
class InstructionTreeContext extends DefaultActionContext {
|
||||||
private FunctionBitPatternsGTree tree;
|
private FunctionBitPatternsGTree tree;
|
||||||
private TreePath path;
|
private TreePath path;
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ import java.util.Date;
|
||||||
|
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
import docking.action.ToggleDockingAction;
|
import docking.action.ToggleDockingAction;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
import ghidra.app.plugin.core.format.*;
|
import ghidra.app.plugin.core.format.*;
|
||||||
|
@ -153,7 +153,7 @@ public class ByteViewerConnectedToolBehaviorTest extends AbstractGhidraHeadedInt
|
||||||
ByteViewerComponent c = panelOne.getCurrentComponent();
|
ByteViewerComponent c = panelOne.getCurrentComponent();
|
||||||
c.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
|
c.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
|
||||||
action.setSelected(true);
|
action.setSelected(true);
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
});
|
});
|
||||||
assertTrue(action.isSelected());
|
assertTrue(action.isSelected());
|
||||||
final ByteViewerComponent c = panelOne.getCurrentComponent();
|
final ByteViewerComponent c = panelOne.getCurrentComponent();
|
||||||
|
@ -183,7 +183,7 @@ public class ByteViewerConnectedToolBehaviorTest extends AbstractGhidraHeadedInt
|
||||||
ByteViewerComponent c = panelOne.getCurrentComponent();
|
ByteViewerComponent c = panelOne.getCurrentComponent();
|
||||||
c.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
|
c.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
|
||||||
action.setSelected(true);
|
action.setSelected(true);
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
});
|
});
|
||||||
assertTrue(action.isSelected());
|
assertTrue(action.isSelected());
|
||||||
final ByteViewerComponent c = panelOne.getCurrentComponent();
|
final ByteViewerComponent c = panelOne.getCurrentComponent();
|
||||||
|
|
|
@ -819,7 +819,7 @@ public class ByteViewerPlugin1Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
final DockingActionIf action = getAction(plugin, "Byte Viewer Options");
|
final DockingActionIf action = getAction(plugin, "Byte Viewer Options");
|
||||||
assertTrue(action.isEnabled());
|
assertTrue(action.isEnabled());
|
||||||
|
|
||||||
runSwing(() -> action.actionPerformed(new ActionContext()), false);
|
runSwing(() -> action.actionPerformed(new DefaultActionContext()), false);
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
ByteViewerOptionsDialog d = waitForDialogComponent(ByteViewerOptionsDialog.class);
|
ByteViewerOptionsDialog d = waitForDialogComponent(ByteViewerOptionsDialog.class);
|
||||||
return d;
|
return d;
|
||||||
|
|
|
@ -28,7 +28,7 @@ import javax.swing.*;
|
||||||
|
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
import docking.DockingUtils;
|
import docking.DockingUtils;
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import docking.action.ToggleDockingAction;
|
import docking.action.ToggleDockingAction;
|
||||||
|
@ -144,7 +144,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
ByteViewerComponent c = panel.getCurrentComponent();
|
ByteViewerComponent c = panel.getCurrentComponent();
|
||||||
c.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
|
c.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
|
||||||
action.setSelected(true);
|
action.setSelected(true);
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
});
|
});
|
||||||
assertTrue(action.isSelected());
|
assertTrue(action.isSelected());
|
||||||
final ByteViewerComponent c = panel.getCurrentComponent();
|
final ByteViewerComponent c = panel.getCurrentComponent();
|
||||||
|
@ -162,7 +162,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
|
|
||||||
SwingUtilities.invokeAndWait(() -> {
|
SwingUtilities.invokeAndWait(() -> {
|
||||||
action.setSelected(false);
|
action.setSelected(false);
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
});
|
});
|
||||||
assertTrue(!action.isSelected());
|
assertTrue(!action.isSelected());
|
||||||
assertEquals(ByteViewerComponentProvider.CURSOR_ACTIVE_COLOR,
|
assertEquals(ByteViewerComponentProvider.CURSOR_ACTIVE_COLOR,
|
||||||
|
@ -188,7 +188,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
ByteViewerComponent c = panel.getCurrentComponent();
|
ByteViewerComponent c = panel.getCurrentComponent();
|
||||||
c.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
|
c.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
|
||||||
action.setSelected(true);
|
action.setSelected(true);
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
});
|
});
|
||||||
assertTrue(action.isSelected());
|
assertTrue(action.isSelected());
|
||||||
final ByteViewerComponent c = panel.getCurrentComponent();
|
final ByteViewerComponent c = panel.getCurrentComponent();
|
||||||
|
@ -237,7 +237,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
(ToggleDockingAction) getAction(plugin, "Enable/Disable Byteviewer Editing");
|
(ToggleDockingAction) getAction(plugin, "Enable/Disable Byteviewer Editing");
|
||||||
SwingUtilities.invokeAndWait(() -> {
|
SwingUtilities.invokeAndWait(() -> {
|
||||||
action.setSelected(true);
|
action.setSelected(true);
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
});
|
});
|
||||||
final ByteViewerComponent c = panel.getCurrentComponent();
|
final ByteViewerComponent c = panel.getCurrentComponent();
|
||||||
|
|
||||||
|
@ -282,7 +282,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
(ToggleDockingAction) getAction(plugin, "Enable/Disable Byteviewer Editing");
|
(ToggleDockingAction) getAction(plugin, "Enable/Disable Byteviewer Editing");
|
||||||
SwingUtilities.invokeAndWait(() -> {
|
SwingUtilities.invokeAndWait(() -> {
|
||||||
action.setSelected(true);
|
action.setSelected(true);
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
});
|
});
|
||||||
final ByteViewerComponent c = panel.getCurrentComponent();
|
final ByteViewerComponent c = panel.getCurrentComponent();
|
||||||
|
|
||||||
|
@ -325,7 +325,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
ByteViewerComponent c = panel.getCurrentComponent();
|
ByteViewerComponent c = panel.getCurrentComponent();
|
||||||
c.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
|
c.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
|
||||||
action.setSelected(true);
|
action.setSelected(true);
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
});
|
});
|
||||||
final ByteViewerComponent c = panel.getCurrentComponent();
|
final ByteViewerComponent c = panel.getCurrentComponent();
|
||||||
byte value = program.getMemory().getByte(addr);
|
byte value = program.getMemory().getByte(addr);
|
||||||
|
@ -378,7 +378,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
ByteViewerComponent c = panel.getCurrentComponent();
|
ByteViewerComponent c = panel.getCurrentComponent();
|
||||||
c.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
|
c.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
|
||||||
action.setSelected(true);
|
action.setSelected(true);
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
});
|
});
|
||||||
final ByteViewerComponent c = panel.getCurrentComponent();
|
final ByteViewerComponent c = panel.getCurrentComponent();
|
||||||
|
|
||||||
|
@ -472,7 +472,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
currentComponent.setCursorPosition(loc.getIndex(), loc.getFieldNum(), loc.getRow(),
|
currentComponent.setCursorPosition(loc.getIndex(), loc.getFieldNum(), loc.getRow(),
|
||||||
loc.getCol());
|
loc.getCol());
|
||||||
action.setSelected(true);
|
action.setSelected(true);
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
});
|
});
|
||||||
byte value = program.getMemory().getByte(addr);
|
byte value = program.getMemory().getByte(addr);
|
||||||
SwingUtilities.invokeAndWait(() -> {
|
SwingUtilities.invokeAndWait(() -> {
|
||||||
|
@ -527,7 +527,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
ByteViewerComponent currentComponent = panel.getCurrentComponent();
|
ByteViewerComponent currentComponent = panel.getCurrentComponent();
|
||||||
currentComponent.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
|
currentComponent.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
|
||||||
action.setSelected(true);
|
action.setSelected(true);
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
});
|
});
|
||||||
|
|
||||||
SwingUtilities.invokeAndWait(() -> {
|
SwingUtilities.invokeAndWait(() -> {
|
||||||
|
@ -589,7 +589,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
ByteViewerComponent c = panel.getCurrentComponent();
|
ByteViewerComponent c = panel.getCurrentComponent();
|
||||||
c.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
|
c.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
|
||||||
action.setSelected(true);
|
action.setSelected(true);
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
});
|
});
|
||||||
assertTrue(action.isSelected());
|
assertTrue(action.isSelected());
|
||||||
final ByteViewerComponent c = panel.getCurrentComponent();
|
final ByteViewerComponent c = panel.getCurrentComponent();
|
||||||
|
@ -619,7 +619,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
ByteViewerComponent currentComponent = panel.getCurrentComponent();
|
ByteViewerComponent currentComponent = panel.getCurrentComponent();
|
||||||
currentComponent.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
|
currentComponent.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
|
||||||
action.setSelected(true);
|
action.setSelected(true);
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
});
|
});
|
||||||
waitForPostedSwingRunnables();
|
waitForPostedSwingRunnables();
|
||||||
assertTrue(action.isSelected());
|
assertTrue(action.isSelected());
|
||||||
|
@ -638,7 +638,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
|
|
||||||
SwingUtilities.invokeAndWait(() -> {
|
SwingUtilities.invokeAndWait(() -> {
|
||||||
action.setSelected(false);
|
action.setSelected(false);
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
});
|
});
|
||||||
assertTrue(!action.isSelected());
|
assertTrue(!action.isSelected());
|
||||||
assertEquals(ByteViewerComponentProvider.CURSOR_ACTIVE_COLOR,
|
assertEquals(ByteViewerComponentProvider.CURSOR_ACTIVE_COLOR,
|
||||||
|
@ -660,7 +660,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
ByteViewerComponent currentComponent = panel.getCurrentComponent();
|
ByteViewerComponent currentComponent = panel.getCurrentComponent();
|
||||||
currentComponent.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
|
currentComponent.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
|
||||||
action.setSelected(true);
|
action.setSelected(true);
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
});
|
});
|
||||||
assertTrue(action.isSelected());
|
assertTrue(action.isSelected());
|
||||||
assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR, c.getFocusedCursorColor());
|
assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR, c.getFocusedCursorColor());
|
||||||
|
@ -680,7 +680,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
|
|
||||||
SwingUtilities.invokeAndWait(() -> {
|
SwingUtilities.invokeAndWait(() -> {
|
||||||
action.setSelected(false);
|
action.setSelected(false);
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
});
|
});
|
||||||
assertTrue(!action.isSelected());
|
assertTrue(!action.isSelected());
|
||||||
assertEquals(ByteViewerComponentProvider.CURSOR_ACTIVE_COLOR,
|
assertEquals(ByteViewerComponentProvider.CURSOR_ACTIVE_COLOR,
|
||||||
|
@ -702,7 +702,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
ByteViewerComponent currentComponent = panel.getCurrentComponent();
|
ByteViewerComponent currentComponent = panel.getCurrentComponent();
|
||||||
currentComponent.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
|
currentComponent.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
|
||||||
action.setSelected(true);
|
action.setSelected(true);
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
});
|
});
|
||||||
assertTrue(action.isSelected());
|
assertTrue(action.isSelected());
|
||||||
assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR, c.getFocusedCursorColor());
|
assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR, c.getFocusedCursorColor());
|
||||||
|
@ -732,7 +732,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
ByteViewerComponent currentComponent = panel.getCurrentComponent();
|
ByteViewerComponent currentComponent = panel.getCurrentComponent();
|
||||||
currentComponent.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
|
currentComponent.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
|
||||||
action.setSelected(true);
|
action.setSelected(true);
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
});
|
});
|
||||||
assertTrue(action.isSelected());
|
assertTrue(action.isSelected());
|
||||||
assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR, c.getFocusedCursorColor());
|
assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR, c.getFocusedCursorColor());
|
||||||
|
@ -749,7 +749,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
|
|
||||||
SwingUtilities.invokeAndWait(() -> {
|
SwingUtilities.invokeAndWait(() -> {
|
||||||
action.setSelected(false);
|
action.setSelected(false);
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
});
|
});
|
||||||
assertTrue(!action.isSelected());
|
assertTrue(!action.isSelected());
|
||||||
assertEquals(ByteViewerComponentProvider.CURSOR_ACTIVE_COLOR,
|
assertEquals(ByteViewerComponentProvider.CURSOR_ACTIVE_COLOR,
|
||||||
|
@ -765,7 +765,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
(ToggleDockingAction) getAction(plugin, "Enable/Disable Byteviewer Editing");
|
(ToggleDockingAction) getAction(plugin, "Enable/Disable Byteviewer Editing");
|
||||||
SwingUtilities.invokeAndWait(() -> {
|
SwingUtilities.invokeAndWait(() -> {
|
||||||
action.setSelected(true);
|
action.setSelected(true);
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
});
|
});
|
||||||
|
|
||||||
// add a memory block
|
// add a memory block
|
||||||
|
@ -818,7 +818,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
(ToggleDockingAction) getAction(plugin, "Enable/Disable Byteviewer Editing");
|
(ToggleDockingAction) getAction(plugin, "Enable/Disable Byteviewer Editing");
|
||||||
SwingUtilities.invokeAndWait(() -> {
|
SwingUtilities.invokeAndWait(() -> {
|
||||||
action.setSelected(true);
|
action.setSelected(true);
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
});
|
});
|
||||||
|
|
||||||
// first add a memory block
|
// first add a memory block
|
||||||
|
@ -1176,7 +1176,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
ToggleDockingAction action =
|
ToggleDockingAction action =
|
||||||
(ToggleDockingAction) getAction(plugin, "Enable/Disable Byteviewer Editing");
|
(ToggleDockingAction) getAction(plugin, "Enable/Disable Byteviewer Editing");
|
||||||
action.setSelected(true);
|
action.setSelected(true);
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
});
|
});
|
||||||
|
|
||||||
// add the block
|
// add the block
|
||||||
|
@ -1292,7 +1292,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
ToggleDockingAction action =
|
ToggleDockingAction action =
|
||||||
(ToggleDockingAction) getAction(plugin, "Enable/Disable Byteviewer Editing");
|
(ToggleDockingAction) getAction(plugin, "Enable/Disable Byteviewer Editing");
|
||||||
action.setSelected(true);
|
action.setSelected(true);
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
|
|
||||||
ByteViewerComponent c = panel.getCurrentComponent();
|
ByteViewerComponent c = panel.getCurrentComponent();
|
||||||
|
|
||||||
|
@ -1529,7 +1529,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
final DockingActionIf action = getAction(plugin, "Byte Viewer Options");
|
final DockingActionIf action = getAction(plugin, "Byte Viewer Options");
|
||||||
assertTrue(action.isEnabled());
|
assertTrue(action.isEnabled());
|
||||||
|
|
||||||
SwingUtilities.invokeLater(() -> action.actionPerformed(new ActionContext()));
|
SwingUtilities.invokeLater(() -> action.actionPerformed(new DefaultActionContext()));
|
||||||
waitForPostedSwingRunnables();
|
waitForPostedSwingRunnables();
|
||||||
ByteViewerOptionsDialog d = env.waitForDialogComponent(ByteViewerOptionsDialog.class, 2000);
|
ByteViewerOptionsDialog d = env.waitForDialogComponent(ByteViewerOptionsDialog.class, 2000);
|
||||||
return d;
|
return d;
|
||||||
|
|
|
@ -27,7 +27,7 @@ import javax.swing.*;
|
||||||
|
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import docking.action.ToggleDockingAction;
|
import docking.action.ToggleDockingAction;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
|
@ -274,7 +274,7 @@ public class ByteViewerPluginFormatsTest extends AbstractGhidraHeadedIntegration
|
||||||
ByteViewerComponent currentComponent = panel.getCurrentComponent();
|
ByteViewerComponent currentComponent = panel.getCurrentComponent();
|
||||||
currentComponent.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
|
currentComponent.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
|
||||||
action.setSelected(true);
|
action.setSelected(true);
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
KeyEvent ev =
|
KeyEvent ev =
|
||||||
new KeyEvent(currentComponent, 0, new Date().getTime(), 0, KeyEvent.VK_1, '1');
|
new KeyEvent(currentComponent, 0, new Date().getTime(), 0, KeyEvent.VK_1, '1');
|
||||||
currentComponent.keyPressed(ev, loc.getIndex(), loc.getFieldNum(), loc.getRow(),
|
currentComponent.keyPressed(ev, loc.getIndex(), loc.getFieldNum(), loc.getRow(),
|
||||||
|
@ -417,7 +417,7 @@ public class ByteViewerPluginFormatsTest extends AbstractGhidraHeadedIntegration
|
||||||
ByteViewerComponent currentComponent = panel.getCurrentComponent();
|
ByteViewerComponent currentComponent = panel.getCurrentComponent();
|
||||||
currentComponent.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
|
currentComponent.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
|
||||||
action.setSelected(true);
|
action.setSelected(true);
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
|
|
||||||
KeyEvent ev =
|
KeyEvent ev =
|
||||||
new KeyEvent(currentComponent, 0, new Date().getTime(), 0, KeyEvent.VK_1, '1');
|
new KeyEvent(currentComponent, 0, new Date().getTime(), 0, KeyEvent.VK_1, '1');
|
||||||
|
@ -463,7 +463,7 @@ public class ByteViewerPluginFormatsTest extends AbstractGhidraHeadedIntegration
|
||||||
|
|
||||||
ByteViewerComponent currentComponent = panel.getCurrentComponent();
|
ByteViewerComponent currentComponent = panel.getCurrentComponent();
|
||||||
currentComponent.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
|
currentComponent.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
|
||||||
action.actionPerformed(new ActionContext());
|
action.actionPerformed(new DefaultActionContext());
|
||||||
|
|
||||||
KeyEvent ev =
|
KeyEvent ev =
|
||||||
new KeyEvent(currentComponent, 0, new Date().getTime(), 0, KeyEvent.VK_1, '1');
|
new KeyEvent(currentComponent, 0, new Date().getTime(), 0, KeyEvent.VK_1, '1');
|
||||||
|
@ -821,7 +821,7 @@ public class ByteViewerPluginFormatsTest extends AbstractGhidraHeadedIntegration
|
||||||
final DockingActionIf action = getAction(plugin, "Byte Viewer Options");
|
final DockingActionIf action = getAction(plugin, "Byte Viewer Options");
|
||||||
assertTrue(action.isEnabled());
|
assertTrue(action.isEnabled());
|
||||||
|
|
||||||
runSwing(() -> action.actionPerformed(new ActionContext()), false);
|
runSwing(() -> action.actionPerformed(new DefaultActionContext()), false);
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
ByteViewerOptionsDialog d = waitForDialogComponent(ByteViewerOptionsDialog.class);
|
ByteViewerOptionsDialog d = waitForDialogComponent(ByteViewerOptionsDialog.class);
|
||||||
return d;
|
return d;
|
||||||
|
|
|
@ -17,8 +17,8 @@ package ghidra.app.decompiler.component;
|
||||||
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
|
|
||||||
import docking.ActionContext;
|
|
||||||
import docking.ComponentProvider;
|
import docking.ComponentProvider;
|
||||||
|
import docking.DefaultActionContext;
|
||||||
import docking.widgets.fieldpanel.internal.FieldPanelCoordinator;
|
import docking.widgets.fieldpanel.internal.FieldPanelCoordinator;
|
||||||
import ghidra.app.context.RestrictedAddressSetContext;
|
import ghidra.app.context.RestrictedAddressSetContext;
|
||||||
import ghidra.app.util.viewer.util.CodeComparisonPanel;
|
import ghidra.app.util.viewer.util.CodeComparisonPanel;
|
||||||
|
@ -27,7 +27,7 @@ import ghidra.app.util.viewer.util.CodeComparisonPanelActionContext;
|
||||||
/**
|
/**
|
||||||
* Action context for a dual decompiler panel.
|
* Action context for a dual decompiler panel.
|
||||||
*/
|
*/
|
||||||
public class DualDecompilerActionContext extends ActionContext
|
public class DualDecompilerActionContext extends DefaultActionContext
|
||||||
implements RestrictedAddressSetContext, CodeComparisonPanelActionContext {
|
implements RestrictedAddressSetContext, CodeComparisonPanelActionContext {
|
||||||
|
|
||||||
private CodeComparisonPanel<? extends FieldPanelCoordinator> codeComparisonPanel = null;
|
private CodeComparisonPanel<? extends FieldPanelCoordinator> codeComparisonPanel = null;
|
||||||
|
|
|
@ -24,8 +24,7 @@ import javax.swing.JPanel;
|
||||||
|
|
||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.*;
|
||||||
import docking.DialogComponentProvider;
|
|
||||||
import docking.action.*;
|
import docking.action.*;
|
||||||
import docking.widgets.OptionDialog;
|
import docking.widgets.OptionDialog;
|
||||||
import ghidra.app.util.viewer.format.*;
|
import ghidra.app.util.viewer.format.*;
|
||||||
|
@ -122,7 +121,7 @@ public class SetFormatDialogComponentProvider extends DialogComponentProvider {
|
||||||
FieldHeader headerPanel = listingPanel.getFieldHeader();
|
FieldHeader headerPanel = listingPanel.getFieldHeader();
|
||||||
if (headerPanel != null && headerPanel.isAncestorOf(event.getComponent())) {
|
if (headerPanel != null && headerPanel.isAncestorOf(event.getComponent())) {
|
||||||
FieldHeaderLocation fhLoc = headerPanel.getFieldHeaderLocation(event.getPoint());
|
FieldHeaderLocation fhLoc = headerPanel.getFieldHeaderLocation(event.getPoint());
|
||||||
return new ActionContext().setContextObject(fhLoc);
|
return new DefaultActionContext().setContextObject(fhLoc);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,11 +15,11 @@
|
||||||
*/
|
*/
|
||||||
package ghidra.app.plugin.core.functiongraph.action;
|
package ghidra.app.plugin.core.functiongraph.action;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
import ghidra.app.plugin.core.functiongraph.FGProvider;
|
import ghidra.app.plugin.core.functiongraph.FGProvider;
|
||||||
import ghidra.graph.viewer.actions.VisualGraphSatelliteActionContext;
|
import ghidra.graph.viewer.actions.VisualGraphSatelliteActionContext;
|
||||||
|
|
||||||
public class FunctionGraphSatelliteViewerActionContext extends ActionContext
|
public class FunctionGraphSatelliteViewerActionContext extends DefaultActionContext
|
||||||
implements VisualGraphSatelliteActionContext {
|
implements VisualGraphSatelliteActionContext {
|
||||||
|
|
||||||
public FunctionGraphSatelliteViewerActionContext(FGProvider functionGraphProvider) {
|
public FunctionGraphSatelliteViewerActionContext(FGProvider functionGraphProvider) {
|
||||||
|
|
|
@ -172,12 +172,12 @@ public abstract class AbstractFunctionGraphTest extends AbstractGhidraHeadedInte
|
||||||
// 01002239
|
// 01002239
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
A
|
A
|
||||||
|->B
|
|->B
|
||||||
C
|
C
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// A
|
// A
|
||||||
|
@ -212,7 +212,7 @@ public abstract class AbstractFunctionGraphTest extends AbstractGhidraHeadedInte
|
||||||
private void build_ghidra(ToyProgramBuilder builder) throws MemoryAccessException {
|
private void build_ghidra(ToyProgramBuilder builder) throws MemoryAccessException {
|
||||||
/*
|
/*
|
||||||
Originally from notepad 'ghidra'
|
Originally from notepad 'ghidra'
|
||||||
|
|
||||||
A
|
A
|
||||||
|-> B
|
|-> B
|
||||||
|-> C
|
|-> C
|
||||||
|
@ -224,7 +224,7 @@ public abstract class AbstractFunctionGraphTest extends AbstractGhidraHeadedInte
|
||||||
|-> G
|
|-> G
|
||||||
|
|
|
|
||||||
H
|
H
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// A -
|
// A -
|
||||||
|
@ -311,7 +311,7 @@ public abstract class AbstractFunctionGraphTest extends AbstractGhidraHeadedInte
|
||||||
private void build_sscanf(ToyProgramBuilder builder) throws MemoryAccessException {
|
private void build_sscanf(ToyProgramBuilder builder) throws MemoryAccessException {
|
||||||
/*
|
/*
|
||||||
Originally from notepad 'sscanf'
|
Originally from notepad 'sscanf'
|
||||||
|
|
||||||
A
|
A
|
||||||
|-> B
|
|-> B
|
||||||
|
|
|
|
||||||
|
@ -322,7 +322,7 @@ public abstract class AbstractFunctionGraphTest extends AbstractGhidraHeadedInte
|
||||||
F
|
F
|
||||||
|
|
|
|
||||||
G
|
G
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// A - 9 code units
|
// A - 9 code units
|
||||||
|
@ -455,7 +455,7 @@ public abstract class AbstractFunctionGraphTest extends AbstractGhidraHeadedInte
|
||||||
Object actionManager = getInstanceField("actionManager", graphProvider);
|
Object actionManager = getInstanceField("actionManager", graphProvider);
|
||||||
final MultiStateDockingAction<?> action =
|
final MultiStateDockingAction<?> action =
|
||||||
(MultiStateDockingAction<?>) getInstanceField("layoutAction", actionManager);
|
(MultiStateDockingAction<?>) getInstanceField("layoutAction", actionManager);
|
||||||
runSwing(() -> action.actionPerformed(new ActionContext()));
|
runSwing(() -> action.actionPerformed(new DefaultActionContext()));
|
||||||
|
|
||||||
// wait for the threaded graph layout code
|
// wait for the threaded graph layout code
|
||||||
FGController controller = getFunctionGraphController();
|
FGController controller = getFunctionGraphController();
|
||||||
|
@ -1450,14 +1450,14 @@ public abstract class AbstractFunctionGraphTest extends AbstractGhidraHeadedInte
|
||||||
//
|
//
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
0) Initial Graph
|
0) Initial Graph
|
||||||
|
|
||||||
1 -> 2 -> 3 -> 4
|
1 -> 2 -> 3 -> 4
|
||||||
|
|
|
|
||||||
*
|
*
|
||||||
5
|
5
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
create12345Graph();
|
create12345Graph();
|
||||||
|
@ -1481,12 +1481,12 @@ public abstract class AbstractFunctionGraphTest extends AbstractGhidraHeadedInte
|
||||||
|
|
||||||
/*
|
/*
|
||||||
1) Create two separate group vertices (A and B), such that A has an edge to B.
|
1) Create two separate group vertices (A and B), such that A has an edge to B.
|
||||||
|
|
||||||
A (v:{1,2} e:{1->2, 2->3}) -> B (v:{3,4} e:{2->3,3->4,3->5})
|
A (v:{1,2} e:{1->2, 2->3}) -> B (v:{3,4} e:{2->3,3->4,3->5})
|
||||||
|
|
|
|
||||||
*
|
*
|
||||||
5
|
5
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
GroupedFunctionGraphVertex groupA = group("A", v1, v2);
|
GroupedFunctionGraphVertex groupA = group("A", v1, v2);
|
||||||
|
@ -1499,12 +1499,12 @@ public abstract class AbstractFunctionGraphTest extends AbstractGhidraHeadedInte
|
||||||
/*
|
/*
|
||||||
2) Create a third group vertex (Z) that contains a non-grouped vertex *and* one
|
2) Create a third group vertex (Z) that contains a non-grouped vertex *and* one
|
||||||
of the other groups (B).
|
of the other groups (B).
|
||||||
|
|
||||||
A (v:{1,2} e:{1->2, 2->3}) -> Z (
|
A (v:{1,2} e:{1->2, 2->3}) -> Z (
|
||||||
v:{B (v:{3,4} e:{2->3,3->4,3->5}), 5}
|
v:{B (v:{3,4} e:{2->3,3->4,3->5}), 5}
|
||||||
e:{2->3, 3->5}
|
e:{2->3, 3->5}
|
||||||
)
|
)
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
GroupedFunctionGraphVertex groupZ = group("Z", groupB, v5);
|
GroupedFunctionGraphVertex groupZ = group("Z", groupB, v5);
|
||||||
|
@ -1514,12 +1514,12 @@ public abstract class AbstractFunctionGraphTest extends AbstractGhidraHeadedInte
|
||||||
|
|
||||||
/*
|
/*
|
||||||
3) Now, ungroup the 1 remaining originally grouped vertex (A).
|
3) Now, ungroup the 1 remaining originally grouped vertex (A).
|
||||||
|
|
||||||
1 -> 2 -> Z (
|
1 -> 2 -> Z (
|
||||||
v:{B (v:{3,4} e:{2->3,3->4,3->5}), 5}
|
v:{B (v:{3,4} e:{2->3,3->4,3->5}), 5}
|
||||||
e:{2->3, 3->5}
|
e:{2->3, 3->5}
|
||||||
)
|
)
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ungroup(groupA);
|
ungroup(groupA);
|
||||||
|
@ -1529,14 +1529,14 @@ public abstract class AbstractFunctionGraphTest extends AbstractGhidraHeadedInte
|
||||||
verifyEdgeCount(2);
|
verifyEdgeCount(2);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
4) Now, ungroup Z and go back to having one remaining group vertex (B)
|
4) Now, ungroup Z and go back to having one remaining group vertex (B)
|
||||||
|
|
||||||
1 -> 2 -> -> B (v:{3,4} e:{2->3,3->4,3->5})
|
1 -> 2 -> -> B (v:{3,4} e:{2->3,3->4,3->5})
|
||||||
|
|
|
|
||||||
*
|
*
|
||||||
5
|
5
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ungroup(groupZ);
|
ungroup(groupZ);
|
||||||
|
@ -1548,12 +1548,12 @@ public abstract class AbstractFunctionGraphTest extends AbstractGhidraHeadedInte
|
||||||
|
|
||||||
/*
|
/*
|
||||||
5) Finally, ungroup the last group and make sure the graph is restored
|
5) Finally, ungroup the last group and make sure the graph is restored
|
||||||
|
|
||||||
1 -> 2 -> 3 -> 4
|
1 -> 2 -> 3 -> 4
|
||||||
|
|
|
|
||||||
*
|
*
|
||||||
5
|
5
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ungroup(groupB);
|
ungroup(groupB);
|
||||||
|
@ -2297,7 +2297,7 @@ public abstract class AbstractFunctionGraphTest extends AbstractGhidraHeadedInte
|
||||||
|
|
||||||
DockingActionIf action = getAction(tool, "FunctionGraphPlugin", name);
|
DockingActionIf action = getAction(tool, "FunctionGraphPlugin", name);
|
||||||
ToggleDockingAction displayAction = (ToggleDockingAction) action;
|
ToggleDockingAction displayAction = (ToggleDockingAction) action;
|
||||||
setToggleActionSelected(displayAction, new ActionContext(), expectedVisible);
|
setToggleActionSelected(displayAction, new DefaultActionContext(), expectedVisible);
|
||||||
//
|
//
|
||||||
// // make sure the action is not already in the state we expect
|
// // make sure the action is not already in the state we expect
|
||||||
// assertEquals(name + " action is not selected as expected", !expectedVisible,
|
// assertEquals(name + " action is not selected as expected", !expectedVisible,
|
||||||
|
|
|
@ -15,14 +15,14 @@
|
||||||
*/
|
*/
|
||||||
package functioncalls.plugin.context;
|
package functioncalls.plugin.context;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
import functioncalls.graph.FunctionCallGraph;
|
import functioncalls.graph.FunctionCallGraph;
|
||||||
import functioncalls.plugin.FcgProvider;
|
import functioncalls.plugin.FcgProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Context for the {@link FunctionCallGraph}
|
* Context for the {@link FunctionCallGraph}
|
||||||
*/
|
*/
|
||||||
public class FcgActionContext extends ActionContext {
|
public class FcgActionContext extends DefaultActionContext {
|
||||||
|
|
||||||
public FcgActionContext(FcgProvider provider) {
|
public FcgActionContext(FcgProvider provider) {
|
||||||
this(provider, null);
|
this(provider, null);
|
||||||
|
|
|
@ -75,8 +75,7 @@ public class PdbPlugin extends Plugin {
|
||||||
|
|
||||||
private void createActions() {
|
private void createActions() {
|
||||||
new ActionBuilder("Load PDB File", this.getName())
|
new ActionBuilder("Load PDB File", this.getName())
|
||||||
.supportsDefaultToolContext(true)
|
.withContext(ProgramActionContext.class, true)
|
||||||
.withContext(ProgramActionContext.class)
|
|
||||||
.validContextWhen(pac -> pac.getProgram() != null &&
|
.validContextWhen(pac -> pac.getProgram() != null &&
|
||||||
PdbAnalyzerCommon.canAnalyzeProgram(pac.getProgram()))
|
PdbAnalyzerCommon.canAnalyzeProgram(pac.getProgram()))
|
||||||
.menuPath(ToolConstants.MENU_FILE, "Load PDB File...")
|
.menuPath(ToolConstants.MENU_FILE, "Load PDB File...")
|
||||||
|
|
|
@ -21,7 +21,7 @@ import java.awt.Window;
|
||||||
|
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import docking.action.ToggleDockingAction;
|
import docking.action.ToggleDockingAction;
|
||||||
import docking.util.image.ToolIconURL;
|
import docking.util.image.ToolIconURL;
|
||||||
|
@ -47,8 +47,8 @@ public class DiffSaveSettingsTest extends DiffApplyTestAdapter {
|
||||||
private void launchTool() throws Exception {
|
private void launchTool() throws Exception {
|
||||||
// Launch our own tool for the Diff so that we can close it and handle "Save Tool?".
|
// Launch our own tool for the Diff so that we can close it and handle "Save Tool?".
|
||||||
runSwing(() -> tool = frontEndTool.getProject()
|
runSwing(() -> tool = frontEndTool.getProject()
|
||||||
.getToolServices()
|
.getToolServices()
|
||||||
.launchTool("MyDiffTestTool",
|
.launchTool("MyDiffTestTool",
|
||||||
null));
|
null));
|
||||||
|
|
||||||
cb = getPlugin(tool, CodeBrowserPlugin.class);
|
cb = getPlugin(tool, CodeBrowserPlugin.class);
|
||||||
|
@ -176,8 +176,7 @@ public class DiffSaveSettingsTest extends DiffApplyTestAdapter {
|
||||||
ProgramManagerPlugin pm = getPlugin(tool, ProgramManagerPlugin.class);
|
ProgramManagerPlugin pm = getPlugin(tool, ProgramManagerPlugin.class);
|
||||||
DockingActionIf closeAllProgramAction = getAction(pm, "Close All");
|
DockingActionIf closeAllProgramAction = getAction(pm, "Close All");
|
||||||
assertNotNull(closeAllProgramAction);
|
assertNotNull(closeAllProgramAction);
|
||||||
ActionContext defaultContext = tool.getDefaultToolContext();
|
performAction(closeAllProgramAction, new DefaultActionContext(), true);
|
||||||
performAction(closeAllProgramAction, defaultContext, true);
|
|
||||||
|
|
||||||
openProgram(p3);
|
openProgram(p3);
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ import javax.swing.tree.TreePath;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.DefaultActionContext;
|
||||||
import docking.DialogComponentProvider;
|
import docking.DialogComponentProvider;
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import docking.widgets.fieldpanel.FieldPanel;
|
import docking.widgets.fieldpanel.FieldPanel;
|
||||||
|
@ -456,7 +456,7 @@ public class DiffTest extends DiffTestAdapter {
|
||||||
JTree tree = getProgramTree();
|
JTree tree = getProgramTree();
|
||||||
selectTreeNodeByText(tree, ".data");
|
selectTreeNodeByText(tree, ".data");
|
||||||
|
|
||||||
runSwing(() -> replaceView.actionPerformed(new ActionContext()));
|
runSwing(() -> replaceView.actionPerformed(new DefaultActionContext()));
|
||||||
|
|
||||||
topOfFile(fp1);
|
topOfFile(fp1);
|
||||||
assertEquals(addr("1008000"), cb.getCurrentAddress());
|
assertEquals(addr("1008000"), cb.getCurrentAddress());
|
||||||
|
@ -482,11 +482,11 @@ public class DiffTest extends DiffTestAdapter {
|
||||||
JTree tree = getProgramTree();
|
JTree tree = getProgramTree();
|
||||||
selectTreeNodeByText(tree, ".data");
|
selectTreeNodeByText(tree, ".data");
|
||||||
|
|
||||||
runSwing(() -> replaceView.actionPerformed(new ActionContext()));
|
runSwing(() -> replaceView.actionPerformed(new DefaultActionContext()));
|
||||||
|
|
||||||
selectTreeNodeByText(tree, ".rsrc");
|
selectTreeNodeByText(tree, ".rsrc");
|
||||||
|
|
||||||
runSwing(() -> goToView.actionPerformed(new ActionContext()));
|
runSwing(() -> goToView.actionPerformed(new DefaultActionContext()));
|
||||||
|
|
||||||
topOfFile(fp1);
|
topOfFile(fp1);
|
||||||
assertEquals(addr("1008000"), cb.getCurrentAddress());
|
assertEquals(addr("1008000"), cb.getCurrentAddress());
|
||||||
|
@ -874,7 +874,7 @@ public class DiffTest extends DiffTestAdapter {
|
||||||
private void clickDiffButton() {
|
private void clickDiffButton() {
|
||||||
runSwing(() -> {
|
runSwing(() -> {
|
||||||
openClosePgm2.setSelected(!openClosePgm2.isSelected());
|
openClosePgm2.setSelected(!openClosePgm2.isSelected());
|
||||||
openClosePgm2.actionPerformed(new ActionContext());
|
openClosePgm2.actionPerformed(new DefaultActionContext());
|
||||||
}, false);
|
}, false);
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
}
|
}
|
||||||
|
|
|
@ -720,11 +720,11 @@ public class DiffTestAdapter extends AbstractGhidraHeadedIntegrationTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
void launchDiffByAction() {
|
void launchDiffByAction() {
|
||||||
setToggleActionSelected(openClosePgm2, new ActionContext(), true, false);
|
setToggleActionSelected(openClosePgm2, new DefaultActionContext(), true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void closeDiffByAction() {
|
void closeDiffByAction() {
|
||||||
setToggleActionSelected(openClosePgm2, new ActionContext(), false, false);
|
setToggleActionSelected(openClosePgm2, new DefaultActionContext(), false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void invokeAndWait(DockingActionIf action) {
|
void invokeAndWait(DockingActionIf action) {
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue