GP-6085 - Flow Arrows - Change to a service-based system for margin providers to allow flow arrows in snapshots

This commit is contained in:
dragonmacher
2025-11-21 17:50:32 -05:00
parent d193345dde
commit eb10bd7e08
50 changed files with 2144 additions and 1546 deletions
@@ -15,7 +15,7 @@
*/
package ghidra.app.plugin.core.debug.gui.control;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.*;
import java.util.*;
import java.util.stream.Collectors;
@@ -26,6 +26,7 @@ import org.junit.Test;
import db.Transaction;
import docking.action.DockingActionIf;
import ghidra.app.context.ProgramLocationActionContext;
import ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin;
import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerIntegrationTest;
import ghidra.app.plugin.core.debug.gui.listing.DebuggerListingPlugin;
import ghidra.app.plugin.core.debug.service.modules.DebuggerStaticMappingServicePlugin;
@@ -50,6 +51,7 @@ public class DebuggerMethodActionsPluginTest extends AbstractGhidraHeadedDebugge
@Before
public void setUpMethodActionsTest() throws Exception {
addPlugin(tool, CodeBrowserPlugin.class);
listingPlugin = addPlugin(tool, DebuggerListingPlugin.class);
mappingService = addPlugin(tool, DebuggerStaticMappingServicePlugin.class);
methodsPlugin = addPlugin(tool, DebuggerMethodActionsPlugin.class);
@@ -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.
@@ -31,7 +31,7 @@ import ghidra.app.util.viewer.field.*;
import ghidra.app.util.viewer.format.FieldFormatModel;
import ghidra.app.util.viewer.format.FormatManager;
import ghidra.app.util.viewer.listingpanel.ListingPanel;
import ghidra.app.util.viewer.listingpanel.MarginProvider;
import ghidra.app.util.viewer.listingpanel.ListingMarginProvider;
import ghidra.framework.options.Options;
import ghidra.framework.options.ToolOptions;
import ghidra.program.model.address.Address;
@@ -138,11 +138,11 @@ public class BlockModelScreenShots extends GhidraScreenShotGenerator {
final ListingPanel lp = cb.getListingPanel();
@SuppressWarnings("unchecked")
final List<MarginProvider> list =
new ArrayList<>((List<MarginProvider>) getInstanceField("marginProviders", lp));
final List<ListingMarginProvider> list =
new ArrayList<>((List<ListingMarginProvider>) getInstanceField("marginProviders", lp));
runSwing(() -> {
invokeInstanceMethod("buildPanels", lp);
for (MarginProvider marginProvider : list) {
for (ListingMarginProvider marginProvider : list) {
lp.removeMarginProvider(marginProvider);
}
});
@@ -39,7 +39,7 @@ import ghidra.app.plugin.core.datamgr.DataTypesProvider;
import ghidra.app.plugin.core.programtree.ViewManagerComponentProvider;
import ghidra.app.util.viewer.field.*;
import ghidra.app.util.viewer.listingpanel.ListingPanel;
import ghidra.app.util.viewer.listingpanel.OverviewProvider;
import ghidra.app.util.viewer.listingpanel.ListingOverviewProvider;
import ghidra.program.model.data.*;
import ghidra.program.model.listing.CommentType;
@@ -265,10 +265,10 @@ public class CodeBrowserPluginScreenShots extends GhidraScreenShotGenerator {
public void testCaptureMarkerPopup() {
setToolSize(1400, 1200);
ListingPanel listingPanel = plugin.getListingPanel();
List<OverviewProvider> overviewProviders = listingPanel.getOverviewProviders();
List<ListingOverviewProvider> overviewProviders = listingPanel.getOverviewProviders();
assertEquals(1, overviewProviders.size());
OverviewProvider provider = overviewProviders.get(0);
ListingOverviewProvider provider = overviewProviders.get(0);
rightClick(provider.getComponent(), 1, 1);
captureMenu();