mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 10:49:34 +02:00
GT-2869 - Key Bindings - refactor of methods to provide all actions
This commit is contained in:
parent
c1de98304a
commit
43fa7e3f92
75 changed files with 1243 additions and 1049 deletions
|
@ -17,9 +17,11 @@ package ghidra.feature.vt.gui.plugin;
|
|||
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import docking.action.DockingActionIf;
|
||||
import docking.help.Help;
|
||||
import docking.help.HelpService;
|
||||
import docking.wizard.WizardManager;
|
||||
|
@ -121,14 +123,29 @@ public class VTPlugin extends Plugin {
|
|||
createActions();
|
||||
registerServiceProvided(VTController.class, controller);
|
||||
tool.setUnconfigurable();
|
||||
tool.removeAction(tool.getDockingActionsByFullActionName("Save Tool As (Tool)").get(0));
|
||||
tool.removeAction(tool.getDockingActionsByFullActionName("Export Tool (Tool)").get(0));
|
||||
|
||||
DockingActionIf saveAs = getToolAction("Save Tool As");
|
||||
tool.removeAction(saveAs);
|
||||
|
||||
DockingActionIf export = getToolAction("Export Tool");
|
||||
tool.removeAction(export);
|
||||
|
||||
new MatchStatusUpdaterAssociationHook(controller);
|
||||
new ImpliedMatchAssociationHook(controller);
|
||||
|
||||
initializeOptions();
|
||||
}
|
||||
|
||||
private DockingActionIf getToolAction(String actionName) {
|
||||
Set<DockingActionIf> actions = tool.getDockingActionsByOwnerName("Tool");
|
||||
for (DockingActionIf action : actions) {
|
||||
if (action.getName().equals(actionName)) {
|
||||
return action;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unable to find Tool action '" + actionName + "'");
|
||||
}
|
||||
|
||||
private void initializeOptions() {
|
||||
Options options = tool.getOptions(GhidraOptions.CATEGORY_BROWSER_DISPLAY);
|
||||
options.registerOptionsEditor(new ListingDisplayOptionsEditor(this, options));
|
||||
|
|
|
@ -17,8 +17,7 @@ package ghidra.feature.vt.gui.plugin;
|
|||
|
||||
import java.awt.Component;
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
|
@ -27,6 +26,7 @@ import org.jdom.output.XMLOutputter;
|
|||
|
||||
import docking.ActionContext;
|
||||
import docking.action.*;
|
||||
import docking.tool.util.DockingToolConstants;
|
||||
import docking.widgets.OptionDialog;
|
||||
import docking.widgets.fieldpanel.FieldPanel;
|
||||
import docking.widgets.fieldpanel.support.FieldSelection;
|
||||
|
@ -153,17 +153,17 @@ public class VTSubToolManager implements VTControllerListener, OptionsChangeList
|
|||
catch (PluginException e) {
|
||||
Msg.error(this, "Failed to create subordinate tool: " + toolName);
|
||||
}
|
||||
|
||||
newTool.setToolName(toolName);
|
||||
newTool.removeAction(newTool.getDockingActionsByFullActionName("Save Tool (Tool)").get(0));
|
||||
newTool.removeAction(
|
||||
newTool.getDockingActionsByFullActionName("Save Tool As (Tool)").get(0));
|
||||
// newTool.removeAction(newTool.getDockableActionsByFullActionName("Export
|
||||
// Tool (Tool)").get(0));
|
||||
|
||||
DockingActionIf save = getToolAction(newTool, "Save Tool");
|
||||
newTool.removeAction(save);
|
||||
|
||||
createMarkupActions(newTool);
|
||||
|
||||
newTool.setConfigChanged(false);
|
||||
|
||||
ToolOptions options = newTool.getOptions(ToolConstants.KEY_BINDINGS);
|
||||
ToolOptions options = newTool.getOptions(DockingToolConstants.KEY_BINDINGS);
|
||||
options.addOptionsChangeListener(this);
|
||||
|
||||
// custom VT actions
|
||||
|
@ -172,6 +172,16 @@ public class VTSubToolManager implements VTControllerListener, OptionsChangeList
|
|||
return newTool;
|
||||
}
|
||||
|
||||
private DockingActionIf getToolAction(Tool tool, String actionName) {
|
||||
Set<DockingActionIf> actions = tool.getDockingActionsByOwnerName("Tool");
|
||||
for (DockingActionIf action : actions) {
|
||||
if (action.getName().equals(actionName)) {
|
||||
return action;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unable to find Tool action '" + actionName + "'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void optionsChanged(ToolOptions options, String optionName, Object oldValue,
|
||||
Object newValue) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue