mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-27 09:37:05 +08:00
Merge remote-tracking branch 'origin/GT-2925-dragonmacher-window-menu-key-bindings'
This commit is contained in:
@@ -73,14 +73,15 @@ public class SampleProgramTreePlugin extends ProgramPlugin {
|
|||||||
public void actionPerformed(ActionContext context) {
|
public void actionPerformed(ActionContext context) {
|
||||||
modularize();
|
modularize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabledForContext(ActionContext context) {
|
||||||
|
return currentProgram != null;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
action.setMenuBarData(
|
action.setMenuBarData(
|
||||||
new MenuData(new String[] { "Misc", "Create Sample Tree" }, null, null));
|
new MenuData(new String[] { "Misc", "Create Sample Tree" }, null, null));
|
||||||
|
|
||||||
action.setEnabled(false);
|
|
||||||
|
|
||||||
action.setDescription("Plugin to create a program tree and modularize accordingly");
|
action.setDescription("Plugin to create a program tree and modularize accordingly");
|
||||||
enableOnProgram(action);
|
|
||||||
tool.addAction(action);
|
tool.addAction(action);
|
||||||
|
|
||||||
}// end of createActions()
|
}// end of createActions()
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ import ghidra.program.util.ProgramChangeRecord;
|
|||||||
import ghidra.util.HelpLocation;
|
import ghidra.util.HelpLocation;
|
||||||
import ghidra.util.Msg;
|
import ghidra.util.Msg;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sample plugin for dealing with Programs. The base class handles
|
* Sample plugin for dealing with Programs. The base class handles
|
||||||
* the event processing and enabling/disabling of actions. This
|
* the event processing and enabling/disabling of actions. This
|
||||||
@@ -51,107 +50,98 @@ import ghidra.util.Msg;
|
|||||||
//@formatter:on
|
//@formatter:on
|
||||||
public class TemplateProgramPlugin extends ProgramPlugin implements DomainObjectListener {
|
public class TemplateProgramPlugin extends ProgramPlugin implements DomainObjectListener {
|
||||||
|
|
||||||
private DockingAction action;
|
private DockingAction action;
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
*
|
*
|
||||||
* Standard Plugin Constructor
|
* Standard Plugin Constructor
|
||||||
*
|
*
|
||||||
*******************************************************************/
|
*******************************************************************/
|
||||||
public TemplateProgramPlugin(PluginTool tool) {
|
public TemplateProgramPlugin(PluginTool tool) {
|
||||||
|
|
||||||
super(tool,
|
super(tool, true, // true means this plugin consumes ProgramLocation events
|
||||||
true, // true means this plugin consumes ProgramLocation events
|
false); // false means this plugin does not consume
|
||||||
false); // false means this plugin does not consume
|
// ProgramSelection events
|
||||||
// ProgramSelection events
|
// the base class ProgramPlugin handles all the event registering
|
||||||
// the base class ProgramPlugin handles all the event registering
|
|
||||||
|
|
||||||
// set up list of actions.
|
// set up list of actions.
|
||||||
setupActions();
|
setupActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This is the callback method for DomainObjectChangedEvents.
|
|
||||||
*/
|
|
||||||
public void domainObjectChanged(DomainObjectChangedEvent ev) {
|
|
||||||
for (int i=0; i< ev.numRecords(); i++) {
|
|
||||||
DomainObjectChangeRecord record = ev.getChangeRecord(i);
|
|
||||||
if (record instanceof ProgramChangeRecord) {
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
ProgramChangeRecord r = (ProgramChangeRecord)record;
|
|
||||||
// code for processing the record...
|
|
||||||
// ...
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the program is opened.
|
* This is the callback method for DomainObjectChangedEvents.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void programActivated(Program program) {
|
public void domainObjectChanged(DomainObjectChangedEvent ev) {
|
||||||
program.addListener(this);
|
for (int i = 0; i < ev.numRecords(); i++) {
|
||||||
}
|
DomainObjectChangeRecord record = ev.getChangeRecord(i);
|
||||||
/**
|
if (record instanceof ProgramChangeRecord) {
|
||||||
* Called when the program is closed.
|
@SuppressWarnings("unused")
|
||||||
*/
|
ProgramChangeRecord r = (ProgramChangeRecord) record;
|
||||||
@Override
|
// code for processing the record...
|
||||||
protected void programDeactivated(Program program) {
|
// ...
|
||||||
program.removeListener(this);
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*******************************************************************
|
/**
|
||||||
********************************************************************
|
* Called when the program is opened.
|
||||||
**
|
*/
|
||||||
**
|
@Override
|
||||||
** Function 1
|
protected void programActivated(Program program) {
|
||||||
**
|
program.addListener(this);
|
||||||
**
|
}
|
||||||
********************************************************************
|
|
||||||
*******************************************************************/
|
|
||||||
private void Function_1 () {
|
|
||||||
// do something with a program location
|
|
||||||
Msg.info(this, getPluginDescription().getName()
|
|
||||||
+ ": Program Location==> " + currentLocation.getAddress());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the program is closed.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void programDeactivated(Program program) {
|
||||||
|
program.removeListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/*******************************************************************
|
||||||
* Set up Actions
|
********************************************************************
|
||||||
*/
|
**
|
||||||
private void setupActions() {
|
**
|
||||||
|
** Function 1
|
||||||
|
**
|
||||||
|
**
|
||||||
|
********************************************************************
|
||||||
|
*******************************************************************/
|
||||||
|
private void Function_1() {
|
||||||
|
// do something with a program location
|
||||||
|
Msg.info(this, getPluginDescription().getName() + ": Program Location==> " +
|
||||||
|
currentLocation.getAddress());
|
||||||
|
}
|
||||||
|
|
||||||
//
|
/**
|
||||||
// Function 1
|
* Set up Actions
|
||||||
//
|
*/
|
||||||
action = new DockingAction("Function 1 Code", getName() ) {
|
private void setupActions() {
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionContext e) {
|
|
||||||
Function_1();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isValidContext( ActionContext context ) {
|
|
||||||
return context instanceof ListingActionContext;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
action.setEnabled( false );
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Function 1
|
||||||
|
//
|
||||||
|
action = new DockingAction("Function 1 Code", getName()) {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionContext e) {
|
||||||
|
Function_1();
|
||||||
|
}
|
||||||
|
|
||||||
action.setMenuBarData( new MenuData(
|
@Override
|
||||||
new String[]{"Misc", "Menu","Menu item 1"}, null, null ) );
|
public boolean isValidContext(ActionContext context) {
|
||||||
|
return context instanceof ListingActionContext;
|
||||||
|
}
|
||||||
// call method in base class to enable this action when a
|
};
|
||||||
// program location event comes in; disable it when focus is
|
action.setEnabled(false);
|
||||||
// lost; it will be disable when the program is closed
|
|
||||||
enableOnLocation(action);
|
|
||||||
|
|
||||||
action.setHelpLocation(new HelpLocation("SampleHelpTopic",
|
|
||||||
"TemplateProgramPlugin_Anchor_Name"));
|
|
||||||
tool.addAction(action);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
action.setMenuBarData(
|
||||||
|
new MenuData(new String[] { "Misc", "Menu", "Menu item 1" }, null, null));
|
||||||
|
|
||||||
|
action.setHelpLocation(
|
||||||
|
new HelpLocation("SampleHelpTopic", "TemplateProgramPlugin_Anchor_Name"));
|
||||||
|
tool.addAction(action);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-8
@@ -1,6 +1,5 @@
|
|||||||
/* ###
|
/* ###
|
||||||
* IP: GHIDRA
|
* IP: GHIDRA
|
||||||
* REVIEWED: YES
|
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -23,20 +22,18 @@ import ghidra.program.model.address.AddressSetView;
|
|||||||
import ghidra.program.model.listing.Function;
|
import ghidra.program.model.listing.Function;
|
||||||
import ghidra.program.model.listing.FunctionIterator;
|
import ghidra.program.model.listing.FunctionIterator;
|
||||||
|
|
||||||
public class DeleteFunctionDefaultPlates extends GhidraScript {
|
public class DeleteFunctionDefaultPlatesScript extends GhidraScript {
|
||||||
|
|
||||||
private static String DEFAULT_PLATE = " FUNCTION";
|
private static String DEFAULT_PLATE = " FUNCTION";
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see ghidra.app.script.GhidraScript#run()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void run() throws Exception {
|
public void run() throws Exception {
|
||||||
|
|
||||||
AddressSetView set = currentProgram.getMemory();
|
AddressSetView set = currentProgram.getMemory();
|
||||||
if (currentSelection != null && !currentSelection.isEmpty()) {
|
if (currentSelection != null && !currentSelection.isEmpty()) {
|
||||||
set = currentSelection;
|
set = currentSelection;
|
||||||
}
|
}
|
||||||
int updateCount=0;
|
int updateCount = 0;
|
||||||
FunctionIterator iter = currentProgram.getFunctionManager().getFunctions(set, true);
|
FunctionIterator iter = currentProgram.getFunctionManager().getFunctions(set, true);
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
Function function = iter.next();
|
Function function = iter.next();
|
||||||
@@ -47,7 +44,7 @@ public class DeleteFunctionDefaultPlates extends GhidraScript {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (updateCount > 0) {
|
if (updateCount > 0) {
|
||||||
String cmt = updateCount > 1? "comments" : "comment";
|
String cmt = updateCount > 1 ? "comments" : "comment";
|
||||||
println("Removed " + updateCount + " default plate " + cmt + ".");
|
println("Removed " + updateCount + " default plate " + cmt + ".");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
</HEAD>
|
</HEAD>
|
||||||
|
|
||||||
<BODY>
|
<BODY>
|
||||||
<H1><A name="Code_Browser"></A>Listing View</H1>
|
<H1><A name="Code_Browser"></A><A name="Listing"></A>Listing View</H1>
|
||||||
|
|
||||||
<P>The Listing View is the main windows for displaying and working with a program's instruction
|
<P>The Listing View is the main windows for displaying and working with a program's instruction
|
||||||
and data.</P>
|
and data.</P>
|
||||||
|
|||||||
@@ -476,6 +476,17 @@
|
|||||||
|
|
||||||
<P class="providedbyplugin">Provided by: <I>Go To Next-Previous Code Unit</I> plugin</P>
|
<P class="providedbyplugin">Provided by: <I>Go To Next-Previous Code Unit</I> plugin</P>
|
||||||
</BLOCKQUOTE>
|
</BLOCKQUOTE>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
This file is different than most, since it has multiple plugins contributing to the
|
||||||
|
content. Add some space at the bottom of the file to separate this last contribution
|
||||||
|
-->
|
||||||
|
<BR>
|
||||||
|
<BR>
|
||||||
|
<BR>
|
||||||
|
<BR>
|
||||||
|
<BR>
|
||||||
|
<BR>
|
||||||
|
|
||||||
<H2><A name="Next_Previous_Function"></A>Next/Previous Function</H2>
|
<H2><A name="Next_Previous_Function"></A>Next/Previous Function</H2>
|
||||||
|
|
||||||
@@ -497,8 +508,21 @@
|
|||||||
<P> This action navigates the cursor to the closest function entry point that is at an
|
<P> This action navigates the cursor to the closest function entry point that is at an
|
||||||
address less than the current address. The default keybinding is <TT><B>Control-Up Arrow</B></TT>.</P>
|
address less than the current address. The default keybinding is <TT><B>Control-Up Arrow</B></TT>.</P>
|
||||||
</BLOCKQUOTE>
|
</BLOCKQUOTE>
|
||||||
</BLOCKQUOTE>
|
|
||||||
<P class="providedbyplugin">Provided by: <I>CodeBrowser</I> plugin</P>
|
<P class="providedbyplugin">Provided by: <I>CodeBrowser</I> plugin</P>
|
||||||
|
</BLOCKQUOTE>
|
||||||
|
|
||||||
|
|
||||||
|
<!--
|
||||||
|
This file is different than most, since it has multiple plugins contributing to the
|
||||||
|
content. Add some space at the bottom of the file to separate this last contribution
|
||||||
|
-->
|
||||||
|
<BR>
|
||||||
|
<BR>
|
||||||
|
<BR>
|
||||||
|
<BR>
|
||||||
|
<BR>
|
||||||
|
<BR>
|
||||||
|
|
||||||
<H2><A name="Navigation_History"></A>Navigation History</H2>
|
<H2><A name="Navigation_History"></A>Navigation History</H2>
|
||||||
|
|
||||||
@@ -554,9 +578,54 @@
|
|||||||
<P>After clearing the history, the <IMG src="images/left.png" border="0"> and <IMG
|
<P>After clearing the history, the <IMG src="images/left.png" border="0"> and <IMG
|
||||||
src="images/right.png" border="0"> buttons are disabled</P>
|
src="images/right.png" border="0"> buttons are disabled</P>
|
||||||
</BLOCKQUOTE>
|
</BLOCKQUOTE>
|
||||||
</BLOCKQUOTE>
|
|
||||||
|
<P class="providedbyplugin">Provided by: <I>Next/Previous</I> plugin</P>
|
||||||
|
</BLOCKQUOTE>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
This file is different than most, since it has multiple plugins contributing to the
|
||||||
|
content. Add some space at the bottom of the file to separate this contribution.
|
||||||
|
-->
|
||||||
|
<BR>
|
||||||
|
<BR>
|
||||||
|
<BR>
|
||||||
|
<BR>
|
||||||
|
<BR>
|
||||||
|
<BR>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<H2>Component Provider Navigation</H2>
|
||||||
|
|
||||||
|
<BLOCKQUOTE>
|
||||||
|
<P>
|
||||||
|
This section lists actions that allow the user to navigate between component providers.
|
||||||
|
</P>
|
||||||
|
|
||||||
|
<H3><A name="Navigation_Previous_Provider"></A>Go To Last Active Component</H3>
|
||||||
|
|
||||||
|
<BLOCKQUOTE>
|
||||||
|
<P>
|
||||||
|
Allows the user to switch focus back to the previously focused component provider.
|
||||||
|
</P>
|
||||||
|
</BLOCKQUOTE>
|
||||||
|
|
||||||
|
<P class="providedbyplugin">Provided by: <I>ProviderNavigation</I> plugin</P>
|
||||||
|
</BLOCKQUOTE>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
This file is different than most, since it has multiple plugins contributing to the
|
||||||
|
content. Add some space at the bottom of the file to separate this contribution.
|
||||||
|
-->
|
||||||
|
<BR>
|
||||||
|
<BR>
|
||||||
|
<BR>
|
||||||
|
<BR>
|
||||||
|
<BR>
|
||||||
|
<BR>
|
||||||
|
|
||||||
|
|
||||||
<P class="providedbyplugin">Provided by: <I>Next/Previous</I> plugin</P>
|
|
||||||
|
|
||||||
<P class="relatedtopic">Related Topics:</P>
|
<P class="relatedtopic">Related Topics:</P>
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
completely different instruction sets. To disassemble properly, the mode register must be set
|
completely different instruction sets. To disassemble properly, the mode register must be set
|
||||||
at the address where the disassembly begins.</P>
|
at the address where the disassembly begins.</P>
|
||||||
|
|
||||||
<H2><A name="RegisterManager"></A>Register Manager</H2>
|
<H2><A name="Register_Manager"></A>Register Manager</H2>
|
||||||
|
|
||||||
<BLOCKQUOTE>
|
<BLOCKQUOTE>
|
||||||
<P>The <I>Register Manager</I> displays the assigned values of registers at addresses within
|
<P>The <I>Register Manager</I> displays the assigned values of registers at addresses within
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import javax.swing.ToolTipManager;
|
|||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import docking.DockingWindowManager;
|
|
||||||
import docking.framework.SplashScreen;
|
import docking.framework.SplashScreen;
|
||||||
import ghidra.base.help.GhidraHelpService;
|
import ghidra.base.help.GhidraHelpService;
|
||||||
import ghidra.framework.Application;
|
import ghidra.framework.Application;
|
||||||
@@ -86,7 +85,6 @@ public class GhidraRun implements GhidraLaunchable {
|
|||||||
updateSplashScreenStatusMessage("Populating Ghidra help...");
|
updateSplashScreenStatusMessage("Populating Ghidra help...");
|
||||||
GhidraHelpService.install();
|
GhidraHelpService.install();
|
||||||
|
|
||||||
DockingWindowManager.enableDiagnosticActions(SystemUtilities.isInDevelopmentMode());
|
|
||||||
ExtensionUtils.cleanupUninstalledExtensions();
|
ExtensionUtils.cleanupUninstalledExtensions();
|
||||||
|
|
||||||
// Allows handling of old content which did not have a content type property
|
// Allows handling of old content which did not have a content type property
|
||||||
|
|||||||
+2
-8
@@ -22,8 +22,7 @@ import javax.swing.KeyStroke;
|
|||||||
|
|
||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
import docking.DockingUtils;
|
import docking.DockingUtils;
|
||||||
import docking.action.DockingAction;
|
import docking.action.*;
|
||||||
import docking.action.KeyBindingData;
|
|
||||||
import ghidra.app.plugin.core.navigation.FindAppliedDataTypesService;
|
import ghidra.app.plugin.core.navigation.FindAppliedDataTypesService;
|
||||||
import ghidra.app.plugin.core.navigation.locationreferences.ReferenceUtils;
|
import ghidra.app.plugin.core.navigation.locationreferences.ReferenceUtils;
|
||||||
import ghidra.framework.plugintool.PluginTool;
|
import ghidra.framework.plugintool.PluginTool;
|
||||||
@@ -44,7 +43,7 @@ public abstract class AbstractFindReferencesDataTypeAction extends DockingAction
|
|||||||
|
|
||||||
protected AbstractFindReferencesDataTypeAction(PluginTool tool, String name, String owner,
|
protected AbstractFindReferencesDataTypeAction(PluginTool tool, String name, String owner,
|
||||||
KeyStroke defaultKeyStroke) {
|
KeyStroke defaultKeyStroke) {
|
||||||
super(name, owner);
|
super(name, owner, KeyBindingType.SHARED);
|
||||||
this.tool = tool;
|
this.tool = tool;
|
||||||
|
|
||||||
setHelpLocation(new HelpLocation("LocationReferencesPlugin", "Data_Types"));
|
setHelpLocation(new HelpLocation("LocationReferencesPlugin", "Data_Types"));
|
||||||
@@ -69,11 +68,6 @@ public abstract class AbstractFindReferencesDataTypeAction extends DockingAction
|
|||||||
setKeyBindingData(new KeyBindingData(keyStroke));
|
setKeyBindingData(new KeyBindingData(keyStroke));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean usesSharedKeyBinding() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEnabledForContext(ActionContext context) {
|
public boolean isEnabledForContext(ActionContext context) {
|
||||||
DataType dataType = getDataType(context);
|
DataType dataType = getDataType(context);
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
/* ###
|
/* ###
|
||||||
* IP: GHIDRA
|
* IP: GHIDRA
|
||||||
* REVIEWED: YES
|
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -16,28 +15,28 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.context;
|
package ghidra.app.context;
|
||||||
|
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
import docking.action.DockingAction;
|
import docking.action.DockingAction;
|
||||||
|
import docking.action.KeyBindingType;
|
||||||
|
|
||||||
public abstract class ListingContextAction extends DockingAction {
|
public abstract class ListingContextAction extends DockingAction {
|
||||||
|
|
||||||
public ListingContextAction(String name, String owner) {
|
public ListingContextAction(String name, String owner) {
|
||||||
this(name, owner, true);
|
super(name, owner);
|
||||||
}
|
|
||||||
|
|
||||||
public ListingContextAction(String name, String owner, boolean isKeyBindingManaged) {
|
|
||||||
super(name, owner, isKeyBindingManaged);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ListingContextAction(String name, String owner, KeyBindingType kbType) {
|
||||||
|
super(name, owner, kbType);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEnabledForContext(ActionContext context) {
|
public boolean isEnabledForContext(ActionContext context) {
|
||||||
if (!(context instanceof ListingActionContext)) {
|
if (!(context instanceof ListingActionContext)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return isEnabledForContext((ListingActionContext)context);
|
return isEnabledForContext((ListingActionContext) context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -45,38 +44,38 @@ public abstract class ListingContextAction extends DockingAction {
|
|||||||
if (!(context instanceof ListingActionContext)) {
|
if (!(context instanceof ListingActionContext)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return isValidContext((ListingActionContext)context);
|
return isValidContext((ListingActionContext) context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAddToPopup(ActionContext context) {
|
public boolean isAddToPopup(ActionContext context) {
|
||||||
if (!(context instanceof ListingActionContext)) {
|
if (!(context instanceof ListingActionContext)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return isAddToPopup((ListingActionContext)context);
|
return isAddToPopup((ListingActionContext) context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionContext context) {
|
public void actionPerformed(ActionContext context) {
|
||||||
actionPerformed((ListingActionContext)context);
|
actionPerformed((ListingActionContext) context);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isAddToPopup(ListingActionContext context) {
|
protected boolean isAddToPopup(ListingActionContext context) {
|
||||||
return isEnabledForContext( context );
|
return isEnabledForContext(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isValidContext(ListingActionContext context) {
|
protected boolean isValidContext(ListingActionContext context) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isEnabledForContext(ListingActionContext context) {
|
protected boolean isEnabledForContext(ListingActionContext context) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void actionPerformed(ListingActionContext context) {
|
protected void actionPerformed(ListingActionContext context) {
|
||||||
|
// clients need to override this method
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldAddToWindow(boolean isMainWindow, Set<Class<?>> contextTypes) {
|
public boolean shouldAddToWindow(boolean isMainWindow, Set<Class<?>> contextTypes) {
|
||||||
for (Class<?> class1 : contextTypes) {
|
for (Class<?> class1 : contextTypes) {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
/* ###
|
/* ###
|
||||||
* IP: GHIDRA
|
* IP: GHIDRA
|
||||||
* REVIEWED: YES
|
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -16,6 +15,10 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.plugin;
|
package ghidra.app.plugin;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import docking.ActionContext;
|
||||||
|
import docking.action.DockingAction;
|
||||||
import ghidra.app.events.*;
|
import ghidra.app.events.*;
|
||||||
import ghidra.app.services.GoToService;
|
import ghidra.app.services.GoToService;
|
||||||
import ghidra.framework.plugintool.*;
|
import ghidra.framework.plugintool.*;
|
||||||
@@ -25,10 +28,6 @@ import ghidra.program.model.listing.*;
|
|||||||
import ghidra.program.util.ProgramLocation;
|
import ghidra.program.util.ProgramLocation;
|
||||||
import ghidra.program.util.ProgramSelection;
|
import ghidra.program.util.ProgramSelection;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import docking.action.DockingAction;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class to handle common program events: Program Open/Close,
|
* Base class to handle common program events: Program Open/Close,
|
||||||
* Program Location, Program Selection, and Program Highlight.
|
* Program Location, Program Selection, and Program Highlight.
|
||||||
@@ -87,10 +86,10 @@ public abstract class ProgramPlugin extends Plugin {
|
|||||||
}
|
}
|
||||||
registerEventConsumed(ProgramOpenedPluginEvent.class);
|
registerEventConsumed(ProgramOpenedPluginEvent.class);
|
||||||
registerEventConsumed(ProgramClosedPluginEvent.class);
|
registerEventConsumed(ProgramClosedPluginEvent.class);
|
||||||
programActionList = new ArrayList<DockingAction>(3);
|
programActionList = new ArrayList<>(3);
|
||||||
locationActionList = new ArrayList<DockingAction>(3);
|
locationActionList = new ArrayList<>(3);
|
||||||
selectionActionList = new ArrayList<DockingAction>(3);
|
selectionActionList = new ArrayList<>(3);
|
||||||
highlightActionList = new ArrayList<DockingAction>(3);
|
highlightActionList = new ArrayList<>(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProgramPlugin(PluginTool tool, boolean consumeLocationChange,
|
public ProgramPlugin(PluginTool tool, boolean consumeLocationChange,
|
||||||
@@ -201,7 +200,10 @@ public abstract class ProgramPlugin extends Plugin {
|
|||||||
* the program is closed.
|
* the program is closed.
|
||||||
* @throws IllegalArgumentException if this action was called for
|
* @throws IllegalArgumentException if this action was called for
|
||||||
* another enableOnXXX(PlugAction) method.
|
* another enableOnXXX(PlugAction) method.
|
||||||
|
* @deprecated {@link ActionContext} is now used for action enablement. Deprecated in 9.1; to
|
||||||
|
* be removed no sooner than two versions after that.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
protected void enableOnProgram(DockingAction action) {
|
protected void enableOnProgram(DockingAction action) {
|
||||||
if (locationActionList.contains(action)) {
|
if (locationActionList.contains(action)) {
|
||||||
throw new IllegalArgumentException("Action already added to location action list");
|
throw new IllegalArgumentException("Action already added to location action list");
|
||||||
@@ -222,7 +224,10 @@ public abstract class ProgramPlugin extends Plugin {
|
|||||||
* is null.
|
* is null.
|
||||||
* @throws IllegalArgumentException if this action was called for
|
* @throws IllegalArgumentException if this action was called for
|
||||||
* another enableOnXXX(PlugAction) method.
|
* another enableOnXXX(PlugAction) method.
|
||||||
|
* @deprecated {@link ActionContext} is now used for action enablement. Deprecated in 9.1; to
|
||||||
|
* be removed no sooner than two versions after that.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
protected void enableOnLocation(DockingAction action) {
|
protected void enableOnLocation(DockingAction action) {
|
||||||
if (programActionList.contains(action)) {
|
if (programActionList.contains(action)) {
|
||||||
throw new IllegalArgumentException("Action already added to program action list");
|
throw new IllegalArgumentException("Action already added to program action list");
|
||||||
@@ -243,7 +248,10 @@ public abstract class ProgramPlugin extends Plugin {
|
|||||||
* the selection is null or empty.
|
* the selection is null or empty.
|
||||||
* @throws IllegalArgumentException if this action was called for
|
* @throws IllegalArgumentException if this action was called for
|
||||||
* another enableOnXXX(PlugAction) method.
|
* another enableOnXXX(PlugAction) method.
|
||||||
|
* @deprecated {@link ActionContext} is now used for action enablement. Deprecated in 9.1; to
|
||||||
|
* be removed no sooner than two versions after that.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
protected void enableOnSelection(DockingAction action) {
|
protected void enableOnSelection(DockingAction action) {
|
||||||
if (programActionList.contains(action)) {
|
if (programActionList.contains(action)) {
|
||||||
throw new IllegalArgumentException("Action already added to program action list");
|
throw new IllegalArgumentException("Action already added to program action list");
|
||||||
@@ -263,7 +271,10 @@ public abstract class ProgramPlugin extends Plugin {
|
|||||||
* the highlight is null or empty.
|
* the highlight is null or empty.
|
||||||
* @throws IllegalArgumentException if this action was called for
|
* @throws IllegalArgumentException if this action was called for
|
||||||
* another enableOnXXX(PlugAction) method.
|
* another enableOnXXX(PlugAction) method.
|
||||||
|
* @deprecated {@link ActionContext} is now used for action enablement. Deprecated in 9.1; to
|
||||||
|
* be removed no sooner than two versions after that.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
protected void enableOnHighlight(DockingAction action) {
|
protected void enableOnHighlight(DockingAction action) {
|
||||||
if (programActionList.contains(action)) {
|
if (programActionList.contains(action)) {
|
||||||
throw new IllegalArgumentException("Action already added to program action list");
|
throw new IllegalArgumentException("Action already added to program action list");
|
||||||
@@ -378,8 +389,8 @@ public abstract class ProgramPlugin extends Plugin {
|
|||||||
if (currentProgram == null) {
|
if (currentProgram == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
firePluginEvent(new ProgramSelectionPluginEvent(getName(), new ProgramSelection(set),
|
firePluginEvent(
|
||||||
currentProgram));
|
new ProgramSelectionPluginEvent(getName(), new ProgramSelection(set), currentProgram));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
-19
@@ -22,7 +22,6 @@ import javax.swing.Icon;
|
|||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
import docking.DockingUtils;
|
|
||||||
import docking.action.*;
|
import docking.action.*;
|
||||||
import docking.widgets.table.GTable;
|
import docking.widgets.table.GTable;
|
||||||
import ghidra.app.CorePluginPackage;
|
import ghidra.app.CorePluginPackage;
|
||||||
@@ -72,7 +71,6 @@ public class BookmarkPlugin extends ProgramPlugin
|
|||||||
|
|
||||||
private BookmarkProvider provider;
|
private BookmarkProvider provider;
|
||||||
private DockingAction addAction;
|
private DockingAction addAction;
|
||||||
private DockingAction showAction;
|
|
||||||
private DockingAction deleteAction;
|
private DockingAction deleteAction;
|
||||||
private CreateBookmarkDialog createDialog;
|
private CreateBookmarkDialog createDialog;
|
||||||
private GoToService goToService;
|
private GoToService goToService;
|
||||||
@@ -113,19 +111,6 @@ public class BookmarkPlugin extends ProgramPlugin
|
|||||||
addAction.setEnabled(true);
|
addAction.setEnabled(true);
|
||||||
tool.addAction(addAction);
|
tool.addAction(addAction);
|
||||||
|
|
||||||
showAction = new DockingAction("Show Bookmarks", getName()) {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionContext context) {
|
|
||||||
tool.showComponentProvider(provider, true);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
showAction.setKeyBindingData(
|
|
||||||
new KeyBindingData(KeyEvent.VK_B, DockingUtils.CONTROL_KEY_MODIFIER_MASK));
|
|
||||||
showAction.setToolBarData(new ToolBarData(BookmarkNavigator.NOTE_ICON, "View"));
|
|
||||||
showAction.setDescription("Display All Bookmarks");
|
|
||||||
tool.addAction(showAction);
|
|
||||||
|
|
||||||
MultiIconBuilder builder = new MultiIconBuilder(Icons.CONFIGURE_FILTER_ICON);
|
MultiIconBuilder builder = new MultiIconBuilder(Icons.CONFIGURE_FILTER_ICON);
|
||||||
builder.addLowerRightIcon(ResourceManager.loadImage("images/check.png"));
|
builder.addLowerRightIcon(ResourceManager.loadImage("images/check.png"));
|
||||||
Icon filterTypesChanged = builder.build();
|
Icon filterTypesChanged = builder.build();
|
||||||
@@ -213,10 +198,6 @@ public class BookmarkPlugin extends ProgramPlugin
|
|||||||
addAction.dispose();
|
addAction.dispose();
|
||||||
addAction = null;
|
addAction = null;
|
||||||
}
|
}
|
||||||
if (showAction != null) {
|
|
||||||
showAction.dispose();
|
|
||||||
showAction = null;
|
|
||||||
}
|
|
||||||
if (provider != null) {
|
if (provider != null) {
|
||||||
provider.dispose();
|
provider.dispose();
|
||||||
provider = null;
|
provider = null;
|
||||||
|
|||||||
+6
-2
@@ -17,6 +17,7 @@ package ghidra.app.plugin.core.bookmark;
|
|||||||
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@@ -24,8 +25,8 @@ import javax.swing.*;
|
|||||||
import javax.swing.event.TableModelListener;
|
import javax.swing.event.TableModelListener;
|
||||||
import javax.swing.table.TableColumn;
|
import javax.swing.table.TableColumn;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.*;
|
||||||
import docking.WindowPosition;
|
import docking.action.KeyBindingData;
|
||||||
import docking.widgets.combobox.GhidraComboBox;
|
import docking.widgets.combobox.GhidraComboBox;
|
||||||
import docking.widgets.table.GTable;
|
import docking.widgets.table.GTable;
|
||||||
import ghidra.app.context.ProgramActionContext;
|
import ghidra.app.context.ProgramActionContext;
|
||||||
@@ -58,6 +59,9 @@ public class BookmarkProvider extends ComponentProviderAdapter {
|
|||||||
super(tool, "Bookmarks", plugin.getName(), ProgramActionContext.class);
|
super(tool, "Bookmarks", plugin.getName(), ProgramActionContext.class);
|
||||||
|
|
||||||
setIcon(BookmarkNavigator.NOTE_ICON);
|
setIcon(BookmarkNavigator.NOTE_ICON);
|
||||||
|
addToToolbar();
|
||||||
|
setKeyBinding(new KeyBindingData(KeyEvent.VK_B, DockingUtils.CONTROL_KEY_MODIFIER_MASK));
|
||||||
|
|
||||||
model = new BookmarkTableModel(tool, null);
|
model = new BookmarkTableModel(tool, null);
|
||||||
threadedTablePanel = new GhidraThreadedTablePanel<>(model);
|
threadedTablePanel = new GhidraThreadedTablePanel<>(model);
|
||||||
|
|
||||||
|
|||||||
+30
-16
@@ -62,12 +62,14 @@ public class CallTreePlugin extends ProgramPlugin {
|
|||||||
ResourceManager.loadImage("images/arrow_rotate_clockwise.png");
|
ResourceManager.loadImage("images/arrow_rotate_clockwise.png");
|
||||||
|
|
||||||
private List<CallTreeProvider> providers = new ArrayList<>();
|
private List<CallTreeProvider> providers = new ArrayList<>();
|
||||||
private DockingAction showProviderAction;
|
private DockingAction showCallTreeFromMenuAction;
|
||||||
|
private CallTreeProvider primaryProvider;
|
||||||
|
|
||||||
public CallTreePlugin(PluginTool tool) {
|
public CallTreePlugin(PluginTool tool) {
|
||||||
super(tool, true, false, false);
|
super(tool, true, false, false);
|
||||||
|
|
||||||
createActions();
|
createActions();
|
||||||
|
primaryProvider = new CallTreeProvider(this, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -116,32 +118,44 @@ public class CallTreePlugin extends ProgramPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void createActions() {
|
private void createActions() {
|
||||||
showProviderAction = new DockingAction("Show Function Call Trees", getName()) {
|
|
||||||
|
|
||||||
@Override
|
// use the name of the provider so that the shared key binding data will get used
|
||||||
public void actionPerformed(ActionContext context) {
|
String actionName = CallTreeProvider.TITLE;
|
||||||
showOrCreateNewCallTree(currentLocation);
|
showCallTreeFromMenuAction =
|
||||||
}
|
new DockingAction(actionName, getName(), KeyBindingType.SHARED) {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionContext context) {
|
||||||
|
showOrCreateNewCallTree(currentLocation);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAddToPopup(ActionContext context) {
|
public boolean isAddToPopup(ActionContext context) {
|
||||||
return (context instanceof ListingActionContext);
|
return (context instanceof ListingActionContext);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
showProviderAction.setPopupMenuData(new MenuData(
|
|
||||||
|
showCallTreeFromMenuAction.setPopupMenuData(new MenuData(
|
||||||
new String[] { "References", "Show Call Trees" }, PROVIDER_ICON, "ShowReferencesTo"));
|
new String[] { "References", "Show Call Trees" }, PROVIDER_ICON, "ShowReferencesTo"));
|
||||||
showProviderAction.setToolBarData(new ToolBarData(PROVIDER_ICON, "View"));
|
showCallTreeFromMenuAction.setHelpLocation(
|
||||||
showProviderAction.setHelpLocation(new HelpLocation("CallTreePlugin", "Call_Tree_Plugin"));
|
new HelpLocation("CallTreePlugin", "Call_Tree_Plugin"));
|
||||||
tool.addAction(showProviderAction);
|
tool.addAction(showCallTreeFromMenuAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void creatAndShowProvider() {
|
private void creatAndShowProvider() {
|
||||||
CallTreeProvider provider = new CallTreeProvider(this);
|
CallTreeProvider provider = new CallTreeProvider(this, false);
|
||||||
providers.add(provider);
|
providers.add(provider);
|
||||||
provider.initialize(currentProgram, currentLocation);
|
provider.initialize(currentProgram, currentLocation);
|
||||||
tool.showComponentProvider(provider, true);
|
tool.showComponentProvider(provider, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CallTreeProvider getPrimaryProvider() {
|
||||||
|
return primaryProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
DockingAction getShowCallTreeFromMenuAction() {
|
||||||
|
return showCallTreeFromMenuAction;
|
||||||
|
}
|
||||||
|
|
||||||
ProgramLocation getCurrentLocation() {
|
ProgramLocation getCurrentLocation() {
|
||||||
return currentLocation;
|
return currentLocation;
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-5
@@ -57,7 +57,7 @@ import resources.ResourceManager;
|
|||||||
public class CallTreeProvider extends ComponentProviderAdapter implements DomainObjectListener {
|
public class CallTreeProvider extends ComponentProviderAdapter implements DomainObjectListener {
|
||||||
|
|
||||||
static final String EXPAND_ACTION_NAME = "Fully Expand Selected Nodes";
|
static final String EXPAND_ACTION_NAME = "Fully Expand Selected Nodes";
|
||||||
private static final String TITLE = "Function Call Trees";
|
static final String TITLE = "Function Call Trees";
|
||||||
private static final Icon EMPTY_ICON = ResourceManager.loadImage("images/EmptyIcon16.gif");
|
private static final Icon EMPTY_ICON = ResourceManager.loadImage("images/EmptyIcon16.gif");
|
||||||
private static final Icon EXPAND_ICON = Icons.EXPAND_ALL_ICON;
|
private static final Icon EXPAND_ICON = Icons.EXPAND_ALL_ICON;
|
||||||
private static final Icon COLLAPSE_ICON = Icons.COLLAPSE_ALL_ICON;
|
private static final Icon COLLAPSE_ICON = Icons.COLLAPSE_ALL_ICON;
|
||||||
@@ -74,6 +74,7 @@ public class CallTreeProvider extends ComponentProviderAdapter implements Domain
|
|||||||
private JSplitPane splitPane;
|
private JSplitPane splitPane;
|
||||||
private GTree incomingTree;
|
private GTree incomingTree;
|
||||||
private GTree outgoingTree;
|
private GTree outgoingTree;
|
||||||
|
private boolean isPrimary;
|
||||||
|
|
||||||
private SwingUpdateManager reloadUpdateManager = new SwingUpdateManager(500, () -> doUpdate());
|
private SwingUpdateManager reloadUpdateManager = new SwingUpdateManager(500, () -> doUpdate());
|
||||||
|
|
||||||
@@ -93,20 +94,21 @@ public class CallTreeProvider extends ComponentProviderAdapter implements Domain
|
|||||||
private AtomicInteger recurseDepth = new AtomicInteger();
|
private AtomicInteger recurseDepth = new AtomicInteger();
|
||||||
private NumberIcon recurseIcon;
|
private NumberIcon recurseIcon;
|
||||||
|
|
||||||
public CallTreeProvider(CallTreePlugin plugin) {
|
public CallTreeProvider(CallTreePlugin plugin, boolean isPrimary) {
|
||||||
super(plugin.getTool(), TITLE, plugin.getName());
|
super(plugin.getTool(), TITLE, plugin.getName());
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
this.isPrimary = isPrimary;
|
||||||
|
|
||||||
component = buildComponent();
|
component = buildComponent();
|
||||||
|
|
||||||
// try to give the trees a suitable amount of space by default
|
// try to give the trees a suitable amount of space by default
|
||||||
component.setPreferredSize(new Dimension(800, 400));
|
component.setPreferredSize(new Dimension(800, 400));
|
||||||
|
|
||||||
setTransient();
|
|
||||||
setWindowMenuGroup(TITLE);
|
setWindowMenuGroup(TITLE);
|
||||||
setDefaultWindowPosition(WindowPosition.BOTTOM);
|
setDefaultWindowPosition(WindowPosition.BOTTOM);
|
||||||
|
|
||||||
setIcon(CallTreePlugin.PROVIDER_ICON);
|
setIcon(CallTreePlugin.PROVIDER_ICON);
|
||||||
|
addToToolbar();
|
||||||
setHelpLocation(new HelpLocation(plugin.getName(), "Call_Tree_Plugin"));
|
setHelpLocation(new HelpLocation(plugin.getName(), "Call_Tree_Plugin"));
|
||||||
|
|
||||||
addToTool();
|
addToTool();
|
||||||
@@ -430,7 +432,11 @@ public class CallTreeProvider extends ComponentProviderAdapter implements Domain
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
navigateIncomingToggleAction.setSelected(false);
|
|
||||||
|
// note: the default state is to follow navigation events for the primary provider;
|
||||||
|
// non-primary providers will function like snapshots of the function with
|
||||||
|
// which they were activated.
|
||||||
|
navigateIncomingToggleAction.setSelected(isPrimary);
|
||||||
navigateIncomingToggleAction.setToolBarData(new ToolBarData(
|
navigateIncomingToggleAction.setToolBarData(new ToolBarData(
|
||||||
Icons.NAVIGATE_ON_INCOMING_EVENT_ICON, navigationOptionsToolbarGroup, "2"));
|
Icons.NAVIGATE_ON_INCOMING_EVENT_ICON, navigationOptionsToolbarGroup, "2"));
|
||||||
navigateIncomingToggleAction.setDescription(HTMLUtilities.toHTML("Incoming Navigation" +
|
navigateIncomingToggleAction.setDescription(HTMLUtilities.toHTML("Incoming Navigation" +
|
||||||
@@ -818,7 +824,9 @@ public class CallTreeProvider extends ComponentProviderAdapter implements Domain
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentHidden() {
|
public void componentHidden() {
|
||||||
plugin.removeProvider(this);
|
if (!isPrimary) {
|
||||||
|
plugin.removeProvider(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void reload() {
|
private void reload() {
|
||||||
@@ -869,6 +877,7 @@ public class CallTreeProvider extends ComponentProviderAdapter implements Domain
|
|||||||
// changes, which means we will get here while setting the location, but our program
|
// changes, which means we will get here while setting the location, but our program
|
||||||
// will have been null'ed out.
|
// will have been null'ed out.
|
||||||
currentProgram = plugin.getCurrentProgram();
|
currentProgram = plugin.getCurrentProgram();
|
||||||
|
currentProgram.addListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Function function = plugin.getFunction(location);
|
Function function = plugin.getFunction(location);
|
||||||
|
|||||||
+5
-10
@@ -915,18 +915,13 @@ public class CodeBrowserPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// note: this action gets added later when the TableService is added
|
||||||
tableFromSelectionAction.setEnabled(false);
|
tableFromSelectionAction.setEnabled(false);
|
||||||
tableFromSelectionAction.setMenuBarData(new MenuData(
|
tableFromSelectionAction.setMenuBarData(new MenuData(
|
||||||
new String[] { ToolConstants.MENU_SELECTION, "Create Table From Selection" }, null,
|
new String[] { ToolConstants.MENU_SELECTION, "Create Table From Selection" }, null,
|
||||||
"SelectUtils"));
|
"SelectUtils"));
|
||||||
tableFromSelectionAction
|
tableFromSelectionAction.setHelpLocation(
|
||||||
.setHelpLocation(new HelpLocation("CodeBrowserPlugin", "Selection_Table"));
|
new HelpLocation("CodeBrowserPlugin", "Selection_Table"));
|
||||||
|
|
||||||
// don't add the actions initially if the service isn't there
|
|
||||||
TableService tableService = tool.getService(TableService.class);
|
|
||||||
if (tableService != null) {
|
|
||||||
tool.addAction(tableFromSelectionAction);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private GhidraProgramTableModel<Address> createTableModel(CodeUnitIterator iterator,
|
private GhidraProgramTableModel<Address> createTableModel(CodeUnitIterator iterator,
|
||||||
@@ -1001,8 +996,8 @@ public class CodeBrowserPlugin extends Plugin
|
|||||||
public boolean goToField(Address a, String fieldName, int occurrence, int row, int col,
|
public boolean goToField(Address a, String fieldName, int occurrence, int row, int col,
|
||||||
boolean scroll) {
|
boolean scroll) {
|
||||||
|
|
||||||
boolean result = SystemUtilities
|
boolean result = SystemUtilities.runSwingNow(
|
||||||
.runSwingNow(() -> doGoToField(a, fieldName, occurrence, row, col, scroll));
|
() -> doGoToField(a, fieldName, occurrence, row, col, scroll));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+31
-46
@@ -36,7 +36,6 @@ import docking.widgets.fieldpanel.FieldPanel;
|
|||||||
import docking.widgets.fieldpanel.HoverHandler;
|
import docking.widgets.fieldpanel.HoverHandler;
|
||||||
import docking.widgets.fieldpanel.internal.FieldPanelCoordinator;
|
import docking.widgets.fieldpanel.internal.FieldPanelCoordinator;
|
||||||
import docking.widgets.fieldpanel.support.*;
|
import docking.widgets.fieldpanel.support.*;
|
||||||
import ghidra.GhidraOptions;
|
|
||||||
import ghidra.app.nav.*;
|
import ghidra.app.nav.*;
|
||||||
import ghidra.app.plugin.core.clipboard.CodeBrowserClipboardProvider;
|
import ghidra.app.plugin.core.clipboard.CodeBrowserClipboardProvider;
|
||||||
import ghidra.app.plugin.core.codebrowser.actions.*;
|
import ghidra.app.plugin.core.codebrowser.actions.*;
|
||||||
@@ -54,6 +53,7 @@ import ghidra.program.model.address.*;
|
|||||||
import ghidra.program.model.listing.*;
|
import ghidra.program.model.listing.*;
|
||||||
import ghidra.program.util.*;
|
import ghidra.program.util.*;
|
||||||
import ghidra.util.HelpLocation;
|
import ghidra.util.HelpLocation;
|
||||||
|
import ghidra.util.Swing;
|
||||||
import resources.ResourceManager;
|
import resources.ResourceManager;
|
||||||
|
|
||||||
public class CodeViewerProvider extends NavigatableComponentProviderAdapter
|
public class CodeViewerProvider extends NavigatableComponentProviderAdapter
|
||||||
@@ -62,8 +62,6 @@ public class CodeViewerProvider extends NavigatableComponentProviderAdapter
|
|||||||
|
|
||||||
private static final String TITLE = "Listing: ";
|
private static final String TITLE = "Listing: ";
|
||||||
|
|
||||||
private static final String OPERAND_OPTIONS_PREFIX = GhidraOptions.OPERAND_GROUP_TITLE + ".";
|
|
||||||
|
|
||||||
private static final Icon LISTING_FORMAT_EXPAND_ICON =
|
private static final Icon LISTING_FORMAT_EXPAND_ICON =
|
||||||
ResourceManager.loadImage("images/field.header.down.png");
|
ResourceManager.loadImage("images/field.header.down.png");
|
||||||
private static final Icon LISTING_FORMAT_COLLAPSE_ICON =
|
private static final Icon LISTING_FORMAT_COLLAPSE_ICON =
|
||||||
@@ -92,9 +90,6 @@ public class CodeViewerProvider extends NavigatableComponentProviderAdapter
|
|||||||
private ProgramDropProvider curDropProvider;
|
private ProgramDropProvider curDropProvider;
|
||||||
private ToggleDockingAction toggleHoverAction;
|
private ToggleDockingAction toggleHoverAction;
|
||||||
|
|
||||||
//TODO - Need to improve CodeUnit.getRepresentation format options interface before adding this
|
|
||||||
//TODO private ToggleOperandMarkupAction[] toggleOperandMarkupActions;
|
|
||||||
|
|
||||||
private ProgramLocation currentLocation;
|
private ProgramLocation currentLocation;
|
||||||
|
|
||||||
private ListingPanel otherPanel;
|
private ListingPanel otherPanel;
|
||||||
@@ -117,17 +112,26 @@ public class CodeViewerProvider extends NavigatableComponentProviderAdapter
|
|||||||
private MultiListingLayoutModel multiModel;
|
private MultiListingLayoutModel multiModel;
|
||||||
|
|
||||||
public CodeViewerProvider(CodeBrowserPluginInterface plugin, FormatManager formatMgr,
|
public CodeViewerProvider(CodeBrowserPluginInterface plugin, FormatManager formatMgr,
|
||||||
boolean connected) {
|
boolean isConnected) {
|
||||||
super(plugin.getTool(), plugin.getName(), plugin.getName(), CodeViewerActionContext.class);
|
super(plugin.getTool(), "Listing", plugin.getName(), CodeViewerActionContext.class);
|
||||||
|
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.formatMgr = formatMgr;
|
this.formatMgr = formatMgr;
|
||||||
setConnected(connected);
|
|
||||||
|
setConnected(isConnected);
|
||||||
|
setIcon(ResourceManager.loadImage("images/Browser.gif"));
|
||||||
|
if (!isConnected) {
|
||||||
|
setTransient();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
addToToolbar();
|
||||||
|
}
|
||||||
setHelpLocation(new HelpLocation("CodeBrowserPlugin", "Code_Browser"));
|
setHelpLocation(new HelpLocation("CodeBrowserPlugin", "Code_Browser"));
|
||||||
setDefaultWindowPosition(WindowPosition.RIGHT);
|
setDefaultWindowPosition(WindowPosition.RIGHT);
|
||||||
setIcon(ResourceManager.loadImage("images/Browser.gif"));
|
|
||||||
listingPanel = new ListingPanel(formatMgr);
|
listingPanel = new ListingPanel(formatMgr);
|
||||||
listingPanel.enablePropertyBasedColorModel(true);
|
listingPanel.enablePropertyBasedColorModel(true);
|
||||||
decorationPanel = new ListingPanelContainer(listingPanel, connected);
|
decorationPanel = new ListingPanelContainer(listingPanel, isConnected);
|
||||||
ListingHighlightProvider listingHighlighter =
|
ListingHighlightProvider listingHighlighter =
|
||||||
createListingHighlighter(listingPanel, tool, decorationPanel);
|
createListingHighlighter(listingPanel, tool, decorationPanel);
|
||||||
highlighterAdapter = new ProgramHighlighterProvider(listingHighlighter);
|
highlighterAdapter = new ProgramHighlighterProvider(listingHighlighter);
|
||||||
@@ -136,7 +140,7 @@ public class CodeViewerProvider extends NavigatableComponentProviderAdapter
|
|||||||
setWindowMenuGroup("Listing");
|
setWindowMenuGroup("Listing");
|
||||||
setIntraGroupPosition(WindowPosition.RIGHT);
|
setIntraGroupPosition(WindowPosition.RIGHT);
|
||||||
|
|
||||||
setTitle(connected ? TITLE : "[" + TITLE + "]");
|
setTitle(isConnected ? TITLE : "[" + TITLE + "]");
|
||||||
fieldNavigator = new FieldNavigator(tool, this);
|
fieldNavigator = new FieldNavigator(tool, this);
|
||||||
listingPanel.addButtonPressedListener(fieldNavigator);
|
listingPanel.addButtonPressedListener(fieldNavigator);
|
||||||
addToTool();
|
addToTool();
|
||||||
@@ -150,6 +154,12 @@ public class CodeViewerProvider extends NavigatableComponentProviderAdapter
|
|||||||
tool.addPopupListener(this);
|
tool.addPopupListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSnapshot() {
|
||||||
|
// we are a snapshot when we are 'disconnected'
|
||||||
|
return !isConnected();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true if this listing is backed by a dynamic data source (e.g., debugger)
|
* @return true if this listing is backed by a dynamic data source (e.g., debugger)
|
||||||
*/
|
*/
|
||||||
@@ -399,9 +409,9 @@ public class CodeViewerProvider extends NavigatableComponentProviderAdapter
|
|||||||
}
|
}
|
||||||
|
|
||||||
void updateTitle() {
|
void updateTitle() {
|
||||||
String subTitle = program == null ? "" : program.getDomainFile().getName();
|
String subTitle = program == null ? "" : ' ' + program.getDomainFile().getName();
|
||||||
String newTitle = isConnected() ? TITLE : "[" + TITLE + "]";
|
String newTitle = isConnected() ? TITLE : "[" + TITLE + subTitle + "]";
|
||||||
setTitle(newTitle + subTitle);
|
setTitle(newTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -882,7 +892,7 @@ public class CodeViewerProvider extends NavigatableComponentProviderAdapter
|
|||||||
final ViewerPosition vp = listingPanel.getFieldPanel().getViewerPosition();
|
final ViewerPosition vp = listingPanel.getFieldPanel().getViewerPosition();
|
||||||
// invoke later to give the window manage a chance to create the new window
|
// invoke later to give the window manage a chance to create the new window
|
||||||
// (its done in an invoke later)
|
// (its done in an invoke later)
|
||||||
SwingUtilities.invokeLater(() -> {
|
Swing.runLater(() -> {
|
||||||
newProvider.doSetProgram(program);
|
newProvider.doSetProgram(program);
|
||||||
newProvider.listingPanel.getFieldPanel().setViewerPosition(vp.getIndex(),
|
newProvider.listingPanel.getFieldPanel().setViewerPosition(vp.getIndex(),
|
||||||
vp.getXOffset(), vp.getYOffset());
|
vp.getXOffset(), vp.getYOffset());
|
||||||
@@ -949,7 +959,7 @@ public class CodeViewerProvider extends NavigatableComponentProviderAdapter
|
|||||||
|
|
||||||
class ToggleHeaderAction extends ToggleDockingAction {
|
class ToggleHeaderAction extends ToggleDockingAction {
|
||||||
ToggleHeaderAction() {
|
ToggleHeaderAction() {
|
||||||
super("Toggle Header", CodeViewerProvider.this.getName());
|
super("Toggle Header", plugin.getName());
|
||||||
setEnabled(true);
|
setEnabled(true);
|
||||||
|
|
||||||
setToolBarData(new ToolBarData(LISTING_FORMAT_EXPAND_ICON, "zzz"));
|
setToolBarData(new ToolBarData(LISTING_FORMAT_EXPAND_ICON, "zzz"));
|
||||||
@@ -960,14 +970,14 @@ public class CodeViewerProvider extends NavigatableComponentProviderAdapter
|
|||||||
public void actionPerformed(ActionContext context) {
|
public void actionPerformed(ActionContext context) {
|
||||||
boolean show = !listingPanel.isHeaderShowing();
|
boolean show = !listingPanel.isHeaderShowing();
|
||||||
listingPanel.showHeader(show);
|
listingPanel.showHeader(show);
|
||||||
getToolBarData()
|
getToolBarData().setIcon(
|
||||||
.setIcon(show ? LISTING_FORMAT_COLLAPSE_ICON : LISTING_FORMAT_EXPAND_ICON);
|
show ? LISTING_FORMAT_COLLAPSE_ICON : LISTING_FORMAT_EXPAND_ICON);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ToggleHoverAction extends ToggleDockingAction {
|
private class ToggleHoverAction extends ToggleDockingAction {
|
||||||
ToggleHoverAction() {
|
ToggleHoverAction() {
|
||||||
super("Toggle Mouse Hover Popups", CodeViewerProvider.this.getName());
|
super("Toggle Mouse Hover Popups", CodeViewerProvider.this.getOwner());
|
||||||
setEnabled(true);
|
setEnabled(true);
|
||||||
setToolBarData(new ToolBarData(HOVER_ON_ICON, "yyyz"));
|
setToolBarData(new ToolBarData(HOVER_ON_ICON, "yyyz"));
|
||||||
setSelected(true);
|
setSelected(true);
|
||||||
@@ -987,31 +997,6 @@ public class CodeViewerProvider extends NavigatableComponentProviderAdapter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ToggleOperandMarkupAction extends ToggleDockingAction {
|
|
||||||
final String optionName;
|
|
||||||
|
|
||||||
ToggleOperandMarkupAction(String operandOption) {
|
|
||||||
super(operandOption, CodeViewerProvider.this.getName());
|
|
||||||
this.optionName = OPERAND_OPTIONS_PREFIX + operandOption;
|
|
||||||
boolean state =
|
|
||||||
tool.getOptions(GhidraOptions.CATEGORY_BROWSER_FIELDS).getBoolean(optionName, true);
|
|
||||||
setMenuBarData(new MenuData(new String[] { operandOption }));
|
|
||||||
setSelected(state);
|
|
||||||
setEnabled(true);
|
|
||||||
setHelpLocation(new HelpLocation("CodeBrowserPlugin", "Operands_Field"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getOptionName() {
|
|
||||||
return optionName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionContext context) {
|
|
||||||
boolean state = isSelected();
|
|
||||||
tool.getOptions(GhidraOptions.CATEGORY_BROWSER_FIELDS).setBoolean(optionName, state);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class that allows clients to install transient highlighters while keeping the
|
* A class that allows clients to install transient highlighters while keeping the
|
||||||
* middle-mouse highlighting on at the same time.
|
* middle-mouse highlighting on at the same time.
|
||||||
|
|||||||
+12
-19
@@ -15,8 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.plugin.core.codebrowser.actions;
|
package ghidra.app.plugin.core.codebrowser.actions;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
@@ -24,21 +22,17 @@ import docking.action.DockingAction;
|
|||||||
import ghidra.app.plugin.core.codebrowser.CodeViewerActionContext;
|
import ghidra.app.plugin.core.codebrowser.CodeViewerActionContext;
|
||||||
|
|
||||||
public abstract class CodeViewerContextAction extends DockingAction {
|
public abstract class CodeViewerContextAction extends DockingAction {
|
||||||
|
|
||||||
public CodeViewerContextAction(String name, String owner) {
|
public CodeViewerContextAction(String name, String owner) {
|
||||||
this(name, owner, true);
|
super(name, owner);
|
||||||
}
|
|
||||||
|
|
||||||
public CodeViewerContextAction(String name, String owner, boolean isKeyBindingManaged) {
|
|
||||||
super(name, owner, isKeyBindingManaged);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEnabledForContext(ActionContext context) {
|
public boolean isEnabledForContext(ActionContext context) {
|
||||||
if (!(context instanceof CodeViewerActionContext)) {
|
if (!(context instanceof CodeViewerActionContext)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return isEnabledForContext((CodeViewerActionContext)context);
|
return isEnabledForContext((CodeViewerActionContext) context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -46,26 +40,25 @@ public abstract class CodeViewerContextAction extends DockingAction {
|
|||||||
if (!(context instanceof CodeViewerActionContext)) {
|
if (!(context instanceof CodeViewerActionContext)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return isValidContext((CodeViewerActionContext)context);
|
return isValidContext((CodeViewerActionContext) context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAddToPopup(ActionContext context) {
|
public boolean isAddToPopup(ActionContext context) {
|
||||||
if (!(context instanceof CodeViewerActionContext)) {
|
if (!(context instanceof CodeViewerActionContext)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return isAddToPopup((CodeViewerActionContext)context);
|
return isAddToPopup((CodeViewerActionContext) context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionContext context) {
|
public void actionPerformed(ActionContext context) {
|
||||||
actionPerformed((CodeViewerActionContext)context);
|
actionPerformed((CodeViewerActionContext) context);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isAddToPopup(CodeViewerActionContext context) {
|
protected boolean isAddToPopup(CodeViewerActionContext context) {
|
||||||
return isEnabledForContext( context );
|
return isEnabledForContext(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected boolean isValidContext(CodeViewerActionContext context) {
|
protected boolean isValidContext(CodeViewerActionContext context) {
|
||||||
return true;
|
return true;
|
||||||
@@ -76,9 +69,9 @@ public abstract class CodeViewerContextAction extends DockingAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void actionPerformed(CodeViewerActionContext context) {
|
protected void actionPerformed(CodeViewerActionContext context) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldAddToWindow(boolean isMainWindow, Set<Class<?>> contextTypes) {
|
public boolean shouldAddToWindow(boolean isMainWindow, Set<Class<?>> contextTypes) {
|
||||||
for (Class<?> class1 : contextTypes) {
|
for (Class<?> class1 : contextTypes) {
|
||||||
|
|||||||
+2
-3
@@ -39,7 +39,7 @@ public class CollapseAllDataAction extends ProgramLocationContextAction {
|
|||||||
private CodeViewerProvider provider;
|
private CodeViewerProvider provider;
|
||||||
|
|
||||||
public CollapseAllDataAction(CodeViewerProvider provider) {
|
public CollapseAllDataAction(CodeViewerProvider provider) {
|
||||||
super("Collapse All Data", provider.getName());
|
super("Collapse All Data", provider.getOwner());
|
||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
|
|
||||||
setPopupMenuData(new MenuData(new String[] { "Collapse All Data" }, null, "Structure"));
|
setPopupMenuData(new MenuData(new String[] { "Collapse All Data" }, null, "Structure"));
|
||||||
@@ -95,8 +95,7 @@ public class CollapseAllDataAction extends ProgramLocationContextAction {
|
|||||||
|
|
||||||
ProgramLocation location = context.getLocation();
|
ProgramLocation location = context.getLocation();
|
||||||
Data data = getTopLevelComponentData(location);
|
Data data = getTopLevelComponentData(location);
|
||||||
TaskLauncher.launchModal("Collapse Data",
|
TaskLauncher.launchModal("Collapse Data", monitor -> model.closeAllData(data, monitor));
|
||||||
monitor -> model.closeAllData(data, monitor));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ListingModel getModel() {
|
private ListingModel getModel() {
|
||||||
|
|||||||
+1
-1
@@ -36,7 +36,7 @@ public class ExpandAllDataAction extends ProgramLocationContextAction {
|
|||||||
private CodeViewerProvider provider;
|
private CodeViewerProvider provider;
|
||||||
|
|
||||||
public ExpandAllDataAction(CodeViewerProvider provider) {
|
public ExpandAllDataAction(CodeViewerProvider provider) {
|
||||||
super("Expand All Data", provider.getName());
|
super("Expand All Data", provider.getOwner());
|
||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
|
|
||||||
setPopupMenuData(new MenuData(new String[] { "Expand All Data" }, null, "Structure"));
|
setPopupMenuData(new MenuData(new String[] { "Expand All Data" }, null, "Structure"));
|
||||||
|
|||||||
+1
-1
@@ -39,7 +39,7 @@ public class ToggleExpandCollapseDataAction extends ProgramLocationContextAction
|
|||||||
private CodeViewerProvider provider;
|
private CodeViewerProvider provider;
|
||||||
|
|
||||||
public ToggleExpandCollapseDataAction(CodeViewerProvider provider) {
|
public ToggleExpandCollapseDataAction(CodeViewerProvider provider) {
|
||||||
super("Toggle Expand/Collapse Data", provider.getName());
|
super("Toggle Expand/Collapse Data", provider.getOwner());
|
||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
|
|
||||||
setPopupMenuData(
|
setPopupMenuData(
|
||||||
|
|||||||
+1
-8
@@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.plugin.core.commentwindow;
|
package ghidra.app.plugin.core.commentwindow;
|
||||||
|
|
||||||
import docking.ActionContext;
|
|
||||||
import docking.action.DockingAction;
|
import docking.action.DockingAction;
|
||||||
import ghidra.app.CorePluginPackage;
|
import ghidra.app.CorePluginPackage;
|
||||||
import ghidra.app.events.ProgramSelectionPluginEvent;
|
import ghidra.app.events.ProgramSelectionPluginEvent;
|
||||||
@@ -186,13 +185,7 @@ public class CommentWindowPlugin extends ProgramPlugin implements DomainObjectLi
|
|||||||
|
|
||||||
private void createActions() {
|
private void createActions() {
|
||||||
|
|
||||||
selectAction = new MakeProgramSelectionAction(getName(), provider.getTable()) {
|
selectAction = new MakeProgramSelectionAction(this, provider.getTable());
|
||||||
@Override
|
|
||||||
protected void makeSelection(ActionContext context) {
|
|
||||||
selectComment(provider.selectComment());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
tool.addLocalAction(provider, selectAction);
|
tool.addLocalAction(provider, selectAction);
|
||||||
|
|
||||||
DockingAction selectionAction = new SelectionNavigationAction(this, provider.getTable());
|
DockingAction selectionAction = new SelectionNavigationAction(this, provider.getTable());
|
||||||
|
|||||||
+20
-34
@@ -15,15 +15,14 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.plugin.core.compositeeditor;
|
package ghidra.app.plugin.core.compositeeditor;
|
||||||
|
|
||||||
import ghidra.framework.plugintool.Plugin;
|
|
||||||
import ghidra.framework.plugintool.PluginTool;
|
|
||||||
import ghidra.util.HelpLocation;
|
|
||||||
|
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
import docking.action.*;
|
import docking.action.*;
|
||||||
|
import ghidra.framework.plugintool.Plugin;
|
||||||
|
import ghidra.framework.plugintool.PluginTool;
|
||||||
|
import ghidra.util.HelpLocation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CompositeEditorAction is an abstract class that should be extended for any
|
* CompositeEditorAction is an abstract class that should be extended for any
|
||||||
@@ -45,13 +44,14 @@ abstract public class CompositeEditorTableAction extends DockingAction implement
|
|||||||
|
|
||||||
public static final String EDIT_ACTION_PREFIX = "Editor: ";
|
public static final String EDIT_ACTION_PREFIX = "Editor: ";
|
||||||
|
|
||||||
/**
|
|
||||||
* Defines an <code>Action</code> object with the specified
|
|
||||||
* description string and a the specified icon.
|
|
||||||
*/
|
|
||||||
public CompositeEditorTableAction(CompositeEditorProvider provider, String name, String group,
|
public CompositeEditorTableAction(CompositeEditorProvider provider, String name, String group,
|
||||||
String[] popupPath, String[] menuPath, ImageIcon icon) {
|
String[] popupPath, String[] menuPath, ImageIcon icon) {
|
||||||
super(name, provider.plugin.getName());
|
this(provider, name, group, popupPath, menuPath, icon, KeyBindingType.INDIVIDUAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompositeEditorTableAction(CompositeEditorProvider provider, String name, String group,
|
||||||
|
String[] popupPath, String[] menuPath, ImageIcon icon, KeyBindingType kbType) {
|
||||||
|
super(name, provider.plugin.getName(), kbType);
|
||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
model = provider.getModel();
|
model = provider.getModel();
|
||||||
if (menuPath != null) {
|
if (menuPath != null) {
|
||||||
@@ -70,9 +70,6 @@ abstract public class CompositeEditorTableAction extends DockingAction implement
|
|||||||
setHelpLocation(new HelpLocation(provider.getHelpTopic(), helpAnchor));
|
setHelpLocation(new HelpLocation(provider.getHelpTopic(), helpAnchor));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see ghidra.framework.plugintool.PluginAction#dispose()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
model.removeCompositeEditorModelListener(this);
|
model.removeCompositeEditorModelListener(this);
|
||||||
@@ -93,64 +90,53 @@ abstract public class CompositeEditorTableAction extends DockingAction implement
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
abstract public void adjustEnablement();
|
abstract public void adjustEnablement();
|
||||||
|
|
||||||
public String getHelpName() {
|
public String getHelpName() {
|
||||||
String actionName = getName();
|
String actionName = getName();
|
||||||
if (actionName.startsWith(CompositeEditorTableAction.EDIT_ACTION_PREFIX)) {
|
if (actionName.startsWith(CompositeEditorTableAction.EDIT_ACTION_PREFIX)) {
|
||||||
actionName = actionName.substring(CompositeEditorTableAction.EDIT_ACTION_PREFIX.length());
|
actionName =
|
||||||
|
actionName.substring(CompositeEditorTableAction.EDIT_ACTION_PREFIX.length());
|
||||||
}
|
}
|
||||||
return actionName;
|
return actionName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see ghidra.app.plugin.stackeditor.EditorModelListener#selectionChanged()
|
|
||||||
*/
|
|
||||||
public void selectionChanged() {
|
public void selectionChanged() {
|
||||||
adjustEnablement();
|
adjustEnablement();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see ghidra.app.plugin.stackeditor.EditorModelListener#editStateChanged(int)
|
|
||||||
*/
|
|
||||||
public void editStateChanged(int i) {
|
public void editStateChanged(int i) {
|
||||||
adjustEnablement();
|
adjustEnablement();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see ghidra.app.plugin.compositeeditor.CompositeEditorModelListener#compositeEditStateChanged(int)
|
|
||||||
*/
|
|
||||||
public void compositeEditStateChanged(int type) {
|
public void compositeEditStateChanged(int type) {
|
||||||
adjustEnablement();
|
adjustEnablement();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see ghidra.app.plugin.compositeeditor.CompositeEditorModelListener#endFieldEditing()
|
|
||||||
*/
|
|
||||||
public void endFieldEditing() {
|
public void endFieldEditing() {
|
||||||
adjustEnablement();
|
adjustEnablement();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see ghidra.app.plugin.compositeeditor.CompositeEditorModelListener#componentDataChanged()
|
|
||||||
*/
|
|
||||||
public void componentDataChanged() {
|
public void componentDataChanged() {
|
||||||
adjustEnablement();
|
adjustEnablement();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see ghidra.app.plugin.compositeeditor.CompositeEditorModelListener#compositeInfoChanged()
|
|
||||||
*/
|
|
||||||
public void compositeInfoChanged() {
|
public void compositeInfoChanged() {
|
||||||
adjustEnablement();
|
adjustEnablement();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see ghidra.app.plugin.compositeeditor.CompositeEditorModelListener#statusChanged(java.lang.String, boolean)
|
|
||||||
*/
|
|
||||||
public void statusChanged(String message, boolean beep) {
|
public void statusChanged(String message, boolean beep) {
|
||||||
|
// we are an action; don't care about status messages
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void showUndefinedStateChanged(boolean showUndefinedBytes) {
|
public void showUndefinedStateChanged(boolean showUndefinedBytes) {
|
||||||
adjustEnablement();
|
adjustEnablement();
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-6
@@ -19,6 +19,7 @@ import javax.swing.KeyStroke;
|
|||||||
|
|
||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
import docking.action.KeyBindingData;
|
import docking.action.KeyBindingData;
|
||||||
|
import docking.action.KeyBindingType;
|
||||||
import ghidra.program.model.data.CycleGroup;
|
import ghidra.program.model.data.CycleGroup;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,7 +33,7 @@ public class CycleGroupAction extends CompositeEditorTableAction {
|
|||||||
public CycleGroupAction(CompositeEditorProvider provider, CycleGroup cycleGroup) {
|
public CycleGroupAction(CompositeEditorProvider provider, CycleGroup cycleGroup) {
|
||||||
super(provider, cycleGroup.getName(), GROUP_NAME,
|
super(provider, cycleGroup.getName(), GROUP_NAME,
|
||||||
new String[] { "Cycle", cycleGroup.getName() },
|
new String[] { "Cycle", cycleGroup.getName() },
|
||||||
new String[] { "Cycle", cycleGroup.getName() }, null);
|
new String[] { "Cycle", cycleGroup.getName() }, null, KeyBindingType.SHARED);
|
||||||
this.cycleGroup = cycleGroup;
|
this.cycleGroup = cycleGroup;
|
||||||
|
|
||||||
initKeyStroke(cycleGroup.getDefaultKeyStroke());
|
initKeyStroke(cycleGroup.getDefaultKeyStroke());
|
||||||
@@ -46,11 +47,6 @@ public class CycleGroupAction extends CompositeEditorTableAction {
|
|||||||
setKeyBindingData(new KeyBindingData(keyStroke));
|
setKeyBindingData(new KeyBindingData(keyStroke));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean usesSharedKeyBinding() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CycleGroup getCycleGroup() {
|
public CycleGroup getCycleGroup() {
|
||||||
return cycleGroup;
|
return cycleGroup;
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -64,11 +64,11 @@ public class ConsoleComponentProvider extends ComponentProviderAdapter
|
|||||||
private PrintWriter stdin;
|
private PrintWriter stdin;
|
||||||
private Program currentProgram;
|
private Program currentProgram;
|
||||||
|
|
||||||
public ConsoleComponentProvider(PluginTool tool, String name) {
|
public ConsoleComponentProvider(PluginTool tool, String owner) {
|
||||||
super(tool, name, name);
|
super(tool, "Console", owner);
|
||||||
|
|
||||||
setDefaultWindowPosition(WindowPosition.BOTTOM);
|
setDefaultWindowPosition(WindowPosition.BOTTOM);
|
||||||
setHelpLocation(new HelpLocation(getName(), "console"));
|
setHelpLocation(new HelpLocation(owner, owner));
|
||||||
setIcon(ResourceManager.loadImage(CONSOLE_GIF));
|
setIcon(ResourceManager.loadImage(CONSOLE_GIF));
|
||||||
setWindowMenuGroup("Console");
|
setWindowMenuGroup("Console");
|
||||||
setSubTitle("Scripting");
|
setSubTitle("Scripting");
|
||||||
@@ -94,7 +94,7 @@ public class ConsoleComponentProvider extends ComponentProviderAdapter
|
|||||||
|
|
||||||
private void createOptions() {
|
private void createOptions() {
|
||||||
ToolOptions options = tool.getOptions("Console");
|
ToolOptions options = tool.getOptions("Console");
|
||||||
HelpLocation help = new HelpLocation(getName(), "ConsolePlugin");
|
HelpLocation help = new HelpLocation(getOwner(), getOwner());
|
||||||
options.registerOption(FONT_OPTION_LABEL, DEFAULT_FONT, help, FONT_DESCRIPTION);
|
options.registerOption(FONT_OPTION_LABEL, DEFAULT_FONT, help, FONT_DESCRIPTION);
|
||||||
options.setOptionsHelpLocation(help);
|
options.setOptionsHelpLocation(help);
|
||||||
font = options.getFont(FONT_OPTION_LABEL, DEFAULT_FONT);
|
font = options.getFont(FONT_OPTION_LABEL, DEFAULT_FONT);
|
||||||
@@ -260,7 +260,7 @@ public class ConsoleComponentProvider extends ComponentProviderAdapter
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void createActions() {
|
private void createActions() {
|
||||||
clearAction = new DockingAction("Clear Console", getName()) {
|
clearAction = new DockingAction("Clear Console", getOwner()) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionContext context) {
|
public void actionPerformed(ActionContext context) {
|
||||||
@@ -273,7 +273,7 @@ public class ConsoleComponentProvider extends ComponentProviderAdapter
|
|||||||
|
|
||||||
clearAction.setEnabled(true);
|
clearAction.setEnabled(true);
|
||||||
|
|
||||||
scrollAction = new ToggleDockingAction("Scroll Lock", getName()) {
|
scrollAction = new ToggleDockingAction("Scroll Lock", getOwner()) {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionContext context) {
|
public void actionPerformed(ActionContext context) {
|
||||||
textPane.setScrollLock(isSelected());
|
textPane.setScrollLock(isSelected());
|
||||||
|
|||||||
+2
-8
@@ -20,8 +20,7 @@ import java.awt.event.KeyEvent;
|
|||||||
import javax.swing.KeyStroke;
|
import javax.swing.KeyStroke;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
import docking.action.DockingAction;
|
import docking.action.*;
|
||||||
import docking.action.KeyBindingData;
|
|
||||||
import ghidra.app.context.ListingActionContext;
|
import ghidra.app.context.ListingActionContext;
|
||||||
import ghidra.app.util.datatype.DataTypeSelectionDialog;
|
import ghidra.app.util.datatype.DataTypeSelectionDialog;
|
||||||
import ghidra.framework.plugintool.PluginTool;
|
import ghidra.framework.plugintool.PluginTool;
|
||||||
@@ -43,7 +42,7 @@ public class ChooseDataTypeAction extends DockingAction {
|
|||||||
private final static String ACTION_NAME = "Choose Data Type";
|
private final static String ACTION_NAME = "Choose Data Type";
|
||||||
|
|
||||||
public ChooseDataTypeAction(DataPlugin plugin) {
|
public ChooseDataTypeAction(DataPlugin plugin) {
|
||||||
super(ACTION_NAME, plugin.getName(), false);
|
super(ACTION_NAME, plugin.getName(), KeyBindingType.SHARED);
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
|
||||||
initKeyStroke(KEY_BINDING);
|
initKeyStroke(KEY_BINDING);
|
||||||
@@ -57,11 +56,6 @@ public class ChooseDataTypeAction extends DockingAction {
|
|||||||
setKeyBindingData(new KeyBindingData(keyStroke));
|
setKeyBindingData(new KeyBindingData(keyStroke));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean usesSharedKeyBinding() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionContext context) {
|
public void actionPerformed(ActionContext context) {
|
||||||
ListingActionContext programActionContext =
|
ListingActionContext programActionContext =
|
||||||
|
|||||||
+1
-6
@@ -44,7 +44,7 @@ class CreateArrayAction extends DockingAction {
|
|||||||
private DataPlugin plugin;
|
private DataPlugin plugin;
|
||||||
|
|
||||||
public CreateArrayAction(DataPlugin plugin) {
|
public CreateArrayAction(DataPlugin plugin) {
|
||||||
super("Define Array", plugin.getName(), false);
|
super("Define Array", plugin.getName(), KeyBindingType.SHARED);
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
|
||||||
setPopupMenuData(new MenuData(CREATE_ARRAY_POPUP_MENU, "BasicData"));
|
setPopupMenuData(new MenuData(CREATE_ARRAY_POPUP_MENU, "BasicData"));
|
||||||
@@ -61,11 +61,6 @@ class CreateArrayAction extends DockingAction {
|
|||||||
setKeyBindingData(new KeyBindingData(keyStroke));
|
setKeyBindingData(new KeyBindingData(keyStroke));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean usesSharedKeyBinding() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionContext context) {
|
public void actionPerformed(ActionContext context) {
|
||||||
ListingActionContext programActionContext =
|
ListingActionContext programActionContext =
|
||||||
|
|||||||
+2
-8
@@ -18,8 +18,7 @@ package ghidra.app.plugin.core.data;
|
|||||||
import javax.swing.KeyStroke;
|
import javax.swing.KeyStroke;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
import docking.action.DockingAction;
|
import docking.action.*;
|
||||||
import docking.action.KeyBindingData;
|
|
||||||
import ghidra.app.cmd.data.*;
|
import ghidra.app.cmd.data.*;
|
||||||
import ghidra.app.context.ListingActionContext;
|
import ghidra.app.context.ListingActionContext;
|
||||||
import ghidra.framework.cmd.BackgroundCommand;
|
import ghidra.framework.cmd.BackgroundCommand;
|
||||||
@@ -41,7 +40,7 @@ public class CycleGroupAction extends DockingAction {
|
|||||||
private CycleGroup cycleGroup;
|
private CycleGroup cycleGroup;
|
||||||
|
|
||||||
CycleGroupAction(CycleGroup group, DataPlugin plugin) {
|
CycleGroupAction(CycleGroup group, DataPlugin plugin) {
|
||||||
super(group.getName(), plugin.getName(), false);
|
super(group.getName(), plugin.getName(), KeyBindingType.SHARED);
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.cycleGroup = group;
|
this.cycleGroup = group;
|
||||||
|
|
||||||
@@ -56,11 +55,6 @@ public class CycleGroupAction extends DockingAction {
|
|||||||
setKeyBindingData(new KeyBindingData(keyStroke));
|
setKeyBindingData(new KeyBindingData(keyStroke));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean usesSharedKeyBinding() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
cycleGroup = null;
|
cycleGroup = null;
|
||||||
|
|||||||
@@ -17,8 +17,7 @@ package ghidra.app.plugin.core.data;
|
|||||||
|
|
||||||
import javax.swing.KeyStroke;
|
import javax.swing.KeyStroke;
|
||||||
|
|
||||||
import docking.action.KeyBindingData;
|
import docking.action.*;
|
||||||
import docking.action.MenuData;
|
|
||||||
import ghidra.app.context.ListingActionContext;
|
import ghidra.app.context.ListingActionContext;
|
||||||
import ghidra.app.context.ListingContextAction;
|
import ghidra.app.context.ListingContextAction;
|
||||||
import ghidra.program.model.data.*;
|
import ghidra.program.model.data.*;
|
||||||
@@ -45,7 +44,7 @@ class DataAction extends ListingContextAction {
|
|||||||
* @param plugin the plugin that owns this action
|
* @param plugin the plugin that owns this action
|
||||||
*/
|
*/
|
||||||
public DataAction(String name, String group, DataType dataType, DataPlugin plugin) {
|
public DataAction(String name, String group, DataType dataType, DataPlugin plugin) {
|
||||||
super(name, plugin.getName(), false);
|
super(name, plugin.getName(), KeyBindingType.SHARED);
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.dataType = dataType;
|
this.dataType = dataType;
|
||||||
|
|
||||||
@@ -54,11 +53,6 @@ class DataAction extends ListingContextAction {
|
|||||||
initKeyStroke(getDefaultKeyStroke());
|
initKeyStroke(getDefaultKeyStroke());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean usesSharedKeyBinding() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected KeyStroke getDefaultKeyStroke() {
|
protected KeyStroke getDefaultKeyStroke() {
|
||||||
return null; // we have no default, but our subclasses may
|
return null; // we have no default, but our subclasses may
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-22
@@ -23,7 +23,6 @@ import java.io.IOException;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import javax.swing.ImageIcon;
|
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import javax.swing.tree.TreePath;
|
import javax.swing.tree.TreePath;
|
||||||
|
|
||||||
@@ -60,7 +59,6 @@ import ghidra.util.HelpLocation;
|
|||||||
import ghidra.util.Msg;
|
import ghidra.util.Msg;
|
||||||
import ghidra.util.datastruct.LRUMap;
|
import ghidra.util.datastruct.LRUMap;
|
||||||
import ghidra.util.task.TaskLauncher;
|
import ghidra.util.task.TaskLauncher;
|
||||||
import resources.ResourceManager;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plugin to pop up the dialog to manage data types in the program
|
* Plugin to pop up the dialog to manage data types in the program
|
||||||
@@ -82,14 +80,12 @@ import resources.ResourceManager;
|
|||||||
public class DataTypeManagerPlugin extends ProgramPlugin
|
public class DataTypeManagerPlugin extends ProgramPlugin
|
||||||
implements DomainObjectListener, DataTypeManagerService, PopupListener {
|
implements DomainObjectListener, DataTypeManagerService, PopupListener {
|
||||||
|
|
||||||
final static String DATA_TYPES_ICON = "images/dataTypes.png";
|
|
||||||
private static final String SEACH_PROVIDER_NAME = "Search DataTypes Provider";
|
private static final String SEACH_PROVIDER_NAME = "Search DataTypes Provider";
|
||||||
private static final int RECENTLY_USED_CACHE_SIZE = 10;
|
private static final int RECENTLY_USED_CACHE_SIZE = 10;
|
||||||
|
|
||||||
private static final String STANDARD_ARCHIVE_MENU = "Standard Archive";
|
private static final String STANDARD_ARCHIVE_MENU = "Standard Archive";
|
||||||
private static final String RECENTLY_OPENED_MENU = "Recently Opened Archive";
|
private static final String RECENTLY_OPENED_MENU = "Recently Opened Archive";
|
||||||
|
|
||||||
private DockingAction manageDataAction;
|
|
||||||
private DataTypeManagerHandler dataTypeManagerHandler;
|
private DataTypeManagerHandler dataTypeManagerHandler;
|
||||||
private DataTypesProvider provider;
|
private DataTypesProvider provider;
|
||||||
private OpenVersionedFileDialog openDialog;
|
private OpenVersionedFileDialog openDialog;
|
||||||
@@ -126,12 +122,10 @@ public class DataTypeManagerPlugin extends ProgramPlugin
|
|||||||
@Override
|
@Override
|
||||||
public void archiveClosed(Archive archive) {
|
public void archiveClosed(Archive archive) {
|
||||||
if (archive instanceof ProjectArchive) {
|
if (archive instanceof ProjectArchive) {
|
||||||
|
// Program is handled by deactivation event
|
||||||
((ProjectArchive) archive).getDomainObject().removeListener(
|
((ProjectArchive) archive).getDomainObject().removeListener(
|
||||||
DataTypeManagerPlugin.this);
|
DataTypeManagerPlugin.this);
|
||||||
}
|
}
|
||||||
// Program is handled by deactivation.
|
|
||||||
|
|
||||||
// Otherwise, don't care.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -467,21 +461,6 @@ public class DataTypeManagerPlugin extends ProgramPlugin
|
|||||||
* Create the actions for the menu on the tool.
|
* Create the actions for the menu on the tool.
|
||||||
*/
|
*/
|
||||||
private void createActions() {
|
private void createActions() {
|
||||||
// create action
|
|
||||||
manageDataAction = new DockingAction("Data Type Manager", getName()) {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionContext context) {
|
|
||||||
tool.showComponentProvider(provider, true);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
ImageIcon dtIcon = ResourceManager.loadImage(DATA_TYPES_ICON);
|
|
||||||
manageDataAction.setToolBarData(new ToolBarData(dtIcon, "View"));
|
|
||||||
|
|
||||||
manageDataAction.setDescription("Display Data Types");
|
|
||||||
manageDataAction.setHelpLocation(provider.getHelpLocation());
|
|
||||||
|
|
||||||
tool.addAction(manageDataAction);
|
|
||||||
|
|
||||||
createStandardArchivesMenu();
|
createStandardArchivesMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-6
@@ -57,6 +57,8 @@ import resources.ResourceManager;
|
|||||||
import util.HistoryList;
|
import util.HistoryList;
|
||||||
|
|
||||||
public class DataTypesProvider extends ComponentProviderAdapter {
|
public class DataTypesProvider extends ComponentProviderAdapter {
|
||||||
|
|
||||||
|
private static final String DATA_TYPES_ICON = "images/dataTypes.png";
|
||||||
private static final String TITLE = "Data Type Manager";
|
private static final String TITLE = "Data Type Manager";
|
||||||
private static final String POINTER_FILTER_STATE = "PointerFilterState";
|
private static final String POINTER_FILTER_STATE = "PointerFilterState";
|
||||||
private static final String ARRAY_FILTER_STATE = "ArrayFilterState";
|
private static final String ARRAY_FILTER_STATE = "ArrayFilterState";
|
||||||
@@ -95,9 +97,12 @@ public class DataTypesProvider extends ComponentProviderAdapter {
|
|||||||
|
|
||||||
public DataTypesProvider(DataTypeManagerPlugin plugin, String providerName) {
|
public DataTypesProvider(DataTypeManagerPlugin plugin, String providerName) {
|
||||||
super(plugin.getTool(), providerName, plugin.getName(), DataTypesActionContext.class);
|
super(plugin.getTool(), providerName, plugin.getName(), DataTypesActionContext.class);
|
||||||
setTitle(TITLE);
|
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
|
||||||
|
setTitle(TITLE);
|
||||||
|
setIcon(ResourceManager.loadImage(DATA_TYPES_ICON));
|
||||||
|
addToToolbar();
|
||||||
|
|
||||||
navigationHistory.setAllowDuplicates(true);
|
navigationHistory.setAllowDuplicates(true);
|
||||||
|
|
||||||
buildComponent();
|
buildComponent();
|
||||||
@@ -106,11 +111,6 @@ public class DataTypesProvider extends ComponentProviderAdapter {
|
|||||||
createLocalActions();
|
createLocalActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ImageIcon getIcon() {
|
|
||||||
return ResourceManager.loadImage(DataTypeManagerPlugin.DATA_TYPES_ICON);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This creates all the actions for opening/creating data type archives.
|
* This creates all the actions for opening/creating data type archives.
|
||||||
* It also creates the action for refreshing the built-in data types
|
* It also creates the action for refreshing the built-in data types
|
||||||
|
|||||||
+1
-1
@@ -123,7 +123,7 @@ class NextPreviousDataTypeAction extends MultiActionDockingAction {
|
|||||||
private class NavigationAction extends DockingAction {
|
private class NavigationAction extends DockingAction {
|
||||||
|
|
||||||
private NavigationAction(DataType dt) {
|
private NavigationAction(DataType dt) {
|
||||||
super("DataTypeNavigationAction_" + ++navigationActionIdCount, owner, false);
|
super("DataTypeNavigationAction_" + ++navigationActionIdCount, owner);
|
||||||
|
|
||||||
setMenuBarData(new MenuData(new String[] { dt.getDisplayName() }));
|
setMenuBarData(new MenuData(new String[] { dt.getDisplayName() }));
|
||||||
setEnabled(true);
|
setEnabled(true);
|
||||||
|
|||||||
+1
-8
@@ -18,7 +18,6 @@ package ghidra.app.plugin.core.datawindow;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import docking.ActionContext;
|
|
||||||
import docking.action.DockingAction;
|
import docking.action.DockingAction;
|
||||||
import ghidra.app.CorePluginPackage;
|
import ghidra.app.CorePluginPackage;
|
||||||
import ghidra.app.events.ProgramSelectionPluginEvent;
|
import ghidra.app.events.ProgramSelectionPluginEvent;
|
||||||
@@ -180,13 +179,7 @@ public class DataWindowPlugin extends ProgramPlugin implements DomainObjectListe
|
|||||||
*/
|
*/
|
||||||
private void createActions() {
|
private void createActions() {
|
||||||
|
|
||||||
selectAction = new MakeProgramSelectionAction(getName(), provider.getTable()) {
|
selectAction = new MakeProgramSelectionAction(this, provider.getTable());
|
||||||
@Override
|
|
||||||
protected void makeSelection(ActionContext context) {
|
|
||||||
selectData(provider.selectData());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
tool.addLocalAction(provider, selectAction);
|
tool.addLocalAction(provider, selectAction);
|
||||||
|
|
||||||
filterAction = new FilterAction(this);
|
filterAction = new FilterAction(this);
|
||||||
|
|||||||
+4
-3
@@ -23,6 +23,8 @@ import java.util.Map.Entry;
|
|||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import docking.*;
|
import docking.*;
|
||||||
import docking.action.ToggleDockingAction;
|
import docking.action.ToggleDockingAction;
|
||||||
import docking.action.ToolBarData;
|
import docking.action.ToolBarData;
|
||||||
@@ -34,7 +36,6 @@ import docking.widgets.filter.FilterTextField;
|
|||||||
import docking.widgets.label.GLabel;
|
import docking.widgets.label.GLabel;
|
||||||
import ghidra.program.model.listing.Program;
|
import ghidra.program.model.listing.Program;
|
||||||
import ghidra.util.HelpLocation;
|
import ghidra.util.HelpLocation;
|
||||||
import ghidra.util.StringUtilities;
|
|
||||||
import ghidra.util.task.SwingUpdateManager;
|
import ghidra.util.task.SwingUpdateManager;
|
||||||
import resources.Icons;
|
import resources.Icons;
|
||||||
|
|
||||||
@@ -351,7 +352,7 @@ class FilterAction extends ToggleDockingAction {
|
|||||||
String curType = itr.next();
|
String curType = itr.next();
|
||||||
Boolean lEnabled = typeEnabledMap.get(curType);
|
Boolean lEnabled = typeEnabledMap.get(curType);
|
||||||
StringBuffer buildMetaCurTypeBuff = new StringBuffer(curType);
|
StringBuffer buildMetaCurTypeBuff = new StringBuffer(curType);
|
||||||
int firstIndex = StringUtilities.indexOfIgnoreCase(curType, filteredText, 0);
|
int firstIndex = StringUtils.indexOfIgnoreCase(curType, filteredText, 0);
|
||||||
int lastIndex = firstIndex + filteredText.length();
|
int lastIndex = firstIndex + filteredText.length();
|
||||||
buildMetaCurTypeBuff.insert(lastIndex, "</b>");//THIS MUST ALWAYS COME BEFORE FIRST INDEX (FOR NO MATH on INDEX)
|
buildMetaCurTypeBuff.insert(lastIndex, "</b>");//THIS MUST ALWAYS COME BEFORE FIRST INDEX (FOR NO MATH on INDEX)
|
||||||
buildMetaCurTypeBuff.insert(firstIndex, "<b>");
|
buildMetaCurTypeBuff.insert(firstIndex, "<b>");
|
||||||
@@ -409,7 +410,7 @@ class FilterAction extends ToggleDockingAction {
|
|||||||
while (iteratorIndex.hasNext()) {
|
while (iteratorIndex.hasNext()) {
|
||||||
Entry<String, Boolean> entry = iteratorIndex.next();
|
Entry<String, Boolean> entry = iteratorIndex.next();
|
||||||
String checkboxName = entry.getKey();
|
String checkboxName = entry.getKey();
|
||||||
if (StringUtilities.containsIgnoreCase(checkboxName, filteredText)) {
|
if (StringUtils.containsIgnoreCase(checkboxName, filteredText)) {
|
||||||
checkboxNameList.add(checkboxName);
|
checkboxNameList.add(checkboxName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+36
-28
@@ -25,7 +25,7 @@ import javax.swing.event.DocumentListener;
|
|||||||
|
|
||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
import docking.DialogComponentProvider;
|
import docking.DialogComponentProvider;
|
||||||
import docking.action.*;
|
import docking.action.DockingAction;
|
||||||
import docking.widgets.checkbox.GCheckBox;
|
import docking.widgets.checkbox.GCheckBox;
|
||||||
import docking.widgets.label.GDLabel;
|
import docking.widgets.label.GDLabel;
|
||||||
import docking.widgets.label.GLabel;
|
import docking.widgets.label.GLabel;
|
||||||
@@ -40,11 +40,13 @@ import ghidra.program.model.mem.MemoryBlock;
|
|||||||
import ghidra.program.util.ProgramSelection;
|
import ghidra.program.util.ProgramSelection;
|
||||||
import ghidra.util.HelpLocation;
|
import ghidra.util.HelpLocation;
|
||||||
import ghidra.util.table.*;
|
import ghidra.util.table.*;
|
||||||
|
import ghidra.util.table.actions.MakeProgramSelectionAction;
|
||||||
import ghidra.util.task.Task;
|
import ghidra.util.task.Task;
|
||||||
import resources.ResourceManager;
|
|
||||||
|
|
||||||
public class AddressTableDialog extends DialogComponentProvider {
|
public class AddressTableDialog extends DialogComponentProvider {
|
||||||
static final int DEFAULT_MINIMUM_TABLE_SIZE = 3;
|
private static final int DEFAULT_MINIMUM_TABLE_SIZE = 3;
|
||||||
|
private static final String DIALOG_NAME = "Search For Address Tables";
|
||||||
|
|
||||||
private JPanel mainPanel;
|
private JPanel mainPanel;
|
||||||
private String[] blockData;
|
private String[] blockData;
|
||||||
private AutoTableDisassemblerPlugin plugin;
|
private AutoTableDisassemblerPlugin plugin;
|
||||||
@@ -67,7 +69,7 @@ public class AddressTableDialog extends DialogComponentProvider {
|
|||||||
private GhidraThreadedTablePanel<AddressTable> resultsTablePanel;
|
private GhidraThreadedTablePanel<AddressTable> resultsTablePanel;
|
||||||
|
|
||||||
public AddressTableDialog(AutoTableDisassemblerPlugin plugin) {
|
public AddressTableDialog(AutoTableDisassemblerPlugin plugin) {
|
||||||
super("Search For Address Tables", false, true, true, true);
|
super(DIALOG_NAME, false, true, true, true);
|
||||||
setHelpLocation(
|
setHelpLocation(
|
||||||
new HelpLocation(HelpTopics.SEARCH, AutoTableDisassemblerPlugin.SEARCH_ACTION_NAME));
|
new HelpLocation(HelpTopics.SEARCH, AutoTableDisassemblerPlugin.SEARCH_ACTION_NAME));
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
@@ -125,8 +127,7 @@ public class AddressTableDialog extends DialogComponentProvider {
|
|||||||
JPanel makeTablePanel = new JPanel(new FlowLayout());
|
JPanel makeTablePanel = new JPanel(new FlowLayout());
|
||||||
|
|
||||||
makeTableButton = new JButton("Make Table");
|
makeTableButton = new JButton("Make Table");
|
||||||
makeTableButton.setToolTipText(
|
makeTableButton.setToolTipText("Make a table of addresses at the selected location(s).");
|
||||||
"Make a table of addresses at the selected location(s).");
|
|
||||||
makeTablePanel.add(makeTableButton);
|
makeTablePanel.add(makeTableButton);
|
||||||
makeTableButton.setEnabled(false);
|
makeTableButton.setEnabled(false);
|
||||||
makeTableButton.addActionListener(e -> plugin.makeTable(resultsTable.getSelectedRows()));
|
makeTableButton.addActionListener(e -> plugin.makeTable(resultsTable.getSelectedRows()));
|
||||||
@@ -175,8 +176,7 @@ public class AddressTableDialog extends DialogComponentProvider {
|
|||||||
skipLabel = new GDLabel("Skip Length: ");
|
skipLabel = new GDLabel("Skip Length: ");
|
||||||
skipField = new JTextField(5);
|
skipField = new JTextField(5);
|
||||||
skipField.setName("Skip");
|
skipField.setName("Skip");
|
||||||
skipLabel.setToolTipText(
|
skipLabel.setToolTipText("Number of bytes to skip between found addresses in a table.");
|
||||||
"Number of bytes to skip between found addresses in a table.");
|
|
||||||
skipField.setText("0");
|
skipField.setText("0");
|
||||||
|
|
||||||
JPanel alignPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
|
JPanel alignPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
|
||||||
@@ -194,8 +194,7 @@ public class AddressTableDialog extends DialogComponentProvider {
|
|||||||
|
|
||||||
selectionButton = new GCheckBox("Search Selection");
|
selectionButton = new GCheckBox("Search Selection");
|
||||||
selectionButton.setSelected(false);
|
selectionButton.setSelected(false);
|
||||||
selectionButton.setToolTipText(
|
selectionButton.setToolTipText("If checked, search only the current selection.");
|
||||||
"If checked, search only the current selection.");
|
|
||||||
JPanel searchOptionsWestPanel = new JPanel(new GridLayout(2, 1));
|
JPanel searchOptionsWestPanel = new JPanel(new GridLayout(2, 1));
|
||||||
searchOptionsWestPanel.add(selectionButton);
|
searchOptionsWestPanel.add(selectionButton);
|
||||||
|
|
||||||
@@ -233,8 +232,7 @@ public class AddressTableDialog extends DialogComponentProvider {
|
|||||||
"Label the top of the address table and all members of the table.");
|
"Label the top of the address table and all members of the table.");
|
||||||
|
|
||||||
offsetLabel = new GDLabel("Offset: ");
|
offsetLabel = new GDLabel("Offset: ");
|
||||||
offsetLabel.setToolTipText(
|
offsetLabel.setToolTipText("Offset from the beginning of the selected table(s)");
|
||||||
"Offset from the beginning of the selected table(s)");
|
|
||||||
offsetLabel.setEnabled(false);
|
offsetLabel.setEnabled(false);
|
||||||
|
|
||||||
JLabel viewOffsetLabel = new GDLabel(" ");
|
JLabel viewOffsetLabel = new GDLabel(" ");
|
||||||
@@ -242,8 +240,7 @@ public class AddressTableDialog extends DialogComponentProvider {
|
|||||||
|
|
||||||
viewOffset = new HintTextField(20);
|
viewOffset = new HintTextField(20);
|
||||||
viewOffset.setName("viewOffset");
|
viewOffset.setName("viewOffset");
|
||||||
viewOffset.setToolTipText(
|
viewOffset.setToolTipText("Address of the selected table starting at the given offset");
|
||||||
"Address of the selected table starting at the given offset");
|
|
||||||
viewOffset.setHintText("table start address");
|
viewOffset.setHintText("table start address");
|
||||||
viewOffset.showHint();
|
viewOffset.showHint();
|
||||||
|
|
||||||
@@ -526,20 +523,31 @@ public class AddressTableDialog extends DialogComponentProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void createAction() {
|
private void createAction() {
|
||||||
DockingAction selectAction =
|
|
||||||
new DockingAction("Make Selection", "AsciiFinderDialog", false) {
|
DockingAction selectAction = new MakeProgramSelectionAction(plugin, resultsTable) {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionContext context) {
|
protected ProgramSelection makeSelection(ActionContext context) {
|
||||||
makeSelection();
|
Program program = plugin.getProgram();
|
||||||
|
AddressSet set = new AddressSet();
|
||||||
|
AutoTableDisassemblerModel model = plugin.getModel();
|
||||||
|
int[] selectedRows = resultsTable.getSelectedRows();
|
||||||
|
for (int selectedRow : selectedRows) {
|
||||||
|
Address selectedAddress = model.getAddress(selectedRow);
|
||||||
|
AddressTable addrTab = model.get(selectedAddress);
|
||||||
|
if (addrTab != null) {
|
||||||
|
set.addRange(selectedAddress,
|
||||||
|
selectedAddress.add(addrTab.getByteLength() - 1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
ProgramSelection selection = new ProgramSelection(set);
|
||||||
selectAction.setDescription("Make a selection using selected rows");
|
if (!set.isEmpty()) {
|
||||||
selectAction.setEnabled(true);
|
plugin.firePluginEvent(
|
||||||
Icon icon = ResourceManager.loadImage("images/text_align_justify.png");
|
new ProgramSelectionPluginEvent(plugin.getName(), selection, program));
|
||||||
selectAction.setPopupMenuData(new MenuData(new String[] { "Make Selection" }, icon));
|
}
|
||||||
selectAction.setToolBarData(new ToolBarData(icon));
|
|
||||||
selectAction.setHelpLocation(
|
return selection;
|
||||||
new HelpLocation(HelpTopics.SEARCH, "Search_Make_Selection_Address_Tables"));
|
}
|
||||||
|
};
|
||||||
|
|
||||||
selectionNavigationAction = new SelectionNavigationAction(plugin, resultsTable);
|
selectionNavigationAction = new SelectionNavigationAction(plugin, resultsTable);
|
||||||
selectionNavigationAction.setHelpLocation(
|
selectionNavigationAction.setHelpLocation(
|
||||||
@@ -548,7 +556,7 @@ public class AddressTableDialog extends DialogComponentProvider {
|
|||||||
addAction(selectAction);
|
addAction(selectAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void makeSelection() {
|
private void doMakeSelection() {
|
||||||
Program program = plugin.getProgram();
|
Program program = plugin.getProgram();
|
||||||
AddressSet set = new AddressSet();
|
AddressSet set = new AddressSet();
|
||||||
AutoTableDisassemblerModel model = plugin.getModel();
|
AutoTableDisassemblerModel model = plugin.getModel();
|
||||||
|
|||||||
+6
-2
@@ -140,15 +140,19 @@ public class AutoTableDisassemblerPlugin extends ProgramPlugin implements Domain
|
|||||||
public void actionPerformed(ActionContext context) {
|
public void actionPerformed(ActionContext context) {
|
||||||
startDialog();
|
startDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabledForContext(ActionContext context) {
|
||||||
|
return currentProgram != null;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
findTableAction.setHelpLocation(
|
findTableAction.setHelpLocation(
|
||||||
new HelpLocation(HelpTopics.SEARCH, findTableAction.getName()));
|
new HelpLocation(HelpTopics.SEARCH, findTableAction.getName()));
|
||||||
findTableAction.setMenuBarData(
|
findTableAction.setMenuBarData(
|
||||||
new MenuData(new String[] { ToolConstants.MENU_SEARCH, "For Address Tables..." }, null,
|
new MenuData(new String[] { ToolConstants.MENU_SEARCH, "For Address Tables..." }, null,
|
||||||
"search for"));
|
"search for"));
|
||||||
|
|
||||||
findTableAction.setDescription(getPluginDescription().getDescription());
|
findTableAction.setDescription(getPluginDescription().getDescription());
|
||||||
enableOnLocation(findTableAction);
|
|
||||||
tool.addAction(findTableAction);
|
tool.addAction(findTableAction);
|
||||||
|
|
||||||
} // end of createActions()
|
} // end of createActions()
|
||||||
|
|||||||
+16
-28
@@ -54,12 +54,7 @@ public class EquateTablePlugin extends ProgramPlugin implements DomainObjectList
|
|||||||
public EquateTablePlugin(PluginTool tool) {
|
public EquateTablePlugin(PluginTool tool) {
|
||||||
super(tool, true, false);
|
super(tool, true, false);
|
||||||
|
|
||||||
updateMgr = new SwingUpdateManager(1000, 3000, new Runnable() {
|
updateMgr = new SwingUpdateManager(1000, 3000, () -> provider.updateEquates());
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
provider.updateEquates();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
provider = new EquateTableProvider(this);
|
provider = new EquateTableProvider(this);
|
||||||
}
|
}
|
||||||
@@ -131,10 +126,10 @@ public class EquateTablePlugin extends ProgramPlugin implements DomainObjectList
|
|||||||
|
|
||||||
ev.containsEvent(ChangeManager.DOCR_CODE_ADDED) ||
|
ev.containsEvent(ChangeManager.DOCR_CODE_ADDED) ||
|
||||||
ev.containsEvent(ChangeManager.DOCR_CODE_MOVED) ||
|
ev.containsEvent(ChangeManager.DOCR_CODE_MOVED) ||
|
||||||
ev.containsEvent(ChangeManager.DOCR_CODE_REMOVED) ||
|
ev.containsEvent(ChangeManager.DOCR_CODE_REMOVED) ||
|
||||||
|
|
||||||
ev.containsEvent(ChangeManager.DOCR_DATA_TYPE_CHANGED)) {
|
ev.containsEvent(ChangeManager.DOCR_DATA_TYPE_CHANGED)) {
|
||||||
|
|
||||||
updateMgr.update();
|
updateMgr.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,9 +149,6 @@ public class EquateTablePlugin extends ProgramPlugin implements DomainObjectList
|
|||||||
provider.programClosed();
|
provider.programClosed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Delete the list of equates.
|
|
||||||
*/
|
|
||||||
void deleteEquates(List<Equate> equates) {
|
void deleteEquates(List<Equate> equates) {
|
||||||
if (equates.isEmpty()) {
|
if (equates.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
@@ -173,13 +165,11 @@ public class EquateTablePlugin extends ProgramPlugin implements DomainObjectList
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
String title = "Delete Equate" + (equates.size() > 1 ? "s" : "") + "?";
|
String title = "Delete Equate" + (equates.size() > 1 ? "s" : "") + "?";
|
||||||
String msg =
|
String msg = "Do you really want to delete the equate" + (equates.size() > 1 ? "s" : "") +
|
||||||
"Do you really want to delete the equate" + (equates.size() > 1 ? "s" : "") + ": " +
|
": " + equates + " ?" + "\n\n NOTE: All references will be removed.";
|
||||||
equates + " ?" + "\n\n NOTE: All references will be removed.";
|
|
||||||
|
|
||||||
int option =
|
int option = OptionDialog.showOptionDialog(provider.getComponent(), title, msg, "Delete",
|
||||||
OptionDialog.showOptionDialog(provider.getComponent(), title, msg, "Delete",
|
OptionDialog.QUESTION_MESSAGE);
|
||||||
OptionDialog.QUESTION_MESSAGE);
|
|
||||||
|
|
||||||
if (option != OptionDialog.CANCEL_OPTION) {
|
if (option != OptionDialog.CANCEL_OPTION) {
|
||||||
tool.execute(new RemoveEquateCmd(equateNames, getTool()), currentProgram);
|
tool.execute(new RemoveEquateCmd(equateNames, getTool()), currentProgram);
|
||||||
@@ -236,26 +226,24 @@ public class EquateTablePlugin extends ProgramPlugin implements DomainObjectList
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the equate exists, checks to make sure the value matches the
|
* If the equate exists, checks to make sure the value matches the current scalar value
|
||||||
* current scalar value.
|
|
||||||
*
|
*
|
||||||
* @param dialog the dialog whose status area should be set with any error messages.
|
* @param equate the equate to check
|
||||||
* @param equateStr the candidate equate name for the set or rename operation.
|
* @param equateStr the candidate equate name for the set or rename operation
|
||||||
|
* @return true if valid
|
||||||
*/
|
*/
|
||||||
boolean isValid(Equate equate, String equateStr) {
|
boolean isValid(Equate equate, String equateStr) {
|
||||||
// these are valid in the sense that they represent a clear or remove operation.
|
// these are valid in the sense that they represent a clear or remove operation
|
||||||
if (equateStr == null || equateStr.length() <= 0) {
|
if (equateStr == null || equateStr.length() <= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// look up the new equate string
|
|
||||||
EquateTable equateTable = currentProgram.getEquateTable();
|
EquateTable equateTable = currentProgram.getEquateTable();
|
||||||
Equate newEquate = equateTable.getEquate(equateStr);
|
Equate newEquate = equateTable.getEquate(equateStr);
|
||||||
|
|
||||||
if (newEquate != null && !newEquate.equals(equate)) {
|
if (newEquate != null && !newEquate.equals(equate)) {
|
||||||
Msg.showInfo(getClass(), provider.getComponent(), "Rename Equate Failed!", "Equate " +
|
Msg.showInfo(getClass(), provider.getComponent(), "Rename Equate Failed!",
|
||||||
equateStr + " exists with value 0x" + Long.toHexString(newEquate.getValue()) +
|
"Equate " + equateStr + " exists with value 0x" +
|
||||||
" (" + newEquate.getValue() + ")");
|
Long.toHexString(newEquate.getValue()) + " (" + newEquate.getValue() + ")");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
+1
-6
@@ -41,7 +41,7 @@ public class ChooseDataTypeAction extends DockingAction {
|
|||||||
private FunctionPlugin plugin;
|
private FunctionPlugin plugin;
|
||||||
|
|
||||||
public ChooseDataTypeAction(FunctionPlugin plugin) {
|
public ChooseDataTypeAction(FunctionPlugin plugin) {
|
||||||
super(ACTION_NAME, plugin.getName(), false);
|
super(ACTION_NAME, plugin.getName(), KeyBindingType.SHARED);
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
|
||||||
setHelpLocation(new HelpLocation("DataTypeEditors", "DataTypeSelectionDialog"));
|
setHelpLocation(new HelpLocation("DataTypeEditors", "DataTypeSelectionDialog"));
|
||||||
@@ -57,11 +57,6 @@ public class ChooseDataTypeAction extends DockingAction {
|
|||||||
setKeyBindingData(new KeyBindingData(keyStroke));
|
setKeyBindingData(new KeyBindingData(keyStroke));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean usesSharedKeyBinding() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionContext actionContext) {
|
public void actionPerformed(ActionContext actionContext) {
|
||||||
ListingActionContext context = (ListingActionContext) actionContext.getContextObject();
|
ListingActionContext context = (ListingActionContext) actionContext.getContextObject();
|
||||||
|
|||||||
+2
-8
@@ -19,8 +19,7 @@ import java.awt.event.KeyEvent;
|
|||||||
|
|
||||||
import javax.swing.KeyStroke;
|
import javax.swing.KeyStroke;
|
||||||
|
|
||||||
import docking.action.KeyBindingData;
|
import docking.action.*;
|
||||||
import docking.action.MenuData;
|
|
||||||
import docking.widgets.dialogs.NumberInputDialog;
|
import docking.widgets.dialogs.NumberInputDialog;
|
||||||
import ghidra.app.context.ListingActionContext;
|
import ghidra.app.context.ListingActionContext;
|
||||||
import ghidra.app.context.ListingContextAction;
|
import ghidra.app.context.ListingContextAction;
|
||||||
@@ -37,7 +36,7 @@ class CreateArrayAction extends ListingContextAction {
|
|||||||
private FunctionPlugin plugin;
|
private FunctionPlugin plugin;
|
||||||
|
|
||||||
public CreateArrayAction(FunctionPlugin plugin) {
|
public CreateArrayAction(FunctionPlugin plugin) {
|
||||||
super("Define Array", plugin.getName(), false);
|
super("Define Array", plugin.getName(), KeyBindingType.SHARED);
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
|
||||||
setPopupMenu(plugin.getDataActionMenuName(null));
|
setPopupMenu(plugin.getDataActionMenuName(null));
|
||||||
@@ -54,11 +53,6 @@ class CreateArrayAction extends ListingContextAction {
|
|||||||
setKeyBindingData(new KeyBindingData(keyStroke));
|
setKeyBindingData(new KeyBindingData(keyStroke));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean usesSharedKeyBinding() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setPopupMenu(String name) {
|
private void setPopupMenu(String name) {
|
||||||
setPopupMenuData(new MenuData(
|
setPopupMenuData(new MenuData(
|
||||||
new String[] { FunctionPlugin.SET_DATA_TYPE_PULLRIGHT, "Array..." }, null, "Array"));
|
new String[] { FunctionPlugin.SET_DATA_TYPE_PULLRIGHT, "Array..." }, null, "Array"));
|
||||||
|
|||||||
+2
-8
@@ -17,8 +17,7 @@ package ghidra.app.plugin.core.function;
|
|||||||
|
|
||||||
import javax.swing.KeyStroke;
|
import javax.swing.KeyStroke;
|
||||||
|
|
||||||
import docking.action.KeyBindingData;
|
import docking.action.*;
|
||||||
import docking.action.MenuData;
|
|
||||||
import ghidra.app.context.ListingActionContext;
|
import ghidra.app.context.ListingActionContext;
|
||||||
import ghidra.app.context.ListingContextAction;
|
import ghidra.app.context.ListingContextAction;
|
||||||
import ghidra.app.util.HelpTopics;
|
import ghidra.app.util.HelpTopics;
|
||||||
@@ -38,7 +37,7 @@ public class CycleGroupAction extends ListingContextAction {
|
|||||||
private CycleGroup cycleGroup;
|
private CycleGroup cycleGroup;
|
||||||
|
|
||||||
CycleGroupAction(CycleGroup group, FunctionPlugin plugin) {
|
CycleGroupAction(CycleGroup group, FunctionPlugin plugin) {
|
||||||
super(group.getName(), plugin.getName(), false);
|
super(group.getName(), plugin.getName(), KeyBindingType.SHARED);
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.cycleGroup = group;
|
this.cycleGroup = group;
|
||||||
|
|
||||||
@@ -56,11 +55,6 @@ public class CycleGroupAction extends ListingContextAction {
|
|||||||
setKeyBindingData(new KeyBindingData(keyStroke));
|
setKeyBindingData(new KeyBindingData(keyStroke));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean usesSharedKeyBinding() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setPopupMenu(String name, boolean isSignatureAction) {
|
private void setPopupMenu(String name, boolean isSignatureAction) {
|
||||||
setPopupMenuData(new MenuData(
|
setPopupMenuData(new MenuData(
|
||||||
new String[] { FunctionPlugin.SET_DATA_TYPE_PULLRIGHT, "Cycle", cycleGroup.getName() },
|
new String[] { FunctionPlugin.SET_DATA_TYPE_PULLRIGHT, "Cycle", cycleGroup.getName() },
|
||||||
|
|||||||
@@ -17,8 +17,7 @@ package ghidra.app.plugin.core.function;
|
|||||||
|
|
||||||
import javax.swing.KeyStroke;
|
import javax.swing.KeyStroke;
|
||||||
|
|
||||||
import docking.action.KeyBindingData;
|
import docking.action.*;
|
||||||
import docking.action.MenuData;
|
|
||||||
import ghidra.app.context.ListingActionContext;
|
import ghidra.app.context.ListingActionContext;
|
||||||
import ghidra.app.context.ListingContextAction;
|
import ghidra.app.context.ListingContextAction;
|
||||||
import ghidra.program.model.data.DataType;
|
import ghidra.program.model.data.DataType;
|
||||||
@@ -41,7 +40,7 @@ class DataAction extends ListingContextAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public DataAction(String name, String group, DataType dataType, FunctionPlugin plugin) {
|
public DataAction(String name, String group, DataType dataType, FunctionPlugin plugin) {
|
||||||
super(name, plugin.getName(), false);
|
super(name, plugin.getName(), KeyBindingType.SHARED);
|
||||||
this.group = group;
|
this.group = group;
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.dataType = dataType;
|
this.dataType = dataType;
|
||||||
@@ -52,11 +51,6 @@ class DataAction extends ListingContextAction {
|
|||||||
initKeyStroke(getDefaultKeyStroke());
|
initKeyStroke(getDefaultKeyStroke());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean usesSharedKeyBinding() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected KeyStroke getDefaultKeyStroke() {
|
protected KeyStroke getDefaultKeyStroke() {
|
||||||
return null; // we have no default, but our subclasses may
|
return null; // we have no default, but our subclasses may
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-12
@@ -15,6 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.plugin.core.function;
|
package ghidra.app.plugin.core.function;
|
||||||
|
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
|
|
||||||
|
import docking.ActionContext;
|
||||||
|
import docking.action.KeyBindingData;
|
||||||
|
import docking.action.KeyBindingType;
|
||||||
import ghidra.app.cmd.function.SetVariableCommentCmd;
|
import ghidra.app.cmd.function.SetVariableCommentCmd;
|
||||||
import ghidra.app.context.ListingActionContext;
|
import ghidra.app.context.ListingActionContext;
|
||||||
import ghidra.app.context.ListingContextAction;
|
import ghidra.app.context.ListingContextAction;
|
||||||
@@ -22,26 +27,19 @@ import ghidra.program.model.listing.Function;
|
|||||||
import ghidra.program.model.listing.Variable;
|
import ghidra.program.model.listing.Variable;
|
||||||
import ghidra.program.util.*;
|
import ghidra.program.util.*;
|
||||||
|
|
||||||
import java.awt.event.KeyEvent;
|
|
||||||
|
|
||||||
import docking.ActionContext;
|
|
||||||
import docking.action.KeyBindingData;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <CODE>VariableCommentDeleteAction</CODE> allows the user to delete a function variable comment.
|
* <CODE>VariableCommentDeleteAction</CODE> allows the user to delete a function variable comment.
|
||||||
*/
|
*/
|
||||||
class VariableCommentDeleteAction extends ListingContextAction {
|
class VariableCommentDeleteAction extends ListingContextAction {
|
||||||
|
|
||||||
/** the plugin associated with this action. */
|
|
||||||
FunctionPlugin funcPlugin;
|
FunctionPlugin funcPlugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new action with the given name and associated to the given plugin.
|
* Creates a new action with the given name and associated to the given plugin.
|
||||||
* @param plugin
|
* @param plugin the plugin this action is associated with.
|
||||||
* the plugin this action is associated with.
|
*/
|
||||||
*/
|
|
||||||
VariableCommentDeleteAction(FunctionPlugin plugin) {
|
VariableCommentDeleteAction(FunctionPlugin plugin) {
|
||||||
super("Delete Function Variable Comment", plugin.getName(), false);
|
super("Delete Function Variable Comment", plugin.getName(), KeyBindingType.SHARED);
|
||||||
this.funcPlugin = plugin;
|
this.funcPlugin = plugin;
|
||||||
setKeyBindingData(new KeyBindingData(KeyEvent.VK_DELETE, 0));
|
setKeyBindingData(new KeyBindingData(KeyEvent.VK_DELETE, 0));
|
||||||
}
|
}
|
||||||
@@ -65,7 +63,6 @@ class VariableCommentDeleteAction extends ListingContextAction {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ///////////////////////////////////////////////////////////
|
|
||||||
/**
|
/**
|
||||||
* Get a variable using the current location.
|
* Get a variable using the current location.
|
||||||
*
|
*
|
||||||
|
|||||||
+5
-5
@@ -43,19 +43,19 @@ class VariableDeleteAction extends ListingContextAction {
|
|||||||
* @param plugin the plugin this action is associated with.
|
* @param plugin the plugin this action is associated with.
|
||||||
*/
|
*/
|
||||||
VariableDeleteAction(FunctionPlugin plugin) {
|
VariableDeleteAction(FunctionPlugin plugin) {
|
||||||
super("Delete Function Variable", plugin.getName(), true);
|
super("Delete Function Variable", plugin.getName());
|
||||||
this.funcPlugin = plugin;
|
this.funcPlugin = plugin;
|
||||||
|
|
||||||
setPopupMenuPath(false);
|
setPopupMenuPath(false);
|
||||||
|
|
||||||
setKeyBindingData(new KeyBindingData(KeyEvent.VK_DELETE, 0));
|
setKeyBindingData(new KeyBindingData(KeyEvent.VK_DELETE, 0));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setPopupMenuPath(boolean isParameter) {
|
private void setPopupMenuPath(boolean isParameter) {
|
||||||
setPopupMenuData(new MenuData(new String[] { FunctionPlugin.VARIABLE_MENU_PULLRIGHT,
|
setPopupMenuData(new MenuData(
|
||||||
"Delete " + (isParameter ? "Parameter" : "Local Variable") }, null,
|
new String[] { FunctionPlugin.VARIABLE_MENU_PULLRIGHT,
|
||||||
FunctionPlugin.VARIABLE_MENU_SUBGROUP));
|
"Delete " + (isParameter ? "Parameter" : "Local Variable") },
|
||||||
|
null, FunctionPlugin.VARIABLE_MENU_SUBGROUP));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+2
-8
@@ -190,18 +190,12 @@ public class FunctionWindowPlugin extends ProgramPlugin implements DomainObjectL
|
|||||||
|
|
||||||
private void addSelectAction() {
|
private void addSelectAction() {
|
||||||
|
|
||||||
selectAction = new MakeProgramSelectionAction(getName(), provider.getTable()) {
|
selectAction = new MakeProgramSelectionAction(this, provider.getTable());
|
||||||
@Override
|
|
||||||
protected void makeSelection(ActionContext context) {
|
|
||||||
selectFunctions(provider.selectFunctions());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
tool.addLocalAction(provider, selectAction);
|
tool.addLocalAction(provider, selectAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addCompareAction() {
|
private void addCompareAction() {
|
||||||
compareAction = new DockingAction("Compare Selected Functions", getName(), false) {
|
compareAction = new DockingAction("Compare Selected Functions", getName()) {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionContext context) {
|
public void actionPerformed(ActionContext context) {
|
||||||
compareSelectedFunctions();
|
compareSelectedFunctions();
|
||||||
|
|||||||
-14
@@ -16,13 +16,10 @@
|
|||||||
package ghidra.app.plugin.core.instructionsearch.ui;
|
package ghidra.app.plugin.core.instructionsearch.ui;
|
||||||
|
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.swing.JToolBar;
|
import javax.swing.JToolBar;
|
||||||
import javax.swing.table.TableCellRenderer;
|
import javax.swing.table.TableCellRenderer;
|
||||||
|
|
||||||
import docking.ActionContext;
|
|
||||||
import docking.action.DockingActionIf;
|
|
||||||
import docking.widgets.table.GTable;
|
import docking.widgets.table.GTable;
|
||||||
import ghidra.app.plugin.core.instructionsearch.model.*;
|
import ghidra.app.plugin.core.instructionsearch.model.*;
|
||||||
import ghidra.util.table.GhidraTable;
|
import ghidra.util.table.GhidraTable;
|
||||||
@@ -109,17 +106,6 @@ public abstract class AbstractInstructionTable extends GhidraTable {
|
|||||||
return (InstructionTableDataObject) getModel().getValueAt(row, col);
|
return (InstructionTableDataObject) getModel().getValueAt(row, col);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Must invoke the parent implementation of this to have the context menu
|
|
||||||
* created.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<DockingActionIf> getDockingActions(ActionContext context) {
|
|
||||||
List<DockingActionIf> list = super.getDockingActions(context);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Must override so it doesn't return an instance of the base
|
* Must override so it doesn't return an instance of the base
|
||||||
* {@link TableCellRenderer}, which will override our changes in the
|
* {@link TableCellRenderer}, which will override our changes in the
|
||||||
|
|||||||
+1
-2
@@ -22,7 +22,6 @@ import java.util.List;
|
|||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
import docking.ActionContext;
|
|
||||||
import docking.DockingWindowManager;
|
import docking.DockingWindowManager;
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import docking.widgets.EmptyBorderButton;
|
import docking.widgets.EmptyBorderButton;
|
||||||
@@ -102,7 +101,7 @@ public class InstructionTable extends AbstractInstructionTable {
|
|||||||
* (which is all of them).
|
* (which is all of them).
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<DockingActionIf> getDockingActions(ActionContext context) {
|
public List<DockingActionIf> getDockingActions() {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-7
@@ -134,14 +134,12 @@ public class PreviewTable extends AbstractInstructionTable {
|
|||||||
/**
|
/**
|
||||||
* Adds custom context-sensitive menus to the table. This does NOT modify
|
* Adds custom context-sensitive menus to the table. This does NOT modify
|
||||||
* any existing menus; it simply adds to them.
|
* any existing menus; it simply adds to them.
|
||||||
*
|
|
||||||
* @param context the action context
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<DockingActionIf> getDockingActions(ActionContext context) {
|
public List<DockingActionIf> getDockingActions() {
|
||||||
|
|
||||||
// Invoke the base class method to add default menu options.
|
// Invoke the base class method to add default menu options.
|
||||||
List<DockingActionIf> list = super.getDockingActions(context);
|
List<DockingActionIf> list = super.getDockingActions();
|
||||||
|
|
||||||
// And now add our own.
|
// And now add our own.
|
||||||
addCustomMenuItems(list);
|
addCustomMenuItems(list);
|
||||||
@@ -489,7 +487,7 @@ public class PreviewTable extends AbstractInstructionTable {
|
|||||||
*/
|
*/
|
||||||
private void createCopyInstructionWithCommentsAction(String owner) {
|
private void createCopyInstructionWithCommentsAction(String owner) {
|
||||||
copyInstructionWithCommentsAction =
|
copyInstructionWithCommentsAction =
|
||||||
new DockingAction("Selected Instructions (with comments)", owner, false) {
|
new DockingAction("Selected Instructions (with comments)", owner) {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionContext context) {
|
public void actionPerformed(ActionContext context) {
|
||||||
int[] selectedRows = PreviewTable.this.getSelectedRows();
|
int[] selectedRows = PreviewTable.this.getSelectedRows();
|
||||||
@@ -520,7 +518,7 @@ public class PreviewTable extends AbstractInstructionTable {
|
|||||||
* as shown in the table.
|
* as shown in the table.
|
||||||
*/
|
*/
|
||||||
private void createCopyInstructionAction(String owner) {
|
private void createCopyInstructionAction(String owner) {
|
||||||
copyInstructionAction = new DockingAction("Selected Instructions", owner, false) {
|
copyInstructionAction = new DockingAction("Selected Instructions", owner) {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionContext context) {
|
public void actionPerformed(ActionContext context) {
|
||||||
int[] selectedRows = PreviewTable.this.getSelectedRows();
|
int[] selectedRows = PreviewTable.this.getSelectedRows();
|
||||||
@@ -541,7 +539,7 @@ public class PreviewTable extends AbstractInstructionTable {
|
|||||||
* rows, as shown in the table, with no spaces.
|
* rows, as shown in the table, with no spaces.
|
||||||
*/
|
*/
|
||||||
private void createCopyNoSpacesAction(String owner) {
|
private void createCopyNoSpacesAction(String owner) {
|
||||||
copyNoSpacesAction = new DockingAction("Selected instructions (no spaces)", owner, false) {
|
copyNoSpacesAction = new DockingAction("Selected instructions (no spaces)", owner) {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionContext context) {
|
public void actionPerformed(ActionContext context) {
|
||||||
int[] selectedRows = PreviewTable.this.getSelectedRows();
|
int[] selectedRows = PreviewTable.this.getSelectedRows();
|
||||||
|
|||||||
+5
-9
@@ -19,7 +19,8 @@ import java.io.*;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.Icon;
|
||||||
|
import javax.swing.JComponent;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
import docking.action.DockingAction;
|
import docking.action.DockingAction;
|
||||||
@@ -33,12 +34,12 @@ import utility.function.Callback;
|
|||||||
|
|
||||||
public class InterpreterComponentProvider extends ComponentProviderAdapter
|
public class InterpreterComponentProvider extends ComponentProviderAdapter
|
||||||
implements InterpreterConsole {
|
implements InterpreterConsole {
|
||||||
|
|
||||||
private static final String CONSOLE_GIF = "images/monitor.png";
|
private static final String CONSOLE_GIF = "images/monitor.png";
|
||||||
private static final String CLEAR_GIF = "images/erase16.png";
|
private static final String CLEAR_GIF = "images/erase16.png";
|
||||||
|
|
||||||
private InterpreterPanel panel;
|
private InterpreterPanel panel;
|
||||||
private InterpreterConnection interpreter;
|
private InterpreterConnection interpreter;
|
||||||
private ImageIcon icon;
|
|
||||||
private List<Callback> firstActivationCallbacks;
|
private List<Callback> firstActivationCallbacks;
|
||||||
|
|
||||||
public InterpreterComponentProvider(InterpreterPanelPlugin plugin,
|
public InterpreterComponentProvider(InterpreterPanelPlugin plugin,
|
||||||
@@ -54,9 +55,9 @@ public class InterpreterComponentProvider extends ComponentProviderAdapter
|
|||||||
addToTool();
|
addToTool();
|
||||||
createActions();
|
createActions();
|
||||||
|
|
||||||
icon = interpreter.getIcon();
|
Icon icon = interpreter.getIcon();
|
||||||
if (icon == null) {
|
if (icon == null) {
|
||||||
ResourceManager.loadImage(CONSOLE_GIF);
|
icon = ResourceManager.loadImage(CONSOLE_GIF);
|
||||||
}
|
}
|
||||||
setIcon(icon);
|
setIcon(icon);
|
||||||
|
|
||||||
@@ -107,11 +108,6 @@ public class InterpreterComponentProvider extends ComponentProviderAdapter
|
|||||||
addLocalAction(disposeAction);
|
addLocalAction(disposeAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Icon getIcon() {
|
|
||||||
return icon;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getWindowSubMenuName() {
|
public String getWindowSubMenuName() {
|
||||||
return interpreter.getTitle();
|
return interpreter.getTitle();
|
||||||
|
|||||||
+4
-43
@@ -15,6 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.plugin.core.memory;
|
package ghidra.app.plugin.core.memory;
|
||||||
|
|
||||||
|
import java.awt.Cursor;
|
||||||
|
|
||||||
import ghidra.app.CorePluginPackage;
|
import ghidra.app.CorePluginPackage;
|
||||||
import ghidra.app.events.ProgramLocationPluginEvent;
|
import ghidra.app.events.ProgramLocationPluginEvent;
|
||||||
import ghidra.app.plugin.PluginCategoryNames;
|
import ghidra.app.plugin.PluginCategoryNames;
|
||||||
@@ -31,15 +33,6 @@ import ghidra.program.model.mem.MemoryBlock;
|
|||||||
import ghidra.program.util.ChangeManager;
|
import ghidra.program.util.ChangeManager;
|
||||||
import ghidra.program.util.ProgramLocation;
|
import ghidra.program.util.ProgramLocation;
|
||||||
|
|
||||||
import java.awt.Cursor;
|
|
||||||
|
|
||||||
import javax.swing.ImageIcon;
|
|
||||||
|
|
||||||
import resources.ResourceManager;
|
|
||||||
import docking.ActionContext;
|
|
||||||
import docking.action.DockingAction;
|
|
||||||
import docking.action.ToolBarData;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <CODE>MemoryMapPlugin</CODE> displays a memory map of all blocks in
|
* <CODE>MemoryMapPlugin</CODE> displays a memory map of all blocks in
|
||||||
* the current program's memory. Options for Adding, Editing, and Deleting
|
* the current program's memory. Options for Adding, Editing, and Deleting
|
||||||
@@ -61,20 +54,15 @@ public class MemoryMapPlugin extends ProgramPlugin implements DomainObjectListen
|
|||||||
final static Cursor WAIT_CURSOR = new Cursor(Cursor.WAIT_CURSOR);
|
final static Cursor WAIT_CURSOR = new Cursor(Cursor.WAIT_CURSOR);
|
||||||
final static Cursor NORM_CURSOR = new Cursor(Cursor.DEFAULT_CURSOR);
|
final static Cursor NORM_CURSOR = new Cursor(Cursor.DEFAULT_CURSOR);
|
||||||
|
|
||||||
private DockingAction memViewAction;
|
|
||||||
private MemoryMapProvider provider;
|
private MemoryMapProvider provider;
|
||||||
private GoToService goToService;
|
private GoToService goToService;
|
||||||
private MemoryMapManager memManager;
|
private MemoryMapManager memManager;
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*/
|
|
||||||
public MemoryMapPlugin(PluginTool tool) {
|
public MemoryMapPlugin(PluginTool tool) {
|
||||||
super(tool, true, false);
|
super(tool, true, false);
|
||||||
|
|
||||||
memManager = new MemoryMapManager(this);
|
memManager = new MemoryMapManager(this);
|
||||||
provider = new MemoryMapProvider(this);
|
provider = new MemoryMapProvider(this);
|
||||||
createActions();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -83,9 +71,6 @@ public class MemoryMapPlugin extends ProgramPlugin implements DomainObjectListen
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
if (memViewAction != null) {
|
|
||||||
memViewAction.dispose();
|
|
||||||
}
|
|
||||||
if (provider != null) {
|
if (provider != null) {
|
||||||
provider.dispose();
|
provider.dispose();
|
||||||
provider = null;
|
provider = null;
|
||||||
@@ -122,8 +107,9 @@ public class MemoryMapPlugin extends ProgramPlugin implements DomainObjectListen
|
|||||||
@Override
|
@Override
|
||||||
protected void init() {
|
protected void init() {
|
||||||
goToService = tool.getService(GoToService.class);
|
goToService = tool.getService(GoToService.class);
|
||||||
if (currentProgram != null)
|
if (currentProgram != null) {
|
||||||
programActivated(currentProgram);
|
programActivated(currentProgram);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -168,29 +154,4 @@ public class MemoryMapPlugin extends ProgramPlugin implements DomainObjectListen
|
|||||||
ProgramLocation loc = new ProgramLocation(currentProgram, addr);
|
ProgramLocation loc = new ProgramLocation(currentProgram, addr);
|
||||||
goToService.goTo(loc);
|
goToService.goTo(loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Create the action for toolbar.
|
|
||||||
*/
|
|
||||||
private void createActions() {
|
|
||||||
|
|
||||||
memViewAction = new DockingAction("View Memory Map", getName()) {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionContext context) {
|
|
||||||
showMemory();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
ImageIcon tableImage = ResourceManager.loadImage(MemoryMapProvider.MEMORY_IMAGE);
|
|
||||||
memViewAction.setToolBarData(new ToolBarData(tableImage, "View"));
|
|
||||||
memViewAction.setDescription("Display Memory Map");
|
|
||||||
tool.addAction(memViewAction);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Callback for the View memory Action
|
|
||||||
*/
|
|
||||||
private void showMemory() {
|
|
||||||
tool.showComponentProvider(provider, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-7
@@ -81,9 +81,11 @@ class MemoryMapProvider extends ComponentProviderAdapter {
|
|||||||
MemoryMapProvider(MemoryMapPlugin plugin) {
|
MemoryMapProvider(MemoryMapPlugin plugin) {
|
||||||
super(plugin.getTool(), "Memory Map", plugin.getName(), ProgramActionContext.class);
|
super(plugin.getTool(), "Memory Map", plugin.getName(), ProgramActionContext.class);
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
|
||||||
setHelpLocation(new HelpLocation(plugin.getName(), getName()));
|
setHelpLocation(new HelpLocation(plugin.getName(), getName()));
|
||||||
memManager = plugin.getMemoryMapManager();
|
memManager = plugin.getMemoryMapManager();
|
||||||
setIcon(ResourceManager.loadImage(MEMORY_IMAGE));
|
setIcon(ResourceManager.loadImage(MEMORY_IMAGE));
|
||||||
|
addToToolbar();
|
||||||
mainPanel = buildMainPanel();
|
mainPanel = buildMainPanel();
|
||||||
addToTool();
|
addToTool();
|
||||||
addLocalActions();
|
addLocalActions();
|
||||||
@@ -107,9 +109,6 @@ class MemoryMapProvider extends ComponentProviderAdapter {
|
|||||||
return new ProgramActionContext(this, program);
|
return new ProgramActionContext(this, program);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the status text on this dialog.
|
|
||||||
*/
|
|
||||||
void setStatusText(String msg) {
|
void setStatusText(String msg) {
|
||||||
tool.setStatusInfo(msg);
|
tool.setStatusInfo(msg);
|
||||||
}
|
}
|
||||||
@@ -367,9 +366,6 @@ class MemoryMapProvider extends ComponentProviderAdapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
JTable getTable() {
|
JTable getTable() {
|
||||||
return memTable;
|
return memTable;
|
||||||
}
|
}
|
||||||
@@ -462,7 +458,8 @@ class MemoryMapProvider extends ComponentProviderAdapter {
|
|||||||
public void mousePressed(MouseEvent e) {
|
public void mousePressed(MouseEvent e) {
|
||||||
setStatusText("");
|
setStatusText("");
|
||||||
if (!e.isPopupTrigger()) {
|
if (!e.isPopupTrigger()) {
|
||||||
if ((e.getModifiers() & (InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK)) == 0) {
|
if ((e.getModifiersEx() &
|
||||||
|
(InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK)) == 0) {
|
||||||
selectAddress();
|
selectAddress();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -368,7 +368,7 @@ public class NextPrevAddressPlugin extends Plugin {
|
|||||||
|
|
||||||
private NavigationAction(Navigatable navigatable, LocationMemento location, boolean isNext,
|
private NavigationAction(Navigatable navigatable, LocationMemento location, boolean isNext,
|
||||||
NavigationHistoryService service, CodeUnitFormat formatter) {
|
NavigationHistoryService service, CodeUnitFormat formatter) {
|
||||||
super("NavigationAction: " + ++idCount, NextPrevAddressPlugin.this.getName(), false);
|
super("NavigationAction: " + ++idCount, NextPrevAddressPlugin.this.getName());
|
||||||
this.location = location;
|
this.location = location;
|
||||||
this.isNext = isNext;
|
this.isNext = isNext;
|
||||||
this.service = service;
|
this.service = service;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user