Merge remote-tracking branch 'origin/GP-5354_James_function_tags_selection_action--SQUASHED'

This commit is contained in:
Ryan Kurtz
2025-02-10 14:52:36 -05:00
2 changed files with 30 additions and 6 deletions

View File

@@ -127,4 +127,12 @@ public class AllFunctionsPanel extends JPanel {
public FunctionTableModel getTableModel() { public FunctionTableModel getTableModel() {
return model; return model;
} }
/**
* Returns the underlying table.
* @return table
*/
public GhidraTable getTable() {
return table;
}
} }

View File

@@ -43,6 +43,7 @@ import ghidra.program.model.listing.*;
import ghidra.program.util.FunctionLocation; import ghidra.program.util.FunctionLocation;
import ghidra.program.util.ProgramLocation; import ghidra.program.util.ProgramLocation;
import ghidra.util.*; import ghidra.util.*;
import ghidra.util.table.actions.MakeProgramSelectionAction;
import ghidra.util.task.SwingUpdateManager; import ghidra.util.task.SwingUpdateManager;
import resources.ResourceManager; import resources.ResourceManager;
@@ -107,6 +108,8 @@ public class FunctionTagProvider extends ComponentProviderAdapter implements Dom
// this we would need to reload from file on each new program activation. // this we would need to reload from file on each new program activation.
private Set<FunctionTag> tagsFromFile; private Set<FunctionTag> tagsFromFile;
private FunctionTagPlugin plugin;
/** /**
* Constructor * Constructor
* *
@@ -115,18 +118,26 @@ public class FunctionTagProvider extends ComponentProviderAdapter implements Dom
*/ */
public FunctionTagProvider(FunctionTagPlugin plugin, Program program) { public FunctionTagProvider(FunctionTagPlugin plugin, Program program) {
super(plugin.getTool(), "Function Tags", plugin.getName(), ProgramActionContext.class); super(plugin.getTool(), "Function Tags", plugin.getName(), ProgramActionContext.class);
this.plugin = plugin;
setHelpLocation(new HelpLocation(plugin.getName(), plugin.getName())); setHelpLocation(new HelpLocation(plugin.getName(), plugin.getName()));
this.program = program; this.program = program;
mainPanel = createWorkPanel(); mainPanel = createWorkPanel();
addToTool(); addToTool();
createActions();
} }
@Override @Override
public void componentShown() { public void componentShown() {
updateView(); updateView();
} }
@Override
public void componentHidden() {
allFunctionsPanel.getTable().clearSelection();
}
@Override @Override
public JComponent getComponent() { public JComponent getComponent() {
return mainPanel; return mainPanel;
@@ -406,7 +417,6 @@ public class FunctionTagProvider extends ComponentProviderAdapter implements Dom
if (!sTags.isEmpty()) { if (!sTags.isEmpty()) {
allFunctionsPanel.refresh(sTags); allFunctionsPanel.refresh(sTags);
} }
Function function = getFunction(currentLocation); Function function = getFunction(currentLocation);
sourcePanel.refresh(function); sourcePanel.refresh(function);
targetPanel.refresh(function); targetPanel.refresh(function);
@@ -495,4 +505,10 @@ public class FunctionTagProvider extends ComponentProviderAdapter implements Dom
return inputPanel; return inputPanel;
} }
private void createActions() {
tool.addLocalAction(this,
new MakeProgramSelectionAction(plugin, allFunctionsPanel.getTable()));
}
} }