GT-2925 - Key Bindings - Support Window Menu Provider Key Bindings -

Step 3 - removed old plugin pattern of creating special actions to show
their respective providers; updated inception information for new action
This commit is contained in:
dragonmacher 2019-06-26 15:30:34 -04:00
parent f510ddf338
commit fa75f7dff6
32 changed files with 296 additions and 425 deletions

View file

@ -8,7 +8,7 @@
</head>
<body lang="EN-US">
<h1><a name="ByteViewerPlugin"></a><a name="Byte_Viewer"></a>The Byte Viewer </h1>
<h1><a name="ByteViewerPlugin"></a><a name="Bytes"></a>The Byte Viewer </h1>
<p>The Byte Viewer displays bytes in memory in various formats, e.g.,
Hex, Ascii, Octal, etc.&nbsp;The figure below shows the Byte Viewer
plugin in a separate window from the

View file

@ -19,9 +19,6 @@ import java.util.*;
import org.jdom.Element;
import docking.ActionContext;
import docking.action.DockingAction;
import docking.action.ToolBarData;
import ghidra.app.CorePluginPackage;
import ghidra.app.events.*;
import ghidra.app.plugin.PluginCategoryNames;
@ -35,7 +32,6 @@ import ghidra.program.model.listing.Program;
import ghidra.program.util.ProgramLocation;
import ghidra.program.util.ProgramSelection;
import ghidra.util.SystemUtilities;
import resources.ResourceManager;
import utility.function.Callback;
/**
@ -73,23 +69,6 @@ public class ByteViewerPlugin extends Plugin {
super(tool);
connectedProvider = new ProgramByteViewerComponentProvider(tool, this, true);
createActions();
}
private void createActions() {
DockingAction action = new DockingAction("Byte Viewer", getName()) {
@Override
public void actionPerformed(ActionContext context) {
showConnectedProvider();
}
};
action.setToolBarData(
new ToolBarData(ResourceManager.loadImage("images/binaryData.gif"), "View"));
action.setDescription("Display Bytes");
action.setEnabled(true);
tool.addAction(action);
}
protected void showConnectedProvider() {

View file

@ -71,8 +71,10 @@ public class ProgramByteViewerComponentProvider extends ByteViewerComponentProvi
boolean isConnected) {
super(tool, plugin, "Bytes", ByteViewerActionContext.class);
this.isConnected = isConnected;
decorationComponent = new DecoratorPanel(panel, isConnected);
setIcon(ResourceManager.loadImage("images/binaryData.gif"), true);
decorationComponent = new DecoratorPanel(panel, isConnected);
clipboardProvider = new ByteViewerClipboardProvider(this, tool);
addToTool();
@ -503,7 +505,8 @@ public class ProgramByteViewerComponentProvider extends ByteViewerComponentProvi
}
/**
* Gets the text of the current {@link ProgramSelection}.
* Gets the text of the current {@link ProgramSelection}
* @return the text
*/
String getCurrentTextSelection() {
return panel.getCurrentComponent().getTextForSelection();