Skip to content

Ghidra is a software reverse engineering (SRE) framework

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.

ghidragon5da5af23fb73
diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/DebuggerSnapActionContext.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/DebuggerSnapActionContext.java
index bb1072a60a..765f9b226b 100644
--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/DebuggerSnapActionContext.java
+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/DebuggerSnapActionContext.java
@@ -15,10 +15,10 @@
*/
package ghidra.app.plugin.core.debug.gui;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import ghidra.trace.model.Trace;
-public class DebuggerSnapActionContext extends ActionContext {
+public class DebuggerSnapActionContext extends DefaultActionContext {
private final Trace trace;
private final long snap;
diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/breakpoint/DebuggerBreakpointLocationsActionContext.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/breakpoint/DebuggerBreakpointLocationsActionContext.java
index a57df3770c..0873b6ed01 100644
--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/breakpoint/DebuggerBreakpointLocationsActionContext.java
+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/breakpoint/DebuggerBreakpointLocationsActionContext.java
@@ -18,10 +18,10 @@ package ghidra.app.plugin.core.debug.gui.breakpoint;
import java.util.Collection;
import java.util.stream.Collectors;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import ghidra.trace.model.breakpoint.TraceBreakpoint;
-public class DebuggerBreakpointLocationsActionContext extends ActionContext {
+public class DebuggerBreakpointLocationsActionContext extends DefaultActionContext {
private final Collection<BreakpointLocationRow> selection;
public DebuggerBreakpointLocationsActionContext(Collection<BreakpointLocationRow> selection) {
diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/breakpoint/DebuggerLogicalBreakpointsActionContext.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/breakpoint/DebuggerLogicalBreakpointsActionContext.java
index 5798c96979..14d5d331ba 100644
--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/breakpoint/DebuggerLogicalBreakpointsActionContext.java
+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/breakpoint/DebuggerLogicalBreakpointsActionContext.java
@@ -18,10 +18,10 @@ package ghidra.app.plugin.core.debug.gui.breakpoint;
import java.util.Collection;
import java.util.stream.Collectors;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import ghidra.app.services.LogicalBreakpoint;
-public class DebuggerLogicalBreakpointsActionContext extends ActionContext {
+public class DebuggerLogicalBreakpointsActionContext extends DefaultActionContext {
private final Collection<LogicalBreakpointRow> selection;
public DebuggerLogicalBreakpointsActionContext(Collection<LogicalBreakpointRow> selection) {
@@ -34,7 +34,7 @@ public class DebuggerLogicalBreakpointsActionContext extends ActionContext {
public Collection<LogicalBreakpoint> getBreakpoints() {
return selection.stream()
- .map(row -> row.getLogicalBreakpoint())
- .collect(Collectors.toList());
+ .map(row -> row.getLogicalBreakpoint())
+ .collect(Collectors.toList());
}
}
diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/breakpoint/DebuggerMakeBreakpointsEffectiveActionContext.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/breakpoint/DebuggerMakeBreakpointsEffectiveActionContext.java
index e6c14bc6f0..3642a6f277 100644
--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/breakpoint/DebuggerMakeBreakpointsEffectiveActionContext.java
+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/breakpoint/DebuggerMakeBreakpointsEffectiveActionContext.java
@@ -15,9 +15,9 @@
*/
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?
-public class DebuggerMakeBreakpointsEffectiveActionContext extends ActionContext {
+public class DebuggerMakeBreakpointsEffectiveActionContext extends DefaultActionContext {
// Nothing to add
}
diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/console/LogRowConsoleActionContext.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/console/LogRowConsoleActionContext.java
index db0658b1c0..6e4384c212 100644
--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/console/LogRowConsoleActionContext.java
+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/console/LogRowConsoleActionContext.java
@@ -15,8 +15,8 @@
*/
package ghidra.app.plugin.core.debug.gui.console;
-import docking.ActionContext;
+import docking.DefaultActionContext;
-public class LogRowConsoleActionContext extends ActionContext {
+public class LogRowConsoleActionContext extends DefaultActionContext {
}
diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/listing/DebuggerOpenProgramActionContext.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/listing/DebuggerOpenProgramActionContext.java
index 8da682cdf8..3583cfb8a6 100644
--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/listing/DebuggerOpenProgramActionContext.java
+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/listing/DebuggerOpenProgramActionContext.java
@@ -17,10 +17,10 @@ package ghidra.app.plugin.core.debug.gui.listing;
import java.util.Objects;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import ghidra.framework.model.DomainFile;
-public class DebuggerOpenProgramActionContext extends ActionContext {
+public class DebuggerOpenProgramActionContext extends DefaultActionContext {
private final DomainFile df;
private final int hashCode;
diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/memory/DebuggerRegionActionContext.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/memory/DebuggerRegionActionContext.java
index b27055f31e..8526b72315 100644
--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/memory/DebuggerRegionActionContext.java
+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/memory/DebuggerRegionActionContext.java
@@ -18,10 +18,10 @@ package ghidra.app.plugin.core.debug.gui.memory;
import java.util.Collection;
import java.util.Set;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.widgets.table.GTable;
-public class DebuggerRegionActionContext extends ActionContext {
+public class DebuggerRegionActionContext extends DefaultActionContext {
private final Set<RegionRow> selectedRegions;
public DebuggerRegionActionContext(DebuggerRegionsProvider provider,
diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/memview/MemviewProvider.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/memview/MemviewProvider.java
index 2451c79387..5b9d32f130 100644
--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/memview/MemviewProvider.java
+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/memview/MemviewProvider.java
@@ -23,6 +23,7 @@ import java.util.List;
import javax.swing.*;
import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.DockingAction;
import docking.action.builder.ToggleActionBuilder;
import ghidra.app.plugin.core.debug.DebuggerPluginPackage;
@@ -96,27 +97,27 @@ public class MemviewProvider extends ComponentProviderAdapter {
tool.addLocalAction(this, zoomOutTAction);
new ToggleActionBuilder("Toggle Layout", plugin.getName()) //
- //.menuPath("&Toggle layout") //
- .toolBarIcon(AbstractRefreshAction.ICON)
- .helpLocation(new HelpLocation(plugin.getName(), "toggle_layout")) //
- .onAction(ctx -> performToggleLayout(ctx))
- .buildAndInstallLocal(this);
+ //.menuPath("&Toggle layout") //
+ .toolBarIcon(AbstractRefreshAction.ICON)
+ .helpLocation(new HelpLocation(plugin.getName(), "toggle_layout")) //
+ .onAction(ctx -> performToggleLayout(ctx))
+ .buildAndInstallLocal(this);
new ToggleActionBuilder("Toggle Process Trace", plugin.getName()) //
- //.menuPath("&Toggle layout") //
- .toolBarIcon(DebuggerResources.ICON_SYNC)
- .helpLocation(new HelpLocation(plugin.getName(), "toggle_process_trace")) //
- .onAction(ctx -> performToggleTrace(ctx))
- .selected(false)
- .buildAndInstallLocal(this);
+ //.menuPath("&Toggle layout") //
+ .toolBarIcon(DebuggerResources.ICON_SYNC)
+ .helpLocation(new HelpLocation(plugin.getName(), "toggle_process_trace")) //
+ .onAction(ctx -> performToggleTrace(ctx))
+ .selected(false)
+ .buildAndInstallLocal(this);
new ToggleActionBuilder("Apply Filter To Panel", plugin.getName()) //
- //.menuPath("&Toggle layout") //
- .toolBarIcon(DebuggerResources.ICON_FILTER)
- .helpLocation(new HelpLocation(plugin.getName(), "apply_to_panel")) //
- .onAction(ctx -> performApplyFilterToPanel(ctx))
- .selected(true)
- .buildAndInstallLocal(this);
+ //.menuPath("&Toggle layout") //
+ .toolBarIcon(DebuggerResources.ICON_FILTER)
+ .helpLocation(new HelpLocation(plugin.getName(), "apply_to_panel")) //
+ .onAction(ctx -> performApplyFilterToPanel(ctx))
+ .selected(true)
+ .buildAndInstallLocal(this);
}
@@ -176,10 +177,10 @@ public class MemviewProvider extends ComponentProviderAdapter {
@Override
public ActionContext getActionContext(MouseEvent event) {
if (event != null && event.getSource() == mainPanel) {
- return new ActionContext(this, mainPanel);
+ return new DefaultActionContext(this, mainPanel);
}
if (event != null && event.getSource() == memviewPanel) {
- return new ActionContext(this, memviewPanel);
+ return new DefaultActionContext(this, memviewPanel);
}
return null;
}
@@ -217,7 +218,7 @@ public class MemviewProvider extends ComponentProviderAdapter {
public void goTo(int x, int y) {
Rectangle bounds = scrollPane.getBounds();
scrollPane.getViewport()
- .scrollRectToVisible(new Rectangle(x, y, bounds.width, bounds.height));
+ .scrollRectToVisible(new Rectangle(x, y, bounds.width, bounds.height));
scrollPane.getViewport().doLayout();
}
diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/DebuggerObjectActionContext.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/DebuggerObjectActionContext.java
index 05afd6d10b..1680d69582 100644
--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/DebuggerObjectActionContext.java
+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/DebuggerObjectActionContext.java
@@ -19,11 +19,11 @@ import java.awt.Component;
import java.util.Collection;
import java.util.List;
-import docking.ActionContext;
import docking.ComponentProvider;
+import docking.DefaultActionContext;
import ghidra.trace.model.target.TraceObjectValue;
-public class DebuggerObjectActionContext extends ActionContext {
+public class DebuggerObjectActionContext extends DefaultActionContext {
private final List<TraceObjectValue> objectValues;
public DebuggerObjectActionContext(Collection<TraceObjectValue> objectValues,
diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/modules/DebuggerMissingModuleActionContext.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/modules/DebuggerMissingModuleActionContext.java
index 86c31cc0fb..ae0191a0f2 100644
--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/modules/DebuggerMissingModuleActionContext.java
+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/modules/DebuggerMissingModuleActionContext.java
@@ -17,10 +17,10 @@ package ghidra.app.plugin.core.debug.gui.modules;
import java.util.Objects;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import ghidra.trace.model.modules.TraceModule;
-public class DebuggerMissingModuleActionContext extends ActionContext {
+public class DebuggerMissingModuleActionContext extends DefaultActionContext {
private final TraceModule module;
private final int hashCode;
diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/modules/DebuggerModuleActionContext.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/modules/DebuggerModuleActionContext.java
index bb777f5595..c4d8cf0da7 100644
--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/modules/DebuggerModuleActionContext.java
+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/modules/DebuggerModuleActionContext.java
@@ -18,10 +18,10 @@ package ghidra.app.plugin.core.debug.gui.modules;
import java.util.Collection;
import java.util.Set;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.widgets.table.GTable;
-public class DebuggerModuleActionContext extends ActionContext {
+public class DebuggerModuleActionContext extends DefaultActionContext {
private final Set<ModuleRow> selectedModules;
public DebuggerModuleActionContext(DebuggerModulesProvider provider,
diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/modules/DebuggerSectionActionContext.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/modules/DebuggerSectionActionContext.java
index b346412562..a93415b375 100644
--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/modules/DebuggerSectionActionContext.java
+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/modules/DebuggerSectionActionContext.java
@@ -18,10 +18,10 @@ package ghidra.app.plugin.core.debug.gui.modules;
import java.util.Collection;
import java.util.Set;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.widgets.table.GTable;
-public class DebuggerSectionActionContext extends ActionContext {
+public class DebuggerSectionActionContext extends DefaultActionContext {
private final Set<SectionRow> selectedSections;
//private final Set<ModuleRecord> involvedModules;
diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/modules/DebuggerStaticMappingActionContext.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/modules/DebuggerStaticMappingActionContext.java
index 3a518a8195..94e81473fd 100644
--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/modules/DebuggerStaticMappingActionContext.java
+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/modules/DebuggerStaticMappingActionContext.java
@@ -18,10 +18,10 @@ package ghidra.app.plugin.core.debug.gui.modules;
import java.util.Collection;
import java.util.Collections;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.widgets.table.GTable;
-public class DebuggerStaticMappingActionContext extends ActionContext {
+public class DebuggerStaticMappingActionContext extends DefaultActionContext {
private final Collection<StaticMappingRow> selected;
public DebuggerStaticMappingActionContext(DebuggerStaticMappingProvider provider,
diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/objects/DebuggerObjectsProvider.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/objects/DebuggerObjectsProvider.java
index b1341614e9..07a4105cdd 100644
--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/objects/DebuggerObjectsProvider.java
+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/objects/DebuggerObjectsProvider.java
@@ -20,14 +20,8 @@ import java.awt.Color;
import java.awt.event.MouseEvent;
import java.io.PrintWriter;
import java.lang.invoke.MethodHandles;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import java.util.Map.Entry;
-import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
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.lang3.StringUtils;
-import docking.ActionContext;
-import docking.WindowPosition;
-import docking.action.DockingAction;
-import docking.action.DockingActionIf;
-import docking.action.MenuData;
-import docking.action.ToggleDockingAction;
+import docking.*;
+import docking.action.*;
import docking.action.builder.ActionBuilder;
import docking.action.builder.ToggleActionBuilder;
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.DebuggerPluginPackage;
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.AbstractConsoleAction;
-import ghidra.app.plugin.core.debug.gui.DebuggerResources.AbstractDetachAction;
-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.gui.DebuggerResources.*;
+import ghidra.app.plugin.core.debug.gui.objects.actions.*;
+import ghidra.app.plugin.core.debug.gui.objects.components.*;
import ghidra.app.plugin.core.debug.mapping.DebuggerMemoryMapper;
-import ghidra.app.script.GhidraScript;
-import ghidra.app.script.GhidraScriptLoadException;
-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.script.*;
+import ghidra.app.services.*;
import ghidra.app.services.DebuggerTraceManagerService.ActivationCause;
-import ghidra.app.services.GraphDisplayBroker;
-import ghidra.app.services.TraceRecorder;
-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.async.*;
+import ghidra.dbg.*;
import ghidra.dbg.DebuggerObjectModel.RefreshBehavior;
import ghidra.dbg.error.DebuggerMemoryAccessException;
-import ghidra.dbg.target.TargetAccessConditioned;
-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.*;
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.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.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.TargetTogglable;
import ghidra.dbg.util.DebuggerCallbackReorderer;
import ghidra.dbg.util.PathUtils;
import ghidra.framework.model.Project;
import ghidra.framework.options.AutoOptions;
import ghidra.framework.options.SaveState;
import ghidra.framework.options.annotation.AutoOptionDefined;
-import ghidra.framework.plugintool.AutoConfigState;
-import ghidra.framework.plugintool.AutoService;
-import ghidra.framework.plugintool.ComponentProviderAdapter;
+import ghidra.framework.plugintool.*;
import ghidra.framework.plugintool.annotation.AutoConfigStateField;
import ghidra.framework.plugintool.annotation.AutoServiceConsumed;
import ghidra.program.model.address.Address;
@@ -166,9 +79,7 @@ import ghidra.program.util.ProgramLocation;
import ghidra.program.util.ProgramSelection;
import ghidra.trace.model.Trace;
import ghidra.trace.model.thread.TraceThread;
-import ghidra.util.HelpLocation;
-import ghidra.util.Msg;
-import ghidra.util.Swing;
+import ghidra.util.*;
import ghidra.util.datastruct.PrivatelyQueuedListener;
import ghidra.util.table.GhidraTable;
import ghidra.util.task.TaskMonitor;
@@ -793,7 +704,7 @@ public class DebuggerObjectsProvider extends ComponentProviderAdapter
plugin.fireObjectUpdated(object);
}
- class ObjectActionContext extends ActionContext {
+ class ObjectActionContext extends DefaultActionContext {
private DebuggerObjectsProvider provider;
@@ -1766,7 +1677,7 @@ public class DebuggerObjectsProvider extends ComponentProviderAdapter
TargetObject result = null;
try {
result = DebugModelConventions.findSuitable(TargetExecutionStateful.class, object)
- .get(100, TimeUnit.MILLISECONDS);
+ .get(100, TimeUnit.MILLISECONDS);
}
catch (Exception e) {
// IGNORE
diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/register/DebuggerAvailableRegistersActionContext.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/register/DebuggerAvailableRegistersActionContext.java
index f18166642a..31072b077a 100644
--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/register/DebuggerAvailableRegistersActionContext.java
+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/register/DebuggerAvailableRegistersActionContext.java
@@ -17,9 +17,9 @@ package ghidra.app.plugin.core.debug.gui.register;
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;
public DebuggerAvailableRegistersActionContext(Collection<AvailableRegisterRow> selection) {
diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/register/DebuggerRegisterActionContext.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/register/DebuggerRegisterActionContext.java
index 2f4a86fcd3..64382dd456 100644
--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/register/DebuggerRegisterActionContext.java
+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/register/DebuggerRegisterActionContext.java
@@ -15,10 +15,10 @@
*/
package ghidra.app.plugin.core.debug.gui.register;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.widgets.table.GTable;
-public class DebuggerRegisterActionContext extends ActionContext {
+public class DebuggerRegisterActionContext extends DefaultActionContext {
private final RegisterRow selected;
public DebuggerRegisterActionContext(DebuggerRegistersProvider provider, RegisterRow selected,
diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/stack/DebuggerStackActionContext.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/stack/DebuggerStackActionContext.java
index 9925d4db43..e1ff25cee2 100644
--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/stack/DebuggerStackActionContext.java
+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/stack/DebuggerStackActionContext.java
@@ -17,9 +17,9 @@ package ghidra.app.plugin.core.debug.gui.stack;
import java.awt.Component;
-import docking.ActionContext;
+import docking.DefaultActionContext;
-public class DebuggerStackActionContext extends ActionContext {
+public class DebuggerStackActionContext extends DefaultActionContext {
private final StackFrameRow frame;
diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/target/DebuggerModelActionContext.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/target/DebuggerModelActionContext.java
index 75b8e54492..5985c8f8c7 100644
--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/target/DebuggerModelActionContext.java
+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/target/DebuggerModelActionContext.java
@@ -19,14 +19,14 @@ import java.util.function.Function;
import javax.swing.tree.TreePath;
-import docking.ActionContext;
import docking.ComponentProvider;
+import docking.DefaultActionContext;
import docking.widgets.tree.GTree;
import docking.widgets.tree.GTreeNode;
import ghidra.app.services.DebuggerModelService;
import ghidra.dbg.DebuggerObjectModel;
-public class DebuggerModelActionContext extends ActionContext {
+public class DebuggerModelActionContext extends DefaultActionContext {
private final TreePath path;
DebuggerModelActionContext(ComponentProvider provider, TreePath path, GTree tree) {
diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/thread/DebuggerThreadActionContext.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/thread/DebuggerThreadActionContext.java
index ed00e507c9..bd88c4f35b 100644
--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/thread/DebuggerThreadActionContext.java
+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/thread/DebuggerThreadActionContext.java
@@ -15,11 +15,11 @@
*/
package ghidra.app.plugin.core.debug.gui.thread;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import ghidra.trace.model.Trace;
import ghidra.trace.model.thread.TraceThread;
-public class DebuggerThreadActionContext extends ActionContext {
+public class DebuggerThreadActionContext extends DefaultActionContext {
private final Trace trace;
private final TraceThread thread;
diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/thread/DebuggerTraceFileActionContext.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/thread/DebuggerTraceFileActionContext.java
index 4a926a3b79..111ad83131 100644
--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/thread/DebuggerTraceFileActionContext.java
+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/thread/DebuggerTraceFileActionContext.java
@@ -15,16 +15,16 @@
*/
package ghidra.app.plugin.core.debug.gui.thread;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import ghidra.trace.model.Trace;
-public class DebuggerTraceFileActionContext extends ActionContext {
+public class DebuggerTraceFileActionContext extends DefaultActionContext {
private final Trace trace;
public DebuggerTraceFileActionContext(Trace trace) {
this.trace = trace;
}
-
+
public Trace getTrace() {
return trace;
}
diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/watch/DebuggerWatchActionContext.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/watch/DebuggerWatchActionContext.java
index 82a2caf6c7..e646fde36a 100644
--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/watch/DebuggerWatchActionContext.java
+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/watch/DebuggerWatchActionContext.java
@@ -19,9 +19,9 @@ import java.awt.Component;
import java.util.Collection;
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;
public DebuggerWatchActionContext(DebuggerWatchesProvider provider,
diff --git a/Ghidra/Debug/Debugger/src/screen/java/ghidra/app/plugin/core/debug/gui/console/DebuggerConsolePluginScreenShots.java b/Ghidra/Debug/Debugger/src/screen/java/ghidra/app/plugin/core/debug/gui/console/DebuggerConsolePluginScreenShots.java
index e4a8165e28..50c2ad5e9a 100644
--- a/Ghidra/Debug/Debugger/src/screen/java/ghidra/app/plugin/core/debug/gui/console/DebuggerConsolePluginScreenShots.java
+++ b/Ghidra/Debug/Debugger/src/screen/java/ghidra/app/plugin/core/debug/gui/console/DebuggerConsolePluginScreenShots.java
@@ -15,12 +15,13 @@
*/
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.rules.TestName;
import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.builder.ActionBuilder;
import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest;
import ghidra.app.plugin.core.debug.gui.DebuggerResources;
@@ -29,7 +30,7 @@ import help.screenshot.GhidraScreenShotGenerator;
public class DebuggerConsolePluginScreenShots extends GhidraScreenShotGenerator {
- public static class ScreenShotActionContext extends ActionContext {
+ public static class ScreenShotActionContext extends DefaultActionContext {
}
DebuggerConsolePlugin consolePlugin;
@@ -44,21 +45,21 @@ public class DebuggerConsolePluginScreenShots extends GhidraScreenShotGenerator
consoleProvider = waitForComponentProvider(DebuggerConsoleProvider.class);
consolePlugin.addResolutionAction(new ActionBuilder("Import", name.getMethodName())
- .toolBarIcon(DebuggerResources.ICON_IMPORT)
- .popupMenuIcon(DebuggerResources.ICON_IMPORT)
- .popupMenuPath("Map")
- .description("Import")
- .withContext(ScreenShotActionContext.class)
- .onAction(ctx -> Msg.info(this, "Import clicked"))
- .build());
+ .toolBarIcon(DebuggerResources.ICON_IMPORT)
+ .popupMenuIcon(DebuggerResources.ICON_IMPORT)
+ .popupMenuPath("Map")
+ .description("Import")
+ .withContext(ScreenShotActionContext.class)
+ .onAction(ctx -> Msg.info(this, "Import clicked"))
+ .build());
consolePlugin.addResolutionAction(new ActionBuilder("Map", name.getMethodName())
- .toolBarIcon(DebuggerResources.ICON_MODULES)
- .popupMenuIcon(DebuggerResources.ICON_MODULES)
- .popupMenuPath("Map")
- .description("Map")
- .withContext(ScreenShotActionContext.class)
- .onAction(ctx -> Msg.info(this, "Map clicked"))
- .build());
+ .toolBarIcon(DebuggerResources.ICON_MODULES)
+ .popupMenuIcon(DebuggerResources.ICON_MODULES)
+ .popupMenuPath("Map")
+ .description("Map")
+ .withContext(ScreenShotActionContext.class)
+ .onAction(ctx -> Msg.info(this, "Map clicked"))
+ .build());
}
@Test
@@ -70,7 +71,7 @@ public class DebuggerConsolePluginScreenShots extends GhidraScreenShotGenerator
new ScreenShotActionContext());
AbstractGhidraHeadedDebuggerGUITest
- .waitForPass(() -> assertEquals(3, consolePlugin.getRowCount(ActionContext.class)));
+ .waitForPass(() -> assertEquals(3, consolePlugin.getRowCount(ActionContext.class)));
captureIsolatedProvider(consoleProvider, 600, 300);
}
diff --git a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/AbstractGhidraHeadedDebuggerGUITest.java b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/AbstractGhidraHeadedDebuggerGUITest.java
index 6511684383..99b0b1df48 100644
--- a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/AbstractGhidraHeadedDebuggerGUITest.java
+++ b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/AbstractGhidraHeadedDebuggerGUITest.java
@@ -39,6 +39,7 @@ import org.junit.runner.Description;
import db.Transaction;
import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.ActionContextProvider;
import docking.action.DockingActionIf;
import docking.widgets.table.DynamicTableColumn;
@@ -222,7 +223,7 @@ public abstract class AbstractGhidraHeadedDebuggerGUITest
public static Language getToyBE64Language() {
try {
return DefaultLanguageService.getLanguageService()
- .getLanguage(new LanguageID(LANGID_TOYBE64));
+ .getLanguage(new LanguageID(LANGID_TOYBE64));
}
catch (LanguageNotFoundException e) {
throw new AssertionError("Why is the Toy language missing?", e);
@@ -477,7 +478,7 @@ public abstract class AbstractGhidraHeadedDebuggerGUITest
DockingActionIf action, boolean wait) {
ActionContext context = waitForValue(() -> {
ActionContext ctx = provider == null
- ? new ActionContext()
+ ? new DefaultActionContext()
: provider.getActionContext(null);
if (!action.isEnabledForContext(ctx)) {
return null;
@@ -676,8 +677,8 @@ public abstract class AbstractGhidraHeadedDebuggerGUITest
protected void intoProject(DomainObject obj) {
waitForDomainObject(obj);
DomainFolder rootFolder = tool.getProject()
- .getProjectData()
- .getRootFolder();
+ .getProjectData()
+ .getRootFolder();
waitForCondition(() -> {
try {
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
// can't remove listener until observedTraceChange has completed.
bank.writeRegistersNamed(values)
- .thenCompose(__ -> observedTraceChange)
- .get(timeoutMillis, TimeUnit.MILLISECONDS);
+ .thenCompose(__ -> observedTraceChange)
+ .get(timeoutMillis, TimeUnit.MILLISECONDS);
}
finally {
trace.removeListener(listener);
@@ -835,8 +836,8 @@ public abstract class AbstractGhidraHeadedDebuggerGUITest
protected DomainFile unpack(File pack) throws Exception {
return tool.getProject()
- .getProjectData()
- .getRootFolder()
- .createFile("Restored", pack, monitor);
+ .getProjectData()
+ .getRootFolder()
+ .createFile("Restored", pack, monitor);
}
}
diff --git a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/console/DebuggerConsoleProviderTest.java b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/console/DebuggerConsoleProviderTest.java
index 055bebd24d..745003d371 100644
--- a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/console/DebuggerConsoleProviderTest.java
+++ b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/console/DebuggerConsoleProviderTest.java
@@ -15,12 +15,12 @@
*/
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.Test;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.builder.ActionBuilder;
import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest;
import ghidra.app.plugin.core.debug.gui.DebuggerResources;
@@ -36,25 +36,25 @@ public class DebuggerConsoleProviderTest extends AbstractGhidraHeadedDebuggerGUI
consoleProvider = waitForComponentProvider(DebuggerConsoleProvider.class);
}
- public static class TestConsoleActionContext extends ActionContext {
+ public static class TestConsoleActionContext extends DefaultActionContext {
}
@Test
public void testActions() throws Exception {
consolePlugin.addResolutionAction(new ActionBuilder("Add", name.getMethodName())
- .toolBarIcon(DebuggerResources.ICON_ADD)
- .description("Add")
- .withContext(TestConsoleActionContext.class)
- .onAction(ctx -> Msg.info(this, "Add clicked"))
- .build());
+ .toolBarIcon(DebuggerResources.ICON_ADD)
+ .description("Add")
+ .withContext(TestConsoleActionContext.class)
+ .onAction(ctx -> Msg.info(this, "Add clicked"))
+ .build());
consolePlugin.addResolutionAction(new ActionBuilder("Delete", name.getMethodName())
- .popupMenuIcon(DebuggerResources.ICON_DELETE)
- .popupMenuPath("Delete")
- .description("Delete")
- .withContext(TestConsoleActionContext.class)
- .onAction(ctx -> Msg.info(this, "Delete clicked"))
- .build());
+ .popupMenuIcon(DebuggerResources.ICON_DELETE)
+ .popupMenuPath("Delete")
+ .description("Delete")
+ .withContext(TestConsoleActionContext.class)
+ .onAction(ctx -> Msg.info(this, "Delete clicked"))
+ .build());
consolePlugin.log(DebuggerResources.ICON_DEBUGGER, "<html><b>Test message</b></html>",
new TestConsoleActionContext());
diff --git a/Ghidra/Extensions/MachineLearning/src/main/java/ghidra/machinelearning/functionfinding/RandomForestFunctionFinderPlugin.java b/Ghidra/Extensions/MachineLearning/src/main/java/ghidra/machinelearning/functionfinding/RandomForestFunctionFinderPlugin.java
index e0a1753467..143c8294e4 100644
--- a/Ghidra/Extensions/MachineLearning/src/main/java/ghidra/machinelearning/functionfinding/RandomForestFunctionFinderPlugin.java
+++ b/Ghidra/Extensions/MachineLearning/src/main/java/ghidra/machinelearning/functionfinding/RandomForestFunctionFinderPlugin.java
@@ -205,17 +205,16 @@ public class RandomForestFunctionFinderPlugin extends ProgramPlugin
private void createActions() {
new ActionBuilder(ACTION_NAME, getName())
- .menuPath(ToolConstants.MENU_SEARCH, MENU_PATH_ENTRY)
- .menuGroup("search for", null)
- .description("Train models to search for function starts")
- .helpLocation(new HelpLocation(getName(), getName()))
- .withContext(NavigatableActionContext.class)
- .validContextWhen(c -> !(c instanceof RestrictedAddressSetContext))
- .supportsDefaultToolContext(true)
- .onAction(c -> {
- displayDialog(c);
- })
- .buildAndInstall(tool);
+ .menuPath(ToolConstants.MENU_SEARCH, MENU_PATH_ENTRY)
+ .menuGroup("search for", null)
+ .description("Train models to search for function starts")
+ .helpLocation(new HelpLocation(getName(), getName()))
+ .withContext(NavigatableActionContext.class, true)
+ .validContextWhen(c -> !(c instanceof RestrictedAddressSetContext))
+ .onAction(c -> {
+ displayDialog(c);
+ })
+ .buildAndInstall(tool);
}
private void displayDialog(NavigatableActionContext c) {
diff --git a/Ghidra/Extensions/sample/src/main/java/ghidra/examples/HelloWorldComponentProvider.java b/Ghidra/Extensions/sample/src/main/java/ghidra/examples/HelloWorldComponentProvider.java
index f0701444f8..3235a57ca9 100644
--- a/Ghidra/Extensions/sample/src/main/java/ghidra/examples/HelloWorldComponentProvider.java
+++ b/Ghidra/Extensions/sample/src/main/java/ghidra/examples/HelloWorldComponentProvider.java
@@ -20,8 +20,7 @@ import java.awt.event.*;
import javax.swing.*;
-import docking.ActionContext;
-import docking.WindowPosition;
+import docking.*;
import docking.action.*;
import docking.widgets.EmptyBorderButton;
import generic.theme.GIcon;
@@ -132,7 +131,7 @@ public class HelloWorldComponentProvider extends ComponentProviderAdapter {
if (event != null) {
Object source = event.getSource();
if (source == activeButtonObj) {
- return new ActionContext(this, activeButtonObj);
+ return new DefaultActionContext(this, activeButtonObj);
}
}
return null;
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/context/NavigatableContextAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/context/NavigatableContextAction.java
index 84a8be66ea..9e1f59bdc3 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/context/NavigatableContextAction.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/context/NavigatableContextAction.java
@@ -45,7 +45,7 @@ public abstract class NavigatableContextAction extends DockingAction {
public NavigatableContextAction(String name, String owner,
boolean supportsRestrictedAddressSetContext) {
super(name, owner);
- setSupportsDefaultToolContext(true);
+ setContextClass(NavigatableActionContext.class, true);
this.supportsRestrictedAddressSetContext = supportsRestrictedAddressSetContext;
}
@@ -58,7 +58,7 @@ public abstract class NavigatableContextAction extends DockingAction {
*/
public NavigatableContextAction(String name, String owner, KeyBindingType type) {
super(name, owner, type);
- setSupportsDefaultToolContext(true);
+ setContextClass(NavigatableActionContext.class, true);
this.supportsRestrictedAddressSetContext = true;
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/context/ProgramActionContext.java b/Ghidra/Features/Base/src/main/java/ghidra/app/context/ProgramActionContext.java
index d9e8761c05..d94d4a328a 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/context/ProgramActionContext.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/context/ProgramActionContext.java
@@ -18,11 +18,11 @@ package ghidra.app.context;
import java.awt.Component;
import java.awt.KeyboardFocusManager;
-import docking.ActionContext;
import docking.ComponentProvider;
+import docking.DefaultActionContext;
import ghidra.program.model.listing.Program;
-public class ProgramActionContext extends ActionContext {
+public class ProgramActionContext extends DefaultActionContext {
protected final Program program;
public ProgramActionContext(ComponentProvider provider, Program program) {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AutoAnalysisPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AutoAnalysisPlugin.java
index ce4d6e97f8..88e43295d5 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AutoAnalysisPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AutoAnalysisPlugin.java
@@ -105,28 +105,28 @@ public class AutoAnalysisPlugin extends Plugin implements AutoAnalysisManagerLis
// they are inserted
int subGroupIndex = 0;
- //@formatter:off
- autoAnalyzeAction =
- new ActionBuilder("Auto Analyze", getName())
- .supportsDefaultToolContext(true)
- .menuPath("&Analysis", "&Auto Analyze...")
- .menuGroup(ANALYZE_GROUP_NAME, "" + subGroupIndex++)
- .keyBinding("A")
- .validContextWhen(ac -> {
- updateActionName(ac);
- return ac instanceof ListingActionContext;
- })
- .onAction(this::analyzeCallback)
- .buildAndInstall(tool);
+ autoAnalyzeAction = new ActionBuilder("Auto Analyze", getName())
+ .menuPath("&Analysis", "&Auto Analyze...")
+ .menuGroup(ANALYZE_GROUP_NAME, "" + subGroupIndex++)
+ .keyBinding("A")
+ .withContext(ListingActionContext.class, true)
+ .onAction(this::analyzeCallback)
+ .buildAndInstall(tool);
+
+ // we need to specially override the validContextWhen so that as a side effect, we
+ // can change the action name to not include a program name when the action is
+ // actually invalid.
+ autoAnalyzeAction.validContextWhen(ac -> {
+ updateActionName(ac);
+ return ac instanceof ListingActionContext;
+ });
new ActionBuilder("Analyze All Open", getName())
- .supportsDefaultToolContext(true)
- .menuPath("&Analysis", "Analyze All &Open...")
- .menuGroup(ANALYZE_GROUP_NAME, "" + subGroupIndex++)
- .onAction(c -> analyzeAllCallback())
- .validContextWhen(ac -> ac instanceof ListingActionContext)
- .buildAndInstall(tool);
- //@formatter:on
+ .menuPath("&Analysis", "Analyze All &Open...")
+ .menuGroup(ANALYZE_GROUP_NAME, "" + subGroupIndex++)
+ .withContext(ListingActionContext.class, true)
+ .onAction(c -> analyzeAllCallback())
+ .buildAndInstall(tool);
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) {
program.getOptions(StoredAnalyzerTimes.OPTIONS_LIST)
- .registerOption(StoredAnalyzerTimes.OPTION_NAME, OptionType.CUSTOM_TYPE, null, null,
- "Cumulative analysis task times", new StoredAnalyzerTimesPropertyEditor());
+ .registerOption(StoredAnalyzerTimes.OPTION_NAME, OptionType.CUSTOM_TYPE, null, null,
+ "Cumulative analysis task times", new StoredAnalyzerTimesPropertyEditor());
}
@@ -326,7 +326,7 @@ public class AutoAnalysisPlugin extends Plugin implements AutoAnalysisManagerLis
null, ANALYZE_GROUP_NAME));
setHelpLocation(new HelpLocation("AutoAnalysisPlugin", "Auto_Analyzers"));
- setSupportsDefaultToolContext(true);
+ setContextClass(ListingActionContext.class, true);
}
@Override
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/FindPossibleReferencesPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/FindPossibleReferencesPlugin.java
index a6ef6a3e9f..8730fe8b81 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/FindPossibleReferencesPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/FindPossibleReferencesPlugin.java
@@ -25,6 +25,7 @@ import docking.action.MenuData;
import docking.action.builder.ActionBuilder;
import docking.tool.ToolConstants;
import ghidra.app.CorePluginPackage;
+import ghidra.app.context.ListingActionContext;
import ghidra.app.context.NavigatableActionContext;
import ghidra.app.events.ProgramClosedPluginEvent;
import ghidra.app.events.ProgramSelectionPluginEvent;
@@ -98,16 +99,15 @@ public class FindPossibleReferencesPlugin extends Plugin {
private void createActions() {
action = new ActionBuilder(SEARCH_DIRECT_REFS_ACTION_NAME, getName())
- .menuPath(ToolConstants.MENU_SEARCH, "For Direct References")
- .menuGroup("search for")
- .supportsDefaultToolContext(true)
- .helpLocation(new HelpLocation(HelpTopics.SEARCH, SEARCH_DIRECT_REFS_ACTION_NAME))
- .description(getPluginDescription().getDescription())
- .withContext(NavigatableActionContext.class)
- .inWindow(ActionBuilder.When.CONTEXT_MATCHES)
- .onAction(this::findReferences)
- .enabledWhen(this::hasCorrectAddressSize)
- .buildAndInstall(tool);
+ .menuPath(ToolConstants.MENU_SEARCH, "For Direct References")
+ .menuGroup("search for")
+ .helpLocation(new HelpLocation(HelpTopics.SEARCH, SEARCH_DIRECT_REFS_ACTION_NAME))
+ .description(getPluginDescription().getDescription())
+ .withContext(ListingActionContext.class, true)
+ .inWindow(ActionBuilder.When.CONTEXT_MATCHES)
+ .onAction(this::findReferences)
+ .enabledWhen(this::hasCorrectAddressSize)
+ .buildAndInstall(tool);
}
@@ -194,9 +194,9 @@ public class FindPossibleReferencesPlugin extends Plugin {
return;
}
if (currentProgram.getMemory()
- .getBlock(
- fromAddr)
- .getType() == MemoryBlockType.BIT_MAPPED) {
+ .getBlock(
+ fromAddr)
+ .getType() == MemoryBlockType.BIT_MAPPED) {
Msg.showWarn(getClass(), null, "Search For Direct References",
"Cannot search for direct references on bit memory!");
return;
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/calltree/CallTreeProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/calltree/CallTreeProvider.java
index af9625d203..f90e289f2c 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/calltree/CallTreeProvider.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/calltree/CallTreeProvider.java
@@ -23,8 +23,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import javax.swing.*;
import javax.swing.tree.TreePath;
-import docking.ActionContext;
-import docking.WindowPosition;
+import docking.*;
import docking.action.*;
import docking.resources.icons.NumberIcon;
import docking.widgets.dialogs.NumberInputDialog;
@@ -352,7 +351,7 @@ public class CallTreeProvider extends ComponentProviderAdapter implements Domain
}
};
goToSourceAction
- .setPopupMenuData(new MenuData(new String[] { "Go To Call Source" }, goToMenu));
+ .setPopupMenuData(new MenuData(new String[] { "Go To Call Source" }, goToMenu));
goToSourceAction.setHelpLocation(
new HelpLocation(plugin.getName(), "Call_Tree_Context_Action_Goto_Source"));
tool.addLocalAction(this, goToSourceAction);
@@ -367,11 +366,11 @@ public class CallTreeProvider extends ComponentProviderAdapter implements Domain
}
};
filterDuplicates
- .setToolBarData(new ToolBarData(new GIcon("icon.plugin.calltree.filter.duplicates"),
- filterOptionsToolbarGroup, "1"));
+ .setToolBarData(new ToolBarData(new GIcon("icon.plugin.calltree.filter.duplicates"),
+ filterOptionsToolbarGroup, "1"));
filterDuplicates.setSelected(true);
filterDuplicates
- .setHelpLocation(new HelpLocation(plugin.getName(), "Call_Tree_Action_Filter"));
+ .setHelpLocation(new HelpLocation(plugin.getName(), "Call_Tree_Action_Filter"));
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");
recurseIcon = new NumberIcon(recurseDepth.get());
recurseDepthAction
- .setToolBarData(new ToolBarData(recurseIcon, filterOptionsToolbarGroup, "2"));
+ .setToolBarData(new ToolBarData(recurseIcon, filterOptionsToolbarGroup, "2"));
recurseDepthAction.setHelpLocation(
new HelpLocation(plugin.getName(), "Call_Tree_Action_Recurse_Depth"));
@@ -416,7 +415,7 @@ public class CallTreeProvider extends ComponentProviderAdapter implements Domain
navigationOutgoingAction.setToolBarData(new ToolBarData(
Icons.NAVIGATE_ON_OUTGOING_EVENT_ICON, navigationOptionsToolbarGroup, "1"));
navigationOutgoingAction
- .setHelpLocation(new HelpLocation(plugin.getName(), "Call_Tree_Action_Navigation"));
+ .setHelpLocation(new HelpLocation(plugin.getName(), "Call_Tree_Action_Navigation"));
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>" +
"This is highlighted when the data <i>may</i> be stale.<br>");
refreshAction
- .setHelpLocation(new HelpLocation(plugin.getName(), "Call_Tree_Action_Refresh"));
+ .setHelpLocation(new HelpLocation(plugin.getName(), "Call_Tree_Action_Refresh"));
tool.addLocalAction(this, refreshAction);
//
@@ -712,7 +711,7 @@ public class CallTreeProvider extends ComponentProviderAdapter implements Domain
@Override
public ActionContext getActionContext(MouseEvent e) {
if (e == null) {
- return new ActionContext(this, getActiveComponent());
+ return new DefaultActionContext(this, getActiveComponent());
}
Object source = e.getSource();
@@ -722,7 +721,7 @@ public class CallTreeProvider extends ComponentProviderAdapter implements Domain
if (outgoingTree.isMyJTree(jTree)) {
gTree = outgoingTree;
}
- return new ActionContext(this, gTree);
+ return new DefaultActionContext(this, gTree);
}
return null;
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/AbstractCodeBrowserPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/AbstractCodeBrowserPlugin.java
index 5f2f1e6f86..64ea6b14b5 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/AbstractCodeBrowserPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/AbstractCodeBrowserPlugin.java
@@ -114,7 +114,6 @@ public abstract class AbstractCodeBrowserPlugin<P extends CodeViewerProvider> ex
initMiscellaneousOptions();
displayOptions.addOptionsChangeListener(this);
fieldOptions.addOptionsChangeListener(this);
- tool.setDefaultComponent(connectedProvider);
markerChangeListener = new MarkerChangeListener(connectedProvider);
}
@@ -775,7 +774,7 @@ public abstract class AbstractCodeBrowserPlugin<P extends CodeViewerProvider> ex
public boolean goTo(ProgramLocation location, boolean centerOnScreen) {
return Swing
- .runNow(() -> connectedProvider.getListingPanel().goTo(location, centerOnScreen));
+ .runNow(() -> connectedProvider.getListingPanel().goTo(location, centerOnScreen));
}
@Override
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/CodeBrowserPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/CodeBrowserPlugin.java
index f719eba2cc..01835cb441 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/CodeBrowserPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/CodeBrowserPlugin.java
@@ -23,6 +23,7 @@ import docking.widgets.fieldpanel.FieldPanel;
import docking.widgets.fieldpanel.support.FieldSelection;
import docking.widgets.fieldpanel.support.ViewerPosition;
import ghidra.app.CorePluginPackage;
+import ghidra.app.context.*;
import ghidra.app.events.*;
import ghidra.app.plugin.PluginCategoryNames;
import ghidra.app.services.*;
@@ -37,6 +38,7 @@ import ghidra.program.model.listing.Program;
import ghidra.program.util.ProgramLocation;
import ghidra.program.util.ProgramSelection;
+//@formatter:off
@PluginInfo(
status = PluginStatus.RELEASED,
packageName = CorePluginPackage.NAME,
@@ -59,6 +61,7 @@ import ghidra.program.util.ProgramSelection;
ProgramClosedPluginEvent.class, ProgramLocationPluginEvent.class,
ViewChangedPluginEvent.class, ProgramHighlightPluginEvent.class },
eventsProduced = { ProgramLocationPluginEvent.class, ProgramSelectionPluginEvent.class })
+//@formatter:on
public class CodeBrowserPlugin extends AbstractCodeBrowserPlugin<CodeViewerProvider> {
public CodeBrowserPlugin(PluginTool tool) {
@@ -66,6 +69,25 @@ public class CodeBrowserPlugin extends AbstractCodeBrowserPlugin<CodeViewerProvi
registerServiceProvided(FieldMouseHandlerService.class,
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
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/CodeBrowserSelectionPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/CodeBrowserSelectionPlugin.java
index ed427d83e5..71cbcfb752 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/CodeBrowserSelectionPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/CodeBrowserSelectionPlugin.java
@@ -65,48 +65,44 @@ public class CodeBrowserSelectionPlugin extends Plugin {
private void createActions() {
new ActionBuilder("Select All", getName())
- .menuPath(ToolConstants.MENU_SELECTION, "&All in View")
- .menuGroup(SELECT_GROUP, "a")
- .keyBinding("ctrl A")
- .supportsDefaultToolContext(true)
- .helpLocation(new HelpLocation(HelpTopics.SELECTION, "Select All"))
- .withContext(CodeViewerActionContext.class)
- .inWindow(ActionBuilder.When.CONTEXT_MATCHES)
- .onAction(c -> ((CodeViewerProvider) c.getComponentProvider()).selectAll())
- .buildAndInstall(tool);
+ .menuPath(ToolConstants.MENU_SELECTION, "&All in View")
+ .menuGroup(SELECT_GROUP, "a")
+ .keyBinding("ctrl A")
+ .helpLocation(new HelpLocation(HelpTopics.SELECTION, "Select All"))
+ .withContext(CodeViewerActionContext.class, true)
+ .inWindow(ActionBuilder.When.CONTEXT_MATCHES)
+ .onAction(c -> ((CodeViewerProvider) c.getComponentProvider()).selectAll())
+ .buildAndInstall(tool);
new ActionBuilder("Clear Selection", getName())
- .menuPath(ToolConstants.MENU_SELECTION, "&Clear Selection")
- .menuGroup(SELECT_GROUP, "b")
- .supportsDefaultToolContext(true)
- .helpLocation(new HelpLocation(HelpTopics.SELECTION, "Clear Selection"))
- .withContext(CodeViewerActionContext.class)
- .inWindow(ActionBuilder.When.CONTEXT_MATCHES)
- .onAction(c -> ((CodeViewerProvider) c.getComponentProvider())
- .setSelection(new ProgramSelection()))
- .buildAndInstall(tool);
+ .menuPath(ToolConstants.MENU_SELECTION, "&Clear Selection")
+ .menuGroup(SELECT_GROUP, "b")
+ .helpLocation(new HelpLocation(HelpTopics.SELECTION, "Clear Selection"))
+ .withContext(CodeViewerActionContext.class, true)
+ .inWindow(ActionBuilder.When.CONTEXT_MATCHES)
+ .onAction(c -> ((CodeViewerProvider) c.getComponentProvider())
+ .setSelection(new ProgramSelection()))
+ .buildAndInstall(tool);
new ActionBuilder("Select Complement", getName())
- .menuPath(ToolConstants.MENU_SELECTION, "&Complement")
- .menuGroup(SELECT_GROUP, "c")
- .supportsDefaultToolContext(true)
- .helpLocation(new HelpLocation(HelpTopics.SELECTION, "Select Complement"))
- .withContext(CodeViewerActionContext.class)
- .inWindow(ActionBuilder.When.CONTEXT_MATCHES)
- .onAction(c -> ((CodeViewerProvider) c.getComponentProvider()).selectComplement())
- .buildAndInstall(tool);
+ .menuPath(ToolConstants.MENU_SELECTION, "&Complement")
+ .menuGroup(SELECT_GROUP, "c")
+ .helpLocation(new HelpLocation(HelpTopics.SELECTION, "Select Complement"))
+ .withContext(CodeViewerActionContext.class, true)
+ .inWindow(ActionBuilder.When.CONTEXT_MATCHES)
+ .onAction(c -> ((CodeViewerProvider) c.getComponentProvider()).selectComplement())
+ .buildAndInstall(tool);
tool.addAction(new MarkAndSelectionAction(getName(), SELECT_GROUP, "d"));
new ActionBuilder("Create Table From Selection", getName())
- .menuPath(ToolConstants.MENU_SELECTION, "Create Table From Selection")
- .menuGroup("SelectUtils")
- .helpLocation(new HelpLocation("CodeBrowserPlugin", "Selection_Table"))
- .supportsDefaultToolContext(true)
- .withContext(CodeViewerActionContext.class)
- .inWindow(ActionBuilder.When.CONTEXT_MATCHES)
- .onAction(c -> createTable((CodeViewerProvider) c.getComponentProvider()))
- .buildAndInstall(tool);
+ .menuPath(ToolConstants.MENU_SELECTION, "Create Table From Selection")
+ .menuGroup("SelectUtils")
+ .helpLocation(new HelpLocation("CodeBrowserPlugin", "Selection_Table"))
+ .withContext(CodeViewerActionContext.class, true)
+ .inWindow(ActionBuilder.When.CONTEXT_MATCHES)
+ .onAction(c -> createTable((CodeViewerProvider) c.getComponentProvider()))
+ .buildAndInstall(tool);
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/MarkAndSelectionAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/MarkAndSelectionAction.java
index edcfe3a23a..9c9e6cfb72 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/MarkAndSelectionAction.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/MarkAndSelectionAction.java
@@ -53,7 +53,7 @@ public class MarkAndSelectionAction extends ToggleDockingAction {
new ToolBarData(unarmedIcon, ToolConstants.TOOLBAR_GROUP_THREE, "Z"));
setHelpLocation((new HelpLocation(HelpTopics.SELECTION, "Mark_And_Select")));
- setSupportsDefaultToolContext(true);
+ setContextClass(NavigatableActionContext.class, true);
addToWindowWhen(NavigatableActionContext.class);
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/commentwindow/CommentWindowContext.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/commentwindow/CommentWindowContext.java
index 7ff3415813..fbf358bf3c 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/commentwindow/CommentWindowContext.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/commentwindow/CommentWindowContext.java
@@ -15,13 +15,13 @@
*/
package ghidra.app.plugin.core.commentwindow;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import ghidra.util.table.GhidraTable;
/*
* 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) {
super(provider, commentTable);
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/BitFieldEditorPanel.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/BitFieldEditorPanel.java
index 1717f59771..5059e982ef 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/BitFieldEditorPanel.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/BitFieldEditorPanel.java
@@ -26,6 +26,7 @@ import javax.swing.plaf.UIResource;
import com.google.common.base.Predicate;
import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.widgets.DropDownSelectionTextField;
import docking.widgets.OptionDialog;
import docking.widgets.button.GButton;
@@ -757,7 +758,7 @@ public class BitFieldEditorPanel extends JPanel {
return null;
}
- class BitFieldEditorContext extends ActionContext {
+ class BitFieldEditorContext extends DefaultActionContext {
private int selectedBitOffset;
private DataTypeComponent selectedDtc;
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/ComponentStandAloneActionContext.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/ComponentStandAloneActionContext.java
index d1fb0a4323..97a48993a7 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/ComponentStandAloneActionContext.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/ComponentStandAloneActionContext.java
@@ -15,7 +15,7 @@
*/
package ghidra.app.plugin.core.compositeeditor;
-import docking.ActionContext;
+import docking.DefaultActionContext;
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
* stand-alone archive.
*/
-public class ComponentStandAloneActionContext extends ActionContext
+public class ComponentStandAloneActionContext extends DefaultActionContext
implements ComponentContext {
private DataTypeComponent component;
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/CompositeEditorProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/CompositeEditorProvider.java
index 6ac350c2b4..4dd7cd5531 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/CompositeEditorProvider.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/CompositeEditorProvider.java
@@ -19,8 +19,7 @@ import java.awt.event.MouseEvent;
import javax.swing.*;
-import docking.ActionContext;
-import docking.ComponentProvider;
+import docking.*;
import docking.widgets.OptionDialog;
import generic.theme.GIcon;
import ghidra.app.context.ProgramActionContext;
@@ -189,7 +188,7 @@ public abstract class CompositeEditorProvider extends ComponentProviderAdapter
else if (componentAt != null && (originalDTM instanceof StandAloneDataTypeManager)) {
return new ComponentStandAloneActionContext(this, componentAt);
}
- return new ActionContext(this, null);
+ return new DefaultActionContext(this, null);
}
@Override
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/DataTypesProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/DataTypesProvider.java
index 7c20d83b60..5c1f6631b1 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/DataTypesProvider.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/DataTypesProvider.java
@@ -26,8 +26,7 @@ import javax.swing.event.*;
import javax.swing.event.HyperlinkEvent.EventType;
import javax.swing.tree.TreePath;
-import docking.ActionContext;
-import docking.DockingWindowManager;
+import docking.*;
import docking.action.DockingAction;
import docking.action.ToggleDockingAction;
import docking.event.mouse.GMouseListenerAdapter;
@@ -348,7 +347,7 @@ public class DataTypesProvider extends ComponentProviderAdapter {
Object source = event.getSource();
if (source instanceof JTextField || source instanceof JTextPane) {
Component component = (Component) source;
- return new ActionContext(this, source, component);
+ return new DefaultActionContext(this, source, component);
}
Point point = event.getPoint();
@@ -493,8 +492,8 @@ public class DataTypesProvider extends ComponentProviderAdapter {
previewScrollPane = new JScrollPane(previewPane);
DockingWindowManager.getHelpService()
- .registerHelp(previewScrollPane,
- new HelpLocation("DataTypeManagerPlugin", "Preview_Window"));
+ .registerHelp(previewScrollPane,
+ new HelpLocation("DataTypeManagerPlugin", "Preview_Window"));
}
private DataType locateDataType(HyperlinkEvent event) {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/editor/EnumEditorProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/editor/EnumEditorProvider.java
index 1e837ea61d..6826a2de55 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/editor/EnumEditorProvider.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/editor/EnumEditorProvider.java
@@ -27,8 +27,7 @@ import javax.swing.table.TableCellEditor;
import org.apache.commons.lang3.StringUtils;
-import docking.ActionContext;
-import docking.ComponentProvider;
+import docking.*;
import docking.action.*;
import docking.action.builder.ToggleActionBuilder;
import docking.widgets.OptionDialog;
@@ -152,7 +151,7 @@ public class EnumEditorProvider extends ComponentProviderAdapter
@Override
public ActionContext getActionContext(MouseEvent event) {
- return new ActionContext(this, editorPanel.getTable());
+ return new DefaultActionContext(this, editorPanel.getTable());
}
@Override
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datawindow/DataWindowContext.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datawindow/DataWindowContext.java
index 67a9f6a6fc..7b075dfd68 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datawindow/DataWindowContext.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datawindow/DataWindowContext.java
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
- * REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,16 +15,16 @@
*/
package ghidra.app.plugin.core.datawindow;
+import docking.DefaultActionContext;
import ghidra.util.table.GhidraTable;
-import docking.ActionContext;
-public class DataWindowContext extends ActionContext {
+public class DataWindowContext extends DefaultActionContext {
- DataWindowContext( DataWindowProvider provider, GhidraTable dataTable ) {
- super( provider, dataTable );
- }
-
- GhidraTable getDataTable() {
- return (GhidraTable) getContextObject();
- }
+ DataWindowContext(DataWindowProvider provider, GhidraTable dataTable) {
+ super(provider, dataTable);
+ }
+
+ GhidraTable getDataTable() {
+ return (GhidraTable) getContextObject();
+ }
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/editor/TextEditorComponentProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/editor/TextEditorComponentProvider.java
index 3be338b441..fb16b9ac13 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/editor/TextEditorComponentProvider.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/editor/TextEditorComponentProvider.java
@@ -26,8 +26,7 @@ import javax.swing.event.DocumentListener;
import javax.swing.text.Document;
import javax.swing.undo.UndoableEdit;
-import docking.ActionContext;
-import docking.ComponentProvider;
+import docking.*;
import docking.action.*;
import docking.actions.KeyBindingUtils;
import docking.options.editor.FontEditor;
@@ -256,7 +255,7 @@ public class TextEditorComponentProvider extends ComponentProviderAdapter {
ActionContextProvider acp = e -> {
ComponentProvider p = TextEditorComponentProvider.this;
- return new ActionContext(p);
+ return new DefaultActionContext(p);
};
KeyBindingUtils.registerAction(textarea, saveAction, acp);
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/functionwindow/FunctionWindowProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/functionwindow/FunctionWindowProvider.java
index 67395fa17f..f989834934 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/functionwindow/FunctionWindowProvider.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/functionwindow/FunctionWindowProvider.java
@@ -25,6 +25,7 @@ import javax.swing.*;
import javax.swing.table.*;
import docking.ActionContext;
+import docking.DefaultActionContext;
import generic.theme.GIcon;
import ghidra.app.services.GoToService;
import ghidra.framework.plugintool.ComponentProviderAdapter;
@@ -77,7 +78,7 @@ public class FunctionWindowProvider extends ComponentProviderAdapter {
@Override
public ActionContext getActionContext(MouseEvent event) {
- return new ActionContext(this, functionTable);
+ return new DefaultActionContext(this, functionTable);
}
@Override
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/help/AboutProgramPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/help/AboutProgramPlugin.java
index f9408628ed..905ff48471 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/help/AboutProgramPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/help/AboutProgramPlugin.java
@@ -116,7 +116,8 @@ public class AboutProgramPlugin extends Plugin implements ApplicationLevelPlugin
}
};
aboutAction.addToWindowWhen(ProgramActionContext.class);
- aboutAction.setSupportsDefaultToolContext(true);
+ // use the CodeBrowser as a backup context provider
+ aboutAction.setContextClass(ProgramActionContext.class, true);
aboutAction.setMenuBarData(
new MenuData(new String[] { ToolConstants.MENU_HELP, ACTION_NAME }, null, "ZZZ"));
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/AbstractNextPreviousAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/AbstractNextPreviousAction.java
index f58852193e..476c4fe9c9 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/AbstractNextPreviousAction.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/AbstractNextPreviousAction.java
@@ -53,8 +53,6 @@ public abstract class AbstractNextPreviousAction extends NavigatableContextActio
public AbstractNextPreviousAction(PluginTool tool, String name, String owner, String subGroup) {
super(name, owner);
this.tool = tool;
- setSupportsDefaultToolContext(true);
-
ToolBarData toolBarData =
new ToolBarData(getIcon(), ToolConstants.TOOLBAR_GROUP_FOUR);
toolBarData.setToolBarSubGroup(subGroup);
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPreviousBookmarkAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPreviousBookmarkAction.java
index d002ecc7dc..079fd71d1a 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPreviousBookmarkAction.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPreviousBookmarkAction.java
@@ -66,8 +66,7 @@ public class NextPreviousBookmarkAction extends MultiStateDockingAction<String>
public NextPreviousBookmarkAction(PluginTool tool, String owner, String subGroup) {
super("Next Bookmark", owner);
this.tool = tool;
-
- setSupportsDefaultToolContext(true);
+ setContextClass(NavigatableActionContext.class, true);
ToolBarData toolBarData =
new ToolBarData(BOOKMARK_ICON, ToolConstants.TOOLBAR_GROUP_FOUR);
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/locationreferences/LocationReferencesProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/locationreferences/LocationReferencesProvider.java
index 4a76e9cd3a..9bc814df43 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/locationreferences/LocationReferencesProvider.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/locationreferences/LocationReferencesProvider.java
@@ -23,6 +23,7 @@ import javax.swing.*;
import javax.swing.event.ChangeListener;
import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.*;
import docking.widgets.table.GTable;
import generic.theme.GIcon;
@@ -402,7 +403,7 @@ public class LocationReferencesProvider extends ComponentProviderAdapter
@Override
public ActionContext getActionContext(MouseEvent event) {
- return new ActionContext(this, referencesPanel.getTable());
+ return new DefaultActionContext(this, referencesPanel.getTable());
}
//==================================================================================================
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/programtree/TreeViewProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/programtree/TreeViewProvider.java
index 9fdc34bbc7..cb0952ca32 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/programtree/TreeViewProvider.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/programtree/TreeViewProvider.java
@@ -23,6 +23,7 @@ import javax.swing.JComponent;
import javax.swing.event.ChangeEvent;
import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.DockingAction;
import ghidra.app.events.ViewChangedPluginEvent;
import ghidra.app.services.GoToService;
@@ -102,7 +103,7 @@ class TreeViewProvider implements ViewProviderService {
@Override
public ActionContext getActionContext(MouseEvent event) {
- return new ActionContext().setContextObject(getActivePopupObject(event));
+ return new DefaultActionContext().setContextObject(getActivePopupObject(event));
}
@Override
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/ExternalReferencesProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/ExternalReferencesProvider.java
index 5d286166c6..df49874200 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/ExternalReferencesProvider.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/ExternalReferencesProvider.java
@@ -24,6 +24,7 @@ import javax.swing.*;
import org.apache.commons.lang3.StringUtils;
import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.builder.ActionBuilder;
import docking.widgets.dialogs.InputDialog;
import docking.widgets.table.AbstractSortedTableModel;
@@ -83,36 +84,36 @@ public class ExternalReferencesProvider extends ComponentProviderAdapter {
private void createActions() {
new ActionBuilder("Add External Program Name", getOwner())
- .popupMenuPath("Add External Program")
- .popupMenuIcon(ADD_ICON)
- .toolBarIcon(ADD_ICON)
- .enabledWhen(ac -> program != null)
- .onAction(ac -> addExternalProgram())
- .buildAndInstallLocal(this);
+ .popupMenuPath("Add External Program")
+ .popupMenuIcon(ADD_ICON)
+ .toolBarIcon(ADD_ICON)
+ .enabledWhen(ac -> program != null)
+ .onAction(ac -> addExternalProgram())
+ .buildAndInstallLocal(this);
new ActionBuilder("Delete External Program Name", getOwner())
- .popupMenuPath("Delete External Program")
- .popupMenuIcon(DELETE_ICON)
- .toolBarIcon(DELETE_ICON)
- .enabledWhen(ac -> hasSelectedRows())
- .onAction(ac -> deleteExternalProgram())
- .buildAndInstallLocal(this);
+ .popupMenuPath("Delete External Program")
+ .popupMenuIcon(DELETE_ICON)
+ .toolBarIcon(DELETE_ICON)
+ .enabledWhen(ac -> hasSelectedRows())
+ .onAction(ac -> deleteExternalProgram())
+ .buildAndInstallLocal(this);
new ActionBuilder("Set External Name Association", getOwner())
- .popupMenuPath("Set External Name Association")
- .popupMenuIcon(EDIT_ICON)
- .toolBarIcon(EDIT_ICON)
- .enabledWhen(ac -> isSingleRowSelected())
- .onAction(ac -> setExternalProgramAssociation())
- .buildAndInstallLocal(this);
+ .popupMenuPath("Set External Name Association")
+ .popupMenuIcon(EDIT_ICON)
+ .toolBarIcon(EDIT_ICON)
+ .enabledWhen(ac -> isSingleRowSelected())
+ .onAction(ac -> setExternalProgramAssociation())
+ .buildAndInstallLocal(this);
new ActionBuilder("Clear External Name Association", getOwner())
- .popupMenuPath("Clear External Name Association")
- .popupMenuIcon(CLEAR_ICON)
- .toolBarIcon(CLEAR_ICON)
- .enabledWhen(ac -> hasSelectedRows())
- .onAction(ac -> clearExternalAssociation())
- .buildAndInstallLocal(this);
+ .popupMenuPath("Clear External Name Association")
+ .popupMenuIcon(CLEAR_ICON)
+ .toolBarIcon(CLEAR_ICON)
+ .enabledWhen(ac -> hasSelectedRows())
+ .onAction(ac -> clearExternalAssociation())
+ .buildAndInstallLocal(this);
}
@@ -148,7 +149,7 @@ public class ExternalReferencesProvider extends ComponentProviderAdapter {
@Override
public ActionContext getActionContext(MouseEvent event) {
- return new ActionContext(this, table);
+ return new DefaultActionContext(this, table);
}
private JPanel buildMainPanel() {
@@ -452,7 +453,7 @@ public class ExternalReferencesProvider extends ComponentProviderAdapter {
// there are lots of empty path values.
Comparator<ExternalNamesRow> c1 =
(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 super.createSortComparator(columnIndex);
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/scalartable/ScalarSearchContext.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/scalartable/ScalarSearchContext.java
index 204573bd51..3a8642b325 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/scalartable/ScalarSearchContext.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/scalartable/ScalarSearchContext.java
@@ -15,19 +15,19 @@
*/
package ghidra.app.plugin.core.scalartable;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import ghidra.util.table.GhidraTable;
/**
* 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) {
super(provider, scalarTable);
- }
-
+ }
+
GhidraTable getScalarTable() {
- return (GhidraTable) getContextObject();
- }
+ return (GhidraTable) getContextObject();
+ }
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/script/GhidraScriptComponentProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/script/GhidraScriptComponentProvider.java
index a1f08d1d70..5d42f116ce 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/script/GhidraScriptComponentProvider.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/script/GhidraScriptComponentProvider.java
@@ -15,17 +15,16 @@
*/
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.concurrent.atomic.AtomicReference;
import java.util.function.Predicate;
import java.util.function.Supplier;
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.event.ChangeEvent;
import javax.swing.event.ChangeListener;
@@ -38,6 +37,7 @@ import javax.swing.tree.TreeSelectionModel;
import org.apache.commons.lang3.StringUtils;
import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.KeyBindingData;
import docking.event.mouse.GMouseListenerAdapter;
import docking.widgets.OptionDialog;
@@ -176,7 +176,7 @@ public class GhidraScriptComponentProvider extends ComponentProviderAdapter {
});
scriptCategoryTree.getSelectionModel()
- .setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
+ .setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
}
private void build() {
@@ -475,11 +475,11 @@ public class GhidraScriptComponentProvider extends ComponentProviderAdapter {
*/
public List<ResourceFile> getScriptDirectories() {
return bundleHost.getGhidraBundles()
- .stream()
- .filter(GhidraSourceBundle.class::isInstance)
- .filter(GhidraBundle::isEnabled)
- .map(GhidraBundle::getFile)
- .collect(Collectors.toList());
+ .stream()
+ .filter(GhidraSourceBundle.class::isInstance)
+ .filter(GhidraBundle::isEnabled)
+ .map(GhidraBundle::getFile)
+ .collect(Collectors.toList());
}
/**
@@ -487,12 +487,12 @@ public class GhidraScriptComponentProvider extends ComponentProviderAdapter {
*/
public List<ResourceFile> getWritableScriptDirectories() {
return bundleHost.getGhidraBundles()
- .stream()
- .filter(GhidraSourceBundle.class::isInstance)
- .filter(Predicate.not(GhidraBundle::isSystemBundle))
- .filter(GhidraBundle::isEnabled)
- .map(GhidraBundle::getFile)
- .collect(Collectors.toList());
+ .stream()
+ .filter(GhidraSourceBundle.class::isInstance)
+ .filter(Predicate.not(GhidraBundle::isSystemBundle))
+ .filter(GhidraBundle::isEnabled)
+ .map(GhidraBundle::getFile)
+ .collect(Collectors.toList());
}
boolean isEditorOpen(ResourceFile script) {
@@ -647,9 +647,9 @@ public class GhidraScriptComponentProvider extends ComponentProviderAdapter {
AtomicReference<GhidraScript> ref = new AtomicReference<>();
TaskBuilder.withRunnable(monitor -> ref.set(scriptSupplier.get()))
- .setTitle("Compiling Script Directory")
- .setLaunchDelay(1000)
- .launchModal();
+ .setTitle("Compiling Script Directory")
+ .setLaunchDelay(1000)
+ .launchModal();
return ref.get();
}
@@ -1132,11 +1132,11 @@ public class GhidraScriptComponentProvider extends ComponentProviderAdapter {
int[] selectedRows = scriptTable.getSelectedRows();
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]);
- return new ActionContext(this, script, scriptTable);
+ return new DefaultActionContext(this, script, scriptTable);
}
@Override
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/searchtext/SearchTextPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/searchtext/SearchTextPlugin.java
index 4c8b54bd8b..69b9e9e581 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/searchtext/SearchTextPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/searchtext/SearchTextPlugin.java
@@ -379,36 +379,34 @@ public class SearchTextPlugin extends ProgramPlugin implements OptionsChangeList
String subGroup = getClass().getName();
new ActionBuilder("Search Text", getName())
- .menuPath("&Search", "Program &Text...")
- .menuGroup("search", subGroup)
- .keyBinding("ctrl shift E")
- .description(DESCRIPTION)
- .helpLocation(new HelpLocation(HelpTopics.SEARCH, "Search Text"))
- .withContext(NavigatableActionContext.class)
- .validContextWhen(c -> !(c instanceof RestrictedAddressSetContext))
- .inWindow(ActionBuilder.When.CONTEXT_MATCHES)
- .supportsDefaultToolContext(true)
- .onAction(c -> {
- setNavigatable(c.getNavigatable());
- displayDialog(c);
- })
- .buildAndInstall(tool);
+ .menuPath("&Search", "Program &Text...")
+ .menuGroup("search", subGroup)
+ .keyBinding("ctrl shift E")
+ .description(DESCRIPTION)
+ .helpLocation(new HelpLocation(HelpTopics.SEARCH, "Search Text"))
+ .withContext(NavigatableActionContext.class, true)
+ .validContextWhen(c -> !(c instanceof RestrictedAddressSetContext))
+ .inWindow(ActionBuilder.When.CONTEXT_MATCHES)
+ .onAction(c -> {
+ setNavigatable(c.getNavigatable());
+ displayDialog(c);
+ })
+ .buildAndInstall(tool);
new ActionBuilder("Repeat Text Search", getName())
- .menuPath("&Search", "Repeat Text Search")
- .menuGroup("search", subGroup)
- .keyBinding("ctrl shift F3")
- .description(DESCRIPTION)
- .supportsDefaultToolContext(true)
- .helpLocation(new HelpLocation(HelpTopics.SEARCH, "Repeat Text Search"))
- .withContext(NavigatableActionContext.class)
- .inWindow(ActionBuilder.When.CONTEXT_MATCHES)
- .enabledWhen(c -> searchedOnce)
- .onAction(c -> {
- setNavigatable(c.getNavigatable());
- searchDialog.repeatSearch();
- })
- .buildAndInstall(tool);
+ .menuPath("&Search", "Repeat Text Search")
+ .menuGroup("search", subGroup)
+ .keyBinding("ctrl shift F3")
+ .description(DESCRIPTION)
+ .helpLocation(new HelpLocation(HelpTopics.SEARCH, "Repeat Text Search"))
+ .withContext(NavigatableActionContext.class, true)
+ .inWindow(ActionBuilder.When.CONTEXT_MATCHES)
+ .enabledWhen(c -> searchedOnce)
+ .onAction(c -> {
+ setNavigatable(c.getNavigatable());
+ searchDialog.repeatSearch();
+ })
+ .buildAndInstall(tool);
}
protected void updateNavigatable(ActionContext context) {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/select/flow/SelectByFlowAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/select/flow/SelectByFlowAction.java
index 6dbe9ca4f5..aef19b4ed0 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/select/flow/SelectByFlowAction.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/select/flow/SelectByFlowAction.java
@@ -62,9 +62,7 @@ class SelectByFlowAction extends ListingContextAction {
super(name, plugin.getName());
this.selectByFlowPlugin = plugin;
this.selectionType = selectionType;
-
- // this is in the main tool menu, so make it a tool action
- setSupportsDefaultToolContext(true);
+ setContextClass(ListingActionContext.class, true);
String[] menuPath = null;
if (selectionType == SelectByFlowPlugin.SELECT_FUNCTIONS) {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/strings/ViewStringsContext.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/strings/ViewStringsContext.java
index 664cd771c9..80428e2db6 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/strings/ViewStringsContext.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/strings/ViewStringsContext.java
@@ -18,14 +18,14 @@ package ghidra.app.plugin.core.strings;
import java.util.List;
import java.util.function.Predicate;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import ghidra.app.context.DataLocationListContext;
import ghidra.program.model.listing.Data;
import ghidra.program.model.listing.Program;
import ghidra.program.util.ProgramLocation;
import ghidra.util.table.GhidraTable;
-public class ViewStringsContext extends ActionContext implements DataLocationListContext {
+public class ViewStringsContext extends DefaultActionContext implements DataLocationListContext {
private ViewStringsProvider viewStringsProvider;
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/table/TableComponentProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/table/TableComponentProvider.java
index e253b65e13..7ce7fc3e37 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/table/TableComponentProvider.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/table/TableComponentProvider.java
@@ -25,8 +25,7 @@ import javax.swing.*;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
-import docking.ActionContext;
-import docking.ComponentProviderActivationListener;
+import docking.*;
import docking.action.DockingAction;
import docking.action.MenuData;
import docking.widgets.table.AbstractSortedTableModel;
@@ -156,7 +155,7 @@ public class TableComponentProvider<T> extends ComponentProviderAdapter
selectionNavigationAction = new SelectionNavigationAction(plugin, table);
selectionNavigationAction
- .setHelpLocation(new HelpLocation(HelpTopics.SEARCH, "Selection_Navigation"));
+ .setHelpLocation(new HelpLocation(HelpTopics.SEARCH, "Selection_Navigation"));
DockingAction externalGotoAction = new DockingAction("Go to External Location", getName()) {
@Override
@@ -394,7 +393,7 @@ public class TableComponentProvider<T> extends ComponentProviderAdapter
@Override
public ActionContext getActionContext(MouseEvent event) {
- return new ActionContext(this, threadedPanel.getTable());
+ return new DefaultActionContext(this, threadedPanel.getTable());
}
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/services/CodeViewerService.java b/Ghidra/Features/Base/src/main/java/ghidra/app/services/CodeViewerService.java
index ea5235609c..091b3f3e1b 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/services/CodeViewerService.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/services/CodeViewerService.java
@@ -42,7 +42,6 @@ import ghidra.program.util.ProgramSelection;
*/
@ServiceInfo(defaultProvider = CodeBrowserPlugin.class)
public interface CodeViewerService {
-
/**
* Add a provider that shows an overview of the program.
* @param overviewProvider provider to add
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/listingpanel/ListingCodeComparisonPanel.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/listingpanel/ListingCodeComparisonPanel.java
index 16432ce690..d2afe56354 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/listingpanel/ListingCodeComparisonPanel.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/listingpanel/ListingCodeComparisonPanel.java
@@ -1561,8 +1561,8 @@ public class ListingCodeComparisonPanel
if (programs[LEFT] != null) {
AddressIndexMap indexMap = listingPanels[LEFT].getAddressIndexMap();
listingPanels[LEFT].getFieldPanel()
- .setBackgroundColorModel(new MarkerServiceBackgroundColorModel(
- markerManagers[LEFT], programs[LEFT], indexMap));
+ .setBackgroundColorModel(new MarkerServiceBackgroundColorModel(
+ markerManagers[LEFT], programs[LEFT], indexMap));
unmatchedCodeMarkers[LEFT] =
markerManagers[LEFT].createAreaMarker("Listing1 Unmatched Code",
"Instructions that are not matched to an instruction in the other function.",
@@ -1575,8 +1575,8 @@ public class ListingCodeComparisonPanel
if (programs[RIGHT] != null) {
AddressIndexMap rightIndexMap = listingPanels[RIGHT].getAddressIndexMap();
listingPanels[RIGHT].getFieldPanel()
- .setBackgroundColorModel(new MarkerServiceBackgroundColorModel(
- markerManagers[RIGHT], programs[RIGHT], rightIndexMap));
+ .setBackgroundColorModel(new MarkerServiceBackgroundColorModel(
+ markerManagers[RIGHT], programs[RIGHT], rightIndexMap));
unmatchedCodeMarkers[RIGHT] =
markerManagers[RIGHT].createAreaMarker("Listing2 Unmatched Code",
"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]);
markerManagers[LEFT].getOverviewProvider().setProgram(getLeftProgram(), indexMaps[LEFT]);
listingPanels[LEFT].getFieldPanel()
- .setBackgroundColorModel(new MarkerServiceBackgroundColorModel(markerManagers[LEFT],
- programs[LEFT], indexMaps[LEFT]));
+ .setBackgroundColorModel(new MarkerServiceBackgroundColorModel(markerManagers[LEFT],
+ programs[LEFT], indexMaps[LEFT]));
}
private void updateRightAddressSet(Function rightFunction) {
@@ -1693,8 +1693,8 @@ public class ListingCodeComparisonPanel
indexMaps[RIGHT] = new AddressIndexMap(addressSets[RIGHT]);
markerManagers[RIGHT].getOverviewProvider().setProgram(getRightProgram(), indexMaps[RIGHT]);
listingPanels[RIGHT].getFieldPanel()
- .setBackgroundColorModel(new MarkerServiceBackgroundColorModel(
- markerManagers[RIGHT], programs[RIGHT], indexMaps[RIGHT]));
+ .setBackgroundColorModel(new MarkerServiceBackgroundColorModel(
+ markerManagers[RIGHT], programs[RIGHT], indexMaps[RIGHT]));
}
@Override
@@ -2085,18 +2085,18 @@ public class ListingCodeComparisonPanel
Object leftMarginContext = getContextForMarginPanels(leftPanel, event);
if (leftMarginContext != null) {
- return new ActionContext(provider).setContextObject(leftMarginContext);
+ return new DefaultActionContext(provider).setContextObject(leftMarginContext);
}
Object rightMarginContext = getContextForMarginPanels(rightPanel, event);
if (rightMarginContext != null) {
- return new ActionContext(provider).setContextObject(rightMarginContext);
+ return new DefaultActionContext(provider).setContextObject(rightMarginContext);
}
Object source = event.getSource();
if (source instanceof FieldHeaderComp) {
FieldHeaderLocation fieldHeaderLocation =
leftPanel.getFieldHeader().getFieldHeaderLocation(event.getPoint());
- return new ActionContext(provider).setContextObject(fieldHeaderLocation);
+ return new DefaultActionContext(provider).setContextObject(fieldHeaderLocation);
}
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.
Object sourceMarginContextObject = getContextObjectForMarginPanels(sourcePanel, event);
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.
Object destinationMarginContextObject =
getContextObjectForMarginPanels(destinationPanel, event);
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
@@ -2703,7 +2705,7 @@ public class ListingCodeComparisonPanel
if (sourceComponent instanceof FieldHeaderComp) {
FieldHeaderLocation fieldHeaderLocation =
sourcePanel.getFieldHeader().getFieldHeaderLocation(event.getPoint());
- return new ActionContext(provider).setContextObject(fieldHeaderLocation);
+ return new DefaultActionContext(provider).setContextObject(fieldHeaderLocation);
}
}
return null;
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/framework/main/OpenVersionedFileDialog.java b/Ghidra/Features/Base/src/main/java/ghidra/framework/main/OpenVersionedFileDialog.java
index a7311543c8..cef794835c 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/framework/main/OpenVersionedFileDialog.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/framework/main/OpenVersionedFileDialog.java
@@ -25,6 +25,7 @@ import java.util.List;
import javax.swing.*;
import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.DockingActionIf;
import docking.event.mouse.GMouseListenerAdapter;
import docking.widgets.table.*;
@@ -163,7 +164,7 @@ public class OpenVersionedFileDialog<T extends DomainObject> extends DataTreeDia
@Override
protected JPanel buildMainPanel() {
-
+
mainPanel = new JPanel(new BorderLayout());
mainPanel.add(super.buildMainPanel(), BorderLayout.CENTER);
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());
GTable table = openObjectsTable.getTable();
table.getSelectionModel()
- .setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ .setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
openObjectsTable.addSelectionListener(e -> {
setOkEnabled(true);
okButton.setToolTipText("Use the selected " + domainObjectClass.getSimpleName());
@@ -402,7 +403,7 @@ public class OpenVersionedFileDialog<T extends DomainObject> extends DataTreeDia
return context;
}
- ActionContext actionContext = new ActionContext(null, this, event.getComponent());
+ ActionContext actionContext = new DefaultActionContext(null, this, event.getComponent());
actionContext.setMouseEvent(event);
return actionContext;
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/plugins/fsbrowser/FSBActionContext.java b/Ghidra/Features/Base/src/main/java/ghidra/plugins/fsbrowser/FSBActionContext.java
index f22ef712ad..3df001321e 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/plugins/fsbrowser/FSBActionContext.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/plugins/fsbrowser/FSBActionContext.java
@@ -22,7 +22,7 @@ import java.util.List;
import javax.swing.tree.TreePath;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.widgets.tree.GTree;
import docking.widgets.tree.GTreeNode;
import ghidra.formats.gfilesystem.*;
@@ -30,7 +30,7 @@ import ghidra.formats.gfilesystem.*;
/**
* {@link FileSystemBrowserPlugin}-specific action.
*/
-public class FSBActionContext extends ActionContext {
+public class FSBActionContext extends DefaultActionContext {
private GTree gTree;
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/bookmark/BookmarkPluginTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/bookmark/BookmarkPluginTest.java
index addca1769d..b640697696 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/bookmark/BookmarkPluginTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/bookmark/BookmarkPluginTest.java
@@ -27,7 +27,7 @@ import javax.swing.text.JTextComponent;
import org.junit.*;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.DockingActionIf;
import docking.widgets.filter.FilterOptions;
import docking.widgets.table.*;
@@ -300,7 +300,7 @@ public class BookmarkPluginTest extends AbstractGhidraHeadedIntegrationTest {
selectRow(5, true);
DockingActionIf action = getAction(plugin, "Select Bookmark Locations");
- action.actionPerformed(new ActionContext());
+ action.actionPerformed(new DefaultActionContext());
AddressSet set = new AddressSet();
@@ -311,7 +311,7 @@ public class BookmarkPluginTest extends AbstractGhidraHeadedIntegrationTest {
selectRow(0, false);
selectRow(3, true);
- action.actionPerformed(new ActionContext());
+ action.actionPerformed(new DefaultActionContext());
sel = cbPlugin.getCurrentSelection();
set.clear();
set.addRange(addr("0x01001010"), addr("0x01001011"));
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/calltree/CallTreePluginTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/calltree/CallTreePluginTest.java
index 4702cce0e4..0b6d3645dc 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/calltree/CallTreePluginTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/calltree/CallTreePluginTest.java
@@ -30,6 +30,7 @@ import org.apache.commons.collections4.map.LazyMap;
import org.junit.*;
import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.*;
import docking.widgets.tree.*;
import generic.test.AbstractGenericTest;
@@ -497,7 +498,7 @@ public class CallTreePluginTest extends AbstractGhidraHeadedIntegrationTest {
outgoingTree.setSelectedNode(child1);
waitForTree(outgoingTree);
- ActionContext actionContext = new ActionContext(provider, outgoingTree);
+ ActionContext actionContext = new DefaultActionContext(provider, outgoingTree);
DockingActionIf goToAction = getAction("Go To Destination");
performAction(goToAction, actionContext, true);
@@ -517,7 +518,7 @@ public class CallTreePluginTest extends AbstractGhidraHeadedIntegrationTest {
setProviderFunction("0x5000");
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",
!selectSourceAction.isEnabledForContext(context));
@@ -605,7 +606,7 @@ public class CallTreePluginTest extends AbstractGhidraHeadedIntegrationTest {
ToggleDockingAction filterDuplicatesAction =
(ToggleDockingAction) getAction("Filter Duplicates");
- setToggleActionSelected(filterDuplicatesAction, new ActionContext(), true);
+ setToggleActionSelected(filterDuplicatesAction, new DefaultActionContext(), true);
waitForTree(outgoingTree);
GTreeNode rootNode = getRootNode(outgoingTree);
@@ -638,7 +639,7 @@ public class CallTreePluginTest extends AbstractGhidraHeadedIntegrationTest {
ToggleDockingAction filterDuplicatesAction =
(ToggleDockingAction) getAction("Filter Duplicates");
- setToggleActionSelected(filterDuplicatesAction, new ActionContext(), true);
+ setToggleActionSelected(filterDuplicatesAction, new DefaultActionContext(), true);
waitForTree(outgoingTree);
GTreeNode rootNode = getRootNode(outgoingTree);
@@ -671,7 +672,7 @@ public class CallTreePluginTest extends AbstractGhidraHeadedIntegrationTest {
ToggleDockingAction filterDuplicatesAction =
(ToggleDockingAction) getAction("Filter Duplicates");
- setToggleActionSelected(filterDuplicatesAction, new ActionContext(), true);
+ setToggleActionSelected(filterDuplicatesAction, new DefaultActionContext(), true);
waitForTree(outgoingTree);
GTreeNode rootNode = getRootNode(outgoingTree);
@@ -714,7 +715,7 @@ public class CallTreePluginTest extends AbstractGhidraHeadedIntegrationTest {
ToggleDockingAction filterDuplicatesAction =
(ToggleDockingAction) getAction("Filter Duplicates");
- setToggleActionSelected(filterDuplicatesAction, new ActionContext(), true);
+ setToggleActionSelected(filterDuplicatesAction, new DefaultActionContext(), true);
waitForTree(incomingTree);
// 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) {
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());
}
private void fullyExpandOutgoingNode(GTreeNode node) {
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());
}
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/codebrowser/HeaderTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/codebrowser/HeaderTest.java
index 8cfb5008fd..bb0ad202cc 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/codebrowser/HeaderTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/codebrowser/HeaderTest.java
@@ -22,7 +22,7 @@ import java.util.List;
import org.junit.*;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import ghidra.GhidraOptions;
import ghidra.app.cmd.data.CreateDataCmd;
import ghidra.app.plugin.core.navigation.NextPrevAddressPlugin;
@@ -275,13 +275,13 @@ public class HeaderTest extends AbstractGhidraHeadedIntegrationTest {
public void testInsertDeleteRow() {
FieldFormatModel model = header.getHeaderTab().getModel();
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)));
performAction(act, true);
assertEquals(8, model.getNumRows());
assertEquals(0, model.getNumFactorys(0));
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)));
performAction(act2, true);
assertEquals(7, model.getNumRows());
@@ -294,7 +294,7 @@ public class HeaderTest extends AbstractGhidraHeadedIntegrationTest {
ListingField bf = cb.getCurrentField();
int startX = bf.getStartX();
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)));
performAction(act, true);
int width = bf.getWidth();
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/colorizer/ColorizingPluginTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/colorizer/ColorizingPluginTest.java
index b5335ac963..3b48064073 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/colorizer/ColorizingPluginTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/colorizer/ColorizingPluginTest.java
@@ -27,6 +27,7 @@ import javax.swing.JButton;
import org.junit.*;
import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.DockingActionIf;
import docking.options.editor.GhidraColorChooser;
import docking.widgets.EventTrigger;
@@ -635,7 +636,7 @@ public class ColorizingPluginTest extends AbstractGhidraHeadedIntegrationTest {
private ActionContext getActionContext() {
ActionContext context = cb.getProvider().getActionContext(null);
if (context == null) {
- context = new ActionContext();
+ context = new DefaultActionContext();
}
return context;
}
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/AbstractEditorTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/AbstractEditorTest.java
index 8a51db6b82..7b3ccfb4f6 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/AbstractEditorTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/AbstractEditorTest.java
@@ -29,7 +29,7 @@ import javax.swing.tree.TreePath;
import org.junit.*;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.DockingDialog;
import docking.action.DockingActionIf;
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(),
ReflectionUtilities.createJavaFilteredThrowable());
}
- runSwing(() -> action.actionPerformed(new ActionContext()), wait);
+ runSwing(() -> action.actionPerformed(new DefaultActionContext()), wait);
waitForSwing();
}
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/StructureEditorProviderTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/StructureEditorProviderTest.java
index 87d7d0da60..333100db01 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/StructureEditorProviderTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/StructureEditorProviderTest.java
@@ -22,7 +22,7 @@ import java.awt.Window;
import org.junit.Assert;
import org.junit.Test;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.DockingActionIf;
import docking.action.ToggleDockingActionIf;
import ghidra.framework.options.Options;
@@ -118,7 +118,7 @@ public class StructureEditorProviderTest extends AbstractStructureEditorTest {
runSwingLater(() -> {
getTable().requestFocus();
setSelection(new int[] { 4, 5 });
- deleteAction.actionPerformed(new ActionContext());
+ deleteAction.actionPerformed(new DefaultActionContext());
try {
model.add(new WordDataType());
}
@@ -137,8 +137,8 @@ public class StructureEditorProviderTest extends AbstractStructureEditorTest {
runSwingLater(() -> {
getTable().requestFocus();
setSelection(new int[] { 1 });
- clearAction.actionPerformed(new ActionContext());
- deleteAction.actionPerformed(new ActionContext());// Must be undefined before it can delete.
+ clearAction.actionPerformed(new DefaultActionContext());
+ deleteAction.actionPerformed(new DefaultActionContext());// Must be undefined before it can delete.
});
waitForSwing();
assertFalse(complexStructure.isEquivalent(model.viewComposite));
@@ -454,7 +454,7 @@ public class StructureEditorProviderTest extends AbstractStructureEditorTest {
runSwingLater(() -> {
getTable().requestFocus();
setSelection(new int[] { 4, 5 });
- deleteAction.actionPerformed(new ActionContext());
+ deleteAction.actionPerformed(new DefaultActionContext());
try {
model.add(new WordDataType());
}
@@ -509,7 +509,7 @@ public class StructureEditorProviderTest extends AbstractStructureEditorTest {
runSwingLater(() -> {
getTable().requestFocus();
setSelection(new int[] { 4, 5 });
- deleteAction.actionPerformed(new ActionContext());
+ deleteAction.actionPerformed(new DefaultActionContext());
try {
model.add(new WordDataType());
}
@@ -545,7 +545,7 @@ public class StructureEditorProviderTest extends AbstractStructureEditorTest {
runSwing(() -> {
getTable().requestFocus();
setSelection(new int[] { 4, 5 });
- deleteAction.actionPerformed(new ActionContext());
+ deleteAction.actionPerformed(new DefaultActionContext());
try {
model.add(new WordDataType());
}
@@ -571,7 +571,7 @@ public class StructureEditorProviderTest extends AbstractStructureEditorTest {
runSwingLater(() -> {
getTable().requestFocus();
setSelection(new int[] { 4, 5 });
- deleteAction.actionPerformed(new ActionContext());
+ deleteAction.actionPerformed(new DefaultActionContext());
try {
model.add(new WordDataType());
}
@@ -705,7 +705,7 @@ public class StructureEditorProviderTest extends AbstractStructureEditorTest {
assertEquals("0x145", model.getLengthAsString());
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("47", model.getValueAt(15, model.getOffsetColumn()));
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/UnionEditorProviderTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/UnionEditorProviderTest.java
index 18c7dc97ef..cc27fd2b3e 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/UnionEditorProviderTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/compositeeditor/UnionEditorProviderTest.java
@@ -22,7 +22,7 @@ import java.awt.Window;
import org.junit.Assert;
import org.junit.Test;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.DockingActionIf;
import docking.action.ToggleDockingActionIf;
import ghidra.framework.options.Options;
@@ -346,7 +346,7 @@ public class UnionEditorProviderTest extends AbstractUnionEditorTest {
assertEquals("0x57", model.getLengthAsString());
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("29", model.getValueAt(15, model.getLengthColumn()));
@@ -358,7 +358,7 @@ public class UnionEditorProviderTest extends AbstractUnionEditorTest {
getTable().requestFocus();
model.setSelection(rows);
- deleteAction.actionPerformed(new ActionContext());
+ deleteAction.actionPerformed(new DefaultActionContext());
}
protected UnionEditorProvider edit(DataType dt) {
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/data/AbstractDataActionTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/data/AbstractDataActionTest.java
index 2aa65d4365..b9ca00466e 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/data/AbstractDataActionTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/data/AbstractDataActionTest.java
@@ -27,6 +27,7 @@ import javax.swing.table.TableCellEditor;
import org.junit.*;
import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.DockingActionIf;
import docking.action.MenuData;
import docking.widgets.combobox.GhidraComboBox;
@@ -1528,8 +1529,8 @@ public abstract class AbstractDataActionTest extends AbstractGhidraHeadedIntegra
}
// assumes returned set may be modified
return actions.stream()
- .filter(a -> a.isValidContext(context))
- .collect(Collectors.toSet());
+ .filter(a -> a.isValidContext(context))
+ .collect(Collectors.toSet());
}
/**
@@ -1634,7 +1635,7 @@ public abstract class AbstractDataActionTest extends AbstractGhidraHeadedIntegra
cb.updateNow();
ActionContext context = cb.getProvider().getActionContext(null);
if (context == null) {
- context = new ActionContext();
+ context = new DefaultActionContext();
}
return context;
}
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/datamgr/editor/EnumEditor1Test.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/datamgr/editor/EnumEditor1Test.java
index 5db7b71776..43bd7b795d 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/datamgr/editor/EnumEditor1Test.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/datamgr/editor/EnumEditor1Test.java
@@ -29,7 +29,7 @@ import javax.swing.table.TableCellEditor;
import org.junit.*;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.DockingActionIf;
import docking.widgets.OptionDialog;
import generic.stl.Pair;
@@ -167,7 +167,7 @@ public class EnumEditor1Test extends AbstractGhidraHeadedIntegrationTest {
assertEquals(5L, model.getValueAt(2, VALUE_COL));
// apply the change
- runSwing(() -> applyAction.actionPerformed(new ActionContext()));
+ runSwing(() -> applyAction.actionPerformed(new DefaultActionContext()));
program.flushEvents();
waitForSwing();
@@ -390,7 +390,7 @@ public class EnumEditor1Test extends AbstractGhidraHeadedIntegrationTest {
int lastRow = model.getRowCount() - 1;
table.addRowSelectionInterval(lastRow, lastRow);
DockingActionIf addAction = getAction(plugin, "Add Enum Value");
- addAction.actionPerformed(new ActionContext());
+ addAction.actionPerformed(new DefaultActionContext());
});
waitForSwing();
@@ -1166,7 +1166,7 @@ public class EnumEditor1Test extends AbstractGhidraHeadedIntegrationTest {
private void apply() {
runSwing(() -> {
DockingActionIf applyAction = getAction(plugin, "Apply Enum Changes");
- applyAction.actionPerformed(new ActionContext());
+ applyAction.actionPerformed(new DefaultActionContext());
}, false);
program.flushEvents();
waitForSwing();
@@ -1332,7 +1332,7 @@ public class EnumEditor1Test extends AbstractGhidraHeadedIntegrationTest {
private void addEnumValue() {
runSwing(() -> {
DockingActionIf addAction = getAction(plugin, "Add Enum Value");
- addAction.actionPerformed(new ActionContext());
+ addAction.actionPerformed(new DefaultActionContext());
});
}
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/datamgr/editor/EnumEditor2Test.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/datamgr/editor/EnumEditor2Test.java
index 22f0bd20be..45e38970c0 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/datamgr/editor/EnumEditor2Test.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/datamgr/editor/EnumEditor2Test.java
@@ -275,14 +275,14 @@ public class EnumEditor2Test extends AbstractGhidraHeadedIntegrationTest {
final DockingActionIf deleteAction = getAction(plugin, "Delete Enum Value");
assertTrue(deleteAction.isEnabled());
- runSwing(() -> deleteAction.actionPerformed(new ActionContext()));
+ runSwing(() -> deleteAction.actionPerformed(new DefaultActionContext()));
waitForSwing();
assertTrue(table.isRowSelected(3));
final DockingActionIf applyAction = getAction(plugin, "Apply Enum Changes");
assertTrue(applyAction.isEnabled());
- runSwing(() -> applyAction.actionPerformed(new ActionContext()));
+ runSwing(() -> applyAction.actionPerformed(new DefaultActionContext()));
program.flushEvents();
waitForSwing();
@@ -304,7 +304,7 @@ public class EnumEditor2Test extends AbstractGhidraHeadedIntegrationTest {
for (int i = 0; i < count; i++) {
- runSwing(() -> deleteAction.actionPerformed(new ActionContext()));
+ runSwing(() -> deleteAction.actionPerformed(new DefaultActionContext()));
waitForSwing();
}
assertEquals(0, model.getRowCount());
@@ -326,7 +326,7 @@ public class EnumEditor2Test extends AbstractGhidraHeadedIntegrationTest {
for (int i = 0; i < count; i++) {
- runSwing(() -> deleteAction.actionPerformed(new ActionContext()));
+ runSwing(() -> deleteAction.actionPerformed(new DefaultActionContext()));
waitForSwing();
}
applyChanges(true);
@@ -352,7 +352,7 @@ public class EnumEditor2Test extends AbstractGhidraHeadedIntegrationTest {
for (int i = 0; i < count; i++) {
- runSwing(() -> deleteAction.actionPerformed(new ActionContext()));
+ runSwing(() -> deleteAction.actionPerformed(new DefaultActionContext()));
waitForSwing();
}
@@ -387,7 +387,7 @@ public class EnumEditor2Test extends AbstractGhidraHeadedIntegrationTest {
for (int i = 0; i < count; i++) {
- runSwing(() -> deleteAction.actionPerformed(new ActionContext()));
+ runSwing(() -> deleteAction.actionPerformed(new DefaultActionContext()));
waitForSwing();
}
@@ -416,7 +416,7 @@ public class EnumEditor2Test extends AbstractGhidraHeadedIntegrationTest {
for (int i = 0; i < count; i++) {
- runSwing(() -> deleteAction.actionPerformed(new ActionContext()));
+ runSwing(() -> deleteAction.actionPerformed(new DefaultActionContext()));
waitForSwing();
}
@@ -448,7 +448,7 @@ public class EnumEditor2Test extends AbstractGhidraHeadedIntegrationTest {
final DockingActionIf deleteAction = getAction(plugin, "Delete Enum Value");
assertTrue(deleteAction.isEnabled());
- runSwing(() -> deleteAction.actionPerformed(new ActionContext()));
+ runSwing(() -> deleteAction.actionPerformed(new DefaultActionContext()));
waitForSwing();
assertTrue(table.isRowSelected(0));
@@ -456,7 +456,7 @@ public class EnumEditor2Test extends AbstractGhidraHeadedIntegrationTest {
final DockingActionIf applyAction = getAction(plugin, "Apply Enum Changes");
assertTrue(applyAction.isEnabled());
- runSwing(() -> applyAction.actionPerformed(new ActionContext()));
+ runSwing(() -> applyAction.actionPerformed(new DefaultActionContext()));
program.flushEvents();
waitForSwing();
@@ -635,7 +635,7 @@ public class EnumEditor2Test extends AbstractGhidraHeadedIntegrationTest {
table.setRowSelectionInterval(0, 0);
runSwing(() -> {
DockingActionIf action = getAction(plugin, "Delete Enum Value");
- action.actionPerformed(new ActionContext());
+ action.actionPerformed(new DefaultActionContext());
});
applyChanges(true);
assertNull(enumDt.getName(0));
@@ -660,16 +660,16 @@ public class EnumEditor2Test extends AbstractGhidraHeadedIntegrationTest {
int origRowCount = model.getRowCount();
runSwing(() -> {
DockingActionIf action = getAction(plugin, "Add Enum Value");
- action.actionPerformed(new ActionContext());
- action.actionPerformed(new ActionContext());
+ action.actionPerformed(new DefaultActionContext());
+ action.actionPerformed(new DefaultActionContext());
});
waitForSwing();
applyChanges(true);
// make more changes
runSwing(() -> {
DockingActionIf action = getAction(plugin, "Add Enum Value");
- action.actionPerformed(new ActionContext());
- action.actionPerformed(new ActionContext());
+ action.actionPerformed(new DefaultActionContext());
+ action.actionPerformed(new DefaultActionContext());
});
waitForSwing();
undo(false);
@@ -698,8 +698,8 @@ public class EnumEditor2Test extends AbstractGhidraHeadedIntegrationTest {
table.addRowSelectionInterval(lastRow, lastRow);
}
DockingActionIf action = getAction(plugin, "Add Enum Value");
- action.actionPerformed(new ActionContext());
- action.actionPerformed(new ActionContext());
+ action.actionPerformed(new DefaultActionContext());
+ action.actionPerformed(new DefaultActionContext());
});
waitForSwing();
applyChanges(true);
@@ -710,8 +710,8 @@ public class EnumEditor2Test extends AbstractGhidraHeadedIntegrationTest {
table.addRowSelectionInterval(lastRow, lastRow);
}
DockingActionIf action = getAction(plugin, "Add Enum Value");
- action.actionPerformed(new ActionContext());
- action.actionPerformed(new ActionContext());
+ action.actionPerformed(new DefaultActionContext());
+ action.actionPerformed(new DefaultActionContext());
});
waitForSwing();
int rowCount = model.getRowCount();
@@ -784,7 +784,7 @@ public class EnumEditor2Test extends AbstractGhidraHeadedIntegrationTest {
table.addRowSelectionInterval(lastRow, lastRow);
}
DockingActionIf addAction = getAction(plugin, "Add Enum Value");
- addAction.actionPerformed(new ActionContext());
+ addAction.actionPerformed(new DefaultActionContext());
});
waitForSwing();
final int newRow = model.getRowCount() - 1;
@@ -823,7 +823,7 @@ public class EnumEditor2Test extends AbstractGhidraHeadedIntegrationTest {
final DockingActionIf applyAction = getAction(plugin, "Apply Enum Changes");
assertTrue(applyAction.isEnabled());
- Runnable r = () -> applyAction.actionPerformed(new ActionContext());
+ Runnable r = () -> applyAction.actionPerformed(new DefaultActionContext());
if (doWait) {
runSwing(r);
program.flushEvents();
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/disassembler/ClearTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/disassembler/ClearTest.java
index 1144c69403..f271aca530 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/disassembler/ClearTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/disassembler/ClearTest.java
@@ -24,8 +24,7 @@ import javax.swing.*;
import org.junit.*;
-import docking.ActionContext;
-import docking.DialogComponentProvider;
+import docking.*;
import docking.action.DockingActionIf;
import docking.widgets.fieldpanel.*;
import docking.widgets.fieldpanel.field.Field;
@@ -179,7 +178,7 @@ public class ClearTest extends AbstractGhidraHeadedIntegrationTest {
closeProgram();
assertFalse(isEnabled(clearAction, cb.getProvider()));
- assertFalse(clearAction.isEnabledForContext(new ActionContext()));
+ assertFalse(clearAction.isEnabledForContext(new DefaultActionContext()));
showTool(tool);
loadProgram("notepad");
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/disassembler/DisassemblerPluginTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/disassembler/DisassemblerPluginTest.java
index 88976c50b6..7e3c70fef3 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/disassembler/DisassemblerPluginTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/disassembler/DisassemblerPluginTest.java
@@ -20,6 +20,7 @@ import static org.junit.Assert.*;
import org.junit.*;
import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.DockingActionIf;
import docking.widgets.EventTrigger;
import docking.widgets.fieldpanel.FieldPanel;
@@ -453,7 +454,7 @@ public class DisassemblerPluginTest extends AbstractGhidraHeadedIntegrationTest
private ActionContext getContext() {
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) {
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/equate/EquatePlugin1Test.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/equate/EquatePlugin1Test.java
index 537921988e..abf2417591 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/equate/EquatePlugin1Test.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/equate/EquatePlugin1Test.java
@@ -25,8 +25,7 @@ import javax.swing.table.TableModel;
import org.junit.*;
-import docking.ActionContext;
-import docking.ComponentProvider;
+import docking.*;
import docking.action.DockingActionIf;
import docking.action.MenuData;
import docking.widgets.OptionDialog;
@@ -673,7 +672,7 @@ public class EquatePlugin1Test extends AbstractGhidraHeadedIntegrationTest {
env.close(program);
- assertFalse(setAction.isEnabledForContext(new ActionContext()));
+ assertFalse(setAction.isEnabledForContext(new DefaultActionContext()));
}
/*
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/fallthrough/FallThroughActionTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/fallthrough/FallThroughActionTest.java
index dd861b4cfc..68c3acb803 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/fallthrough/FallThroughActionTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/fallthrough/FallThroughActionTest.java
@@ -15,13 +15,14 @@
*/
package ghidra.app.plugin.core.fallthrough;
-import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.*;
import java.util.Set;
import org.junit.*;
import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.DockingActionIf;
import ghidra.app.LocationCallback;
import ghidra.app.SampleLocationGenerator;
@@ -138,7 +139,7 @@ public class FallThroughActionTest extends AbstractGhidraHeadedIntegrationTest
if (actionName.equals(name)) {
ActionContext actionContext = cb.getProvider().getActionContext(null);
if (actionContext == null) {
- actionContext = new ActionContext();
+ actionContext = new DefaultActionContext();
}
boolean validContext = action.isAddToPopup(actionContext);
assertEquals("Enablement: actionName = " + actionName + " [case: " + caseName + "]",
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/function/Function1Test.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/function/Function1Test.java
index b575a6c44f..bba9211827 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/function/Function1Test.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/function/Function1Test.java
@@ -26,6 +26,7 @@ import javax.swing.*;
import org.junit.*;
import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.DockingActionIf;
import docking.widgets.OptionDialog;
import docking.widgets.combobox.GhidraComboBox;
@@ -100,7 +101,7 @@ public class Function1Test extends AbstractGhidraHeadedIntegrationTest {
public void testEnablement() throws Exception {
ActionContext actionContext = cb.getProvider().getActionContext(null);
assertNull(actionContext);
- actionContext = new ActionContext();
+ actionContext = new DefaultActionContext();
assertFalse(createFunction.isEnabledForContext(actionContext));
assertFalse(createThunk.isEnabledForContext(actionContext));
assertFalse(editThunk.isEnabledForContext(actionContext));
@@ -176,7 +177,7 @@ public class Function1Test extends AbstractGhidraHeadedIntegrationTest {
closeProgram();
actionContext = cb.getProvider().getActionContext(null);
assertNull(actionContext);
- actionContext = new ActionContext();
+ actionContext = new DefaultActionContext();
assertFalse(createFunction.isEnabledForContext(actionContext));
assertFalse(deleteFunction.isEnabledForContext(actionContext));
assertFalse(editThunk.isEnabledForContext(actionContext));
@@ -885,8 +886,8 @@ public class Function1Test extends AbstractGhidraHeadedIntegrationTest {
Variable[] vars = function.getLocalVariables(VariableFilter.STACK_VARIABLE_FILTER);
tx(program, () -> {
DataType byteDT = program.getDataTypeManager()
- .addDataType(new ByteDataType(),
- DataTypeConflictHandler.DEFAULT_HANDLER);
+ .addDataType(new ByteDataType(),
+ DataTypeConflictHandler.DEFAULT_HANDLER);
vars[1].setDataType(byteDT, SourceType.ANALYSIS);
});
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/functionwindow/FunctionWindowPluginTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/functionwindow/FunctionWindowPluginTest.java
index b2075a3b41..b525fd0c85 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/functionwindow/FunctionWindowPluginTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/functionwindow/FunctionWindowPluginTest.java
@@ -24,8 +24,7 @@ import javax.swing.table.*;
import org.junit.*;
-import docking.ActionContext;
-import docking.ComponentProvider;
+import docking.*;
import docking.action.DockingActionIf;
import docking.tool.ToolConstants;
import docking.widgets.combobox.GComboBox;
@@ -148,7 +147,7 @@ public class FunctionWindowPluginTest extends AbstractGhidraHeadedIntegrationTes
String signatureText = getRenderedTableCellValue(functionTable, row, column);
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);
//
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/label/LabelActionTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/label/LabelActionTest.java
index 67994aef4c..6302a12cae 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/label/LabelActionTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/label/LabelActionTest.java
@@ -23,8 +23,7 @@ import javax.swing.table.TableModel;
import org.junit.*;
-import docking.ActionContext;
-import docking.DialogComponentProvider;
+import docking.*;
import docking.action.DockingActionIf;
import generic.test.TestUtils;
import ghidra.app.LocationCallback;
@@ -135,7 +134,7 @@ public class LabelActionTest extends AbstractGhidraHeadedIntegrationTest
@Test
public void testNotepadLocations() {
- ActionContext context = new ActionContext();
+ ActionContext context = new DefaultActionContext();
assertFalse(addLabel.isEnabledForContext(context));
assertFalse(editLabel.isEnabledForContext(context));
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/memory/MemoryMapPluginTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/memory/MemoryMapPluginTest.java
index 575dca04b9..fa92ab5d99 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/memory/MemoryMapPluginTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/memory/MemoryMapPluginTest.java
@@ -28,6 +28,7 @@ import javax.swing.table.TableModel;
import org.junit.*;
import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.DockingActionIf;
import ghidra.app.cmd.memory.*;
import ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin;
@@ -139,7 +140,7 @@ public class MemoryMapPluginTest extends AbstractGhidraHeadedIntegrationTest {
private ActionContext getActionContext() {
ActionContext context = provider.getActionContext(null);
if (context == null) {
- return new ActionContext();
+ return new DefaultActionContext();
}
return context;
}
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/navigation/GoToAddressLabelPluginTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/navigation/GoToAddressLabelPluginTest.java
index cf5432725d..d2241555ea 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/navigation/GoToAddressLabelPluginTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/navigation/GoToAddressLabelPluginTest.java
@@ -25,6 +25,7 @@ import javax.swing.JCheckBox;
import org.junit.*;
import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.DockingActionIf;
import docking.widgets.combobox.GhidraComboBox;
import docking.widgets.table.GTable;
@@ -689,7 +690,7 @@ public class GoToAddressLabelPluginTest extends AbstractGhidraHeadedIntegrationT
performOkCallback();
assertEquals(addr("100493b"), cbPlugin.getCurrentAddress());
- clear.actionPerformed(new ActionContext());
+ clear.actionPerformed(new DefaultActionContext());
assertFalse(clear.isEnabledForContext(provider.getActionContext(null)));
assertFalse(next.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)));
assertTrue(prev.isEnabledForContext(provider.getActionContext(null)));
- prev.actionPerformed(new ActionContext());
+ prev.actionPerformed(new DefaultActionContext());
assertEquals(addr("100493b"), cbPlugin.getCurrentAddress());
assertTrue(next.isEnabledForContext(provider.getActionContext(null)));
assertFalse(prev.isEnabledForContext(provider.getActionContext(null)));
- next.actionPerformed(new ActionContext());
+ next.actionPerformed(new DefaultActionContext());
assertEquals(addr("1001000"), cbPlugin.getCurrentAddress());
setText("1001010");
@@ -718,8 +719,8 @@ public class GoToAddressLabelPluginTest extends AbstractGhidraHeadedIntegrationT
assertFalse(next.isEnabledForContext(provider.getActionContext(null)));
assertTrue(prev.isEnabledForContext(provider.getActionContext(null)));
- prev.actionPerformed(new ActionContext());
- prev.actionPerformed(new ActionContext());
+ prev.actionPerformed(new DefaultActionContext());
+ prev.actionPerformed(new DefaultActionContext());
assertEquals(addr("100493b"), cbPlugin.getCurrentAddress());
assertTrue(next.isEnabledForContext(provider.getActionContext(null)));
@@ -1029,7 +1030,7 @@ public class GoToAddressLabelPluginTest extends AbstractGhidraHeadedIntegrationT
private ActionContext getActionContext() {
ActionContext context = runSwing(() -> cbPlugin.getProvider().getActionContext(null));
if (context == null) {
- context = new ActionContext();
+ context = new DefaultActionContext();
}
return context;
}
@@ -1052,7 +1053,7 @@ public class GoToAddressLabelPluginTest extends AbstractGhidraHeadedIntegrationT
TableComponentProvider<?>[] providers = getProviders();
if (providers.length > 0) {
GThreadedTablePanel<?> panel = (GThreadedTablePanel<?>) TestUtils
- .getInstanceField("threadedPanel", providers[0]);
+ .getInstanceField("threadedPanel", providers[0]);
GTable table = panel.getTable();
while (panel.isBusy()) {
Thread.sleep(50);
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/navigation/NextPrevSelectionHighlightTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/navigation/NextPrevSelectionHighlightTest.java
index 0f7bc1caf5..ad6c1a03df 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/navigation/NextPrevSelectionHighlightTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/navigation/NextPrevSelectionHighlightTest.java
@@ -15,12 +15,12 @@
*/
package ghidra.app.plugin.core.navigation;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
import org.junit.*;
import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.DockingActionIf;
import docking.widgets.EventTrigger;
import docking.widgets.fieldpanel.FieldPanel;
@@ -310,7 +310,7 @@ public class NextPrevSelectionHighlightTest extends AbstractGhidraHeadedIntegrat
ActionContext getActionContext() {
ActionContext context = cb.getProvider().getActionContext(null);
if (context == null) {
- context = new ActionContext();
+ context = new DefaultActionContext();
}
return context;
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/navigation/ProviderNavigationPluginTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/navigation/ProviderNavigationPluginTest.java
index 24a2919fee..986f3c13aa 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/navigation/ProviderNavigationPluginTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/navigation/ProviderNavigationPluginTest.java
@@ -129,14 +129,14 @@ public class ProviderNavigationPluginTest extends AbstractProgramBasedTest {
assertTrue(
"'" + ProviderNavigationPlugin.GO_TO_LAST_ACTIVE_COMPONENT_ACTION_NAME + "'" +
" should be enabled when there is a previous provider set",
- previousProviderAction.isEnabledForContext(new ActionContext()));
+ previousProviderAction.isEnabledForContext(new DefaultActionContext()));
}
private void assertPreviousProviderActionNotEnabled() {
assertFalse(
"'" + ProviderNavigationPlugin.GO_TO_LAST_ACTIVE_COMPONENT_ACTION_NAME + "'" +
" should not be enabled when there is no previous provider set",
- previousProviderAction.isEnabledForContext(new ActionContext()));
+ previousProviderAction.isEnabledForContext(new DefaultActionContext()));
}
private ComponentProvider activateProvider(String name) {
@@ -152,7 +152,7 @@ public class ProviderNavigationPluginTest extends AbstractProgramBasedTest {
}
private void forceActivate(ComponentProvider provider) {
- ActionContext context = new ActionContext(provider);
+ ActionContext context = new DefaultActionContext(provider);
for (DockingContextListener l : testContextListeners) {
l.contextChanged(context);
}
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/programtree/ProgramTreePlugin2Test.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/programtree/ProgramTreePlugin2Test.java
index 5fc53c71b1..5ac7ca0490 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/programtree/ProgramTreePlugin2Test.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/programtree/ProgramTreePlugin2Test.java
@@ -24,7 +24,7 @@ import javax.swing.tree.TreePath;
import org.junit.*;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.DockingActionIf;
import generic.theme.GIcon;
import ghidra.program.database.ProgramBuilder;
@@ -721,7 +721,7 @@ public class ProgramTreePlugin2Test extends AbstractProgramTreePluginTest {
setSelectionPaths(new TreePath[] { rsrcNode.getTreePath(), textNode.getTreePath() });
// cut Strings
- runSwing(() -> cutAction.actionPerformed(new ActionContext()));
+ runSwing(() -> cutAction.actionPerformed(new DefaultActionContext()));
// select Strings (has no fragments)
ProgramNode stringsNode = root.getChild("Strings");
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/programtree/ViewManagerPluginTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/programtree/ViewManagerPluginTest.java
index 6293ad9e68..29624a2444 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/programtree/ViewManagerPluginTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/programtree/ViewManagerPluginTest.java
@@ -25,7 +25,7 @@ import javax.swing.*;
import org.junit.*;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.EditWindow;
import docking.action.DockingActionIf;
import ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin;
@@ -124,7 +124,8 @@ public class ViewManagerPluginTest extends AbstractGhidraHeadedIntegrationTest {
public void testCreateDefaultView() throws Exception {
ProgramTreePlugin treePlugin = env.getPlugin(ProgramTreePlugin.class);
final DockingActionIf createTreeAction = getAction(treePlugin, "Create Default Tree View");
- SwingUtilities.invokeAndWait(() -> createTreeAction.actionPerformed(new ActionContext()));
+ SwingUtilities
+ .invokeAndWait(() -> createTreeAction.actionPerformed(new DefaultActionContext()));
program.flushEvents();
ViewProviderService vps = provider.getCurrentViewProvider();
@@ -134,7 +135,8 @@ public class ViewManagerPluginTest extends AbstractGhidraHeadedIntegrationTest {
assertEquals(treeNames.length, tabbedPane.getTabCount());
assertEquals(PluginConstants.DEFAULT_TREE_NAME + "(1)", vps.getViewName());
assertEquals(tabbedPane.getSelectedComponent(), vps.getViewComponent());
- SwingUtilities.invokeAndWait(() -> createTreeAction.actionPerformed(new ActionContext()));
+ SwingUtilities
+ .invokeAndWait(() -> createTreeAction.actionPerformed(new DefaultActionContext()));
program.flushEvents();
vps = provider.getCurrentViewProvider();
treeNames = program.getListing().getTreeNames();
@@ -149,7 +151,8 @@ public class ViewManagerPluginTest extends AbstractGhidraHeadedIntegrationTest {
public void testUndoRedo() throws Exception {
ProgramTreePlugin treePlugin = env.getPlugin(ProgramTreePlugin.class);
final DockingActionIf createTreeAction = getAction(treePlugin, "Create Default Tree View");
- SwingUtilities.invokeAndWait(() -> createTreeAction.actionPerformed(new ActionContext()));
+ SwingUtilities
+ .invokeAndWait(() -> createTreeAction.actionPerformed(new DefaultActionContext()));
program.flushEvents();
env.showTool();
ViewProviderService vps = provider.getCurrentViewProvider();
@@ -159,7 +162,8 @@ public class ViewManagerPluginTest extends AbstractGhidraHeadedIntegrationTest {
assertEquals(treeNames.length, tabbedPane.getTabCount());
assertEquals(PluginConstants.DEFAULT_TREE_NAME + "(1)", vps.getViewName());
assertEquals(tabbedPane.getSelectedComponent(), vps.getViewComponent());
- SwingUtilities.invokeAndWait(() -> createTreeAction.actionPerformed(new ActionContext()));
+ SwingUtilities
+ .invokeAndWait(() -> createTreeAction.actionPerformed(new DefaultActionContext()));
program.flushEvents();
vps = provider.getCurrentViewProvider();
treeNames = program.getListing().getTreeNames();
@@ -232,7 +236,7 @@ public class ViewManagerPluginTest extends AbstractGhidraHeadedIntegrationTest {
public void testCloseView() throws Exception {
// close "Program Tree"
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();
assertEquals(treeNames.length - 1, tabbedPane.getTabCount());
@@ -251,7 +255,8 @@ public class ViewManagerPluginTest extends AbstractGhidraHeadedIntegrationTest {
setCurrentViewProvider("Tree Two");
final DockingActionIf deleteAction = getAction(plugin, "Delete Tree View");
- SwingUtilities.invokeAndWait(() -> deleteAction.actionPerformed(new ActionContext()));
+ SwingUtilities
+ .invokeAndWait(() -> deleteAction.actionPerformed(new DefaultActionContext()));
program.flushEvents();
assertNull(program.getListing().getRootModule("Tree Two"));
String[] treeNames = program.getListing().getTreeNames();
@@ -285,26 +290,31 @@ public class ViewManagerPluginTest extends AbstractGhidraHeadedIntegrationTest {
setCurrentViewProvider("Main Tree");
- SwingUtilities.invokeAndWait(() -> deleteAction.actionPerformed(new ActionContext()));
+ SwingUtilities
+ .invokeAndWait(() -> deleteAction.actionPerformed(new DefaultActionContext()));
program.flushEvents();
setCurrentViewProvider("Tree One");
- SwingUtilities.invokeAndWait(() -> deleteAction.actionPerformed(new ActionContext()));
+ SwingUtilities
+ .invokeAndWait(() -> deleteAction.actionPerformed(new DefaultActionContext()));
program.flushEvents();
setCurrentViewProvider("Tree Two");
- SwingUtilities.invokeAndWait(() -> deleteAction.actionPerformed(new ActionContext()));
+ SwingUtilities
+ .invokeAndWait(() -> deleteAction.actionPerformed(new DefaultActionContext()));
program.flushEvents();
setCurrentViewProvider("Tree Three");
- SwingUtilities.invokeAndWait(() -> deleteAction.actionPerformed(new ActionContext()));
+ SwingUtilities
+ .invokeAndWait(() -> deleteAction.actionPerformed(new DefaultActionContext()));
program.flushEvents();
// attempt to delete the last view
- SwingUtilities.invokeAndWait(() -> deleteAction.actionPerformed(new ActionContext()));
+ SwingUtilities
+ .invokeAndWait(() -> deleteAction.actionPerformed(new DefaultActionContext()));
program.flushEvents();
ViewProviderService vps = provider.getCurrentViewProvider();
@@ -321,18 +331,18 @@ public class ViewManagerPluginTest extends AbstractGhidraHeadedIntegrationTest {
final DockingActionIf closeAction = getAction(plugin, "Close Tree View");
setCurrentViewProvider(PluginConstants.DEFAULT_TREE_NAME);
- SwingUtilities.invokeAndWait(() -> closeAction.actionPerformed(new ActionContext()));
+ SwingUtilities.invokeAndWait(() -> closeAction.actionPerformed(new DefaultActionContext()));
setCurrentViewProvider("Main Tree");
SwingUtilities.invokeAndWait(() -> {
- closeAction.actionPerformed(new ActionContext());
+ closeAction.actionPerformed(new DefaultActionContext());
provider.setCurrentViewProvider("Tree One");
- closeAction.actionPerformed(new ActionContext());
+ closeAction.actionPerformed(new DefaultActionContext());
provider.setCurrentViewProvider("Tree Two");
- closeAction.actionPerformed(new ActionContext());
+ closeAction.actionPerformed(new DefaultActionContext());
provider.setCurrentViewProvider("Tree Three");
DockingActionIf deleteAction = getAction(plugin, "Delete Tree View");
- deleteAction.actionPerformed(new ActionContext());
+ deleteAction.actionPerformed(new DefaultActionContext());
});
// cannot delete the last view
ViewProviderService vps = provider.getCurrentViewProvider();
@@ -355,7 +365,8 @@ public class ViewManagerPluginTest extends AbstractGhidraHeadedIntegrationTest {
waitForPostedSwingRunnables();
setCurrentViewProvider(PluginConstants.DEFAULT_TREE_NAME);
- SwingUtilities.invokeAndWait(() -> renameAction.actionPerformed(new ActionContext()));
+ SwingUtilities
+ .invokeAndWait(() -> renameAction.actionPerformed(new DefaultActionContext()));
EditWindow editWindow = findEditWindow(tool.getToolFrame());
assertNotNull(editWindow);
@@ -397,7 +408,8 @@ public class ViewManagerPluginTest extends AbstractGhidraHeadedIntegrationTest {
waitForPostedSwingRunnables();
setCurrentViewProvider(PluginConstants.DEFAULT_TREE_NAME);
- SwingUtilities.invokeAndWait(() -> renameAction.actionPerformed(new ActionContext()));
+ SwingUtilities
+ .invokeAndWait(() -> renameAction.actionPerformed(new DefaultActionContext()));
EditWindow editWindow = findEditWindow(tool.getToolFrame());
assertNotNull(editWindow);
final JTextField textField = (JTextField) getInstanceField("textField", editWindow);
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/script/AbstractGhidraScriptMgrPluginTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/script/AbstractGhidraScriptMgrPluginTest.java
index 0f6493a7a4..4986c6135e 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/script/AbstractGhidraScriptMgrPluginTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/script/AbstractGhidraScriptMgrPluginTest.java
@@ -36,7 +36,7 @@ import javax.swing.undo.UndoableEdit;
import org.junit.*;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.DockingActionIf;
import docking.widgets.OptionDialog;
import docking.widgets.filter.FilterTextField;
@@ -307,7 +307,7 @@ public abstract class AbstractGhidraScriptMgrPluginTest
DockingActionIf runLastAction = getRunLastScriptAction();
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());
}
@@ -988,10 +988,10 @@ public abstract class AbstractGhidraScriptMgrPluginTest
// destroy any NewScriptxxx files...and Temp ones too
List<ResourceFile> paths = provider.getBundleHost()
- .getBundleFiles()
- .stream()
- .filter(ResourceFile::isDirectory)
- .collect(Collectors.toList());
+ .getBundleFiles()
+ .stream()
+ .filter(ResourceFile::isDirectory)
+ .collect(Collectors.toList());
for (ResourceFile path : paths) {
File file = path.getFile(false);
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/select/SelectBlockPluginTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/select/SelectBlockPluginTest.java
index fa46c380d6..42c940d0ea 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/select/SelectBlockPluginTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/select/SelectBlockPluginTest.java
@@ -25,6 +25,7 @@ import javax.swing.*;
import org.junit.*;
import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.DockingActionIf;
import docking.widgets.textfield.IntegerTextField;
import ghidra.app.plugin.core.blockmodel.BlockModelServicePlugin;
@@ -113,7 +114,7 @@ public class SelectBlockPluginTest extends AbstractGhidraHeadedIntegrationTest {
private ActionContext getContext() {
ActionContext context = browser.getProvider().getActionContext(null);
if (context == null) {
- context = new ActionContext();
+ context = new DefaultActionContext();
}
return context;
}
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symtable/SymbolTablePluginTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symtable/SymbolTablePluginTest.java
index f8c51a17f4..0ea0755af0 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symtable/SymbolTablePluginTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symtable/SymbolTablePluginTest.java
@@ -237,7 +237,7 @@ public class SymbolTablePluginTest extends AbstractGhidraHeadedIntegrationTest {
public void testFilter() throws Exception {
openProgram("sample");
- performAction(setFilterAction, new ActionContext(), false);
+ performAction(setFilterAction, new DefaultActionContext(), false);
waitForSwing();
final FilterDialog filterDialog1 = waitForDialogComponent(FilterDialog.class);
@@ -694,7 +694,7 @@ public class SymbolTablePluginTest extends AbstractGhidraHeadedIntegrationTest {
public void testDefaultFunctionToNamedFunctionWithFilterOn() throws Exception {
openProgram("sample");
- performAction(setFilterAction, new ActionContext(), false);
+ performAction(setFilterAction, new DefaultActionContext(), false);
waitForSwing();
final FilterDialog filterDialog1 = waitForDialogComponent(FilterDialog.class);
diff --git a/Ghidra/Features/BytePatterns/src/main/java/ghidra/bitpatterns/gui/FunctionBitPatternsMainProvider.java b/Ghidra/Features/BytePatterns/src/main/java/ghidra/bitpatterns/gui/FunctionBitPatternsMainProvider.java
index 0d5c13fc48..78787b759e 100644
--- a/Ghidra/Features/BytePatterns/src/main/java/ghidra/bitpatterns/gui/FunctionBitPatternsMainProvider.java
+++ b/Ghidra/Features/BytePatterns/src/main/java/ghidra/bitpatterns/gui/FunctionBitPatternsMainProvider.java
@@ -24,6 +24,7 @@ import javax.swing.*;
import javax.swing.tree.TreePath;
import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.DockingAction;
import docking.action.MenuData;
import docking.tool.ToolConstants;
@@ -488,7 +489,7 @@ public class FunctionBitPatternsMainProvider extends ComponentProviderAdapter
return super.getActionContext(event);
}
- class EvaluateContext extends ActionContext {
+ class EvaluateContext extends DefaultActionContext {
List<PatternInfoRowObject> selectedRows;
public EvaluateContext(List<PatternInfoRowObject> selectedRowObjects) {
@@ -510,7 +511,7 @@ public class FunctionBitPatternsMainProvider extends ComponentProviderAdapter
}
}
- class ByteSequenceContext extends ActionContext {
+ class ByteSequenceContext extends DefaultActionContext {
ByteSequencePanelBuilder builder;
List<ByteSequenceRowObject> selectedRows;
@@ -532,7 +533,7 @@ public class FunctionBitPatternsMainProvider extends ComponentProviderAdapter
}
}
- class InstructionTreeContext extends ActionContext {
+ class InstructionTreeContext extends DefaultActionContext {
private FunctionBitPatternsGTree tree;
private TreePath path;
diff --git a/Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/app/plugin/core/byteviewer/ByteViewerConnectedToolBehaviorTest.java b/Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/app/plugin/core/byteviewer/ByteViewerConnectedToolBehaviorTest.java
index a6f0c734b0..712d5eef95 100644
--- a/Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/app/plugin/core/byteviewer/ByteViewerConnectedToolBehaviorTest.java
+++ b/Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/app/plugin/core/byteviewer/ByteViewerConnectedToolBehaviorTest.java
@@ -24,7 +24,7 @@ import java.util.Date;
import org.junit.*;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.ToggleDockingAction;
import docking.widgets.fieldpanel.support.FieldLocation;
import ghidra.app.plugin.core.format.*;
@@ -153,7 +153,7 @@ public class ByteViewerConnectedToolBehaviorTest extends AbstractGhidraHeadedInt
ByteViewerComponent c = panelOne.getCurrentComponent();
c.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
action.setSelected(true);
- action.actionPerformed(new ActionContext());
+ action.actionPerformed(new DefaultActionContext());
});
assertTrue(action.isSelected());
final ByteViewerComponent c = panelOne.getCurrentComponent();
@@ -183,7 +183,7 @@ public class ByteViewerConnectedToolBehaviorTest extends AbstractGhidraHeadedInt
ByteViewerComponent c = panelOne.getCurrentComponent();
c.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
action.setSelected(true);
- action.actionPerformed(new ActionContext());
+ action.actionPerformed(new DefaultActionContext());
});
assertTrue(action.isSelected());
final ByteViewerComponent c = panelOne.getCurrentComponent();
diff --git a/Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/app/plugin/core/byteviewer/ByteViewerPlugin1Test.java b/Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/app/plugin/core/byteviewer/ByteViewerPlugin1Test.java
index a4e98f2a38..bd52ae8b50 100644
--- a/Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/app/plugin/core/byteviewer/ByteViewerPlugin1Test.java
+++ b/Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/app/plugin/core/byteviewer/ByteViewerPlugin1Test.java
@@ -819,7 +819,7 @@ public class ByteViewerPlugin1Test extends AbstractGhidraHeadedIntegrationTest {
final DockingActionIf action = getAction(plugin, "Byte Viewer Options");
assertTrue(action.isEnabled());
- runSwing(() -> action.actionPerformed(new ActionContext()), false);
+ runSwing(() -> action.actionPerformed(new DefaultActionContext()), false);
waitForSwing();
ByteViewerOptionsDialog d = waitForDialogComponent(ByteViewerOptionsDialog.class);
return d;
diff --git a/Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/app/plugin/core/byteviewer/ByteViewerPlugin2Test.java b/Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/app/plugin/core/byteviewer/ByteViewerPlugin2Test.java
index 9c46425a5e..d62530550e 100644
--- a/Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/app/plugin/core/byteviewer/ByteViewerPlugin2Test.java
+++ b/Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/app/plugin/core/byteviewer/ByteViewerPlugin2Test.java
@@ -28,7 +28,7 @@ import javax.swing.*;
import org.junit.*;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.DockingUtils;
import docking.action.DockingActionIf;
import docking.action.ToggleDockingAction;
@@ -144,7 +144,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
ByteViewerComponent c = panel.getCurrentComponent();
c.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
action.setSelected(true);
- action.actionPerformed(new ActionContext());
+ action.actionPerformed(new DefaultActionContext());
});
assertTrue(action.isSelected());
final ByteViewerComponent c = panel.getCurrentComponent();
@@ -162,7 +162,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
SwingUtilities.invokeAndWait(() -> {
action.setSelected(false);
- action.actionPerformed(new ActionContext());
+ action.actionPerformed(new DefaultActionContext());
});
assertTrue(!action.isSelected());
assertEquals(ByteViewerComponentProvider.CURSOR_ACTIVE_COLOR,
@@ -188,7 +188,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
ByteViewerComponent c = panel.getCurrentComponent();
c.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
action.setSelected(true);
- action.actionPerformed(new ActionContext());
+ action.actionPerformed(new DefaultActionContext());
});
assertTrue(action.isSelected());
final ByteViewerComponent c = panel.getCurrentComponent();
@@ -237,7 +237,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
(ToggleDockingAction) getAction(plugin, "Enable/Disable Byteviewer Editing");
SwingUtilities.invokeAndWait(() -> {
action.setSelected(true);
- action.actionPerformed(new ActionContext());
+ action.actionPerformed(new DefaultActionContext());
});
final ByteViewerComponent c = panel.getCurrentComponent();
@@ -282,7 +282,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
(ToggleDockingAction) getAction(plugin, "Enable/Disable Byteviewer Editing");
SwingUtilities.invokeAndWait(() -> {
action.setSelected(true);
- action.actionPerformed(new ActionContext());
+ action.actionPerformed(new DefaultActionContext());
});
final ByteViewerComponent c = panel.getCurrentComponent();
@@ -325,7 +325,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
ByteViewerComponent c = panel.getCurrentComponent();
c.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
action.setSelected(true);
- action.actionPerformed(new ActionContext());
+ action.actionPerformed(new DefaultActionContext());
});
final ByteViewerComponent c = panel.getCurrentComponent();
byte value = program.getMemory().getByte(addr);
@@ -378,7 +378,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
ByteViewerComponent c = panel.getCurrentComponent();
c.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
action.setSelected(true);
- action.actionPerformed(new ActionContext());
+ action.actionPerformed(new DefaultActionContext());
});
final ByteViewerComponent c = panel.getCurrentComponent();
@@ -472,7 +472,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
currentComponent.setCursorPosition(loc.getIndex(), loc.getFieldNum(), loc.getRow(),
loc.getCol());
action.setSelected(true);
- action.actionPerformed(new ActionContext());
+ action.actionPerformed(new DefaultActionContext());
});
byte value = program.getMemory().getByte(addr);
SwingUtilities.invokeAndWait(() -> {
@@ -527,7 +527,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
ByteViewerComponent currentComponent = panel.getCurrentComponent();
currentComponent.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
action.setSelected(true);
- action.actionPerformed(new ActionContext());
+ action.actionPerformed(new DefaultActionContext());
});
SwingUtilities.invokeAndWait(() -> {
@@ -589,7 +589,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
ByteViewerComponent c = panel.getCurrentComponent();
c.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
action.setSelected(true);
- action.actionPerformed(new ActionContext());
+ action.actionPerformed(new DefaultActionContext());
});
assertTrue(action.isSelected());
final ByteViewerComponent c = panel.getCurrentComponent();
@@ -619,7 +619,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
ByteViewerComponent currentComponent = panel.getCurrentComponent();
currentComponent.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
action.setSelected(true);
- action.actionPerformed(new ActionContext());
+ action.actionPerformed(new DefaultActionContext());
});
waitForPostedSwingRunnables();
assertTrue(action.isSelected());
@@ -638,7 +638,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
SwingUtilities.invokeAndWait(() -> {
action.setSelected(false);
- action.actionPerformed(new ActionContext());
+ action.actionPerformed(new DefaultActionContext());
});
assertTrue(!action.isSelected());
assertEquals(ByteViewerComponentProvider.CURSOR_ACTIVE_COLOR,
@@ -660,7 +660,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
ByteViewerComponent currentComponent = panel.getCurrentComponent();
currentComponent.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
action.setSelected(true);
- action.actionPerformed(new ActionContext());
+ action.actionPerformed(new DefaultActionContext());
});
assertTrue(action.isSelected());
assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR, c.getFocusedCursorColor());
@@ -680,7 +680,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
SwingUtilities.invokeAndWait(() -> {
action.setSelected(false);
- action.actionPerformed(new ActionContext());
+ action.actionPerformed(new DefaultActionContext());
});
assertTrue(!action.isSelected());
assertEquals(ByteViewerComponentProvider.CURSOR_ACTIVE_COLOR,
@@ -702,7 +702,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
ByteViewerComponent currentComponent = panel.getCurrentComponent();
currentComponent.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
action.setSelected(true);
- action.actionPerformed(new ActionContext());
+ action.actionPerformed(new DefaultActionContext());
});
assertTrue(action.isSelected());
assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR, c.getFocusedCursorColor());
@@ -732,7 +732,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
ByteViewerComponent currentComponent = panel.getCurrentComponent();
currentComponent.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
action.setSelected(true);
- action.actionPerformed(new ActionContext());
+ action.actionPerformed(new DefaultActionContext());
});
assertTrue(action.isSelected());
assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR, c.getFocusedCursorColor());
@@ -749,7 +749,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
SwingUtilities.invokeAndWait(() -> {
action.setSelected(false);
- action.actionPerformed(new ActionContext());
+ action.actionPerformed(new DefaultActionContext());
});
assertTrue(!action.isSelected());
assertEquals(ByteViewerComponentProvider.CURSOR_ACTIVE_COLOR,
@@ -765,7 +765,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
(ToggleDockingAction) getAction(plugin, "Enable/Disable Byteviewer Editing");
SwingUtilities.invokeAndWait(() -> {
action.setSelected(true);
- action.actionPerformed(new ActionContext());
+ action.actionPerformed(new DefaultActionContext());
});
// add a memory block
@@ -818,7 +818,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
(ToggleDockingAction) getAction(plugin, "Enable/Disable Byteviewer Editing");
SwingUtilities.invokeAndWait(() -> {
action.setSelected(true);
- action.actionPerformed(new ActionContext());
+ action.actionPerformed(new DefaultActionContext());
});
// first add a memory block
@@ -1176,7 +1176,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
ToggleDockingAction action =
(ToggleDockingAction) getAction(plugin, "Enable/Disable Byteviewer Editing");
action.setSelected(true);
- action.actionPerformed(new ActionContext());
+ action.actionPerformed(new DefaultActionContext());
});
// add the block
@@ -1292,7 +1292,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
ToggleDockingAction action =
(ToggleDockingAction) getAction(plugin, "Enable/Disable Byteviewer Editing");
action.setSelected(true);
- action.actionPerformed(new ActionContext());
+ action.actionPerformed(new DefaultActionContext());
ByteViewerComponent c = panel.getCurrentComponent();
@@ -1529,7 +1529,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
final DockingActionIf action = getAction(plugin, "Byte Viewer Options");
assertTrue(action.isEnabled());
- SwingUtilities.invokeLater(() -> action.actionPerformed(new ActionContext()));
+ SwingUtilities.invokeLater(() -> action.actionPerformed(new DefaultActionContext()));
waitForPostedSwingRunnables();
ByteViewerOptionsDialog d = env.waitForDialogComponent(ByteViewerOptionsDialog.class, 2000);
return d;
diff --git a/Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/app/plugin/core/byteviewer/ByteViewerPluginFormatsTest.java b/Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/app/plugin/core/byteviewer/ByteViewerPluginFormatsTest.java
index 87a27d707f..3f18f337a3 100644
--- a/Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/app/plugin/core/byteviewer/ByteViewerPluginFormatsTest.java
+++ b/Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/app/plugin/core/byteviewer/ByteViewerPluginFormatsTest.java
@@ -27,7 +27,7 @@ import javax.swing.*;
import org.junit.*;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.DockingActionIf;
import docking.action.ToggleDockingAction;
import docking.widgets.fieldpanel.support.FieldLocation;
@@ -274,7 +274,7 @@ public class ByteViewerPluginFormatsTest extends AbstractGhidraHeadedIntegration
ByteViewerComponent currentComponent = panel.getCurrentComponent();
currentComponent.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
action.setSelected(true);
- action.actionPerformed(new ActionContext());
+ action.actionPerformed(new DefaultActionContext());
KeyEvent ev =
new KeyEvent(currentComponent, 0, new Date().getTime(), 0, KeyEvent.VK_1, '1');
currentComponent.keyPressed(ev, loc.getIndex(), loc.getFieldNum(), loc.getRow(),
@@ -417,7 +417,7 @@ public class ByteViewerPluginFormatsTest extends AbstractGhidraHeadedIntegration
ByteViewerComponent currentComponent = panel.getCurrentComponent();
currentComponent.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
action.setSelected(true);
- action.actionPerformed(new ActionContext());
+ action.actionPerformed(new DefaultActionContext());
KeyEvent ev =
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();
currentComponent.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
- action.actionPerformed(new ActionContext());
+ action.actionPerformed(new DefaultActionContext());
KeyEvent ev =
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");
assertTrue(action.isEnabled());
- runSwing(() -> action.actionPerformed(new ActionContext()), false);
+ runSwing(() -> action.actionPerformed(new DefaultActionContext()), false);
waitForSwing();
ByteViewerOptionsDialog d = waitForDialogComponent(ByteViewerOptionsDialog.class);
return d;
diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/DualDecompilerActionContext.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/DualDecompilerActionContext.java
index f4942f81fd..9625aaad93 100644
--- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/DualDecompilerActionContext.java
+++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/DualDecompilerActionContext.java
@@ -17,8 +17,8 @@ package ghidra.app.decompiler.component;
import java.awt.Component;
-import docking.ActionContext;
import docking.ComponentProvider;
+import docking.DefaultActionContext;
import docking.widgets.fieldpanel.internal.FieldPanelCoordinator;
import ghidra.app.context.RestrictedAddressSetContext;
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.
*/
-public class DualDecompilerActionContext extends ActionContext
+public class DualDecompilerActionContext extends DefaultActionContext
implements RestrictedAddressSetContext, CodeComparisonPanelActionContext {
private CodeComparisonPanel<? extends FieldPanelCoordinator> codeComparisonPanel = null;
diff --git a/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/SetFormatDialogComponentProvider.java b/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/SetFormatDialogComponentProvider.java
index 7259e30836..4009cea765 100644
--- a/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/SetFormatDialogComponentProvider.java
+++ b/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/SetFormatDialogComponentProvider.java
@@ -24,8 +24,7 @@ import javax.swing.JPanel;
import org.jdom.Element;
-import docking.ActionContext;
-import docking.DialogComponentProvider;
+import docking.*;
import docking.action.*;
import docking.widgets.OptionDialog;
import ghidra.app.util.viewer.format.*;
@@ -122,7 +121,7 @@ public class SetFormatDialogComponentProvider extends DialogComponentProvider {
FieldHeader headerPanel = listingPanel.getFieldHeader();
if (headerPanel != null && headerPanel.isAncestorOf(event.getComponent())) {
FieldHeaderLocation fhLoc = headerPanel.getFieldHeaderLocation(event.getPoint());
- return new ActionContext().setContextObject(fhLoc);
+ return new DefaultActionContext().setContextObject(fhLoc);
}
return null;
}
diff --git a/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/action/FunctionGraphSatelliteViewerActionContext.java b/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/action/FunctionGraphSatelliteViewerActionContext.java
index fda6d0ab1c..1a27af0b22 100644
--- a/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/action/FunctionGraphSatelliteViewerActionContext.java
+++ b/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/action/FunctionGraphSatelliteViewerActionContext.java
@@ -15,11 +15,11 @@
*/
package ghidra.app.plugin.core.functiongraph.action;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import ghidra.app.plugin.core.functiongraph.FGProvider;
import ghidra.graph.viewer.actions.VisualGraphSatelliteActionContext;
-public class FunctionGraphSatelliteViewerActionContext extends ActionContext
+public class FunctionGraphSatelliteViewerActionContext extends DefaultActionContext
implements VisualGraphSatelliteActionContext {
public FunctionGraphSatelliteViewerActionContext(FGProvider functionGraphProvider) {
diff --git a/Ghidra/Features/FunctionGraph/src/test.slow/java/ghidra/app/plugin/core/functiongraph/AbstractFunctionGraphTest.java b/Ghidra/Features/FunctionGraph/src/test.slow/java/ghidra/app/plugin/core/functiongraph/AbstractFunctionGraphTest.java
index 2ee2f07a4c..422e6744de 100644
--- a/Ghidra/Features/FunctionGraph/src/test.slow/java/ghidra/app/plugin/core/functiongraph/AbstractFunctionGraphTest.java
+++ b/Ghidra/Features/FunctionGraph/src/test.slow/java/ghidra/app/plugin/core/functiongraph/AbstractFunctionGraphTest.java
@@ -172,12 +172,12 @@ public abstract class AbstractFunctionGraphTest extends AbstractGhidraHeadedInte
// 01002239
/*
-
+
A
|->B
C
-
-
+
+
*/
// A
@@ -212,7 +212,7 @@ public abstract class AbstractFunctionGraphTest extends AbstractGhidraHeadedInte
private void build_ghidra(ToyProgramBuilder builder) throws MemoryAccessException {
/*
Originally from notepad 'ghidra'
-
+
A
|-> B
|-> C
@@ -224,7 +224,7 @@ public abstract class AbstractFunctionGraphTest extends AbstractGhidraHeadedInte
|-> G
|
H
-
+
*/
// A -
@@ -311,7 +311,7 @@ public abstract class AbstractFunctionGraphTest extends AbstractGhidraHeadedInte
private void build_sscanf(ToyProgramBuilder builder) throws MemoryAccessException {
/*
Originally from notepad 'sscanf'
-
+
A
|-> B
|
@@ -322,7 +322,7 @@ public abstract class AbstractFunctionGraphTest extends AbstractGhidraHeadedInte
F
|
G
-
+
*/
// A - 9 code units
@@ -455,7 +455,7 @@ public abstract class AbstractFunctionGraphTest extends AbstractGhidraHeadedInte
Object actionManager = getInstanceField("actionManager", graphProvider);
final MultiStateDockingAction<?> action =
(MultiStateDockingAction<?>) getInstanceField("layoutAction", actionManager);
- runSwing(() -> action.actionPerformed(new ActionContext()));
+ runSwing(() -> action.actionPerformed(new DefaultActionContext()));
// wait for the threaded graph layout code
FGController controller = getFunctionGraphController();
@@ -1450,14 +1450,14 @@ public abstract class AbstractFunctionGraphTest extends AbstractGhidraHeadedInte
//
/*
-
+
0) Initial Graph
-
+
1 -> 2 -> 3 -> 4
|
*
5
-
+
*/
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.
-
+
A (v:{1,2} e:{1->2, 2->3}) -> B (v:{3,4} e:{2->3,3->4,3->5})
|
*
5
-
+
*/
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
of the other groups (B).
-
+
A (v:{1,2} e:{1->2, 2->3}) -> Z (
v:{B (v:{3,4} e:{2->3,3->4,3->5}), 5}
e:{2->3, 3->5}
)
-
+
*/
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).
-
+
1 -> 2 -> Z (
v:{B (v:{3,4} e:{2->3,3->4,3->5}), 5}
e:{2->3, 3->5}
)
-
+
*/
ungroup(groupA);
@@ -1529,14 +1529,14 @@ public abstract class AbstractFunctionGraphTest extends AbstractGhidraHeadedInte
verifyEdgeCount(2);
/*
-
+
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})
|
*
5
-
+
*/
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
-
+
1 -> 2 -> 3 -> 4
|
*
5
-
+
*/
ungroup(groupB);
@@ -2297,7 +2297,7 @@ public abstract class AbstractFunctionGraphTest extends AbstractGhidraHeadedInte
DockingActionIf action = getAction(tool, "FunctionGraphPlugin", name);
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
// assertEquals(name + " action is not selected as expected", !expectedVisible,
diff --git a/Ghidra/Features/GraphFunctionCalls/src/main/java/functioncalls/plugin/context/FcgActionContext.java b/Ghidra/Features/GraphFunctionCalls/src/main/java/functioncalls/plugin/context/FcgActionContext.java
index 39a21de8b3..68454830da 100644
--- a/Ghidra/Features/GraphFunctionCalls/src/main/java/functioncalls/plugin/context/FcgActionContext.java
+++ b/Ghidra/Features/GraphFunctionCalls/src/main/java/functioncalls/plugin/context/FcgActionContext.java
@@ -15,14 +15,14 @@
*/
package functioncalls.plugin.context;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import functioncalls.graph.FunctionCallGraph;
import functioncalls.plugin.FcgProvider;
/**
* Context for the {@link FunctionCallGraph}
*/
-public class FcgActionContext extends ActionContext {
+public class FcgActionContext extends DefaultActionContext {
public FcgActionContext(FcgProvider provider) {
this(provider, null);
diff --git a/Ghidra/Features/PDB/src/main/java/pdb/PdbPlugin.java b/Ghidra/Features/PDB/src/main/java/pdb/PdbPlugin.java
index 8024da113e..82aa501532 100644
--- a/Ghidra/Features/PDB/src/main/java/pdb/PdbPlugin.java
+++ b/Ghidra/Features/PDB/src/main/java/pdb/PdbPlugin.java
@@ -75,8 +75,7 @@ public class PdbPlugin extends Plugin {
private void createActions() {
new ActionBuilder("Load PDB File", this.getName())
- .supportsDefaultToolContext(true)
- .withContext(ProgramActionContext.class)
+ .withContext(ProgramActionContext.class, true)
.validContextWhen(pac -> pac.getProgram() != null &&
PdbAnalyzerCommon.canAnalyzeProgram(pac.getProgram()))
.menuPath(ToolConstants.MENU_FILE, "Load PDB File...")
diff --git a/Ghidra/Features/ProgramDiff/src/test.slow/java/ghidra/app/plugin/core/diff/DiffSaveSettingsTest.java b/Ghidra/Features/ProgramDiff/src/test.slow/java/ghidra/app/plugin/core/diff/DiffSaveSettingsTest.java
index 539b9b73a9..2aabab143a 100644
--- a/Ghidra/Features/ProgramDiff/src/test.slow/java/ghidra/app/plugin/core/diff/DiffSaveSettingsTest.java
+++ b/Ghidra/Features/ProgramDiff/src/test.slow/java/ghidra/app/plugin/core/diff/DiffSaveSettingsTest.java
@@ -21,7 +21,7 @@ import java.awt.Window;
import org.junit.*;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.DockingActionIf;
import docking.action.ToggleDockingAction;
import docking.util.image.ToolIconURL;
@@ -47,8 +47,8 @@ public class DiffSaveSettingsTest extends DiffApplyTestAdapter {
private void launchTool() throws Exception {
// Launch our own tool for the Diff so that we can close it and handle "Save Tool?".
runSwing(() -> tool = frontEndTool.getProject()
- .getToolServices()
- .launchTool("MyDiffTestTool",
+ .getToolServices()
+ .launchTool("MyDiffTestTool",
null));
cb = getPlugin(tool, CodeBrowserPlugin.class);
@@ -176,8 +176,7 @@ public class DiffSaveSettingsTest extends DiffApplyTestAdapter {
ProgramManagerPlugin pm = getPlugin(tool, ProgramManagerPlugin.class);
DockingActionIf closeAllProgramAction = getAction(pm, "Close All");
assertNotNull(closeAllProgramAction);
- ActionContext defaultContext = tool.getDefaultToolContext();
- performAction(closeAllProgramAction, defaultContext, true);
+ performAction(closeAllProgramAction, new DefaultActionContext(), true);
openProgram(p3);
diff --git a/Ghidra/Features/ProgramDiff/src/test.slow/java/ghidra/app/plugin/core/diff/DiffTest.java b/Ghidra/Features/ProgramDiff/src/test.slow/java/ghidra/app/plugin/core/diff/DiffTest.java
index f0c01a99c8..d3419822f2 100644
--- a/Ghidra/Features/ProgramDiff/src/test.slow/java/ghidra/app/plugin/core/diff/DiffTest.java
+++ b/Ghidra/Features/ProgramDiff/src/test.slow/java/ghidra/app/plugin/core/diff/DiffTest.java
@@ -28,7 +28,7 @@ import javax.swing.tree.TreePath;
import org.junit.Test;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.DialogComponentProvider;
import docking.action.DockingActionIf;
import docking.widgets.fieldpanel.FieldPanel;
@@ -456,7 +456,7 @@ public class DiffTest extends DiffTestAdapter {
JTree tree = getProgramTree();
selectTreeNodeByText(tree, ".data");
- runSwing(() -> replaceView.actionPerformed(new ActionContext()));
+ runSwing(() -> replaceView.actionPerformed(new DefaultActionContext()));
topOfFile(fp1);
assertEquals(addr("1008000"), cb.getCurrentAddress());
@@ -482,11 +482,11 @@ public class DiffTest extends DiffTestAdapter {
JTree tree = getProgramTree();
selectTreeNodeByText(tree, ".data");
- runSwing(() -> replaceView.actionPerformed(new ActionContext()));
+ runSwing(() -> replaceView.actionPerformed(new DefaultActionContext()));
selectTreeNodeByText(tree, ".rsrc");
- runSwing(() -> goToView.actionPerformed(new ActionContext()));
+ runSwing(() -> goToView.actionPerformed(new DefaultActionContext()));
topOfFile(fp1);
assertEquals(addr("1008000"), cb.getCurrentAddress());
@@ -874,7 +874,7 @@ public class DiffTest extends DiffTestAdapter {
private void clickDiffButton() {
runSwing(() -> {
openClosePgm2.setSelected(!openClosePgm2.isSelected());
- openClosePgm2.actionPerformed(new ActionContext());
+ openClosePgm2.actionPerformed(new DefaultActionContext());
}, false);
waitForSwing();
}
diff --git a/Ghidra/Features/ProgramDiff/src/test.slow/java/ghidra/app/plugin/core/diff/DiffTestAdapter.java b/Ghidra/Features/ProgramDiff/src/test.slow/java/ghidra/app/plugin/core/diff/DiffTestAdapter.java
index 405b2b5ede..ca438768f9 100644
--- a/Ghidra/Features/ProgramDiff/src/test.slow/java/ghidra/app/plugin/core/diff/DiffTestAdapter.java
+++ b/Ghidra/Features/ProgramDiff/src/test.slow/java/ghidra/app/plugin/core/diff/DiffTestAdapter.java
@@ -720,11 +720,11 @@ public class DiffTestAdapter extends AbstractGhidraHeadedIntegrationTest {
}
void launchDiffByAction() {
- setToggleActionSelected(openClosePgm2, new ActionContext(), true, false);
+ setToggleActionSelected(openClosePgm2, new DefaultActionContext(), true, false);
}
void closeDiffByAction() {
- setToggleActionSelected(openClosePgm2, new ActionContext(), false, false);
+ setToggleActionSelected(openClosePgm2, new DefaultActionContext(), false, false);
}
void invokeAndWait(DockingActionIf action) {
diff --git a/Ghidra/Features/ProgramDiff/src/test.slow/java/ghidra/app/plugin/core/diff/DualProgramTest.java b/Ghidra/Features/ProgramDiff/src/test.slow/java/ghidra/app/plugin/core/diff/DualProgramTest.java
index fdbadb2c22..11a8cf5f91 100644
--- a/Ghidra/Features/ProgramDiff/src/test.slow/java/ghidra/app/plugin/core/diff/DualProgramTest.java
+++ b/Ghidra/Features/ProgramDiff/src/test.slow/java/ghidra/app/plugin/core/diff/DualProgramTest.java
@@ -27,7 +27,7 @@ import javax.swing.tree.TreePath;
import org.junit.Test;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.DialogComponentProvider;
import docking.widgets.MultiLineLabel;
import docking.widgets.fieldpanel.LayoutModel;
@@ -305,7 +305,7 @@ public class DualProgramTest extends DiffTestAdapter {
runSwing(() -> {
openClosePgm2.setSelected(true);
- openClosePgm2.actionPerformed(new ActionContext());
+ openClosePgm2.actionPerformed(new DefaultActionContext());
}, false);
waitForSwing();
diff --git a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/functionassociation/VTFunctionAssociationContext.java b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/functionassociation/VTFunctionAssociationContext.java
index 32d67f1f46..a7ea842070 100644
--- a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/functionassociation/VTFunctionAssociationContext.java
+++ b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/functionassociation/VTFunctionAssociationContext.java
@@ -15,12 +15,13 @@
*/
package ghidra.feature.vt.gui.provider.functionassociation;
+import docking.DefaultActionContext;
import ghidra.feature.vt.api.main.VTMatch;
import ghidra.framework.plugintool.PluginTool;
import ghidra.program.model.listing.Function;
-import docking.ActionContext;
-public class VTFunctionAssociationContext extends ActionContext implements FunctionAssociationContext {
+public class VTFunctionAssociationContext extends DefaultActionContext
+ implements FunctionAssociationContext {
private final PluginTool tool;
private final Function selectedSourceFunction;
diff --git a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/markuptable/VTMarkupItemContext.java b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/markuptable/VTMarkupItemContext.java
index 3ab90e28d6..845f37ca99 100644
--- a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/markuptable/VTMarkupItemContext.java
+++ b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/markuptable/VTMarkupItemContext.java
@@ -17,7 +17,7 @@ package ghidra.feature.vt.gui.provider.markuptable;
import java.util.List;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.widgets.fieldpanel.internal.FieldPanelCoordinator;
import ghidra.app.util.viewer.util.CodeComparisonPanel;
import ghidra.app.util.viewer.util.CodeComparisonPanelActionContext;
@@ -26,7 +26,8 @@ import ghidra.feature.vt.api.main.VTMarkupItem;
/**
* Action context for the version tracking markup item provider.
*/
-public class VTMarkupItemContext extends ActionContext implements CodeComparisonPanelActionContext {
+public class VTMarkupItemContext extends DefaultActionContext
+ implements CodeComparisonPanelActionContext {
private final List<VTMarkupItem> selectedItems;
private CodeComparisonPanel<? extends FieldPanelCoordinator> codeComparisonPanel = null;
diff --git a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/matchtable/VTMatchContext.java b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/matchtable/VTMatchContext.java
index fd7308dd17..a37d31ba86 100644
--- a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/matchtable/VTMatchContext.java
+++ b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/matchtable/VTMatchContext.java
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
- * REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,14 +15,13 @@
*/
package ghidra.feature.vt.gui.provider.matchtable;
-import ghidra.feature.vt.api.main.VTMatch;
-import ghidra.feature.vt.api.main.VTSession;
-
import java.util.List;
-import docking.ActionContext;
+import docking.DefaultActionContext;
+import ghidra.feature.vt.api.main.VTMatch;
+import ghidra.feature.vt.api.main.VTSession;
-public class VTMatchContext extends ActionContext {
+public class VTMatchContext extends DefaultActionContext {
private final List<VTMatch> selectedMatches;
private final VTSession session;
diff --git a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/onetomany/VTMatchOneToManyContext.java b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/onetomany/VTMatchOneToManyContext.java
index 53f6d34e6d..250c810554 100644
--- a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/onetomany/VTMatchOneToManyContext.java
+++ b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/provider/onetomany/VTMatchOneToManyContext.java
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
- * REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,13 +15,12 @@
*/
package ghidra.feature.vt.gui.provider.onetomany;
-import ghidra.feature.vt.api.main.VTMatch;
-
import java.util.List;
-import docking.ActionContext;
+import docking.DefaultActionContext;
+import ghidra.feature.vt.api.main.VTMatch;
-public class VTMatchOneToManyContext extends ActionContext {
+public class VTMatchOneToManyContext extends DefaultActionContext {
private final List<VTMatch> selectedItems;
diff --git a/Ghidra/Features/VersionTracking/src/screen/java/help/screenshot/VersionTrackingPluginScreenShots.java b/Ghidra/Features/VersionTracking/src/screen/java/help/screenshot/VersionTrackingPluginScreenShots.java
index 6356776c6f..7e81321fc0 100644
--- a/Ghidra/Features/VersionTracking/src/screen/java/help/screenshot/VersionTrackingPluginScreenShots.java
+++ b/Ghidra/Features/VersionTracking/src/screen/java/help/screenshot/VersionTrackingPluginScreenShots.java
@@ -743,7 +743,7 @@ public class VersionTrackingPluginScreenShots extends GhidraScreenShotGenerator
ToggleDockingAction action =
(ToggleDockingAction) getLocalAction(provider, "Toggle Dual Listing Visibility");
assertNotNull(action);
- setToggleActionSelected(action, new ActionContext(), false);
+ setToggleActionSelected(action, new DefaultActionContext(), false);
waitForSwing();
waitForCondition(() -> !dualListingIsVisible(provider));
}
@@ -778,7 +778,7 @@ public class VersionTrackingPluginScreenShots extends GhidraScreenShotGenerator
ToggleDockingAction action =
(ToggleDockingAction) getLocalAction(provider, "Dual Listing Toggle Orientation");
assertNotNull(action);
- setToggleActionSelected(action, new ActionContext(), vertical);
+ setToggleActionSelected(action, new DefaultActionContext(), vertical);
waitForSwing();
return action;
}
@@ -792,7 +792,7 @@ public class VersionTrackingPluginScreenShots extends GhidraScreenShotGenerator
ToggleDockingAction action =
(ToggleDockingAction) getLocalAction(provider, "Dual Listing Toggle Header");
assertNotNull(action);
- setToggleActionSelected(action, new ActionContext(), showing);
+ setToggleActionSelected(action, new DefaultActionContext(), showing);
waitForSwing();
return action;
}
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/ActionContext.java b/Ghidra/Framework/Docking/src/main/java/docking/ActionContext.java
index de1dfd7224..35846dce37 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/ActionContext.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/ActionContext.java
@@ -21,28 +21,47 @@ import java.awt.event.*;
import docking.action.DockingActionIf;
/**
- * Action context is a class that contains state information that is given to
- * {@link DockingActionIf}s for them to decide if they are enabled for a given user action. User
- * actions are toolbar button presses, menu bar item presses and popup menu item presses. As
- * the user changes focus in the system, all actions are queried with the current context. Thus,
- * <b>toolbar buttons and menu items will enable and disable as the user interacts with the system.
- * Further, popup menu items will not be added to popup menus when they report false for
- * {@link DockingActionIf#isAddToPopup(ActionContext)}; they will appear in the popup, but be
- * disabled if they report <code>true</code> for the above call, but <code>false</code> for
- * {@link DockingActionIf#isEnabledForContext(ActionContext)}.</b>
- * When the user executes an action, the current context will be passed to the backing
- * {@link DockingActionIf}. Ultimately, context serves to control action enablement and to
- * allow plugins to share state with actions without having to store that state information
- * in class fields of the plugin.
+ * ActionContext is an interface used by {@link DockingActionIf}s that contains tool and
+ * plugin state information that allows an action to operate. Actions can use the context to get the
+ * information it needs to perform its intended purpose. Context is also used to determine if
+ * an action should be enabled, should be added to a popup menu, or if it is even valid for the
+ * current context.
*
- * <p>ComponentProviders are required to return Objects of this type in their getActionContext()
- * methods. Generally, ComponentProviders have two ways to use this class. They can either create
- * an ActionContext instance and pass in a contextObject that will be useful to its actions or,
- * subclass the ActionContext object to include specific methods to provide the information that
- * actions will require.
+ * <P>
+ * The concept of an action being valid or invalid is critical to how the action system works. The
+ * reason is that actions can get their context from two different sources. The first
+ * source of action context is the current active (focused) {@link ComponentProvider}. This is
+ * always the preferred source of context for an action. However, if that context is not valid
+ * for an action, the action has the option of specifying that it works on default context. In this
+ * case, the tool will use the action's declared context type to see if anyone has registered a
+ * default provider for that type. If so, the action will be given that context
+ * to work on instead of the active context.
+ *
+ * <P>
+ * Whenever the user moves the focus around by clicking on different components or locations in
+ * the tool, all actions are given the opportunity to change their enablement state. The tool
+ * calls each action's {@link DockingActionIf#isEnabledForContext(ActionContext)} method
+ * with the new active context (or default context as explained above). Thus, toolbar
+ * buttons and menu items will enable and disable as the user interacts with the system.
+ *
+ * <P>
+ * When the user executes an action, the current context will be passed to the
+ * {@link DockingActionIf}, again using a possible default context if the active context isn't valid
+ * for that action. Ultimately, context serves to manage actions and to
+ * allow plugins to share state with actions without them being directly coupled together.
+
+ * <P>
+ * {@link ComponentProvider}s are required to return ActionContext objects in their
+ * {@link ComponentProvider#getActionContext(MouseEvent)} methods. Generally, ComponentProviders
+ * have two ways to use this class. They can either create an {@link DefaultActionContext} instance
+ * and pass in a contextObject that will be useful to its actions or, subclass the ActionContext
+ * object to include specific methods to provide the information that actions will require. If
+ * actions want to work with default context, then they must declare a action context type that is
+ * more specific than just ActionContext.
+ *
+ * <P>
+ * The generic data that all instances of ActionContxt provide is as follows:
*
- * <p>The data contained by this class has meaning that can change relative to the code that
- * created it. The intended purpose for the fields of this class is as follows:
* <ul>
* <li><b>provider</b> - the component provider to which this context belongs; the provider that
* contains the component that is the source of the user action
@@ -68,101 +87,19 @@ import docking.action.DockingActionIf;
* triggered by a key binding.
* </li>
* </ul>
- *
- * <p>Ultimately, clients can pass any values they wish for the fields of this class, even if
- * that changes the meaning of the fields outlined above.
+ * <P>
+ * Typically, component providers will define more specific types of ActionContext where they
+ * can include any additional information that an action might need to work with that component.
*/
+public interface ActionContext {
-public class ActionContext {
- private ComponentProvider provider;
- private MouseEvent mouseEvent;
- private Object contextObject;
- private Object sourceObject;
- private int eventClickModifiers;
- private ActionContext globalContext;
-
- // Note: the setting of this object is delayed. This allows clients to build-up the state
- // of this context. This object will be set when getSourceComponent() is called if it
- // has not already been set.
- private Component sourceComponent;
-
- public ActionContext() {
- this(null, null);
- }
-
- public ActionContext(ComponentProvider cp) {
- this(cp, null);
- }
-
- /**
- * Basic constructor for ActionContext
- * @param provider the ComponentProvider that generated this context.
- * @param sourceComponent an optional source object; this is intended to be the component that
- * is the source of the context, usually the focused component
- */
- public ActionContext(ComponentProvider provider, Component sourceComponent) {
- this(provider, sourceComponent, sourceComponent);
- }
-
- /**
- * Constructor
- *
- * @param provider the ComponentProvider that generated this context.
- * @param contextObject an optional contextObject that the ComponentProvider can provide; this
- * can be anything that actions wish to later retrieve
- * @param sourceComponent an optional source object; this is intended to be the component that
- * is the source of the context, usually the focused component
- */
- public ActionContext(ComponentProvider provider, Object contextObject,
- Component sourceComponent) {
- this.provider = provider;
- this.contextObject = contextObject;
- this.sourceObject = sourceComponent;
- this.sourceComponent = sourceComponent;
- }
-
- private void lazyDeriveSourceComponent() {
-
- if (sourceComponent != null) {
- // Do not allow this to change once set. This prevents the value from getting changed
- // when the user clicks a menu item.
- return;
- }
-
- // check this in order of preference
- if (sourceObject instanceof Component) {
- sourceComponent = (Component) sourceObject;
- return;
- }
-
- if (mouseEvent != null) {
- sourceComponent = mouseEvent.getComponent();
- return;
- }
-
- if (contextObject instanceof Component) {
- sourceComponent = (Component) contextObject;
- }
- }
-
- /**
- * Returns the {@link ComponentProvider} that generated this ActionContext
- * @return the provider
- */
- public ComponentProvider getComponentProvider() {
- return provider;
- }
+ public ComponentProvider getComponentProvider();
/**
* Returns the object that was included by the ComponentProvider when this context was created.
* @return the object that was included by the ComponentProvider when this context was created.
*/
- public Object getContextObject() {
- if (contextObject != null) {
- return contextObject;
- }
- return this;
- }
+ public Object getContextObject();
/**
* Sets the context object for this context. This can be any object of the creator's
@@ -171,18 +108,13 @@ public class ActionContext {
* @param contextObject Sets the context object for this context.
* @return this context
*/
- public ActionContext setContextObject(Object contextObject) {
- this.contextObject = contextObject;
- return this;
- }
+ public ActionContext setContextObject(Object contextObject);
/**
* Returns the sourceObject from the actionEvent that triggered this context to be generated.
* @return the sourceObject from the actionEvent that triggered this context to be generated.
*/
- public Object getSourceObject() {
- return sourceObject;
- }
+ public Object getSourceObject();
/**
* Sets the modifiers for this event that were present when the item was clicked on.
@@ -190,9 +122,7 @@ public class ActionContext {
* @param modifiers bit-masked int, see {@link ActionEvent#getModifiers()} or
* {@link MouseEvent#getModifiersEx()}
*/
- public void setEventClickModifiers(int modifiers) {
- this.eventClickModifiers = modifiers;
- }
+ public void setEventClickModifiers(int modifiers);
/**
* Returns the click modifiers for this event.
@@ -202,9 +132,7 @@ public class ActionContext {
*
* @return bit-masked int, see {@link InputEvent#SHIFT_MASK}, etc
*/
- public int getEventClickModifiers() {
- return eventClickModifiers;
- }
+ public int getEventClickModifiers();
/**
* Tests the click modifiers for this event to see if they contain any bit from the
@@ -213,9 +141,7 @@ public class ActionContext {
* @param modifiersMask bitmask to test
* @return boolean true if any bit in the eventClickModifiers matches the mask
*/
- public boolean hasAnyEventClickModifiers(int modifiersMask) {
- return (eventClickModifiers & modifiersMask) != 0;
- }
+ public boolean hasAnyEventClickModifiers(int modifiersMask);
/**
* Sets the sourceObject for this ActionContext. This method is used internally by the
@@ -225,10 +151,7 @@ public class ActionContext {
* @param sourceObject the source object
* @return this context
*/
- public ActionContext setSourceObject(Object sourceObject) {
- this.sourceObject = sourceObject;
- return this;
- }
+ public ActionContext setSourceObject(Object sourceObject);
/**
* Updates the context's mouse event. Contexts that are based upon key events will have no
@@ -238,13 +161,7 @@ public class ActionContext {
* @param e the event that triggered this context.
* @return this context
*/
- public ActionContext setMouseEvent(MouseEvent e) {
- if (e != null) {
- this.mouseEvent = e;
- this.eventClickModifiers = e.getModifiersEx();
- }
- return this;
- }
+ public ActionContext setMouseEvent(MouseEvent e);
/**
* Returns the context's mouse event. Contexts that are based upon key events will have no
@@ -252,9 +169,7 @@ public class ActionContext {
*
* @return the mouse event that triggered this context; null implies a key event-based context
*/
- public MouseEvent getMouseEvent() {
- return mouseEvent;
- }
+ public MouseEvent getMouseEvent();
/**
* Returns the component that is the target of this context. This value should not change
@@ -262,48 +177,6 @@ public class ActionContext {
*
* @return the component; may be null
*/
- public Component getSourceComponent() {
- lazyDeriveSourceComponent();
- return sourceComponent;
- }
-
- @Override
- public String toString() {
-
- //@formatter:off
- return "{\n" +
- "\tprovider: " + provider + ",\n" +
- "\tcontextObject: " + contextObject + ",\n" +
- "\tsourceObject: " + sourceObject + ",\n" +
- "\tsourceComponent: " + sourceComponent + ",\n" +
- "\tmouseEvent: " + mouseEvent + "\n" +
- "}";
- //@formatter:on
- }
-
- /**
- * Returns the global action context for the tool. The global context is the context of
- * the default focused component, instead of the normal action context which is the current
- * focused component.
- * @return the global action context for the tool
- */
- public ActionContext getGlobalContext() {
- if (globalContext == null) {
- Tool tool = getTool();
- globalContext = tool == null ? new ActionContext() : tool.getDefaultToolContext();
- }
- return globalContext;
- }
-
- private Tool getTool() {
- if (provider != null) {
- return provider.getTool();
- }
- DockingWindowManager manager = DockingWindowManager.getActiveInstance();
- if (manager != null) {
- return manager.getTool();
- }
- return null;
- }
+ public Component getSourceComponent();
}
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/ComponentPlaceholder.java b/Ghidra/Framework/Docking/src/main/java/docking/ComponentPlaceholder.java
index 9d4fcafc7d..2571fd477d 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/ComponentPlaceholder.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/ComponentPlaceholder.java
@@ -531,7 +531,7 @@ public class ComponentPlaceholder {
ActionContext actionContext = componentProvider.getActionContext(null);
if (actionContext == null) {
- actionContext = new ActionContext(componentProvider, null);
+ actionContext = new DefaultActionContext(componentProvider, null);
}
for (DockingActionIf action : actions) {
action.setEnabled(
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/ComponentProvider.java b/Ghidra/Framework/Docking/src/main/java/docking/ComponentProvider.java
index 8573768bc2..90a79de858 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/ComponentProvider.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/ComponentProvider.java
@@ -442,7 +442,7 @@ public abstract class ComponentProvider implements HelpDescriptor, ActionContext
* @return the new context
*/
protected ActionContext createContext() {
- return new ActionContext(this);
+ return new DefaultActionContext(this);
}
/**
@@ -453,7 +453,7 @@ public abstract class ComponentProvider implements HelpDescriptor, ActionContext
* @return the new context
*/
protected ActionContext createContext(Object contextObject) {
- return new ActionContext(this).setContextObject(contextObject);
+ return new DefaultActionContext(this).setContextObject(contextObject);
}
/**
@@ -465,7 +465,7 @@ public abstract class ComponentProvider implements HelpDescriptor, ActionContext
* @return the new context
*/
protected ActionContext createContext(Component sourceComponent, Object contextObject) {
- return new ActionContext(this, sourceComponent).setContextObject(contextObject);
+ return new DefaultActionContext(this, sourceComponent).setContextObject(contextObject);
}
/**
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/DefaultActionContext.java b/Ghidra/Framework/Docking/src/main/java/docking/DefaultActionContext.java
new file mode 100644
index 0000000000..2e45bb4052
--- /dev/null
+++ b/Ghidra/Framework/Docking/src/main/java/docking/DefaultActionContext.java
@@ -0,0 +1,180 @@
+/* ###
+ * IP: GHIDRA
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package docking;
+
+import java.awt.Component;
+import java.awt.event.MouseEvent;
+
+/**
+ * The default implementation of ActionContext
+ */
+public class DefaultActionContext implements ActionContext {
+ private ComponentProvider provider;
+ private MouseEvent mouseEvent;
+ private Object contextObject;
+ private Object sourceObject;
+ private int eventClickModifiers;
+
+ // Note: the setting of this object is delayed. This allows clients to build-up the state
+ // of this context. This object will be set when getSourceComponent() is called if it
+ // has not already been set.
+ private Component sourceComponent;
+
+ /**
+ * Default constructor with no provider, context object, or source component
+ */
+ public DefaultActionContext() {
+ this(null, null);
+ }
+
+ /**
+ * Constructor with no source component and no context object
+ * @param provider the ComponentProvider that generated this context.
+ */
+ public DefaultActionContext(ComponentProvider provider) {
+ this(provider, null);
+ }
+
+ /**
+ * Constructor for ActionContext with context object and sourceComponent being the same
+ * @param provider the ComponentProvider that generated this context.
+ * @param sourceComponent an optional source object; this is intended to be the component that
+ * is the source of the context, usually the focused component
+ */
+ public DefaultActionContext(ComponentProvider provider, Component sourceComponent) {
+ this(provider, sourceComponent, sourceComponent);
+ }
+
+ /**
+ * Constructor
+ *
+ * @param provider the ComponentProvider that generated this context.
+ * @param contextObject an optional contextObject that the ComponentProvider can provide; this
+ * can be anything that actions wish to later retrieve
+ * @param sourceComponent an optional source object; this is intended to be the component that
+ * is the source of the context, usually the focused component
+ */
+ public DefaultActionContext(ComponentProvider provider, Object contextObject,
+ Component sourceComponent) {
+ this.provider = provider;
+ this.contextObject = contextObject;
+ this.sourceObject = sourceComponent;
+ this.sourceComponent = sourceComponent;
+ }
+
+ private void lazyDeriveSourceComponent() {
+
+ if (sourceComponent != null) {
+ // Do not allow this to change once set. This prevents the value from getting changed
+ // when the user clicks a menu item.
+ return;
+ }
+
+ // check this in order of preference
+ if (sourceObject instanceof Component) {
+ sourceComponent = (Component) sourceObject;
+ return;
+ }
+
+ if (mouseEvent != null) {
+ sourceComponent = mouseEvent.getComponent();
+ return;
+ }
+
+ if (contextObject instanceof Component) {
+ sourceComponent = (Component) contextObject;
+ }
+ }
+
+ @Override
+ public ComponentProvider getComponentProvider() {
+ return provider;
+ }
+
+ @Override
+ public Object getContextObject() {
+ if (contextObject != null) {
+ return contextObject;
+ }
+ return this;
+ }
+
+ @Override
+ public DefaultActionContext setContextObject(Object contextObject) {
+ this.contextObject = contextObject;
+ return this;
+ }
+
+ @Override
+ public Object getSourceObject() {
+ return sourceObject;
+ }
+
+ @Override
+ public void setEventClickModifiers(int modifiers) {
+ this.eventClickModifiers = modifiers;
+ }
+
+ @Override
+ public int getEventClickModifiers() {
+ return eventClickModifiers;
+ }
+
+ @Override
+ public boolean hasAnyEventClickModifiers(int modifiersMask) {
+ return (eventClickModifiers & modifiersMask) != 0;
+ }
+
+ @Override
+ public DefaultActionContext setSourceObject(Object sourceObject) {
+ this.sourceObject = sourceObject;
+ return this;
+ }
+
+ @Override
+ public DefaultActionContext setMouseEvent(MouseEvent e) {
+ if (e != null) {
+ this.mouseEvent = e;
+ this.eventClickModifiers = e.getModifiersEx();
+ }
+ return this;
+ }
+
+ @Override
+ public MouseEvent getMouseEvent() {
+ return mouseEvent;
+ }
+
+ @Override
+ public Component getSourceComponent() {
+ lazyDeriveSourceComponent();
+ return sourceComponent;
+ }
+
+ @Override
+ public String toString() {
+
+ //@formatter:off
+ return "{\n" +
+ "\tprovider: " + provider + ",\n" +
+ "\tcontextObject: " + contextObject + ",\n" +
+ "\tsourceObject: " + sourceObject + ",\n" +
+ "\tsourceComponent: " + sourceComponent + ",\n" +
+ "\tmouseEvent: " + mouseEvent + "\n" +
+ "}";
+ //@formatter:on
+ }
+}
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/DialogComponentProvider.java b/Ghidra/Framework/Docking/src/main/java/docking/DialogComponentProvider.java
index b8b2c8a10a..23a0c11edd 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/DialogComponentProvider.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/DialogComponentProvider.java
@@ -642,7 +642,7 @@ public class DialogComponentProvider
private void doSetStatusText(String text, MessageType type, boolean alert) {
SystemUtilities
- .assertThisIsTheSwingThread("Setting text must be performed on the Swing thread");
+ .assertThisIsTheSwingThread("Setting text must be performed on the Swing thread");
statusLabel.setText(text);
statusLabel.setForeground(getStatusColor(type));
@@ -677,7 +677,7 @@ public class DialogComponentProvider
// must be on Swing; this allows us to synchronize the 'alerting' flag
SystemUtilities
- .assertThisIsTheSwingThread("Alerting must be performed on the Swing thread");
+ .assertThisIsTheSwingThread("Alerting must be performed on the Swing thread");
if (isAlerting) {
return;
@@ -1177,14 +1177,14 @@ public class DialogComponentProvider
}
if (event == null) {
- return new ActionContext(null, c);
+ return new DefaultActionContext(null, c);
}
Component sourceComponent = event.getComponent();
if (sourceComponent != null) {
c = sourceComponent;
}
- return new ActionContext(null, c).setSourceObject(event.getSource());
+ return new DefaultActionContext(null, c).setSourceObject(event.getSource());
}
/**
@@ -1194,7 +1194,7 @@ public class DialogComponentProvider
protected void notifyContextChanged() {
ActionContext context = getActionContext(null);
if (context == null) {
- context = new ActionContext();
+ context = new DefaultActionContext();
}
Set<DockingActionIf> keySet = actionMap.keySet();
for (DockingActionIf action : keySet) {
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/DialogComponentProviderPopupActionManager.java b/Ghidra/Framework/Docking/src/main/java/docking/DialogComponentProviderPopupActionManager.java
index 71a9d00cba..abd9df19ec 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/DialogComponentProviderPopupActionManager.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/DialogComponentProviderPopupActionManager.java
@@ -55,7 +55,7 @@ public class DialogComponentProviderPopupActionManager {
}
if (actionContext == null) {
- actionContext = new ActionContext();
+ actionContext = new DefaultActionContext();
}
// If the source is null, must set it or we won't have
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/DockingActionProxy.java b/Ghidra/Framework/Docking/src/main/java/docking/DockingActionProxy.java
index 1520439230..8b2fd3e9dd 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/DockingActionProxy.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/DockingActionProxy.java
@@ -229,12 +229,18 @@ public class DockingActionProxy
}
@Override
- public void setSupportsDefaultToolContext(boolean newValue) {
- dockingAction.setSupportsDefaultToolContext(newValue);
+ public Class<? extends ActionContext> getContextClass() {
+ return dockingAction.getContextClass();
}
@Override
- public boolean supportsDefaultToolContext() {
- return dockingAction.supportsDefaultToolContext();
+ public boolean supportsDefaultContext() {
+ return dockingAction.supportsDefaultContext();
+ }
+
+ @Override
+ public void setContextClass(Class<? extends ActionContext> type,
+ boolean supportsDefaultContext) {
+ dockingAction.setContextClass(type, supportsDefaultContext);
}
}
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/DockingKeyBindingAction.java b/Ghidra/Framework/Docking/src/main/java/docking/DockingKeyBindingAction.java
index 22218ba3b7..f4b7f6c691 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/DockingKeyBindingAction.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/DockingKeyBindingAction.java
@@ -68,7 +68,7 @@ public abstract class DockingKeyBindingAction extends AbstractAction {
protected ActionContext getLocalContext(ComponentProvider localProvider) {
if (localProvider == null) {
- return new ActionContext();
+ return new DefaultActionContext();
}
ActionContext actionContext = localProvider.getActionContext(null);
@@ -76,6 +76,6 @@ public abstract class DockingKeyBindingAction extends AbstractAction {
return actionContext;
}
- return new ActionContext(localProvider, null);
+ return new DefaultActionContext(localProvider, null);
}
}
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/DockingWindowManager.java b/Ghidra/Framework/Docking/src/main/java/docking/DockingWindowManager.java
index ca5091f4bf..f21b529cd0 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/DockingWindowManager.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/DockingWindowManager.java
@@ -29,6 +29,7 @@ import javax.swing.*;
import org.apache.commons.collections4.map.LazyMap;
import org.jdom.Element;
+import docking.action.ActionContextProvider;
import docking.action.DockingActionIf;
import docking.actions.*;
import docking.widgets.PasswordDialog;
@@ -108,6 +109,9 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder
private Window lastActiveWindow;
+ private Map<Class<? extends ActionContext>, ActionContextProvider> defaultContextProviderMap =
+ new HashMap<>();
+
/**
* Constructs a new DockingWindowManager
*
@@ -351,6 +355,34 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder
defaultProvider = provider;
}
+ /**
+ * Registers an action context provider as the default provider for a specific action
+ * context type. Note that this registers a default provider for exactly
+ * that type and not a subclass of that type. If the provider want to support a hierarchy of
+ * types, then it must register separately for each type. See {@link ActionContext} for details
+ * on how the action context system works.
+ * @param type the ActionContext class to register a default provider for
+ * @param provider the ActionContextProvider that provides default tool context for actions
+ * that consume the given ActionContext type
+ */
+ public void registerDefaultContextProvider(Class<? extends ActionContext> type,
+ ActionContextProvider provider) {
+ defaultContextProviderMap.put(type, provider);
+ }
+
+ /**
+ * Removes the default provider for the given ActionContext type.
+ * @param type the subclass of ActionContext to remove a provider for
+ * @param provider the ActionContextProvider to remove for the given ActionContext type
+ */
+ public void unregisterDefaultContextProvider(Class<? extends ActionContext> type,
+ ActionContextProvider provider) {
+ ActionContextProvider currentProvider = defaultContextProviderMap.get(type);
+ if (Objects.equals(provider, currentProvider)) {
+ defaultContextProviderMap.remove(type);
+ }
+ }
+
/**
* Get the window that contains the specified Provider's component
*
@@ -1215,7 +1247,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder
ComponentProvider provider = placeholder.getProvider();
boolean isTransient = provider.isTransient();
actionList
- .add(new ShowComponentAction(this, placeholder, subMenuName, isTransient));
+ .add(new ShowComponentAction(this, placeholder, subMenuName, isTransient));
}
if (subMenuName != null) {
@@ -2346,44 +2378,66 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder
}
/**
- * Returns the default action context for the tool
- *
- * @return the default action context for the tool
+ * Returns the default {@link ActionContext} for the given context type
+ * @param contextType the class of the ActionContext to get a default value for
+ * @return the default {@link ActionContext} for the given context type
+ */
+ public ActionContext getDefaultActionContext(Class<? extends ActionContext> contextType) {
+ ActionContextProvider actionContextProvider = defaultContextProviderMap.get(contextType);
+ if (actionContextProvider != null) {
+ return actionContextProvider.getActionContext(null);
+ }
+ return null;
+ }
+
+ /**
+ * Returns a map containing a default {@link ActionContext} for each registered type.
+ * @return a map containing a default {@link ActionContext} for each registered type
*/
- public ActionContext getDefaultToolContext() {
- return defaultProvider == null ? new ActionContext()
- : defaultProvider.getActionContext(null);
+ public Map<Class<? extends ActionContext>, ActionContext> getDefaultActionContextMap() {
+ Map<Class<? extends ActionContext>, ActionContext> contextMap = new HashMap<>();
+ Set<Entry<Class<? extends ActionContext>, ActionContextProvider>> entrySet =
+ defaultContextProviderMap.entrySet();
+
+ for (Entry<Class<? extends ActionContext>, ActionContextProvider> entry : entrySet) {
+ contextMap.put(entry.getKey(), entry.getValue().getActionContext(null));
+ }
+ return contextMap;
}
/**
- * Gets the {@link ActionContext} appropriate for the given action. This will normally be the
+ * Creates the {@link ActionContext} appropriate for the given action. This will normally be the
* context from the currently focused {@link ComponentProvider}. If that context is not valid
* for the given action and the action supports using the default tool context, then the default
- * tool context will be returned. Otherwise, returns null.
+ * tool context will be returned. Otherwise, returns a generic ActionContext.
*
* @param action the action for which to get an {@link ActionContext}
* @return the {@link ActionContext} appropriate for the given action or null
*/
- public ActionContext getActionContext(DockingActionIf action) {
+ public ActionContext createActionContext(DockingActionIf action) {
ComponentProvider provider = getActiveComponentProvider();
ActionContext context = provider == null ? null : provider.getActionContext(null);
-
- if (context == null) {
- context = new ActionContext(provider, null);
- }
-
- if (action.isValidContext(context)) {
+ if (context != null && action.isValidContext(context)) {
return context;
}
- if (action.supportsDefaultToolContext()) {
- ActionContext toolContext = getDefaultToolContext();
- if (action.isValidContext(toolContext)) {
- return toolContext;
+ // Some actions work on a non-active, default component provider. See if this action
+ // supports that.
+ if (action.supportsDefaultContext()) {
+ context = getDefaultContext(action.getContextClass());
+ if (context != null) {
+ return context;
}
}
- return context;
+ return new DefaultActionContext(provider, null);
+ }
+ private ActionContext getDefaultContext(Class<? extends ActionContext> contextType) {
+ ActionContextProvider contextProvider = defaultContextProviderMap.get(contextType);
+ if (contextProvider != null) {
+ return contextProvider.getActionContext(null);
+ }
+ return null;
}
/**
@@ -2473,4 +2527,5 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder
lastCalledTimestamp = 0;
}
}
+
}
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/GlobalMenuAndToolBarManager.java b/Ghidra/Framework/Docking/src/main/java/docking/GlobalMenuAndToolBarManager.java
index 60b793c70f..475bb98ee7 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/GlobalMenuAndToolBarManager.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/GlobalMenuAndToolBarManager.java
@@ -175,7 +175,9 @@ public class GlobalMenuAndToolBarManager implements DockingWindowListener {
WindowNode focusedWindowNode = getFocusedWindowNode();
Set<DockingActionIf> focusedWindowActions = getWindowActions(focusedWindowNode);
- ActionContext globalContext = windowManager.getDefaultToolContext();
+ Map<Class<? extends ActionContext>, ActionContext> defaultContextMap =
+ windowManager.getDefaultActionContextMap();
+
for (WindowNode windowNode : windowToActionManagerMap.keySet()) {
if (windowNode == focusedWindowNode) {
continue; // the focused window will be called after this loop later
@@ -183,14 +185,14 @@ public class GlobalMenuAndToolBarManager implements DockingWindowListener {
WindowActionManager actionManager = windowToActionManagerMap.get(windowNode);
ActionContext localContext = getContext(windowNode);
- actionManager.contextChanged(globalContext, localContext, focusedWindowActions);
+ actionManager.contextChanged(defaultContextMap, localContext, focusedWindowActions);
}
// now update the focused window's actions
WindowActionManager actionManager = windowToActionManagerMap.get(focusedWindowNode);
ActionContext focusedContext = getContext(focusedWindowNode);
if (actionManager != null) {
- actionManager.contextChanged(globalContext, focusedContext, Collections.emptySet());
+ actionManager.contextChanged(defaultContextMap, focusedContext, Collections.emptySet());
}
// update the docking window manager ; no focused context when no window is focused
@@ -213,7 +215,7 @@ public class GlobalMenuAndToolBarManager implements DockingWindowListener {
}
}
if (context == null) {
- context = new ActionContext();
+ context = new DefaultActionContext();
}
return context;
}
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/MenuBarMenuHandler.java b/Ghidra/Framework/Docking/src/main/java/docking/MenuBarMenuHandler.java
index 773fe36563..5593bcd9d9 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/MenuBarMenuHandler.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/MenuBarMenuHandler.java
@@ -17,11 +17,10 @@ package docking;
import java.awt.event.ActionEvent;
-import javax.swing.SwingUtilities;
-
import docking.action.DockingActionIf;
import docking.action.ToggleDockingActionIf;
import docking.menu.MenuHandler;
+import ghidra.util.Swing;
public class MenuBarMenuHandler extends MenuHandler {
@@ -46,15 +45,12 @@ public class MenuBarMenuHandler extends MenuHandler {
DockingWindowManager.clearMouseOverHelp();
- ActionContext context = windowManager.getActionContext(action);
- if (context == null) {
- return; // nothing to do
- }
+ ActionContext context = windowManager.createActionContext(action);
context.setSourceObject(event.getSource());
// this gives the UI some time to repaint before executing the action
- SwingUtilities.invokeLater(() -> {
+ Swing.runLater(() -> {
windowManager.setStatusText("");
if (action.isValidContext(context) && action.isEnabledForContext(context)) {
if (action instanceof ToggleDockingActionIf) {
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/PopupActionManager.java b/Ghidra/Framework/Docking/src/main/java/docking/PopupActionManager.java
index 5a712f2b76..28baee2725 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/PopupActionManager.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/PopupActionManager.java
@@ -74,7 +74,7 @@ public class PopupActionManager implements PropertyChangeListener {
ComponentProvider popupProvider = placeholder.getProvider();
ActionContext actionContext = popupProvider.getActionContext(event);
if (actionContext == null) {
- actionContext = new ActionContext();
+ actionContext = new DefaultActionContext();
}
actionContext.setSourceObject(popupContext.getSource());
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/Tool.java b/Ghidra/Framework/Docking/src/main/java/docking/Tool.java
index 92850732af..a10cbbea56 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/Tool.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/Tool.java
@@ -341,12 +341,4 @@ public interface Tool extends ServiceProvider {
*/
public void close();
- /**
- * Returns the default {@link ActionContext} for the tool. The default context is the context
- * the default ComponentProvider for the tool.
- *
- * @return the default {@link ActionContext} for the tool
- */
- public ActionContext getDefaultToolContext();
-
}
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/WindowActionManager.java b/Ghidra/Framework/Docking/src/main/java/docking/WindowActionManager.java
index d518fbea97..794d4cdd1a 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/WindowActionManager.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/WindowActionManager.java
@@ -88,8 +88,8 @@ public class WindowActionManager {
toolBarMgr.dispose();
}
- void contextChanged(ActionContext globalContext, ActionContext localContext,
- Set<DockingActionIf> excluded) {
+ void contextChanged(Map<Class<? extends ActionContext>, ActionContext> defaultContextMap,
+ ActionContext localContext, Set<DockingActionIf> excluded) {
if (!node.isVisible() || disposed) {
return;
@@ -104,11 +104,11 @@ public class WindowActionManager {
}
DockingActionIf proxyAction = actionToProxyMap.get(action);
- if (proxyAction.isValidContext(localContext)) {
- proxyAction.setEnabled(proxyAction.isEnabledForContext(localContext));
- }
- else if (isValidDefaultToolContext(proxyAction, globalContext)) {
- proxyAction.setEnabled(proxyAction.isEnabledForContext(globalContext));
+ ActionContext context =
+ getContextForAction(action, localContext, defaultContextMap);
+
+ if (context != null) {
+ proxyAction.setEnabled(proxyAction.isEnabledForContext(context));
}
else {
proxyAction.setEnabled(false);
@@ -116,9 +116,19 @@ public class WindowActionManager {
}
}
- private boolean isValidDefaultToolContext(DockingActionIf action, ActionContext toolContext) {
- return action.supportsDefaultToolContext() &&
- action.isValidContext(toolContext);
+ private ActionContext getContextForAction(DockingActionIf action, ActionContext localContext,
+ Map<Class<? extends ActionContext>, ActionContext> defaultContextMap) {
+
+ if (action.isValidContext(localContext)) {
+ return localContext;
+ }
+ if (action.supportsDefaultContext()) {
+ ActionContext context = defaultContextMap.get(action.getContextClass());
+ if (context != null && action.isValidContext(context)) {
+ return context;
+ }
+ }
+ return null;
}
/**
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/action/DockingAction.java b/Ghidra/Framework/Docking/src/main/java/docking/action/DockingAction.java
index 48b42a2346..ec2b6744a1 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/action/DockingAction.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/action/DockingAction.java
@@ -15,13 +15,12 @@
*/
package docking.action;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import java.util.Objects;
import java.util.Set;
import java.util.function.Predicate;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
import javax.swing.*;
import docking.*;
@@ -85,8 +84,10 @@ public abstract class DockingAction implements DockingActionIf {
private Predicate<ActionContext> validContextPredicate;
private boolean shouldAddToAllWindows = false;
private Class<? extends ActionContext> addToWindowWhenContextClass = null;
+ private Class<? extends ActionContext> contextClass = ActionContext.class;
- private boolean supportsDefaultToolContext;
+ // by default, actions only work on the active provider
+ private boolean supportsDefaultContext = false;
public DockingAction(String name, String owner) {
this.name = name;
@@ -269,16 +270,6 @@ public abstract class DockingAction implements DockingActionIf {
firePropertyChanged(ENABLEMENT_PROPERTY, !isEnabled, isEnabled);
}
- @Override
- public void setSupportsDefaultToolContext(boolean newValue) {
- supportsDefaultToolContext = newValue;
- }
-
- @Override
- public boolean supportsDefaultToolContext() {
- return supportsDefaultToolContext;
- }
-
@Override
public final JButton createButton() {
JButton button = doCreateButton();
@@ -393,6 +384,23 @@ public abstract class DockingAction implements DockingActionIf {
firePropertyChanged(KEYBINDING_DATA_PROPERTY, oldData, keyBindingData);
}
+ @Override
+ public Class<? extends ActionContext> getContextClass() {
+ return contextClass;
+ }
+
+ @Override
+ public boolean supportsDefaultContext() {
+ return supportsDefaultContext;
+ }
+
+ @Override
+ public void setContextClass(Class<? extends ActionContext> type,
+ boolean supportsDefaultContext) {
+ this.contextClass = type;
+ this.supportsDefaultContext = supportsDefaultContext;
+ validContextPredicate = ac -> contextClass.isInstance(ac);
+ }
//==================================================================================================
// Non interface methods
//==================================================================================================
@@ -656,13 +664,13 @@ public abstract class DockingAction implements DockingActionIf {
* If this is set, the the action will only be added to windows that have providers
* that can produce an ActionContext that is appropriate for this action.
* <P>
- * @param contextClass the ActionContext class required to be producible by a
+ * @param addToWindowContextClass the ActionContext class required to be producible by a
* provider that is hosted in that window before this action is added to that
* window.
*
*/
- public void addToWindowWhen(Class<? extends ActionContext> contextClass) {
- addToWindowWhenContextClass = contextClass;
+ public void addToWindowWhen(Class<? extends ActionContext> addToWindowContextClass) {
+ addToWindowWhenContextClass = addToWindowContextClass;
}
/**
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/action/DockingActionIf.java b/Ghidra/Framework/Docking/src/main/java/docking/action/DockingActionIf.java
index a48af04284..43aec2f4a9 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/action/DockingActionIf.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/action/DockingActionIf.java
@@ -22,20 +22,21 @@ import java.util.Set;
import javax.swing.*;
import docking.ActionContext;
+import docking.DockingWindowManager;
import help.HelpDescriptor;
/**
* The base interface for clients that wish to create commands to be registered with a tool.
- *
- * <p>An action may appear in a primary menu, a popup menu or a toolbar. Further, an action
+ * <P>
+ * An action may appear in a primary menu, a popup menu or a toolbar. Further, an action
* may have a key binding assigned.
- *
- * <p>The particular support for key bindings is defined by {@link KeyBindingType}. Almost all
+ * <P>
+ * The particular support for key bindings is defined by {@link KeyBindingType}. Almost all
* client actions will use the default setting of {@link KeyBindingType#INDIVIDUAL}. To control
* the level of key binding support, you can pass the desired {@link KeyBindingType} to the
* base implementation of this interface.
- *
- * <p>ActionContext is a key concept for tool actions so that they can be context sensitive if
+ * <P>
+ * {@link ActionContext} is a key concept for tool actions so that they can be context sensitive if
* appropriate. The context provides a
* consistent way for plugins and components to share tool state with actions. Actions can then
* use that context to make decisions, such as if they should be enabled or added to a popup menu.
@@ -43,16 +44,21 @@ import help.HelpDescriptor;
* action context from a table element may provide the row in a table component that is selected and
* then a "delete table row" action can use that information to be enabled when a table selection
* exists and then delete that row if the action is invoked.
- *
- * <p> To make the overall action experience more convenient for the user, action processing
- * supports the concept of a "default tool context". This allows actions to work on a more global
- * level than just the component that is focused. The idea is that if an action is not valid for
- * the current focused context (and it has be declared to work this way using
- * the {@link #setSupportsDefaultToolContext(boolean)}), then it can be validated against the default
- * tool context. The "default tool context" is defined to be the action context of the tool's
- * primary component. This is primarily intended for tool-level actions which are the ones that appear
- * in the tool's main menu bar or toolbar. This allows the tool actions to mostly work on the
- * tool's main component context regardless of what has focus, and yet still work on the
+ * <P>
+ * Actions can optionally operate on a default context if the current active context is invalid
+ * for that action. This allows actions to work on a more global
+ * level than just the component that is focused (and yet give preference to the active context.)
+ * The idea is that if an action is not valid for the current focused context (and it has been
+ * configured to support default context using {@link #setContextClass(Class, boolean)}), then it
+ * can be validated against a default action context for its specific action context type.
+ * The source for the default context depends on the context type. Default context providers are
+ * registered on the tool for each specific ActionContext type.
+ * See {@link DockingWindowManager#registerDefaultContextProvider(Class, ActionContextProvider)} for
+ * more details.
+ * <P>
+ * The use of default context is primarily intended for tool-level actions which are the ones
+ * that appear in the tool's main menu bar or toolbar. This allows the tool actions to mostly
+ * work on the tool's main component context regardless of what has focus, and yet still work on the
* focused component if appropriate (such as a snapshot of the main component).
*/
public interface DockingActionIf extends HelpDescriptor {
@@ -117,26 +123,6 @@ public interface DockingActionIf extends HelpDescriptor {
*/
public void setEnabled(boolean newValue);
- /**
- * Sets whether or not this action should be activated using the default tool context if the
- * current focused provider's context is not valid for this action. Typically, this should
- * be set on actions that are mostly independent of which component has focus such as those
- * on the tool's main toolbar.
- *
- * @param newValue if true, the action will be activated using the default tool context if the
- * local context is not valid for this action. If false, the action will only ever be
- * activated using the focused context.
- */
- public void setSupportsDefaultToolContext(boolean newValue);
-
- /**
- * Returns true if this action can be activated using the default tool context if the focused
- * context is invalid for this action. See {@link #setSupportsDefaultToolContext(boolean)}
- * @return true if this action can be activated using the default tool context if the local
- * context is invalid for this action.
- */
- public boolean supportsDefaultToolContext();
-
/**
* Returns true if the action is enabled.
*
@@ -346,4 +332,34 @@ public interface DockingActionIf extends HelpDescriptor {
* Called when the action's owner is removed from the tool
*/
public void dispose();
+
+ /**
+ * Returns the class of a specific action context that this action requires for it to
+ * operate. See {@link ActionContext} for details on the action context system.
+ * @return the class of a specific action context that this action requires for it to
+ * operate
+ */
+ public Class<? extends ActionContext> getContextClass();
+
+ /**
+ * Returns true if this action also supports operating on a default context
+ * other then the active (focused) provider's context. See the class header for more
+ * details.
+ * @return true if this action also supports operating on a default context other then
+ * the active (focused) provider's context.
+ */
+ public boolean supportsDefaultContext();
+
+ /**
+ * Sets the specific action context class that this action works on and if the action
+ * supports default context. See {@link ActionContext} for details on how the action
+ * context system works.
+ *
+ * @param type the {@link ActionContext} class that this action works on.
+ * @param supportsDefaultContext if true, then this action also support operating on a
+ * default context other than the active (focused) provider's context.
+ */
+ public void setContextClass(Class<? extends ActionContext> type,
+ boolean supportsDefaultContext);
+
}
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/action/MultipleKeyAction.java b/Ghidra/Framework/Docking/src/main/java/docking/action/MultipleKeyAction.java
index 952a2b00fd..d987f931eb 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/action/MultipleKeyAction.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/action/MultipleKeyAction.java
@@ -151,7 +151,7 @@ public class MultipleKeyAction extends DockingKeyBindingAction {
}
private List<ExecutableAction> getValidContextActions(ActionContext localContext,
- ActionContext globalContext) {
+ Map<Class<? extends ActionContext>, ActionContext> contextMap) {
List<ExecutableAction> list = new ArrayList<>();
boolean hasLocalActionsForKeyBinding = false;
@@ -199,7 +199,7 @@ public class MultipleKeyAction extends DockingKeyBindingAction {
}
//
- // 3) Check for global actions
+ // 3) Check for default context actions
//
for (ActionData actionData : actions) {
if (actionData.isGlobalAction()) {
@@ -208,9 +208,21 @@ public class MultipleKeyAction extends DockingKeyBindingAction {
// available
if (isValidAndEnabled(actionData, localContext)) {
list.add(new ExecutableAction(actionData.action, localContext));
+ continue;
}
- else if (isValidAndEnabledGlobally(actionData, globalContext)) {
- list.add(new ExecutableAction(actionData.action, globalContext));
+
+ // this happens if we are in a dialog, default context is not used
+ if (contextMap == null) {
+ continue;
+ }
+
+ if (!actionData.supportsDefaultContext()) {
+ continue;
+ }
+
+ ActionContext defaultContext = contextMap.get(actionData.getContextType());
+ if (isValidAndEnabled(actionData, defaultContext)) {
+ list.add(new ExecutableAction(actionData.action, defaultContext));
}
}
}
@@ -218,17 +230,11 @@ public class MultipleKeyAction extends DockingKeyBindingAction {
}
private boolean isValidAndEnabled(ActionData actionData, ActionContext context) {
- DockingActionIf a = actionData.action;
- return a.isValidContext(context) && a.isEnabledForContext(context);
- }
-
- private boolean isValidAndEnabledGlobally(ActionData actionData, ActionContext context) {
- // the context may be null when we don't want global action such as when getting actions
- // for a dialog
if (context == null) {
return false;
}
- return actionData.supportsDefaultToolContext() && isValidAndEnabled(actionData, context);
+ DockingActionIf a = actionData.action;
+ return a.isValidContext(context) && a.isEnabledForContext(context);
}
@Override
@@ -275,8 +281,9 @@ public class MultipleKeyAction extends DockingKeyBindingAction {
ComponentProvider localProvider = getProvider(dwm, eventSource);
ActionContext localContext = getLocalContext(localProvider);
localContext.setSourceObject(eventSource);
- ActionContext globalContext = tool.getDefaultToolContext();
- List<ExecutableAction> validActions = getValidContextActions(localContext, globalContext);
+ Map<Class<? extends ActionContext>, ActionContext> contextMap =
+ tool.getWindowManager().getDefaultActionContextMap();
+ List<ExecutableAction> validActions = getValidContextActions(localContext, contextMap);
return validActions;
}
@@ -346,6 +353,14 @@ public class MultipleKeyAction extends DockingKeyBindingAction {
this.provider = provider;
}
+ public Class<? extends ActionContext> getContextType() {
+ return action.getContextClass();
+ }
+
+ public boolean supportsDefaultContext() {
+ return action.supportsDefaultContext();
+ }
+
boolean isGlobalAction() {
return provider == null;
}
@@ -355,10 +370,6 @@ public class MultipleKeyAction extends DockingKeyBindingAction {
return provider == otherProvider;
}
- boolean supportsDefaultToolContext() {
- return action.supportsDefaultToolContext();
- }
-
@Override
public String toString() {
String providerString = provider == null ? "" : provider.toString() + " - ";
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/action/builder/AbstractActionBuilder.java b/Ghidra/Framework/Docking/src/main/java/docking/action/builder/AbstractActionBuilder.java
index 6da9984994..475a8ed4ad 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/action/builder/AbstractActionBuilder.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/action/builder/AbstractActionBuilder.java
@@ -175,16 +175,17 @@ public abstract class AbstractActionBuilder<T extends DockingActionIf, C extends
*/
private Predicate<C> validContextPredicate = ALWAYS_TRUE;
- /**
- * Set to true if the action supports using the default tool context if the local context is invalid
- */
- private boolean supportsDefaultToolContext;
-
/**
* Specifies when the action should appear in a window.
*/
private When windowWhen;
+ /**
+ * If true, the action will be allowed to operate using a default context for its declared
+ * context type when the current active context is invalid for this action
+ */
+ private boolean supportsDefaultContext = false;
+
/**
* For use with the {@link AbstractActionBuilder#inWindow(When)} method to specify which windows (main window
* or secondary windows) a global tool bar or menu action will appear in.
@@ -195,7 +196,7 @@ public abstract class AbstractActionBuilder<T extends DockingActionIf, C extends
ALWAYS, // action should appear in all windows
CONTEXT_MATCHES // action should appear if and only if the window has
} // has a provider that generates the appropriate context.
-
+
/**
* Builder constructor
* @param name the name of the action to be built
@@ -595,22 +596,6 @@ public abstract class AbstractActionBuilder<T extends DockingActionIf, C extends
return self();
}
- /**
- * Sets whether the action will support using the default tool context if the focused provider's
- * context is invalid.
- * <P>
- * By default, actions only work on the current focused provider's context. Setting this
- * to true will cause the action to be evaluated against the default tool context if the
- * focused context is not valid for this action.
- *
- * @param b the new value
- * @return this builder (for chaining)
- */
- public B supportsDefaultToolContext(boolean b) {
- supportsDefaultToolContext = b;
- return self();
- }
-
/**
* Specifies when a global action should appear in a window (main or secondary).
* <P>
@@ -635,22 +620,63 @@ public abstract class AbstractActionBuilder<T extends DockingActionIf, C extends
}
/**
- * Sets the specific ActionContext type to use for the various predicate calls
- * ({@link #validContextWhen(Predicate)}, {@link #enabledWhen(Predicate)}, and
+ * Sets the action context for this action. If this context is set, then this action is only
+ * valid when the current context is that type or extends that type.
+ * <P>
+ * After this method has been called, any the following methods will use this new context type
+ * in the method signature: ({@link #validContextWhen(Predicate)},
+ * {@link #enabledWhen(Predicate)}, and
* {@link #popupWhen(Predicate)}).
* <P>
- * In other words, this allows the client to specify the type of ActionContext that is valid for
- * the action being built.
+ * For example, assume you have an action that is only enabled when the context is of type
+ * FooContext. If you don't call this method to set the action context type, you would
+ * have to write your predicate something like this:
+ * <pre>
+ * {@literal builder.enabledWhen(context -> }{
+ * if (!(context instanceof FooContext)) {
+ * return false;
+ * }
+ * return ((FooContext) context).isAwesome();
+ * });
+ * </pre>
+ * But by first calling the builder method <CODE>withContext(FooContext.class)</CODE>, then the
+ * context will be the new type and you can simply write:
+ *
+ * <pre>
+ * {@literal builder.enabledWhen(context -> context.isAwesome()) }
+ * </pre>
+ *
+ * <p>Note: this triggers automatic action enablement based on context for the action, so you
+ * should not later manually manage action enablement using the action's
+ * {@link DockingAction#setEnabled(boolean)} method.
* <P>
- * To be effective, this method must be called <b>before</b> setting any of the predicates
- * such as the {@link #enabledWhen(Predicate)}. Once this method is called you can define your
- * predicates using the more specific ActionContext and be assured your predicates will only
- * be called when the current action context is the type (or sub-type) of the context you have
- * specified here.
+ * For more details on how the action context system works, see {@link ActionContext}.
+ * <P>
+ * @param newActionContextClass the more specific ActionContext type.
+ * @param <AC2> The new ActionContext type (as determined by the newActionContextClass) that
+ * the returned builder will have.
+ * @param <B2> the new builder type.
+ * @return an ActionBuilder whose generic types have been modified to match the new ActionContext.
+ * It still contains all the configuration that has been applied so far.
+ */
+ public <AC2 extends ActionContext, B2 extends AbstractActionBuilder<T, AC2, B2>> B2 withContext(
+ Class<AC2> newActionContextClass) {
+ return this.withContext(newActionContextClass, false);
+ }
+
+ /**
+ * Sets the action context for this action and whether or not this action supports default
+ * context as explained in {@link ActionContext}. If this context is set, then this
+ * action is only valid when the current context is that type or extends that type.
+ * <P>
+ * After this method has been called, any the following methods will use this new context type
+ * in the method signature: ({@link #validContextWhen(Predicate)},
+ * {@link #enabledWhen(Predicate)}, and
+ * {@link #popupWhen(Predicate)}).
* <P>
* For example, assume you have an action that is only enabled when the context is of type
- * FooActionContext. If you don't call this method to set the ActionContext type, you would have
- * to write your predicate something like this:
+ * FooContext. If you don't call this method to set the action context type, you would
+ * have to write your predicate something like this:
* <pre>
* {@literal builder.enabledWhen(context -> }{
* if (!(context instanceof FooContext)) {
@@ -659,31 +685,36 @@ public abstract class AbstractActionBuilder<T extends DockingActionIf, C extends
* return ((FooContext) context).isAwesome();
* });
* </pre>
- * But by first calling the builder method <CODE>withContext(FooContext.class)</CODE>, you can
- * simply write:
+ * But by first calling the builder method <CODE>withContext(FooContext.class)</CODE>, then the
+ * context will be the new type and you can simply write:
*
* <pre>
- * {@literal builder.enabledWhen(context -> return context.isAwesome() }}
+ * {@literal builder.enabledWhen(context -> context.isAwesome()) }
* </pre>
*
- * <p>Note: this triggers automatic action enablement so you should not later call
- * {@link DockingAction#setEnabled(boolean)} to manually manage action enablement.
- *
-
+ * <p>Note: this triggers automatic action enablement based on context for the action, so you
+ * should not later manually manage action enablement using the action's
+ * {@link DockingAction#setEnabled(boolean)} method.
+ * <P>
+ * For more details on how the action context system works, see {@link ActionContext}.
+ * <P>
* @param newActionContextClass the more specific ActionContext type.
* @param <AC2> The new ActionContext type (as determined by the newActionContextClass) that
* the returned builder will have.
* @param <B2> the new builder type.
+ * @param useDefaultContext if true, then this action also supports operating on a default
+ * context other than the active (focused) provider's context
* @return an ActionBuilder whose generic types have been modified to match the new ActionContext.
- * It still contains all the configuration that has been applied so far.
+ * It still contains all the configuration that has been applied so far
*/
@SuppressWarnings("unchecked")
public <AC2 extends ActionContext, B2 extends AbstractActionBuilder<T, AC2, B2>> B2 withContext(
- Class<AC2> newActionContextClass) {
+ Class<AC2> newActionContextClass, boolean useDefaultContext) {
if (actionContextClass != ActionContext.class) {
throw new IllegalStateException("Can't set the ActionContext type more than once");
}
+ this.supportsDefaultContext = useDefaultContext;
// automatic enablement management triggered, make sure there is a existing enablement
// predicate. The default behavior of manual management interferes with automatic management.
@@ -711,16 +742,15 @@ public abstract class AbstractActionBuilder<T extends DockingActionIf, C extends
"Can't build a DockingAction without an action callback");
}
if (windowWhen == When.CONTEXT_MATCHES && actionContextClass == null) {
- throw new IllegalStateException("The InWindow state was set to "
- + "\"CONTEXT_MATCHES\", but no context class was set. Use"
- + " the \"withContext\" method");
+ throw new IllegalStateException("The InWindow state was set to " +
+ "\"CONTEXT_MATCHES\", but no context class was set. Use" +
+ " the \"withContext\" method");
}
}
protected void decorateAction(DockingAction action) {
action.setEnabled(isEnabled);
action.setDescription(description);
- action.setSupportsDefaultToolContext(supportsDefaultToolContext);
setMenuData(action);
setToolbarData(action);
@@ -735,11 +765,15 @@ public abstract class AbstractActionBuilder<T extends DockingActionIf, C extends
action.enabledWhen(adaptPredicate(enabledPredicate));
}
+ // Note: must set contextClass fore setting "validContextWhen" predicate as this method
+ // also sets a predicate for valid context
+ action.setContextClass(actionContextClass, supportsDefaultContext);
action.validContextWhen(adaptPredicate(validContextPredicate));
+
if (popupPredicate != null) {
action.popupWhen(adaptPredicate(popupPredicate));
}
-
+
if (windowWhen == When.ALWAYS) {
action.setAddToAllWindows(true);
}
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/actions/ActionAdapter.java b/Ghidra/Framework/Docking/src/main/java/docking/actions/ActionAdapter.java
index bc468347ff..fab4f54af6 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/actions/ActionAdapter.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/actions/ActionAdapter.java
@@ -25,6 +25,7 @@ import javax.swing.Action;
import javax.swing.Icon;
import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.ActionContextProvider;
import docking.action.DockingActionIf;
@@ -121,7 +122,7 @@ public class ActionAdapter implements Action, PropertyChangeListener {
context = contextProvider.getActionContext(null);
}
if (context == null) {
- context = new ActionContext();
+ context = new DefaultActionContext();
context.setSourceObject(e.getSource());
}
if (dockingAction.isEnabledForContext(context)) {
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/menu/MenuItemManager.java b/Ghidra/Framework/Docking/src/main/java/docking/menu/MenuItemManager.java
index 13bf1480da..83eeda43c4 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/menu/MenuItemManager.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/menu/MenuItemManager.java
@@ -25,6 +25,7 @@ import javax.swing.JMenuItem;
import javax.swing.event.ChangeListener;
import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.*;
import ghidra.util.Msg;
import ghidra.util.StringUtilities;
@@ -201,7 +202,7 @@ class MenuItemManager implements ManagedMenuItem, PropertyChangeListener, Action
}
try {
- ActionContext context = new ActionContext();
+ ActionContext context = new DefaultActionContext();
context.setSourceObject(e.getSource());
if (action.isEnabledForContext(context)) {
if (action instanceof ToggleDockingActionIf) {
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/menu/MultipleActionDockingToolbarButton.java b/Ghidra/Framework/Docking/src/main/java/docking/menu/MultipleActionDockingToolbarButton.java
index f8882aa6d8..68038daec5 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/menu/MultipleActionDockingToolbarButton.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/menu/MultipleActionDockingToolbarButton.java
@@ -135,7 +135,7 @@ public class MultipleActionDockingToolbarButton extends EmptyBorderButton {
private ActionContext getActionContext() {
ComponentProvider provider = getComponentProvider();
ActionContext context = provider == null ? null : provider.getActionContext(null);
- final ActionContext actionContext = context == null ? new ActionContext() : context;
+ final ActionContext actionContext = context == null ? new DefaultActionContext() : context;
return actionContext;
}
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/menu/ToolBarItemManager.java b/Ghidra/Framework/Docking/src/main/java/docking/menu/ToolBarItemManager.java
index e9e59ff48c..2ddba5682e 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/menu/ToolBarItemManager.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/menu/ToolBarItemManager.java
@@ -20,10 +20,11 @@ import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.JButton;
-import javax.swing.SwingUtilities;
-import docking.*;
+import docking.ActionContext;
+import docking.DockingWindowManager;
import docking.action.*;
+import ghidra.util.Swing;
/**
* Class to manager toolbar buttons.
@@ -113,13 +114,13 @@ public class ToolBarItemManager implements PropertyChangeListener, ActionListene
@Override
public void actionPerformed(ActionEvent event) {
DockingWindowManager.clearMouseOverHelp();
- ActionContext context = getActionContext();
+ ActionContext context = getWindowManager().createActionContext(toolBarAction);
context.setSourceObject(event.getSource());
context.setEventClickModifiers(event.getModifiers());
// this gives the UI some time to repaint before executing the action
- SwingUtilities.invokeLater(() -> {
+ Swing.runLater(() -> {
if (toolBarAction.isValidContext(context) &&
toolBarAction.isEnabledForContext(context)) {
if (toolBarAction instanceof ToggleDockingActionIf) {
@@ -131,16 +132,11 @@ public class ToolBarItemManager implements PropertyChangeListener, ActionListene
});
}
- private ActionContext getActionContext() {
+ private DockingWindowManager getWindowManager() {
if (windowManager != null) {
- return windowManager.getActionContext(toolBarAction);
+ return windowManager;
}
-
- ComponentProvider provider = getComponentProvider();
- ActionContext context = provider == null ? null : provider.getActionContext(null);
- final ActionContext actionContext =
- context == null ? new ActionContext(provider, null) : context;
- return actionContext;
+ return DockingWindowManager.getActiveInstance();
}
@Override
@@ -148,14 +144,6 @@ public class ToolBarItemManager implements PropertyChangeListener, ActionListene
return toolBarAction.getName();
}
- private ComponentProvider getComponentProvider() {
- DockingWindowManager manager = windowManager;
- if (manager == null) {
- manager = DockingWindowManager.getActiveInstance();
- }
- return manager.getActiveComponentProvider();
- }
-
@Override
public void mouseClicked(MouseEvent e) {
// don't care
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/test/AbstractDockingTest.java b/Ghidra/Framework/Docking/src/main/java/docking/test/AbstractDockingTest.java
index cff1c097bd..ee1586145f 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/test/AbstractDockingTest.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/test/AbstractDockingTest.java
@@ -1124,8 +1124,8 @@ public abstract class AbstractDockingTest extends AbstractGuiTest {
String name) {
Set<DockingActionIf> ownerActions = tool.getDockingActionsByOwnerName(owner);
return ownerActions.stream()
- .filter(action -> action.getName().equals(name))
- .collect(Collectors.toSet());
+ .filter(action -> action.getName().equals(name))
+ .collect(Collectors.toSet());
}
/**
@@ -1241,7 +1241,7 @@ public abstract class AbstractDockingTest extends AbstractGuiTest {
public static void performAction(DockingActionIf action, boolean waitForCompletion) {
ActionContext context = runSwing(() -> {
- ActionContext actionContext = new ActionContext();
+ ActionContext actionContext = new DefaultActionContext();
DockingWindowManager activeInstance = DockingWindowManager.getActiveInstance();
if (activeInstance == null) {
return actionContext;
@@ -1302,7 +1302,7 @@ public abstract class AbstractDockingTest extends AbstractGuiTest {
boolean wait) {
ActionContext context = runSwing(() -> {
- ActionContext actionContext = new ActionContext();
+ ActionContext actionContext = new DefaultActionContext();
if (provider == null) {
return actionContext;
}
@@ -2130,7 +2130,7 @@ public abstract class AbstractDockingTest extends AbstractGuiTest {
}
public static boolean isEnabled(DockingActionIf action) {
- return runSwing(() -> action.isEnabledForContext(new ActionContext()));
+ return runSwing(() -> action.isEnabledForContext(new DefaultActionContext()));
}
public static boolean isEnabled(DockingActionIf action, ActionContextProvider contextProvider) {
@@ -2151,7 +2151,7 @@ public abstract class AbstractDockingTest extends AbstractGuiTest {
* @return the new context
*/
public ActionContext createContext(Object contextObject) {
- return new ActionContext().setContextObject(contextObject);
+ return new DefaultActionContext().setContextObject(contextObject);
}
/**
@@ -2161,7 +2161,7 @@ public abstract class AbstractDockingTest extends AbstractGuiTest {
* @return the new context
*/
public ActionContext createContext(ComponentProvider provider, Object contextObject) {
- return new ActionContext(provider).setContextObject(contextObject);
+ return new DefaultActionContext(provider).setContextObject(contextObject);
}
//==================================================================================================
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/theme/gui/ThemeTableContext.java b/Ghidra/Framework/Docking/src/main/java/docking/theme/gui/ThemeTableContext.java
index dbd0ae22a8..420ec5c40d 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/theme/gui/ThemeTableContext.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/theme/gui/ThemeTableContext.java
@@ -15,7 +15,7 @@
*/
package docking.theme.gui;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import generic.theme.ThemeValue;
/**
@@ -23,7 +23,7 @@ import generic.theme.ThemeValue;
*
* @param <T> the resource type (Color, Font, or Icon)
*/
-public class ThemeTableContext<T> extends ActionContext {
+public class ThemeTableContext<T> extends DefaultActionContext {
private ThemeValue<T> currentValue;
private ThemeValue<T> themeValue;
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/table/constraint/dialog/ColumnFilterDialog.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/table/constraint/dialog/ColumnFilterDialog.java
index ed1d4efec9..49fadbeb43 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/table/constraint/dialog/ColumnFilterDialog.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/table/constraint/dialog/ColumnFilterDialog.java
@@ -100,7 +100,7 @@ public class ColumnFilterDialog<R> extends ReusableDialogComponentProvider
public static <R> boolean hasFilterableColumns(JTable table,
RowObjectFilterModel<R> model) {
return !ColumnFilterDialogModel.getAllColumnFilterData(model, table.getColumnModel())
- .isEmpty();
+ .isEmpty();
}
private void addClearFilterButton() {
@@ -414,7 +414,7 @@ public class ColumnFilterDialog<R> extends ReusableDialogComponentProvider
setOkEnabled(isValid);
setApplyEnabled(isValid);
- ActionContext context = new ActionContext();
+ ActionContext context = new DefaultActionContext();
for (DockingActionIf action : getActions()) {
action.setEnabled(action.isEnabledForContext(context));
diff --git a/Ghidra/Framework/Docking/src/test.slow/java/docking/widgets/filechooser/GhidraFileChooserTest.java b/Ghidra/Framework/Docking/src/test.slow/java/docking/widgets/filechooser/GhidraFileChooserTest.java
index 8294ab6e4a..663e318fbd 100644
--- a/Ghidra/Framework/Docking/src/test.slow/java/docking/widgets/filechooser/GhidraFileChooserTest.java
+++ b/Ghidra/Framework/Docking/src/test.slow/java/docking/widgets/filechooser/GhidraFileChooserTest.java
@@ -2033,7 +2033,7 @@ public class GhidraFileChooserTest extends AbstractDockingTest {
private ActionContext createDirListContext() {
DirectoryList dirlist = getListView();
- return new ActionContext(null, dirlist);
+ return new DefaultActionContext(null, dirlist);
}
private boolean isEnabled(DockingAction action, ActionContext context) {
diff --git a/Ghidra/Framework/Docking/src/test/java/docking/FakeDockingTool.java b/Ghidra/Framework/Docking/src/test/java/docking/FakeDockingTool.java
index 81a639860c..e62cbb8b2a 100644
--- a/Ghidra/Framework/Docking/src/test/java/docking/FakeDockingTool.java
+++ b/Ghidra/Framework/Docking/src/test/java/docking/FakeDockingTool.java
@@ -78,9 +78,4 @@ public class FakeDockingTool extends AbstractDockingTool {
public void removeServiceListener(ServiceListener listener) {
// stub
}
-
- @Override
- public ActionContext getDefaultToolContext() {
- return null;
- }
}
diff --git a/Ghidra/Framework/Docking/src/test/java/docking/action/ActionBuilderTest.java b/Ghidra/Framework/Docking/src/test/java/docking/action/ActionBuilderTest.java
index 0b1f545fde..e42d8e00c7 100644
--- a/Ghidra/Framework/Docking/src/test/java/docking/action/ActionBuilderTest.java
+++ b/Ghidra/Framework/Docking/src/test/java/docking/action/ActionBuilderTest.java
@@ -21,7 +21,7 @@ import javax.swing.KeyStroke;
import org.junit.Test;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.builder.ActionBuilder;
import resources.Icons;
@@ -31,18 +31,18 @@ public class ActionBuilderTest {
@Test
public void testDescription() {
DockingAction action = new ActionBuilder("Test", "Test")
- .description("foo")
- .onAction(e -> actionCount++)
- .build();
+ .description("foo")
+ .onAction(e -> actionCount++)
+ .build();
assertEquals("foo", action.getDescription());
}
@Test
public void testMenuPath() {
DockingAction action = new ActionBuilder("Test", "Test")
- .menuPath("foo", "bar")
- .onAction(e -> actionCount++)
- .build();
+ .menuPath("foo", "bar")
+ .onAction(e -> actionCount++)
+ .build();
MenuData data = action.getMenuBarData();
assertEquals("foo->bar", data.getMenuPathAsString());
@@ -51,10 +51,10 @@ public class ActionBuilderTest {
@Test
public void testMenuGroup() {
DockingAction action = new ActionBuilder("Test", "Test")
- .menuPath("foo", "bar")
- .menuGroup("A", "B")
- .onAction(e -> actionCount++)
- .build();
+ .menuPath("foo", "bar")
+ .menuGroup("A", "B")
+ .onAction(e -> actionCount++)
+ .build();
MenuData data = action.getMenuBarData();
assertEquals("A", data.getMenuGroup());
@@ -64,10 +64,10 @@ public class ActionBuilderTest {
@Test
public void testMenuIcon() {
DockingAction action = new ActionBuilder("Test", "Test")
- .menuPath("foo", "bar")
- .menuIcon(Icons.ADD_ICON)
- .onAction(e -> actionCount++)
- .build();
+ .menuPath("foo", "bar")
+ .menuIcon(Icons.ADD_ICON)
+ .onAction(e -> actionCount++)
+ .build();
MenuData data = action.getMenuBarData();
assertEquals(Icons.ADD_ICON, data.getMenuIcon());
@@ -76,10 +76,10 @@ public class ActionBuilderTest {
@Test
public void testMenuMnemonic() {
DockingAction action = new ActionBuilder("Test", "Test")
- .menuPath("foo", "bar")
- .menuMnemonic(5)
- .onAction(e -> actionCount++)
- .build();
+ .menuPath("foo", "bar")
+ .menuMnemonic(5)
+ .onAction(e -> actionCount++)
+ .build();
MenuData data = action.getMenuBarData();
assertEquals(5, data.getMnemonic());
@@ -88,9 +88,9 @@ public class ActionBuilderTest {
@Test
public void testPopupPath() {
DockingAction action = new ActionBuilder("Test", "Test")
- .popupMenuPath("foo", "bar")
- .onAction(e -> actionCount++)
- .build();
+ .popupMenuPath("foo", "bar")
+ .onAction(e -> actionCount++)
+ .build();
MenuData data = action.getPopupMenuData();
assertEquals("foo->bar", data.getMenuPathAsString());
@@ -99,10 +99,10 @@ public class ActionBuilderTest {
@Test
public void testPopupGroup() {
DockingAction action = new ActionBuilder("Test", "Test")
- .popupMenuPath("foo", "bar")
- .popupMenuGroup("A", "B")
- .onAction(e -> actionCount++)
- .build();
+ .popupMenuPath("foo", "bar")
+ .popupMenuGroup("A", "B")
+ .onAction(e -> actionCount++)
+ .build();
MenuData data = action.getPopupMenuData();
assertEquals("A", data.getMenuGroup());
@@ -112,10 +112,10 @@ public class ActionBuilderTest {
@Test
public void testPopupIcon() {
DockingAction action = new ActionBuilder("Test", "Test")
- .popupMenuPath("foo", "bar")
- .popupMenuIcon(Icons.ADD_ICON)
- .onAction(e -> actionCount++)
- .build();
+ .popupMenuPath("foo", "bar")
+ .popupMenuIcon(Icons.ADD_ICON)
+ .onAction(e -> actionCount++)
+ .build();
MenuData data = action.getPopupMenuData();
assertEquals(Icons.ADD_ICON, data.getMenuIcon());
@@ -124,9 +124,9 @@ public class ActionBuilderTest {
@Test
public void testToolbarIcon() {
DockingAction action = new ActionBuilder("Test", "Test")
- .toolBarIcon(Icons.ADD_ICON)
- .onAction(e -> actionCount++)
- .build();
+ .toolBarIcon(Icons.ADD_ICON)
+ .onAction(e -> actionCount++)
+ .build();
ToolBarData data = action.getToolBarData();
assertEquals(Icons.ADD_ICON, data.getIcon());
@@ -135,10 +135,10 @@ public class ActionBuilderTest {
@Test
public void testToolbarGroup() {
DockingAction action = new ActionBuilder("Test", "Test")
- .toolBarIcon(Icons.ADD_ICON)
- .toolBarGroup("A", "B")
- .onAction(e -> actionCount++)
- .build();
+ .toolBarIcon(Icons.ADD_ICON)
+ .toolBarGroup("A", "B")
+ .onAction(e -> actionCount++)
+ .build();
ToolBarData data = action.getToolBarData();
assertEquals("A", data.getToolBarGroup());
@@ -148,9 +148,9 @@ public class ActionBuilderTest {
@Test
public void testKeyBindingKeyStroke() {
DockingAction action = new ActionBuilder("Test", "Test")
- .keyBinding(KeyStroke.getKeyStroke("A"))
- .onAction(e -> actionCount++)
- .build();
+ .keyBinding(KeyStroke.getKeyStroke("A"))
+ .onAction(e -> actionCount++)
+ .build();
assertEquals(KeyStroke.getKeyStroke("A"), action.getKeyBinding());
}
@@ -158,9 +158,9 @@ public class ActionBuilderTest {
@Test
public void testKeyBindingKeyString() {
DockingAction action = new ActionBuilder("Test", "Test")
- .keyBinding("ALT A")
- .onAction(e -> actionCount++)
- .build();
+ .keyBinding("ALT A")
+ .onAction(e -> actionCount++)
+ .build();
assertEquals(KeyStroke.getKeyStroke("alt pressed A"), action.getKeyBinding());
}
@@ -168,26 +168,26 @@ public class ActionBuilderTest {
@Test
public void testOnAction() {
DockingAction action = new ActionBuilder("Test", "Test")
- .onAction(e -> actionCount = 6)
- .build();
+ .onAction(e -> actionCount = 6)
+ .build();
assertEquals(0, actionCount);
- action.actionPerformed(new ActionContext());
+ action.actionPerformed(new DefaultActionContext());
assertEquals(6, actionCount);
}
@Test
public void testEnabled() {
DockingAction action = new ActionBuilder("Test", "Test")
- .enabled(true)
- .onAction(e -> actionCount++)
- .build();
+ .enabled(true)
+ .onAction(e -> actionCount++)
+ .build();
assertTrue(action.isEnabled());
action = new ActionBuilder("Test", "Test")
- .enabled(false)
- .onAction(e -> actionCount++)
- .build();
+ .enabled(false)
+ .onAction(e -> actionCount++)
+ .build();
assertFalse(action.isEnabled());
}
@@ -195,63 +195,63 @@ public class ActionBuilderTest {
@Test
public void testEnabledWhen() {
DockingAction action = new ActionBuilder("Test", "Test")
- .enabledWhen(c -> c.getContextObject() == this)
- .onAction(e -> actionCount++)
- .build();
+ .enabledWhen(c -> c.getContextObject() == this)
+ .onAction(e -> actionCount++)
+ .build();
- assertTrue(action.isEnabledForContext(new ActionContext(null, this, null)));
- assertFalse(action.isEnabledForContext(new ActionContext()));
+ assertTrue(action.isEnabledForContext(new DefaultActionContext(null, this, null)));
+ assertFalse(action.isEnabledForContext(new DefaultActionContext()));
}
@Test
public void testValidContextWhen() {
DockingAction action = new ActionBuilder("Test", "Test")
- .validContextWhen(c -> c.getContextObject() == this)
- .onAction(e -> actionCount++)
- .build();
+ .validContextWhen(c -> c.getContextObject() == this)
+ .onAction(e -> actionCount++)
+ .build();
- assertTrue(action.isValidContext(new ActionContext(null, this, null)));
- assertFalse(action.isValidContext(new ActionContext()));
+ assertTrue(action.isValidContext(new DefaultActionContext(null, this, null)));
+ assertFalse(action.isValidContext(new DefaultActionContext()));
}
@Test
public void testPopupWhen() {
DockingAction action = new ActionBuilder("Test", "Test")
- .popupWhen(c -> c.getContextObject() == this)
- .onAction(e -> actionCount++)
- .build();
+ .popupWhen(c -> c.getContextObject() == this)
+ .onAction(e -> actionCount++)
+ .build();
- assertTrue(action.isAddToPopup(new ActionContext(null, this, null)));
- assertFalse(action.isAddToPopup(new ActionContext()));
+ assertTrue(action.isAddToPopup(new DefaultActionContext(null, this, null)));
+ assertFalse(action.isAddToPopup(new DefaultActionContext()));
}
@Test
public void testWithContext() {
DockingAction action = new ActionBuilder("Test", "Test")
- .withContext(FooActionContext.class)
- .enabledWhen(c -> c.foo())
- .onAction(e -> actionCount++)
- .build();
+ .withContext(FooActionContext.class)
+ .enabledWhen(c -> c.foo())
+ .onAction(e -> actionCount++)
+ .build();
- assertFalse(action.isEnabledForContext(new ActionContext()));
+ assertFalse(action.isEnabledForContext(new DefaultActionContext()));
assertTrue(action.isEnabledForContext(new FooActionContext()));
}
@Test
public void testManualEnablement() {
DockingAction action = new ActionBuilder("Test", "Test")
- .onAction(e -> actionCount++)
- .enabled(false)
- .build();
+ .onAction(e -> actionCount++)
+ .enabled(false)
+ .build();
- assertFalse(action.isEnabledForContext(new ActionContext()));
+ assertFalse(action.isEnabledForContext(new DefaultActionContext()));
action.setEnabled(true);
- assertTrue(action.isEnabledForContext(new ActionContext()));
+ assertTrue(action.isEnabledForContext(new DefaultActionContext()));
action.setEnabled(true);
- assertTrue(action.isEnabledForContext(new ActionContext()));
+ assertTrue(action.isEnabledForContext(new DefaultActionContext()));
}
- static class FooActionContext extends ActionContext {
+ static class FooActionContext extends DefaultActionContext {
public boolean foo() {
return true;
}
diff --git a/Ghidra/Framework/Docking/src/test/java/ghidra/util/bean/EmptyBorderButtonTest.java b/Ghidra/Framework/Docking/src/test/java/ghidra/util/bean/EmptyBorderButtonTest.java
index b808328006..2a9a23e4c5 100644
--- a/Ghidra/Framework/Docking/src/test/java/ghidra/util/bean/EmptyBorderButtonTest.java
+++ b/Ghidra/Framework/Docking/src/test/java/ghidra/util/bean/EmptyBorderButtonTest.java
@@ -15,8 +15,7 @@
*/
package ghidra.util.bean;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
import javax.swing.ButtonModel;
@@ -24,6 +23,7 @@ import org.junit.Before;
import org.junit.Test;
import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.*;
import docking.menu.DialogToolbarButton;
import docking.test.AbstractDockingTest;
@@ -142,7 +142,7 @@ public class EmptyBorderButtonTest extends AbstractDockingTest {
}
};
ActionContextProvider contextProvider =
- e -> new ActionContext(null, e.getSource(), e.getComponent());
+ e -> new DefaultActionContext(null, e.getSource(), e.getComponent());
action.setToolBarData(new ToolBarData(ResourceManager.getDefaultIcon()));
action.setEnabled(false);
diff --git a/Ghidra/Framework/Graph/src/main/java/ghidra/graph/viewer/actions/VgActionContext.java b/Ghidra/Framework/Graph/src/main/java/ghidra/graph/viewer/actions/VgActionContext.java
index f259e453e6..874a671f3d 100644
--- a/Ghidra/Framework/Graph/src/main/java/ghidra/graph/viewer/actions/VgActionContext.java
+++ b/Ghidra/Framework/Graph/src/main/java/ghidra/graph/viewer/actions/VgActionContext.java
@@ -15,14 +15,14 @@
*/
package ghidra.graph.viewer.actions;
-import docking.ActionContext;
import docking.ComponentProvider;
+import docking.DefaultActionContext;
import ghidra.graph.VisualGraph;
/**
* Context for {@link VisualGraph}s
*/
-public class VgActionContext extends ActionContext implements VisualGraphActionContext {
+public class VgActionContext extends DefaultActionContext implements VisualGraphActionContext {
public VgActionContext(ComponentProvider provider) {
this(provider, null);
diff --git a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/FrontEndPlugin.java b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/FrontEndPlugin.java
index fa2c17787b..9272251a94 100644
--- a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/FrontEndPlugin.java
+++ b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/FrontEndPlugin.java
@@ -606,7 +606,7 @@ public class FrontEndPlugin extends Plugin
if (e != null) {
Component source = (Component) e.getSource();
if (source instanceof ToolButton) {
- return new ActionContext(provider, source);
+ return new DefaultActionContext(provider, source);
}
}
}
@@ -704,8 +704,8 @@ public class FrontEndPlugin extends Plugin
connectionButton.setContentAreaFilled(false);
connectionButton.setSelected(isConnected);
connectionButton
- .setBorder(isConnected ? BorderFactory.createBevelBorder(BevelBorder.LOWERED)
- : BorderFactory.createBevelBorder(BevelBorder.RAISED));
+ .setBorder(isConnected ? BorderFactory.createBevelBorder(BevelBorder.LOWERED)
+ : BorderFactory.createBevelBorder(BevelBorder.RAISED));
connectionIconPanel.add(connectionButton);
if (isConnected) {
@@ -717,7 +717,7 @@ public class FrontEndPlugin extends Plugin
}
}
repositoryLabel
- .setText("Project Repository: " + repository.getName() + getAccessString(user));
+ .setText("Project Repository: " + repository.getName() + getAccessString(user));
String serverName = repository.getServerInfo().getServerName();
connectionButton.setToolTipText(
@@ -989,7 +989,7 @@ public class FrontEndPlugin extends Plugin
};
renameToolAction.setPopupMenuData(new MenuData(new String[] { "Rename..." }, "tool"));
renameToolAction
- .setHelpLocation(new HelpLocation(ToolConstants.TOOL_HELP_TOPIC, "Rename Tool"));
+ .setHelpLocation(new HelpLocation(ToolConstants.TOOL_HELP_TOPIC, "Rename Tool"));
propertiesAction = new ToolButtonAction(PROPERTIES_ACTION_NAME) {
@Override
@@ -1013,7 +1013,7 @@ public class FrontEndPlugin extends Plugin
new MenuData(new String[] { "Configure Plugins..." }, "zproperties"));
propertiesAction
- .setHelpLocation(new HelpLocation(ToolConstants.TOOL_HELP_TOPIC, "Configure_Tool"));
+ .setHelpLocation(new HelpLocation(ToolConstants.TOOL_HELP_TOPIC, "Configure_Tool"));
tool.addLocalAction(frontEndProvider, exportToolAction);
tool.addLocalAction(frontEndProvider, renameToolAction);
diff --git a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/ProjectDataPanel.java b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/ProjectDataPanel.java
index 3e9cb85d9e..cc30e257e5 100644
--- a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/ProjectDataPanel.java
+++ b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/ProjectDataPanel.java
@@ -24,8 +24,7 @@ import java.util.Map;
import javax.swing.*;
-import docking.ActionContext;
-import docking.ComponentProvider;
+import docking.*;
import docking.widgets.tabbedpane.DockingTabRenderer;
import ghidra.framework.client.NotConnectedException;
import ghidra.framework.main.datatable.ProjectDataTablePanel;
@@ -368,7 +367,7 @@ class ProjectDataPanel extends JSplitPane implements ProjectViewListener {
while (comp != null) {
if (comp instanceof JTabbedPane) {
- return new ActionContext(provider, comp);
+ return new DefaultActionContext(provider, comp);
}
if (comp instanceof ProjectDataTreePanel) {
ProjectDataTreePanel panel = (ProjectDataTreePanel) comp;
diff --git a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/datatable/ProjectDataContext.java b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/datatable/ProjectDataContext.java
index 35e519fad0..2d3778524e 100644
--- a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/datatable/ProjectDataContext.java
+++ b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/datatable/ProjectDataContext.java
@@ -19,15 +19,15 @@ import java.awt.Component;
import java.util.Collections;
import java.util.List;
-import docking.ActionContext;
import docking.ComponentProvider;
+import docking.DefaultActionContext;
import ghidra.framework.model.*;
/**
* A context that understands files that live in a {@link Project}. Most of the clients of
* this context will use its notion of selected {@link DomainFile}s and folders.
*/
-public class ProjectDataContext extends ActionContext implements DomainFileContext {
+public class ProjectDataContext extends DefaultActionContext implements DomainFileContext {
private List<DomainFolder> selectedFolders;
private List<DomainFile> selectedFiles;
diff --git a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/datatree/DialogProjectTreeContext.java b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/datatree/DialogProjectTreeContext.java
index 8b53e360b9..0d2fd5476a 100644
--- a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/datatree/DialogProjectTreeContext.java
+++ b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/datatree/DialogProjectTreeContext.java
@@ -20,7 +20,7 @@ import java.util.List;
import javax.swing.tree.TreePath;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.widgets.tree.GTreeNode;
import ghidra.framework.main.datatable.ProjectTreeContext;
import ghidra.framework.model.*;
@@ -28,7 +28,7 @@ import ghidra.framework.model.*;
/**
* Context specific to the DataTreeDialog.
*/
-public class DialogProjectTreeContext extends ActionContext implements ProjectTreeContext {
+public class DialogProjectTreeContext extends DefaultActionContext implements ProjectTreeContext {
private TreePath[] selectionPaths;
private DataTree tree;
diff --git a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/datatree/VersionHistoryDialog.java b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/datatree/VersionHistoryDialog.java
index 2ea1b117f7..d586344947 100644
--- a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/datatree/VersionHistoryDialog.java
+++ b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/datatree/VersionHistoryDialog.java
@@ -20,8 +20,7 @@ import java.io.FileNotFoundException;
import java.util.Collections;
import java.util.List;
-import docking.ActionContext;
-import docking.DialogComponentProvider;
+import docking.*;
import docking.action.DockingActionIf;
import ghidra.app.util.GenericHelpTopics;
import ghidra.framework.main.AppInfo;
@@ -145,7 +144,7 @@ public class VersionHistoryDialog extends DialogComponentProvider implements Pro
@Override
public ActionContext getActionContext(MouseEvent event) {
- ActionContext actionContext = new ActionContext(null, this, versionPanel.getTable());
+ ActionContext actionContext = new DefaultActionContext(null, this, versionPanel.getTable());
actionContext.setMouseEvent(event);
return actionContext;
}
diff --git a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/projectdata/actions/CheckoutsActionContext.java b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/projectdata/actions/CheckoutsActionContext.java
index 552bcde7bb..6de189d5db 100644
--- a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/projectdata/actions/CheckoutsActionContext.java
+++ b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/projectdata/actions/CheckoutsActionContext.java
@@ -15,9 +15,9 @@
*/
package ghidra.framework.main.projectdata.actions;
-import docking.ActionContext;
+import docking.DefaultActionContext;
-public class CheckoutsActionContext extends ActionContext {
+public class CheckoutsActionContext extends DefaultActionContext {
private int[] selectedRows;
diff --git a/Ghidra/Framework/Project/src/main/java/ghidra/framework/plugintool/PluginTool.java b/Ghidra/Framework/Project/src/main/java/ghidra/framework/plugintool/PluginTool.java
index 95d4394e74..67a7db337b 100644
--- a/Ghidra/Framework/Project/src/main/java/ghidra/framework/plugintool/PluginTool.java
+++ b/Ghidra/Framework/Project/src/main/java/ghidra/framework/plugintool/PluginTool.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -413,6 +413,31 @@ public abstract class PluginTool extends AbstractDockingTool {
winMgr.setDefaultComponent(provider);
}
+ /**
+ * Registers an action context provider as the default provider for a specific action
+ * context type. Note that this registers a default provider for exactly
+ * that type and not a subclass of that type. If the provider want to support a hierarchy of
+ * types, then it must register separately for each type. See {@link ActionContext} for details
+ * on how the action context system works.
+ * @param type the ActionContext class to register a default provider for
+ * @param provider the ActionContextProvider that provides default tool context for actions
+ * that consume the given ActionContext type
+ */
+ public void registerDefaultContextProvider(Class<? extends ActionContext> type,
+ ActionContextProvider provider) {
+ winMgr.registerDefaultContextProvider(type, provider);
+ }
+
+ /**
+ * Removes the default provider for the given ActionContext type.
+ * @param type the subclass of ActionContext to remove a provider for
+ * @param provider the ActionContextProvider to remove for the given ActionContext type
+ */
+ public void unregisterDefaultContextProvider(Class<? extends ActionContext> type,
+ ActionContextProvider provider) {
+ winMgr.unregisterDefaultContextProvider(type, provider);
+ }
+
public ToolTemplate getToolTemplate(boolean includeConfigState) {
throw new UnsupportedOperationException(
"You cannot create templates for generic tools: " + getClass().getName());
@@ -1027,7 +1052,7 @@ public abstract class PluginTool extends AbstractDockingTool {
saveAsAction.setEnabled(true);
saveAsAction
- .setHelpLocation(new HelpLocation(ToolConstants.TOOL_HELP_TOPIC, "Tool_Changes"));
+ .setHelpLocation(new HelpLocation(ToolConstants.TOOL_HELP_TOPIC, "Tool_Changes"));
addAction(saveAction);
addAction(saveAsAction);
@@ -1053,7 +1078,7 @@ public abstract class PluginTool extends AbstractDockingTool {
menuData.setMenuSubGroup(Integer.toString(subGroup++));
exportToolAction.setMenuBarData(menuData);
exportToolAction
- .setHelpLocation(new HelpLocation(ToolConstants.TOOL_HELP_TOPIC, "Export_Tool"));
+ .setHelpLocation(new HelpLocation(ToolConstants.TOOL_HELP_TOPIC, "Export_Tool"));
addAction(exportToolAction);
DockingAction exportDefautToolAction =
@@ -1076,42 +1101,42 @@ public abstract class PluginTool extends AbstractDockingTool {
protected void addHelpActions() {
new ActionBuilder("About Ghidra", ToolConstants.TOOL_OWNER)
- .menuPath(ToolConstants.MENU_HELP, "&About Ghidra")
- .menuGroup("ZZA")
- .helpLocation(new HelpLocation(ToolConstants.ABOUT_HELP_TOPIC, "About_Ghidra"))
- .inWindow(ActionBuilder.When.ALWAYS)
- .onAction(c -> DockingWindowManager.showDialog(new AboutDialog()))
- .buildAndInstall(this);
+ .menuPath(ToolConstants.MENU_HELP, "&About Ghidra")
+ .menuGroup("ZZA")
+ .helpLocation(new HelpLocation(ToolConstants.ABOUT_HELP_TOPIC, "About_Ghidra"))
+ .inWindow(ActionBuilder.When.ALWAYS)
+ .onAction(c -> DockingWindowManager.showDialog(new AboutDialog()))
+ .buildAndInstall(this);
new ActionBuilder("User Agreement", ToolConstants.TOOL_OWNER)
- .menuPath(ToolConstants.MENU_HELP, "&User Agreement")
- .menuGroup(ToolConstants.HELP_CONTENTS_MENU_GROUP)
- .helpLocation(new HelpLocation(ToolConstants.ABOUT_HELP_TOPIC, "User_Agreement"))
- .inWindow(ActionBuilder.When.ALWAYS)
- .onAction(
- c -> DockingWindowManager.showDialog(new UserAgreementDialog(false, false)))
- .buildAndInstall(this);
+ .menuPath(ToolConstants.MENU_HELP, "&User Agreement")
+ .menuGroup(ToolConstants.HELP_CONTENTS_MENU_GROUP)
+ .helpLocation(new HelpLocation(ToolConstants.ABOUT_HELP_TOPIC, "User_Agreement"))
+ .inWindow(ActionBuilder.When.ALWAYS)
+ .onAction(
+ c -> DockingWindowManager.showDialog(new UserAgreementDialog(false, false)))
+ .buildAndInstall(this);
final ErrorReporter reporter = ErrLogDialog.getErrorReporter();
if (reporter != null) {
new ActionBuilder("Report Bug", ToolConstants.TOOL_OWNER)
- .menuPath(ToolConstants.MENU_HELP, "&Report Bug...")
- .menuGroup("BBB")
- .helpLocation(new HelpLocation("ErrorReporting", "Report_Bug"))
- .inWindow(ActionBuilder.When.ALWAYS)
- .onAction(c -> reporter.report(getToolFrame(), "User Bug Report", null))
- .buildAndInstall(this);
+ .menuPath(ToolConstants.MENU_HELP, "&Report Bug...")
+ .menuGroup("BBB")
+ .helpLocation(new HelpLocation("ErrorReporting", "Report_Bug"))
+ .inWindow(ActionBuilder.When.ALWAYS)
+ .onAction(c -> reporter.report(getToolFrame(), "User Bug Report", null))
+ .buildAndInstall(this);
}
HelpService help = Help.getHelpService();
new ActionBuilder("Contents", ToolConstants.TOOL_OWNER)
- .menuPath(ToolConstants.MENU_HELP, "&Contents")
- .menuGroup(ToolConstants.HELP_CONTENTS_MENU_GROUP)
- .helpLocation(new HelpLocation("Misc", "Welcome_to_Ghidra_Help"))
- .inWindow(ActionBuilder.When.ALWAYS)
- .onAction(c -> help.showHelp(null, false, getToolFrame()))
- .buildAndInstall(this);
+ .menuPath(ToolConstants.MENU_HELP, "&Contents")
+ .menuGroup(ToolConstants.HELP_CONTENTS_MENU_GROUP)
+ .helpLocation(new HelpLocation("Misc", "Welcome_to_Ghidra_Help"))
+ .inWindow(ActionBuilder.When.ALWAYS)
+ .onAction(c -> help.showHelp(null, false, getToolFrame()))
+ .buildAndInstall(this);
}
/**
@@ -1490,11 +1515,6 @@ public abstract class PluginTool extends AbstractDockingTool {
winMgr.removePreferenceState(name);
}
- @Override
- public ActionContext getDefaultToolContext() {
- return winMgr.getDefaultToolContext();
- }
-
@Override
public void contextChanged(ComponentProvider provider) {
if (isDisposed) {
diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/service/graph/GraphActionContext.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/service/graph/GraphActionContext.java
index ad11d0b2d9..90c007e0fb 100644
--- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/service/graph/GraphActionContext.java
+++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/service/graph/GraphActionContext.java
@@ -17,13 +17,13 @@ package ghidra.service.graph;
import java.util.Set;
-import docking.ActionContext;
import docking.ComponentProvider;
+import docking.DefaultActionContext;
/**
* The base ActionContext for the GraphDisplay instances.
*/
-public class GraphActionContext extends ActionContext {
+public class GraphActionContext extends DefaultActionContext {
private final AttributedGraph graph;
private final Set<AttributedVertex> selectedVertices;
private final AttributedVertex focusedVertex;
diff --git a/Ghidra/Test/IntegrationTest/src/screen/java/help/screenshot/FunctionGraphPluginScreenShots.java b/Ghidra/Test/IntegrationTest/src/screen/java/help/screenshot/FunctionGraphPluginScreenShots.java
index 5d8ef59385..a3ccb86399 100644
--- a/Ghidra/Test/IntegrationTest/src/screen/java/help/screenshot/FunctionGraphPluginScreenShots.java
+++ b/Ghidra/Test/IntegrationTest/src/screen/java/help/screenshot/FunctionGraphPluginScreenShots.java
@@ -858,7 +858,7 @@ public class FunctionGraphPluginScreenShots extends AbstractFunctionGraphTest {
new Object[] { minCrossState });
//@formatter:on
- runSwing(() -> action.actionPerformed(new ActionContext()));
+ runSwing(() -> action.actionPerformed(new DefaultActionContext()));
// wait for the threaded graph layout code
FGController controller = getFunctionGraphController();
diff --git a/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/app/plugin/core/clipboard/ClipboardPluginTest.java b/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/app/plugin/core/clipboard/ClipboardPluginTest.java
index 2e34d2266a..373817f152 100644
--- a/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/app/plugin/core/clipboard/ClipboardPluginTest.java
+++ b/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/app/plugin/core/clipboard/ClipboardPluginTest.java
@@ -1345,7 +1345,7 @@ public class ClipboardPluginTest extends AbstractGhidraHeadedIntegrationTest {
final DockingActionIf action = getAction(plugin, "Byte Viewer Options");
assertTrue(action.isEnabled());
- SwingUtilities.invokeLater(() -> action.actionPerformed(new ActionContext()));
+ SwingUtilities.invokeLater(() -> action.actionPerformed(new DefaultActionContext()));
waitForSwing();
ByteViewerOptionsDialog d = waitForDialogComponent(ByteViewerOptionsDialog.class);
return d;
diff --git a/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/framework/main/ByteViewerToolConnectionTest.java b/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/framework/main/ByteViewerToolConnectionTest.java
index cd9aa687c0..6384c4e1c8 100644
--- a/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/framework/main/ByteViewerToolConnectionTest.java
+++ b/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/framework/main/ByteViewerToolConnectionTest.java
@@ -25,7 +25,7 @@ import javax.swing.*;
import org.junit.*;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.DockingActionIf;
import docking.test.AbstractDockingTest;
import ghidra.app.plugin.core.byteviewer.ByteViewerPlugin;
@@ -272,7 +272,7 @@ public class ByteViewerToolConnectionTest extends AbstractGhidraHeadedIntegratio
throws Exception {
final JMenuItem item = new JMenuItem(name);
- Runnable r = () -> action.actionPerformed(new ActionContext(null, null, item));
+ Runnable r = () -> action.actionPerformed(new DefaultActionContext(null, null, item));
if (doWait) {
SwingUtilities.invokeAndWait(r);
}
diff --git a/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/framework/main/ToolActionManagerTest.java b/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/framework/main/ToolActionManagerTest.java
index fe95b5d24a..f836cff431 100644
--- a/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/framework/main/ToolActionManagerTest.java
+++ b/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/framework/main/ToolActionManagerTest.java
@@ -27,7 +27,7 @@ import javax.swing.*;
import org.junit.*;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.DockingActionIf;
import docking.test.AbstractDockingTest;
import docking.tool.ToolConstants;
@@ -176,7 +176,7 @@ public class ToolActionManagerTest extends AbstractGhidraHeadedIntegrationTest {
String toolNamePrefix = "TestCodeBrowser";
final File cbFile = ResourceManager
- .getResourceFile("defaultTools/" + toolNamePrefix + ToolUtils.TOOL_EXTENSION);
+ .getResourceFile("defaultTools/" + toolNamePrefix + ToolUtils.TOOL_EXTENSION);
assertNotNull(cbFile);
DockingActionIf importAction = getAction("Import Tool");
@@ -713,7 +713,7 @@ public class ToolActionManagerTest extends AbstractGhidraHeadedIntegrationTest {
private void performToolButtonAction(final DockingActionIf action, String name, boolean doWait,
boolean runningTool) throws Exception {
final ToolButton tb = findToolButton(frontEndTool.getToolFrame(), name, runningTool);
- Runnable r = () -> action.actionPerformed(new ActionContext(null, tb, tb));
+ Runnable r = () -> action.actionPerformed(new DefaultActionContext(null, tb, tb));
if (doWait) {
runSwing(r);
}
@@ -748,7 +748,7 @@ public class ToolActionManagerTest extends AbstractGhidraHeadedIntegrationTest {
runSwing(() -> {
JMenuItem item = new JMenuItem(name);
- action.actionPerformed(new ActionContext(null, null, item));
+ action.actionPerformed(new DefaultActionContext(null, null, item));
}, doWait);
waitForSwing();
diff --git a/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/framework/main/ToolConnectionTest.java b/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/framework/main/ToolConnectionTest.java
index d10764fc9a..b22e8d63cb 100644
--- a/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/framework/main/ToolConnectionTest.java
+++ b/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/framework/main/ToolConnectionTest.java
@@ -25,7 +25,7 @@ import javax.swing.*;
import org.junit.*;
-import docking.ActionContext;
+import docking.DefaultActionContext;
import docking.action.DockingActionIf;
import ghidra.app.plugin.core.byteviewer.ByteViewerPlugin;
import ghidra.app.services.ProgramManager;
@@ -239,7 +239,7 @@ public class ToolConnectionTest extends AbstractGhidraHeadedIntegrationTest {
throws Exception {
JMenuItem item = new JMenuItem(name);
- Runnable r = () -> action.actionPerformed(new ActionContext(null, null, item));
+ Runnable r = () -> action.actionPerformed(new DefaultActionContext(null, null, item));
runSwing(r, doWait);
waitForSwing();
}