mirror of
https://github.com/NationalSecurityAgency/ghidra
synced 2024-10-04 01:15:18 +00:00
Merge remote-tracking branch 'origin/GP-2663-dragonmacher-remove-deprecated-methods--SQUASHED'
This commit is contained in:
commit
7873d84ed0
|
@ -85,7 +85,7 @@ public class RandomForestFunctionFinderPlugin extends ProgramPlugin
|
||||||
* @param tool tool for plugin
|
* @param tool tool for plugin
|
||||||
*/
|
*/
|
||||||
public RandomForestFunctionFinderPlugin(PluginTool tool) {
|
public RandomForestFunctionFinderPlugin(PluginTool tool) {
|
||||||
super(tool, false, true);
|
super(tool);
|
||||||
programsToProviders = new HashMap<>();
|
programsToProviders = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class SampleTablePlugin extends ProgramPlugin {
|
||||||
private Function currentFunction;
|
private Function currentFunction;
|
||||||
|
|
||||||
public SampleTablePlugin(PluginTool tool) {
|
public SampleTablePlugin(PluginTool tool) {
|
||||||
super(tool, true /*location changes*/, true/*selection changes*/);
|
super(tool);
|
||||||
|
|
||||||
provider = new SampleTableProvider(this);
|
provider = new SampleTableProvider(this);
|
||||||
provider.addToTool();
|
provider.addToTool();
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class SampleSearchTablePlugin extends ProgramPlugin {
|
||||||
private SampleSearchTableProvider provider;
|
private SampleSearchTableProvider provider;
|
||||||
|
|
||||||
public SampleSearchTablePlugin(PluginTool tool) {
|
public SampleSearchTablePlugin(PluginTool tool) {
|
||||||
super(tool, false, false);
|
super(tool);
|
||||||
createActions();
|
createActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class KitchenSinkPlugin extends ProgramPlugin {
|
||||||
*/
|
*/
|
||||||
public KitchenSinkPlugin(PluginTool tool) {
|
public KitchenSinkPlugin(PluginTool tool) {
|
||||||
|
|
||||||
super(tool, false, false);
|
super(tool);
|
||||||
|
|
||||||
// set up list of services.
|
// set up list of services.
|
||||||
setupServices();
|
setupServices();
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class SampleProgramTreePlugin extends ProgramPlugin {
|
||||||
* @param tool tool that will contain this plugin
|
* @param tool tool that will contain this plugin
|
||||||
*/
|
*/
|
||||||
public SampleProgramTreePlugin(PluginTool tool) {
|
public SampleProgramTreePlugin(PluginTool tool) {
|
||||||
super(tool, false, false); // we consume neither location nor selection events
|
super(tool);
|
||||||
createActions();
|
createActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class ShowInfoPlugin extends ProgramPlugin {
|
||||||
private ShowInfoComponentProvider provider;
|
private ShowInfoComponentProvider provider;
|
||||||
|
|
||||||
public ShowInfoPlugin(PluginTool tool) {
|
public ShowInfoPlugin(PluginTool tool) {
|
||||||
super(tool, true, false);
|
super(tool);
|
||||||
provider = new ShowInfoComponentProvider(tool, getName());
|
provider = new ShowInfoComponentProvider(tool, getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,226 +0,0 @@
|
||||||
/* ###
|
|
||||||
* IP: GHIDRA
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package ghidra.examples;
|
|
||||||
|
|
||||||
import ghidra.app.context.ListingActionContext;
|
|
||||||
import ghidra.app.events.ProgramActivatedPluginEvent;
|
|
||||||
import ghidra.app.services.ProgramManager;
|
|
||||||
import ghidra.framework.plugintool.*;
|
|
||||||
import ghidra.program.model.listing.Program;
|
|
||||||
import docking.ActionContext;
|
|
||||||
import docking.action.DockingAction;
|
|
||||||
import docking.action.MenuData;
|
|
||||||
|
|
||||||
/*******************************************************************
|
|
||||||
*
|
|
||||||
* Here's an example of a plugin for a GHIDRA tool.
|
|
||||||
*
|
|
||||||
*******************************************************************/
|
|
||||||
/**
|
|
||||||
* NOTE: this example class is abstract so that it does not appear in the
|
|
||||||
* list of valid plugins. Real plugins should not be abstract.
|
|
||||||
*/
|
|
||||||
public abstract class Template extends Plugin {
|
|
||||||
private DockingAction function_1Action;
|
|
||||||
private DockingAction function_2Action;
|
|
||||||
private DockingAction function_3Action;
|
|
||||||
|
|
||||||
/*******************************************************************
|
|
||||||
*
|
|
||||||
* Standard Plugin Constructor
|
|
||||||
*
|
|
||||||
*******************************************************************/
|
|
||||||
public Template(PluginTool tool) {
|
|
||||||
|
|
||||||
super(tool);
|
|
||||||
|
|
||||||
// set up list of actions.
|
|
||||||
setupActions();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************
|
|
||||||
********************************************************************
|
|
||||||
**
|
|
||||||
**
|
|
||||||
** Function 1
|
|
||||||
**
|
|
||||||
**
|
|
||||||
********************************************************************
|
|
||||||
*******************************************************************/
|
|
||||||
private void Function_1() {
|
|
||||||
|
|
||||||
} // Function_1
|
|
||||||
|
|
||||||
/*******************************************************************
|
|
||||||
********************************************************************
|
|
||||||
**
|
|
||||||
**
|
|
||||||
** Function 2
|
|
||||||
**
|
|
||||||
**
|
|
||||||
********************************************************************
|
|
||||||
*******************************************************************/
|
|
||||||
private void Function_2() {
|
|
||||||
|
|
||||||
} // Function_2
|
|
||||||
|
|
||||||
/*******************************************************************
|
|
||||||
********************************************************************
|
|
||||||
**
|
|
||||||
**
|
|
||||||
** Function 3
|
|
||||||
**
|
|
||||||
**
|
|
||||||
********************************************************************
|
|
||||||
*******************************************************************/
|
|
||||||
private void Function_3() {
|
|
||||||
|
|
||||||
} // Function_3
|
|
||||||
|
|
||||||
/*******************************************************************
|
|
||||||
********************************************************************
|
|
||||||
**
|
|
||||||
**
|
|
||||||
** User Plugin Utilities
|
|
||||||
**
|
|
||||||
**
|
|
||||||
********************************************************************
|
|
||||||
*******************************************************************/
|
|
||||||
/**
|
|
||||||
* Get the current program
|
|
||||||
*/
|
|
||||||
private Program getProgram() {
|
|
||||||
|
|
||||||
ProgramManager pm = tool.getService(ProgramManager.class);
|
|
||||||
if (pm != null) {
|
|
||||||
return pm.getCurrentProgram();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************
|
|
||||||
********************************************************************
|
|
||||||
**
|
|
||||||
**
|
|
||||||
** Required Plugin Routines
|
|
||||||
**
|
|
||||||
**
|
|
||||||
********************************************************************
|
|
||||||
*******************************************************************/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set up Actions
|
|
||||||
*/
|
|
||||||
private void setupActions() {
|
|
||||||
|
|
||||||
DockingAction action;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Function 1
|
|
||||||
//
|
|
||||||
action = new DockingAction( "Function 1 Code", getName() ) {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionContext e) {
|
|
||||||
Function_1();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAddToPopup( ActionContext context ) {
|
|
||||||
if ( !(context.getContextObject() instanceof ListingActionContext) ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return super.isAddToPopup( context );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
action.setMenuBarData( new MenuData(
|
|
||||||
new String[] { "Misc", "Menu", "menu item 1" }, null, null ) );
|
|
||||||
|
|
||||||
if (getProgram() == null) {
|
|
||||||
action.setEnabled(false);
|
|
||||||
}
|
|
||||||
tool.addAction(action);
|
|
||||||
|
|
||||||
function_1Action = action;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Function 2
|
|
||||||
//
|
|
||||||
action =new DockingAction("Function 2 Code", getName() ) {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionContext e) {
|
|
||||||
Function_2();
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public boolean isValidContext(ActionContext context) {
|
|
||||||
return context instanceof ListingActionContext;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
action.setMenuBarData( new MenuData(
|
|
||||||
new String[] { "Misc", "Menu", "Menu item 2" }, null, null ) );
|
|
||||||
if (getProgram() == null) {
|
|
||||||
action.setEnabled(false);
|
|
||||||
}
|
|
||||||
tool.addAction(action);
|
|
||||||
|
|
||||||
// remember this action so I can enable/disable it later
|
|
||||||
function_2Action = action;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Function 3
|
|
||||||
//
|
|
||||||
action =
|
|
||||||
new DockingAction("Function 3 Code", getName() ) {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionContext e) {
|
|
||||||
Function_3();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isValidContext( ActionContext context ) {
|
|
||||||
return context instanceof ListingActionContext;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
action.setMenuBarData( new MenuData(
|
|
||||||
new String[] { "Misc", "Menu", "Menu item 3" }, null, null ) );
|
|
||||||
|
|
||||||
if (getProgram() == null) {
|
|
||||||
action.setEnabled(false);
|
|
||||||
}
|
|
||||||
tool.addAction(action);
|
|
||||||
|
|
||||||
// remember this action so I can enable/disable it later
|
|
||||||
function_3Action = action;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Put event processing code here.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void processEvent(PluginEvent event) {
|
|
||||||
if (event instanceof ProgramActivatedPluginEvent) {
|
|
||||||
Program p = ((ProgramActivatedPluginEvent)event).getActiveProgram();
|
|
||||||
function_1Action.setEnabled(p!=null);
|
|
||||||
function_2Action.setEnabled(p!=null);
|
|
||||||
function_3Action.setEnabled(p!=null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,147 +0,0 @@
|
||||||
/* ###
|
|
||||||
* IP: GHIDRA
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package ghidra.examples;
|
|
||||||
|
|
||||||
import docking.ActionContext;
|
|
||||||
import docking.action.DockingAction;
|
|
||||||
import docking.action.MenuData;
|
|
||||||
import ghidra.app.ExamplesPluginPackage;
|
|
||||||
import ghidra.app.context.ListingActionContext;
|
|
||||||
import ghidra.app.plugin.PluginCategoryNames;
|
|
||||||
import ghidra.app.plugin.ProgramPlugin;
|
|
||||||
import ghidra.app.services.ProgramManager;
|
|
||||||
import ghidra.framework.model.*;
|
|
||||||
import ghidra.framework.plugintool.PluginInfo;
|
|
||||||
import ghidra.framework.plugintool.PluginTool;
|
|
||||||
import ghidra.framework.plugintool.util.PluginStatus;
|
|
||||||
import ghidra.program.model.listing.Program;
|
|
||||||
import ghidra.program.util.ProgramChangeRecord;
|
|
||||||
import ghidra.util.HelpLocation;
|
|
||||||
import ghidra.util.Msg;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sample plugin for dealing with Programs. The base class handles
|
|
||||||
* the event processing and enabling/disabling of actions. This
|
|
||||||
* allows the derived class to be very simple.
|
|
||||||
*/
|
|
||||||
//@formatter:off
|
|
||||||
@PluginInfo(
|
|
||||||
status = PluginStatus.RELEASED,
|
|
||||||
packageName = ExamplesPluginPackage.NAME,
|
|
||||||
category = PluginCategoryNames.EXAMPLES,
|
|
||||||
shortDescription = "Plugin starter template",
|
|
||||||
description = "Copy this plugin and use as a template for creating a new plugin.",
|
|
||||||
servicesRequired = { ProgramManager.class /* list of service classes that this plugin requires */ },
|
|
||||||
servicesProvided = { /* list of service classes that this plugin registers with Plugin.registerServiceProvided() */ }
|
|
||||||
)
|
|
||||||
//@formatter:on
|
|
||||||
public class TemplateProgramPlugin extends ProgramPlugin implements DomainObjectListener {
|
|
||||||
|
|
||||||
private DockingAction action;
|
|
||||||
|
|
||||||
/*******************************************************************
|
|
||||||
*
|
|
||||||
* Standard Plugin Constructor
|
|
||||||
*
|
|
||||||
*******************************************************************/
|
|
||||||
public TemplateProgramPlugin(PluginTool tool) {
|
|
||||||
|
|
||||||
super(tool, true, // true means this plugin consumes ProgramLocation events
|
|
||||||
false); // false means this plugin does not consume
|
|
||||||
// ProgramSelection events
|
|
||||||
// the base class ProgramPlugin handles all the event registering
|
|
||||||
|
|
||||||
// set up list of actions.
|
|
||||||
setupActions();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is the callback method for DomainObjectChangedEvents.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected void programActivated(Program program) {
|
|
||||||
program.addListener(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when the program is closed.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected void programDeactivated(Program program) {
|
|
||||||
program.removeListener(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************
|
|
||||||
********************************************************************
|
|
||||||
**
|
|
||||||
**
|
|
||||||
** Function 1
|
|
||||||
**
|
|
||||||
**
|
|
||||||
********************************************************************
|
|
||||||
*******************************************************************/
|
|
||||||
private void Function_1() {
|
|
||||||
// do something with a program location
|
|
||||||
Msg.info(this, getPluginDescription().getName() + ": Program Location==> " +
|
|
||||||
currentLocation.getAddress());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set up Actions
|
|
||||||
*/
|
|
||||||
private void setupActions() {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Function 1
|
|
||||||
//
|
|
||||||
action = new DockingAction("Function 1 Code", getName()) {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionContext e) {
|
|
||||||
Function_1();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isValidContext(ActionContext context) {
|
|
||||||
return context instanceof ListingActionContext;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
action.setEnabled(false);
|
|
||||||
|
|
||||||
action.setMenuBarData(
|
|
||||||
new MenuData(new String[] { "Misc", "Menu", "Menu item 1" }, null, null));
|
|
||||||
|
|
||||||
action.setHelpLocation(
|
|
||||||
new HelpLocation("SampleHelpTopic", "TemplateProgramPlugin_Anchor_Name"));
|
|
||||||
tool.addAction(action);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -15,44 +15,31 @@
|
||||||
*/
|
*/
|
||||||
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.*;
|
||||||
import ghidra.program.model.address.Address;
|
import ghidra.program.model.address.Address;
|
||||||
import ghidra.program.model.address.AddressSetView;
|
import ghidra.program.model.address.AddressSetView;
|
||||||
import ghidra.program.model.listing.*;
|
import ghidra.program.model.listing.CodeUnit;
|
||||||
|
import ghidra.program.model.listing.Program;
|
||||||
import ghidra.program.util.ProgramLocation;
|
import ghidra.program.util.ProgramLocation;
|
||||||
import ghidra.program.util.ProgramSelection;
|
import ghidra.program.util.ProgramSelection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class to handle common program events: Program Open/Close,
|
* Base class to handle common program events: Program Open/Close, Program Activated,
|
||||||
* Program Location, Program Selection, and Program Highlight.
|
* Program Location, Program Selection, and Program Highlight. This class has fields related to
|
||||||
|
* these events: {@code currentProgram}, {@code currentLocation}, {@code currentSelection} and
|
||||||
|
* {@code currentHighlight}.
|
||||||
* <p>
|
* <p>
|
||||||
* Subclasses should override the following methods if they are interested
|
* Subclasses should override the following methods if they are interested in the corresponding
|
||||||
* in the corresponding events:
|
* events:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <LI> <code>programOpened(Program)</code>
|
* <LI> {@link #programOpened(Program)}
|
||||||
* <LI> <code>programClosed(Program)</code>
|
* <LI> {@link #programClosed(Program)}
|
||||||
* <LI> <code>locationChanged(ProgramLocation)</code>
|
* <LI> {@link #locationChanged(ProgramLocation)}
|
||||||
* <LI> <code>selectionChanged(ProgramSelection) </code>
|
* <LI> {@link #selectionChanged(ProgramSelection)}
|
||||||
* <LI> <code>highlightChanged(ProgramSelection) </code>
|
* <LI> {@link #highlightChanged(ProgramSelection)}
|
||||||
* </LI>
|
|
||||||
* </ul>
|
* </ul>
|
||||||
* <br>
|
|
||||||
* This class will handle the enablement and add to popup state for
|
|
||||||
* plugin actions when subclasses call any of the following methods:
|
|
||||||
* <ul>
|
|
||||||
* <LI><code>enableOnHighlight(PluginAction)</code>
|
|
||||||
* <LI><code>enableOnLocation(PluginAction)</code>
|
|
||||||
* <LI><code>enableOnProgram(PluginAction)</code>
|
|
||||||
* <LI><code>enableOnSelection(PluginAction)</code>
|
|
||||||
* </LI>
|
|
||||||
* </ul>
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public abstract class ProgramPlugin extends Plugin {
|
public abstract class ProgramPlugin extends Plugin {
|
||||||
|
|
||||||
|
@ -60,53 +47,58 @@ public abstract class ProgramPlugin extends Plugin {
|
||||||
protected ProgramLocation currentLocation;
|
protected ProgramLocation currentLocation;
|
||||||
protected ProgramSelection currentSelection;
|
protected ProgramSelection currentSelection;
|
||||||
protected ProgramSelection currentHighlight;
|
protected ProgramSelection currentHighlight;
|
||||||
private ArrayList<DockingAction> programActionList;
|
|
||||||
private ArrayList<DockingAction> locationActionList;
|
|
||||||
private ArrayList<DockingAction> selectionActionList;
|
|
||||||
private ArrayList<DockingAction> highlightActionList;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new program plugin
|
* Constructs a new program plugin
|
||||||
* @param plugintool tool the parent tool for this plugin
|
* @param plugintool tool the parent tool for this plugin
|
||||||
* @param consumeLocationChange true if this plugin should consume ProgramLocation events
|
|
||||||
* @param consumeSelectionChange true if this plugin should consume ProgramSelection events
|
|
||||||
* @param consumeHighlightChange true if this plugin should consume ProgramHighlight events
|
|
||||||
*/
|
*/
|
||||||
|
public ProgramPlugin(PluginTool plugintool) {
|
||||||
|
super(plugintool);
|
||||||
|
internalRegisterEventConsumed(ProgramActivatedPluginEvent.class);
|
||||||
|
internalRegisterEventConsumed(ProgramLocationPluginEvent.class);
|
||||||
|
internalRegisterEventConsumed(ProgramSelectionPluginEvent.class);
|
||||||
|
internalRegisterEventConsumed(ProgramHighlightPluginEvent.class);
|
||||||
|
internalRegisterEventConsumed(ProgramOpenedPluginEvent.class);
|
||||||
|
internalRegisterEventConsumed(ProgramClosedPluginEvent.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calling this constructor is works the same as calling {@link ProgramPlugin}.
|
||||||
|
*
|
||||||
|
* @deprecated call {@link #ProgramPlugin(PluginTool)} instead
|
||||||
|
* @param plugintool the tool
|
||||||
|
* @param consumeLocationChange not used
|
||||||
|
* @param consumeSelectionChange not used
|
||||||
|
*/
|
||||||
|
@Deprecated(forRemoval = true, since = "10.2")
|
||||||
|
public ProgramPlugin(PluginTool plugintool, boolean consumeLocationChange,
|
||||||
|
boolean consumeSelectionChange) {
|
||||||
|
this(plugintool);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calling this constructor is works the same as calling {@link ProgramPlugin}.
|
||||||
|
*
|
||||||
|
* @deprecated call {@link #ProgramPlugin(PluginTool)} instead
|
||||||
|
* @param plugintool the tool
|
||||||
|
* @param consumeLocationChange not used
|
||||||
|
* @param consumeSelectionChange not used
|
||||||
|
* @param consumeHighlightChange not used
|
||||||
|
*/
|
||||||
|
@Deprecated(forRemoval = true, since = "10.2")
|
||||||
public ProgramPlugin(PluginTool plugintool, boolean consumeLocationChange,
|
public ProgramPlugin(PluginTool plugintool, boolean consumeLocationChange,
|
||||||
boolean consumeSelectionChange, boolean consumeHighlightChange) {
|
boolean consumeSelectionChange, boolean consumeHighlightChange) {
|
||||||
super(plugintool);
|
this(plugintool);
|
||||||
registerEventConsumed(ProgramActivatedPluginEvent.class);
|
|
||||||
|
|
||||||
if (consumeLocationChange) {
|
|
||||||
//register most derived class
|
|
||||||
registerEventConsumed(ProgramLocationPluginEvent.class);
|
|
||||||
}
|
|
||||||
if (consumeSelectionChange) {
|
|
||||||
registerEventConsumed(ProgramSelectionPluginEvent.class);
|
|
||||||
}
|
|
||||||
if (consumeHighlightChange) {
|
|
||||||
registerEventConsumed(ProgramHighlightPluginEvent.class);
|
|
||||||
}
|
|
||||||
registerEventConsumed(ProgramOpenedPluginEvent.class);
|
|
||||||
registerEventConsumed(ProgramClosedPluginEvent.class);
|
|
||||||
programActionList = new ArrayList<>(3);
|
|
||||||
locationActionList = new ArrayList<>(3);
|
|
||||||
selectionActionList = new ArrayList<>(3);
|
|
||||||
highlightActionList = new ArrayList<>(3);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ProgramPlugin(PluginTool tool, boolean consumeLocationChange,
|
|
||||||
boolean consumeSelectionChange) {
|
|
||||||
this(tool, consumeLocationChange, consumeSelectionChange, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process the plugin event.
|
* Process the plugin event.
|
||||||
* When a program closed event or focus changed event comes in,
|
* <p>
|
||||||
* the locationChanged() and selectionChanged() methods are called
|
* When a program closed event or focus changed event comes in, the locationChanged() and
|
||||||
* with null arguments; currentProgram and currentLocation are cleared.
|
* selectionChanged() methods are called with null arguments; currentProgram and
|
||||||
* <p>Note: if the subclass overrides processEvent(), it should call
|
* currentLocation are cleared.
|
||||||
* super.processEvent().
|
* <p>
|
||||||
|
* Note: if the subclass overrides processEvent(), it should call super.processEvent().
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void processEvent(PluginEvent event) {
|
public void processEvent(PluginEvent event) {
|
||||||
|
@ -130,14 +122,10 @@ public abstract class ProgramPlugin extends Plugin {
|
||||||
locationChanged(null);
|
locationChanged(null);
|
||||||
selectionChanged(null);
|
selectionChanged(null);
|
||||||
highlightChanged(null);
|
highlightChanged(null);
|
||||||
enableActions(locationActionList, false);
|
|
||||||
enableActions(selectionActionList, false);
|
|
||||||
enableActions(highlightActionList, false);
|
|
||||||
}
|
}
|
||||||
if (currentProgram != null) {
|
if (currentProgram != null) {
|
||||||
programActivated(currentProgram);
|
programActivated(currentProgram);
|
||||||
}
|
}
|
||||||
enableActions(programActionList, currentProgram != null);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (event instanceof ProgramLocationPluginEvent) {
|
else if (event instanceof ProgramLocationPluginEvent) {
|
||||||
|
@ -147,27 +135,11 @@ public abstract class ProgramPlugin extends Plugin {
|
||||||
if (currentLocation != null && currentLocation.getAddress() == null ||
|
if (currentLocation != null && currentLocation.getAddress() == null ||
|
||||||
(currentProgram == null && ev.getProgram() == null)) {
|
(currentProgram == null && ev.getProgram() == null)) {
|
||||||
currentLocation = null;
|
currentLocation = null;
|
||||||
// disable actions, but don't remove from popup
|
|
||||||
enableActions(locationActionList, false);
|
|
||||||
}
|
|
||||||
else if (currentLocation == null) {
|
|
||||||
// disable actions and remove from popup
|
|
||||||
enableActions(locationActionList, false);
|
|
||||||
// remove selection actions
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// enable actions
|
|
||||||
enableActions(locationActionList, true);
|
|
||||||
// add selection actions
|
|
||||||
}
|
}
|
||||||
if (currentProgram == null) {
|
if (currentProgram == null) {
|
||||||
// currentProgram is null because we haven't gotten the
|
// currentProgram is null because we haven't gotten the open program event yet (a
|
||||||
// open program event yet (a plugin is firing location change
|
// plugin is firing location change in response to open program that we haven't
|
||||||
// in response to open program that we haven't gotten yet),
|
// gotten yet)
|
||||||
// so just pull it out of the
|
|
||||||
// location event...
|
|
||||||
//currentProgram = ev.getProgram();
|
|
||||||
//programOpened(currentProgram);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
locationChanged(currentLocation);
|
locationChanged(currentLocation);
|
||||||
|
@ -175,11 +147,7 @@ public abstract class ProgramPlugin extends Plugin {
|
||||||
else if (event instanceof ProgramSelectionPluginEvent) {
|
else if (event instanceof ProgramSelectionPluginEvent) {
|
||||||
ProgramSelectionPluginEvent ev = (ProgramSelectionPluginEvent) event;
|
ProgramSelectionPluginEvent ev = (ProgramSelectionPluginEvent) event;
|
||||||
currentSelection = ev.getSelection();
|
currentSelection = ev.getSelection();
|
||||||
if (currentSelection != null && !currentSelection.isEmpty()) {
|
if (currentSelection != null && currentSelection.isEmpty()) {
|
||||||
enableActions(selectionActionList, true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
enableActions(selectionActionList, false);
|
|
||||||
currentSelection = null;
|
currentSelection = null;
|
||||||
}
|
}
|
||||||
selectionChanged(currentSelection);
|
selectionChanged(currentSelection);
|
||||||
|
@ -187,111 +155,13 @@ public abstract class ProgramPlugin extends Plugin {
|
||||||
else if (event instanceof ProgramHighlightPluginEvent) {
|
else if (event instanceof ProgramHighlightPluginEvent) {
|
||||||
ProgramHighlightPluginEvent ev = (ProgramHighlightPluginEvent) event;
|
ProgramHighlightPluginEvent ev = (ProgramHighlightPluginEvent) event;
|
||||||
currentHighlight = ev.getHighlight();
|
currentHighlight = ev.getHighlight();
|
||||||
if (currentHighlight != null && !currentHighlight.isEmpty()) {
|
if (currentHighlight != null && currentHighlight.isEmpty()) {
|
||||||
enableActions(highlightActionList, true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
enableActions(highlightActionList, false);
|
|
||||||
currentHighlight = null;
|
currentHighlight = null;
|
||||||
}
|
}
|
||||||
highlightChanged(currentHighlight);
|
highlightChanged(currentHighlight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Enable the action when the program is opened; disable it when
|
|
||||||
* the program is closed.
|
|
||||||
* @throws IllegalArgumentException if this action was called for
|
|
||||||
* 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) {
|
|
||||||
if (locationActionList.contains(action)) {
|
|
||||||
throw new IllegalArgumentException("Action already added to location action list");
|
|
||||||
}
|
|
||||||
if (selectionActionList.contains(action)) {
|
|
||||||
throw new IllegalArgumentException("Action already added to selection action list");
|
|
||||||
}
|
|
||||||
if (highlightActionList.contains(action)) {
|
|
||||||
throw new IllegalArgumentException("Action already added to highlight action list");
|
|
||||||
}
|
|
||||||
programActionList.add(action);
|
|
||||||
action.setEnabled(currentProgram != null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enable the action when a program location event comes in; disable it
|
|
||||||
* if either the location is null, or if the address in the location
|
|
||||||
* is null.
|
|
||||||
* @throws IllegalArgumentException if this action was called for
|
|
||||||
* 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) {
|
|
||||||
if (programActionList.contains(action)) {
|
|
||||||
throw new IllegalArgumentException("Action already added to program action list");
|
|
||||||
}
|
|
||||||
if (selectionActionList.contains(action)) {
|
|
||||||
throw new IllegalArgumentException("Action already added to selection action list");
|
|
||||||
}
|
|
||||||
if (highlightActionList.contains(action)) {
|
|
||||||
throw new IllegalArgumentException("Action already added to highlight action list");
|
|
||||||
}
|
|
||||||
|
|
||||||
locationActionList.add(action);
|
|
||||||
action.setEnabled(currentLocation != null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enable the action when a selection event comes in; disable it if
|
|
||||||
* the selection is null or empty.
|
|
||||||
* @throws IllegalArgumentException if this action was called for
|
|
||||||
* 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) {
|
|
||||||
if (programActionList.contains(action)) {
|
|
||||||
throw new IllegalArgumentException("Action already added to program action list");
|
|
||||||
}
|
|
||||||
if (locationActionList.contains(action)) {
|
|
||||||
throw new IllegalArgumentException("Action already added to location action list");
|
|
||||||
}
|
|
||||||
if (highlightActionList.contains(action)) {
|
|
||||||
throw new IllegalArgumentException("Action already added to highlight action list");
|
|
||||||
}
|
|
||||||
selectionActionList.add(action);
|
|
||||||
action.setEnabled(currentSelection != null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enable the action when a highlight event comes in; disable it if
|
|
||||||
* the highlight is null or empty.
|
|
||||||
* @throws IllegalArgumentException if this action was called for
|
|
||||||
* 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) {
|
|
||||||
if (programActionList.contains(action)) {
|
|
||||||
throw new IllegalArgumentException("Action already added to program action list");
|
|
||||||
}
|
|
||||||
if (locationActionList.contains(action)) {
|
|
||||||
throw new IllegalArgumentException("Action already added to location action list");
|
|
||||||
}
|
|
||||||
if (selectionActionList.contains(action)) {
|
|
||||||
throw new IllegalArgumentException("Action already added to selection action list");
|
|
||||||
}
|
|
||||||
highlightActionList.add(action);
|
|
||||||
action.setEnabled(currentHighlight != null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subclass should override this method if it is interested when programs become active.
|
* Subclass should override this method if it is interested when programs become active.
|
||||||
* Note: this method is called in response to a ProgramActivatedPluginEvent.
|
* Note: this method is called in response to a ProgramActivatedPluginEvent.
|
||||||
|
@ -302,6 +172,7 @@ public abstract class ProgramPlugin extends Plugin {
|
||||||
* @param program the new program going active.
|
* @param program the new program going active.
|
||||||
*/
|
*/
|
||||||
protected void programActivated(Program program) {
|
protected void programActivated(Program program) {
|
||||||
|
// override
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -313,6 +184,7 @@ public abstract class ProgramPlugin extends Plugin {
|
||||||
* @param program the program being closed.
|
* @param program the program being closed.
|
||||||
*/
|
*/
|
||||||
protected void programClosed(Program program) {
|
protected void programClosed(Program program) {
|
||||||
|
// override
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,6 +197,7 @@ public abstract class ProgramPlugin extends Plugin {
|
||||||
* @param program the program being opened.
|
* @param program the program being opened.
|
||||||
*/
|
*/
|
||||||
protected void programOpened(Program program) {
|
protected void programOpened(Program program) {
|
||||||
|
// override
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -340,6 +213,7 @@ public abstract class ProgramPlugin extends Plugin {
|
||||||
* @param program the old program going inactive.
|
* @param program the old program going inactive.
|
||||||
*/
|
*/
|
||||||
protected void programDeactivated(Program program) {
|
protected void programDeactivated(Program program) {
|
||||||
|
// override
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -348,6 +222,7 @@ public abstract class ProgramPlugin extends Plugin {
|
||||||
* @param loc location could be null
|
* @param loc location could be null
|
||||||
*/
|
*/
|
||||||
protected void locationChanged(ProgramLocation loc) {
|
protected void locationChanged(ProgramLocation loc) {
|
||||||
|
// override
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -356,6 +231,7 @@ public abstract class ProgramPlugin extends Plugin {
|
||||||
* @param sel selection could be null
|
* @param sel selection could be null
|
||||||
*/
|
*/
|
||||||
protected void selectionChanged(ProgramSelection sel) {
|
protected void selectionChanged(ProgramSelection sel) {
|
||||||
|
// override
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -364,10 +240,13 @@ public abstract class ProgramPlugin extends Plugin {
|
||||||
* @param hl highlight could be null
|
* @param hl highlight could be null
|
||||||
*/
|
*/
|
||||||
protected void highlightChanged(ProgramSelection hl) {
|
protected void highlightChanged(ProgramSelection hl) {
|
||||||
|
// override
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience method to go to the specified address.
|
* Convenience method to go to the specified address.
|
||||||
|
* @param addr the address to go to
|
||||||
|
* @return true if successful
|
||||||
*/
|
*/
|
||||||
protected boolean goTo(Address addr) {
|
protected boolean goTo(Address addr) {
|
||||||
GoToService service = tool.getService(GoToService.class);
|
GoToService service = tool.getService(GoToService.class);
|
||||||
|
@ -396,45 +275,6 @@ public abstract class ProgramPlugin extends Plugin {
|
||||||
new ProgramSelectionPluginEvent(getName(), new ProgramSelection(set), currentProgram));
|
new ProgramSelectionPluginEvent(getName(), new ProgramSelection(set), currentProgram));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Convenience method to set a bookmark;
|
|
||||||
* @param addr address of where the bookmark will be placed
|
|
||||||
* @param type type of bookmark: BookMarkType.NOTE, BookmarkType.INFO,
|
|
||||||
* BookmarkType.ANALYSIS, or BookmarkType.ERROR.
|
|
||||||
* @param category category for the bookmark
|
|
||||||
* @param comment bookmark comment
|
|
||||||
*/
|
|
||||||
protected void setBookmark(Address addr, String type, String category, String comment) {
|
|
||||||
if (currentProgram == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
BookmarkManager mgr = currentProgram.getBookmarkManager();
|
|
||||||
int transactionID = currentProgram.startTransaction("Set Bookmark");
|
|
||||||
|
|
||||||
try {
|
|
||||||
mgr.setBookmark(addr, type, category, comment);
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
currentProgram.endTransaction(transactionID, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enable actions in the list according to the enabled param.
|
|
||||||
* @param enabled true means to enable the action AND set the
|
|
||||||
* add to popup as true; false means disable the action and set
|
|
||||||
* add to popup according to the removeFromPopup
|
|
||||||
* @param removeFromPopup only used if enabled is false
|
|
||||||
*/
|
|
||||||
private void enableActions(ArrayList<DockingAction> list, boolean enabled) {
|
|
||||||
for (int i = 0; i < list.size(); i++) {
|
|
||||||
DockingAction a = list.get(i);
|
|
||||||
a.setEnabled(enabled);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ProgramLocation getProgramLocation() {
|
public ProgramLocation getProgramLocation() {
|
||||||
return currentLocation;
|
return currentLocation;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class ModuleAlgorithmPlugin extends ProgramPlugin implements BlockModelSe
|
||||||
private BlockModelService blockModelService;
|
private BlockModelService blockModelService;
|
||||||
|
|
||||||
public ModuleAlgorithmPlugin(PluginTool tool) {
|
public ModuleAlgorithmPlugin(PluginTool tool) {
|
||||||
super(tool, false, false);
|
super(tool);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class AssemblerPlugin extends ProgramPlugin {
|
||||||
/*test*/ PatchDataAction patchDataAction;
|
/*test*/ PatchDataAction patchDataAction;
|
||||||
|
|
||||||
public AssemblerPlugin(PluginTool tool) {
|
public AssemblerPlugin(PluginTool tool) {
|
||||||
super(tool, false, false, false);
|
super(tool);
|
||||||
createActions();
|
createActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class BlockModelServicePlugin extends ProgramPlugin
|
||||||
|
|
||||||
public BlockModelServicePlugin(PluginTool tool) {
|
public BlockModelServicePlugin(PluginTool tool) {
|
||||||
|
|
||||||
super(tool, false, false);
|
super(tool);
|
||||||
|
|
||||||
// Add standard simple block model
|
// Add standard simple block model
|
||||||
BlockModelInfo info = new BlockModelInfo(SimpleBlockModel.NAME, SimpleBlockModel.class);
|
BlockModelInfo info = new BlockModelInfo(SimpleBlockModel.NAME, SimpleBlockModel.class);
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class BookmarkPlugin extends ProgramPlugin
|
||||||
private NavUpdater navUpdater;
|
private NavUpdater navUpdater;
|
||||||
|
|
||||||
public BookmarkPlugin(PluginTool tool) {
|
public BookmarkPlugin(PluginTool tool) {
|
||||||
super(tool, true, true);
|
super(tool);
|
||||||
|
|
||||||
provider = new BookmarkProvider(tool, this);
|
provider = new BookmarkProvider(tool, this);
|
||||||
provider.addToTool();
|
provider.addToTool();
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class CallTreePlugin extends ProgramPlugin {
|
||||||
private CallTreeProvider primaryProvider;
|
private CallTreeProvider primaryProvider;
|
||||||
|
|
||||||
public CallTreePlugin(PluginTool tool) {
|
public CallTreePlugin(PluginTool tool) {
|
||||||
super(tool, true, false, false);
|
super(tool);
|
||||||
|
|
||||||
createActions();
|
createActions();
|
||||||
primaryProvider = new CallTreeProvider(this, true);
|
primaryProvider = new CallTreeProvider(this, true);
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class ComputeChecksumsPlugin extends ProgramPlugin {
|
||||||
* @param tool
|
* @param tool
|
||||||
*/
|
*/
|
||||||
public ComputeChecksumsPlugin(PluginTool tool) {
|
public ComputeChecksumsPlugin(PluginTool tool) {
|
||||||
super(tool, true, true);
|
super(tool);
|
||||||
createActions();
|
createActions();
|
||||||
|
|
||||||
provider = new ComputeChecksumsProvider(this);
|
provider = new ComputeChecksumsProvider(this);
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class ClipboardPlugin extends ProgramPlugin implements ClipboardOwner, Cl
|
||||||
private boolean isClipboardOwner;
|
private boolean isClipboardOwner;
|
||||||
|
|
||||||
public ClipboardPlugin(PluginTool tool) {
|
public ClipboardPlugin(PluginTool tool) {
|
||||||
super(tool, true, true);
|
super(tool);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class DataTypeListingHoverPlugin extends ProgramPlugin {
|
||||||
private DataTypeListingHover hoverService;
|
private DataTypeListingHover hoverService;
|
||||||
|
|
||||||
public DataTypeListingHoverPlugin(PluginTool tool) {
|
public DataTypeListingHoverPlugin(PluginTool tool) {
|
||||||
super(tool, true, false);
|
super(tool);
|
||||||
hoverService = new DataTypeListingHover(tool);
|
hoverService = new DataTypeListingHover(tool);
|
||||||
registerServiceProvided(ListingHoverService.class, hoverService);
|
registerServiceProvided(ListingHoverService.class, hoverService);
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class ColorizingPlugin extends ProgramPlugin implements DomainObjectListe
|
||||||
});
|
});
|
||||||
|
|
||||||
public ColorizingPlugin(PluginTool tool) {
|
public ColorizingPlugin(PluginTool tool) {
|
||||||
super(tool, true, true);
|
super(tool);
|
||||||
|
|
||||||
service = new ColorizingServiceProvider(tool);
|
service = new ColorizingServiceProvider(tool);
|
||||||
registerServiceProvided(ColorizingService.class, service);
|
registerServiceProvided(ColorizingService.class, service);
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class CommentWindowPlugin extends ProgramPlugin implements DomainObjectLi
|
||||||
private SwingUpdateManager reloadUpdateMgr;
|
private SwingUpdateManager reloadUpdateMgr;
|
||||||
|
|
||||||
public CommentWindowPlugin(PluginTool tool) {
|
public CommentWindowPlugin(PluginTool tool) {
|
||||||
super(tool, true, true);
|
super(tool);
|
||||||
|
|
||||||
reloadUpdateMgr = new SwingUpdateManager(1000, 60000, () -> doReload());
|
reloadUpdateMgr = new SwingUpdateManager(1000, 60000, () -> doReload());
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,10 +20,10 @@ import ghidra.app.events.ProgramLocationPluginEvent;
|
||||||
import ghidra.app.plugin.PluginCategoryNames;
|
import ghidra.app.plugin.PluginCategoryNames;
|
||||||
import ghidra.app.plugin.ProgramPlugin;
|
import ghidra.app.plugin.ProgramPlugin;
|
||||||
import ghidra.app.services.ConsoleService;
|
import ghidra.app.services.ConsoleService;
|
||||||
import ghidra.framework.plugintool.*;
|
import ghidra.framework.plugintool.PluginInfo;
|
||||||
|
import ghidra.framework.plugintool.PluginTool;
|
||||||
import ghidra.framework.plugintool.util.PluginStatus;
|
import ghidra.framework.plugintool.util.PluginStatus;
|
||||||
import ghidra.program.model.listing.Program;
|
import ghidra.program.model.listing.Program;
|
||||||
import ghidra.program.util.ProgramLocation;
|
|
||||||
|
|
||||||
//@formatter:off
|
//@formatter:off
|
||||||
@PluginInfo(
|
@PluginInfo(
|
||||||
|
@ -41,7 +41,7 @@ public class ConsolePlugin extends ProgramPlugin {
|
||||||
private ConsoleComponentProvider provider;
|
private ConsoleComponentProvider provider;
|
||||||
|
|
||||||
public ConsolePlugin(PluginTool tool) {
|
public ConsolePlugin(PluginTool tool) {
|
||||||
super(tool, false, false);
|
super(tool);
|
||||||
provider = new ConsoleComponentProvider(tool, getName());
|
provider = new ConsoleComponentProvider(tool, getName());
|
||||||
registerServiceProvided(ConsoleService.class, provider);
|
registerServiceProvided(ConsoleService.class, provider);
|
||||||
}
|
}
|
||||||
|
@ -67,15 +67,4 @@ public class ConsolePlugin extends ProgramPlugin {
|
||||||
protected void programDeactivated(Program program) {
|
protected void programDeactivated(Program program) {
|
||||||
provider.setCurrentProgram(null);
|
provider.setCurrentProgram(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void processEvent(PluginEvent event) {
|
|
||||||
super.processEvent(event);
|
|
||||||
if (event instanceof ProgramLocationPluginEvent) {
|
|
||||||
ProgramLocationPluginEvent plpe = (ProgramLocationPluginEvent) event;
|
|
||||||
ProgramLocation pl = plpe.getLocation();
|
|
||||||
provider.setCurrentAddress(pl.getAddress());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class CParserPlugin extends ProgramPlugin {
|
||||||
"Parse C and C Header files, extracting data definitions and function signatures.";
|
"Parse C and C Header files, extracting data definitions and function signatures.";
|
||||||
|
|
||||||
public CParserPlugin(PluginTool plugintool) {
|
public CParserPlugin(PluginTool plugintool) {
|
||||||
super(plugintool, false, false);
|
super(plugintool);
|
||||||
createActions();
|
createActions();
|
||||||
setUserProfileDir(USER_PROFILES_DIR);
|
setUserProfileDir(USER_PROFILES_DIR);
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,7 @@ public class DataTypeManagerPlugin extends ProgramPlugin
|
||||||
private DataTypePropertyManager dataTypePropertyManager;
|
private DataTypePropertyManager dataTypePropertyManager;
|
||||||
|
|
||||||
public DataTypeManagerPlugin(PluginTool tool) {
|
public DataTypeManagerPlugin(PluginTool tool) {
|
||||||
super(tool, true, true);
|
super(tool);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -79,7 +79,7 @@ public class DataTypePreviewPlugin extends ProgramPlugin {
|
||||||
private SwingUpdateManager updateManager = new SwingUpdateManager(650, () -> updatePreview());
|
private SwingUpdateManager updateManager = new SwingUpdateManager(650, () -> updatePreview());
|
||||||
|
|
||||||
public DataTypePreviewPlugin(PluginTool tool) {
|
public DataTypePreviewPlugin(PluginTool tool) {
|
||||||
super(tool, true, true);
|
super(tool);
|
||||||
}
|
}
|
||||||
|
|
||||||
DTPPTableModel getTableModel() {
|
DTPPTableModel getTableModel() {
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class DataWindowPlugin extends ProgramPlugin implements DomainObjectListe
|
||||||
private boolean resetTypesNeeded;
|
private boolean resetTypesNeeded;
|
||||||
|
|
||||||
public DataWindowPlugin(PluginTool tool) {
|
public DataWindowPlugin(PluginTool tool) {
|
||||||
super(tool, true, true);
|
super(tool);
|
||||||
|
|
||||||
resetUpdateMgr = new SwingUpdateManager(100, 60000, () -> doReset());
|
resetUpdateMgr = new SwingUpdateManager(100, 60000, () -> doReset());
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class AutoTableDisassemblerPlugin extends ProgramPlugin implements Domain
|
||||||
final static String SEARCH_ACTION_NAME = "Search for Address Tables";
|
final static String SEARCH_ACTION_NAME = "Search for Address Tables";
|
||||||
|
|
||||||
public AutoTableDisassemblerPlugin(PluginTool tool) {
|
public AutoTableDisassemblerPlugin(PluginTool tool) {
|
||||||
super(tool, true, true);
|
super(tool);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -111,7 +111,7 @@ public class DisassembledViewPlugin extends ProgramPlugin implements DomainObjec
|
||||||
// events and selection changed events. The first type we get from
|
// events and selection changed events. The first type we get from
|
||||||
// our parent, the other two we get by passing true to our parent's
|
// our parent, the other two we get by passing true to our parent's
|
||||||
// constructor
|
// constructor
|
||||||
super(plugintool, true, true);
|
super(plugintool);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class EclipseIntegrationPlugin extends ProgramPlugin implements EclipseIn
|
||||||
private ToolOptions options;
|
private ToolOptions options;
|
||||||
|
|
||||||
public EclipseIntegrationPlugin(PluginTool tool) {
|
public EclipseIntegrationPlugin(PluginTool tool) {
|
||||||
super(tool, true, true, true);
|
super(tool);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class TextEditorManagerPlugin extends ProgramPlugin implements TextEditor
|
||||||
private List<TextEditorComponentProvider> editors = new ArrayList<>();
|
private List<TextEditorComponentProvider> editors = new ArrayList<>();
|
||||||
|
|
||||||
public TextEditorManagerPlugin(PluginTool tool) {
|
public TextEditorManagerPlugin(PluginTool tool) {
|
||||||
super(tool, true, true, true);
|
super(tool);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class EquateTablePlugin extends ProgramPlugin implements DomainObjectList
|
||||||
private SwingUpdateManager updateMgr;
|
private SwingUpdateManager updateMgr;
|
||||||
|
|
||||||
public EquateTablePlugin(PluginTool tool) {
|
public EquateTablePlugin(PluginTool tool) {
|
||||||
super(tool, true, false);
|
super(tool);
|
||||||
|
|
||||||
updateMgr = new SwingUpdateManager(1000, 3000, () -> provider.updateEquates());
|
updateMgr = new SwingUpdateManager(1000, 3000, () -> provider.updateEquates());
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class FunctionTagPlugin extends ProgramPlugin {
|
||||||
private FunctionTagProvider provider;
|
private FunctionTagProvider provider;
|
||||||
|
|
||||||
public FunctionTagPlugin(PluginTool tool) {
|
public FunctionTagPlugin(PluginTool tool) {
|
||||||
super(tool, true, false);
|
super(tool);
|
||||||
provider = new FunctionTagProvider(this, getCurrentProgram());
|
provider = new FunctionTagProvider(this, getCurrentProgram());
|
||||||
createActions();
|
createActions();
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class FunctionComparisonPlugin extends ProgramPlugin
|
||||||
* @param tool the tool that owns this plugin
|
* @param tool the tool that owns this plugin
|
||||||
*/
|
*/
|
||||||
public FunctionComparisonPlugin(PluginTool tool) {
|
public FunctionComparisonPlugin(PluginTool tool) {
|
||||||
super(tool, true, true);
|
super(tool);
|
||||||
functionComparisonManager = new FunctionComparisonProviderManager(this);
|
functionComparisonManager = new FunctionComparisonProviderManager(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class FunctionWindowPlugin extends ProgramPlugin implements DomainObjectL
|
||||||
private FunctionComparisonService functionComparisonService;
|
private FunctionComparisonService functionComparisonService;
|
||||||
|
|
||||||
public FunctionWindowPlugin(PluginTool tool) {
|
public FunctionWindowPlugin(PluginTool tool) {
|
||||||
super(tool, true, false);
|
super(tool);
|
||||||
|
|
||||||
swingMgr = new SwingUpdateManager(1000, () -> provider.reload());
|
swingMgr = new SwingUpdateManager(1000, () -> provider.reload());
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ public final class GoToServicePlugin extends ProgramPlugin {
|
||||||
* @param tool the tool
|
* @param tool the tool
|
||||||
*/
|
*/
|
||||||
public GoToServicePlugin(PluginTool tool) {
|
public GoToServicePlugin(PluginTool tool) {
|
||||||
super(tool, true, true);
|
super(tool);
|
||||||
|
|
||||||
Options opt = tool.getOptions(PluginConstants.SEARCH_OPTION_NAME);
|
Options opt = tool.getOptions(PluginConstants.SEARCH_OPTION_NAME);
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class InstructionSearchPlugin extends ProgramPlugin {
|
||||||
* @param tool the plugin tool
|
* @param tool the plugin tool
|
||||||
*/
|
*/
|
||||||
public InstructionSearchPlugin(PluginTool tool) {
|
public InstructionSearchPlugin(PluginTool tool) {
|
||||||
super(tool, true, true);
|
super(tool);
|
||||||
|
|
||||||
// Creates the menu actions used with this plugin.
|
// Creates the menu actions used with this plugin.
|
||||||
createActions();
|
createActions();
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class MemoryMapPlugin extends ProgramPlugin implements DomainObjectListen
|
||||||
private MemoryMapManager memManager;
|
private MemoryMapManager memManager;
|
||||||
|
|
||||||
public MemoryMapPlugin(PluginTool tool) {
|
public MemoryMapPlugin(PluginTool tool) {
|
||||||
super(tool, true, false);
|
super(tool);
|
||||||
|
|
||||||
memManager = new MemoryMapManager(this);
|
memManager = new MemoryMapManager(this);
|
||||||
provider = new MemoryMapProvider(this);
|
provider = new MemoryMapProvider(this);
|
||||||
|
|
|
@ -99,7 +99,7 @@ public class MyProgramChangesDisplayPlugin extends ProgramPlugin implements Doma
|
||||||
|
|
||||||
public MyProgramChangesDisplayPlugin(PluginTool tool) {
|
public MyProgramChangesDisplayPlugin(PluginTool tool) {
|
||||||
|
|
||||||
super(tool, false, false);
|
super(tool);
|
||||||
|
|
||||||
folderListener = new ProgramFolderListener();
|
folderListener = new ProgramFolderListener();
|
||||||
transactionListener = new ProgramTransactionListener();
|
transactionListener = new ProgramTransactionListener();
|
||||||
|
|
|
@ -79,7 +79,7 @@ public class AutoRenamePlugin extends ProgramPlugin {
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
public AutoRenamePlugin(PluginTool tool) {
|
public AutoRenamePlugin(PluginTool tool) {
|
||||||
super(tool, true, false);
|
super(tool);
|
||||||
createActions();
|
createActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class ModuleSortPlugin extends ProgramPlugin {
|
||||||
private ModuleSortAction sortByNameAction;
|
private ModuleSortAction sortByNameAction;
|
||||||
|
|
||||||
public ModuleSortPlugin(PluginTool tool) {
|
public ModuleSortPlugin(PluginTool tool) {
|
||||||
super(tool, false, false);
|
super(tool);
|
||||||
createActions();
|
createActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class OverviewColorPlugin extends ProgramPlugin {
|
||||||
private MultiActionDockingAction multiAction;
|
private MultiActionDockingAction multiAction;
|
||||||
|
|
||||||
public OverviewColorPlugin(PluginTool tool) {
|
public OverviewColorPlugin(PluginTool tool) {
|
||||||
super(tool, false, false);
|
super(tool);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class PrintingPlugin extends ProgramPlugin {
|
||||||
private PageFormat format;
|
private PageFormat format;
|
||||||
|
|
||||||
public PrintingPlugin(PluginTool tool) {
|
public PrintingPlugin(PluginTool tool) {
|
||||||
super(tool, true, true);
|
super(tool);
|
||||||
setupActions();
|
setupActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class ShowInstructionInfoPlugin extends ProgramPlugin {
|
||||||
|
|
||||||
public ShowInstructionInfoPlugin(PluginTool tool) {
|
public ShowInstructionInfoPlugin(PluginTool tool) {
|
||||||
|
|
||||||
super(tool, true, false);
|
super(tool);
|
||||||
|
|
||||||
createStatusPanels();
|
createStatusPanels();
|
||||||
createActions();
|
createActions();
|
||||||
|
|
|
@ -57,7 +57,7 @@ import docking.action.MenuData;
|
||||||
public class ProgramTreeModularizationPlugin extends ProgramPlugin {
|
public class ProgramTreeModularizationPlugin extends ProgramPlugin {
|
||||||
|
|
||||||
public ProgramTreeModularizationPlugin(PluginTool tool) {
|
public ProgramTreeModularizationPlugin(PluginTool tool) {
|
||||||
super(tool, false, false);
|
super(tool);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class ProgramTreePlugin extends ProgramPlugin
|
||||||
private boolean isReplaceViewMode = true;
|
private boolean isReplaceViewMode = true;
|
||||||
|
|
||||||
public ProgramTreePlugin(PluginTool tool) {
|
public ProgramTreePlugin(PluginTool tool) {
|
||||||
super(tool, true, false);
|
super(tool);
|
||||||
|
|
||||||
viewProvider = new ViewManagerComponentProvider(tool, getName());
|
viewProvider = new ViewManagerComponentProvider(tool, getName());
|
||||||
registerServiceProvided(ViewManagerService.class, viewProvider);
|
registerServiceProvided(ViewManagerService.class, viewProvider);
|
||||||
|
@ -332,11 +332,7 @@ public class ProgramTreePlugin extends ProgramPlugin
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void processEvent(PluginEvent event) {
|
public void processEvent(PluginEvent event) {
|
||||||
super.processEvent(event);
|
|
||||||
if (event instanceof ProgramActivatedPluginEvent) {
|
|
||||||
ProgramActivatedPluginEvent ev = (ProgramActivatedPluginEvent) event;
|
|
||||||
viewProvider.setCurrentProgram(ev.getActiveProgram());
|
|
||||||
}
|
|
||||||
if (event instanceof TreeSelectionPluginEvent) {
|
if (event instanceof TreeSelectionPluginEvent) {
|
||||||
TreeSelectionPluginEvent ev = (TreeSelectionPluginEvent) event;
|
TreeSelectionPluginEvent ev = (TreeSelectionPluginEvent) event;
|
||||||
String treeName = ev.getTreeName();
|
String treeName = ev.getTreeName();
|
||||||
|
@ -346,6 +342,16 @@ public class ProgramTreePlugin extends ProgramPlugin
|
||||||
}
|
}
|
||||||
provider.setGroupSelection(ev.getGroupPaths());
|
provider.setGroupSelection(ev.getGroupPaths());
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
super.processEvent(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void programActivated(Program program) {
|
||||||
|
program.addListener(programListener);
|
||||||
|
setProgram(program);
|
||||||
|
viewProvider.setCurrentProgram(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeStaleProviders(ArrayList<TreeViewProvider> providerList) {
|
private void removeStaleProviders(ArrayList<TreeViewProvider> providerList) {
|
||||||
|
@ -384,12 +390,6 @@ public class ProgramTreePlugin extends ProgramPlugin
|
||||||
setProgram(null);
|
setProgram(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void programActivated(Program program) {
|
|
||||||
program.addListener(programListener);
|
|
||||||
setProgram(program);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void locationChanged(ProgramLocation loc) {
|
protected void locationChanged(ProgramLocation loc) {
|
||||||
// select fragment that corresponds to the location
|
// select fragment that corresponds to the location
|
||||||
|
@ -696,17 +696,15 @@ public class ProgramTreePlugin extends ProgramPlugin
|
||||||
}
|
}
|
||||||
tree.reload();
|
tree.reload();
|
||||||
|
|
||||||
for (int i = 0; i < selectList.size(); i++) {
|
for (Object element : selectList) {
|
||||||
GroupPath gp = (GroupPath) selectList.get(i);
|
GroupPath gp = (GroupPath) element;
|
||||||
tree.addGroupSelectionPath(gp);
|
tree.addGroupSelectionPath(gp);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < expandList.size(); i++) {
|
for (GroupPath gp : expandList) {
|
||||||
GroupPath gp = expandList.get(i);
|
|
||||||
tree.expand(gp);
|
tree.expand(gp);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < newViewList.size(); i++) {
|
for (GroupPath gp : newViewList) {
|
||||||
GroupPath gp = newViewList.get(i);
|
|
||||||
tree.addGroupViewPath(gp);
|
tree.addGroupViewPath(gp);
|
||||||
}
|
}
|
||||||
if (newViewList.size() > 0 && tree.getViewList().size() == 0) {
|
if (newViewList.size() > 0 && tree.getViewList().size() == 0) {
|
||||||
|
@ -968,8 +966,8 @@ public class ProgramTreePlugin extends ProgramPlugin
|
||||||
selectionToggleAction.setDescription(
|
selectionToggleAction.setDescription(
|
||||||
HTMLUtilities.toHTML("Toggle <b>On</b> means to select the fragment(s)\n" +
|
HTMLUtilities.toHTML("Toggle <b>On</b> means to select the fragment(s)\n" +
|
||||||
"that corresponds to the current location."));
|
"that corresponds to the current location."));
|
||||||
selectionToggleAction.setHelpLocation(
|
selectionToggleAction
|
||||||
new HelpLocation(getName(), selectionToggleAction.getName()));
|
.setHelpLocation(new HelpLocation(getName(), selectionToggleAction.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void selectFragments() {
|
private void selectFragments() {
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class FunctionReachabilityPlugin extends ProgramPlugin {
|
||||||
new ArrayList<>();
|
new ArrayList<>();
|
||||||
|
|
||||||
public FunctionReachabilityPlugin(PluginTool tool) {
|
public FunctionReachabilityPlugin(PluginTool tool) {
|
||||||
super(tool, true, true);
|
super(tool);
|
||||||
|
|
||||||
createActions();
|
createActions();
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class RegisterPlugin extends ProgramPlugin {
|
||||||
private RegisterTransitionFieldMouseHandler fieldMouseHandler;
|
private RegisterTransitionFieldMouseHandler fieldMouseHandler;
|
||||||
|
|
||||||
public RegisterPlugin(PluginTool tool) {
|
public RegisterPlugin(PluginTool tool) {
|
||||||
super(tool, true, true);
|
super(tool);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class RelocationFixupPlugin extends ProgramPlugin implements DomainObject
|
||||||
new ArrayList<RelocationFixupHandler>();
|
new ArrayList<RelocationFixupHandler>();
|
||||||
|
|
||||||
public RelocationFixupPlugin(PluginTool tool) {
|
public RelocationFixupPlugin(PluginTool tool) {
|
||||||
super(tool, false, false);
|
super(tool);
|
||||||
|
|
||||||
initializeRelocationHandlers();
|
initializeRelocationHandlers();
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class ScalarSearchPlugin extends ProgramPlugin implements DomainObjectLis
|
||||||
private Set<ScalarSearchProvider> providers = new HashSet<>();
|
private Set<ScalarSearchProvider> providers = new HashSet<>();
|
||||||
|
|
||||||
public ScalarSearchPlugin(PluginTool tool) {
|
public ScalarSearchPlugin(PluginTool tool) {
|
||||||
super(tool, true, true);
|
super(tool);
|
||||||
|
|
||||||
reloadUpdateMgr =
|
reloadUpdateMgr =
|
||||||
new SwingUpdateManager(1000, 60000, () -> providers.forEach(p -> p.reload()));
|
new SwingUpdateManager(1000, 60000, () -> providers.forEach(p -> p.reload()));
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class GhidraScriptMgrPlugin extends ProgramPlugin implements GhidraScript
|
||||||
* @param tool the tool this plugin is added to
|
* @param tool the tool this plugin is added to
|
||||||
*/
|
*/
|
||||||
public GhidraScriptMgrPlugin(PluginTool tool) {
|
public GhidraScriptMgrPlugin(PluginTool tool) {
|
||||||
super(tool, true, true, true);
|
super(tool);
|
||||||
|
|
||||||
// Each tool starts a new script manager plugin, but we only ever want one bundle host.
|
// Each tool starts a new script manager plugin, but we only ever want one bundle host.
|
||||||
// GhidraScriptUtil (creates and) manages one instance.
|
// GhidraScriptUtil (creates and) manages one instance.
|
||||||
|
|
|
@ -115,7 +115,7 @@ public class SearchTextPlugin extends ProgramPlugin implements OptionsChangeList
|
||||||
* @param plugintool The tool required by this plugin.
|
* @param plugintool The tool required by this plugin.
|
||||||
*/
|
*/
|
||||||
public SearchTextPlugin(PluginTool plugintool) {
|
public SearchTextPlugin(PluginTool plugintool) {
|
||||||
super(plugintool, true, false);
|
super(plugintool);
|
||||||
createActions();
|
createActions();
|
||||||
initializeOptions();
|
initializeOptions();
|
||||||
tool.addContextListener(this);
|
tool.addContextListener(this);
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class RestoreSelectionPlugin extends ProgramPlugin {
|
||||||
private Map<Program, SelectionState> programToSelectionMap = new HashMap<Program, SelectionState>();
|
private Map<Program, SelectionState> programToSelectionMap = new HashMap<Program, SelectionState>();
|
||||||
|
|
||||||
public RestoreSelectionPlugin( PluginTool tool ) {
|
public RestoreSelectionPlugin( PluginTool tool ) {
|
||||||
super( tool, false, true );
|
super( tool );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -64,7 +64,7 @@ import ghidra.util.task.TaskMonitorAdapter;
|
||||||
//@formatter:on
|
//@formatter:on
|
||||||
public class SelectByScopedFlowPlugin extends ProgramPlugin {
|
public class SelectByScopedFlowPlugin extends ProgramPlugin {
|
||||||
public SelectByScopedFlowPlugin(PluginTool tool) {
|
public SelectByScopedFlowPlugin(PluginTool tool) {
|
||||||
super(tool, true, true);
|
super(tool);
|
||||||
createActions();
|
createActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class ProgramTreeSelectionPlugin extends ProgramPlugin {
|
||||||
private TreeSelectAction selectModuleAction;
|
private TreeSelectAction selectModuleAction;
|
||||||
|
|
||||||
public ProgramTreeSelectionPlugin(PluginTool tool) {
|
public ProgramTreeSelectionPlugin(PluginTool tool) {
|
||||||
super(tool, true, true);
|
super(tool);
|
||||||
createActions();
|
createActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class StringTablePlugin extends ProgramPlugin {
|
||||||
private List<StringTableProvider> transientProviders = new ArrayList<>();
|
private List<StringTableProvider> transientProviders = new ArrayList<>();
|
||||||
|
|
||||||
public StringTablePlugin(PluginTool tool) {
|
public StringTablePlugin(PluginTool tool) {
|
||||||
super(tool, false, true);
|
super(tool);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class ViewStringsPlugin extends ProgramPlugin implements DomainObjectList
|
||||||
private SwingUpdateManager reloadUpdateMgr;
|
private SwingUpdateManager reloadUpdateMgr;
|
||||||
|
|
||||||
public ViewStringsPlugin(PluginTool tool) {
|
public ViewStringsPlugin(PluginTool tool) {
|
||||||
super(tool, false, false);
|
super(tool);
|
||||||
}
|
}
|
||||||
|
|
||||||
void doReload() {
|
void doReload() {
|
||||||
|
|
|
@ -20,7 +20,6 @@ import java.util.*;
|
||||||
|
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
|
|
||||||
import docking.ComponentProvider;
|
|
||||||
import ghidra.app.CorePluginPackage;
|
import ghidra.app.CorePluginPackage;
|
||||||
import ghidra.app.events.ProgramClosedPluginEvent;
|
import ghidra.app.events.ProgramClosedPluginEvent;
|
||||||
import ghidra.app.nav.Navigatable;
|
import ghidra.app.nav.Navigatable;
|
||||||
|
@ -33,7 +32,8 @@ import ghidra.app.tablechooser.TableChooserExecutor;
|
||||||
import ghidra.app.util.query.TableService;
|
import ghidra.app.util.query.TableService;
|
||||||
import ghidra.framework.model.DomainObjectChangedEvent;
|
import ghidra.framework.model.DomainObjectChangedEvent;
|
||||||
import ghidra.framework.model.DomainObjectListener;
|
import ghidra.framework.model.DomainObjectListener;
|
||||||
import ghidra.framework.plugintool.*;
|
import ghidra.framework.plugintool.PluginInfo;
|
||||||
|
import ghidra.framework.plugintool.PluginTool;
|
||||||
import ghidra.framework.plugintool.util.PluginStatus;
|
import ghidra.framework.plugintool.util.PluginStatus;
|
||||||
import ghidra.program.model.listing.Program;
|
import ghidra.program.model.listing.Program;
|
||||||
import ghidra.util.Swing;
|
import ghidra.util.Swing;
|
||||||
|
@ -62,7 +62,7 @@ public class TableServicePlugin extends ProgramPlugin
|
||||||
private Map<Program, List<TableChooserDialog>> programToDialogMap = new HashMap<>();
|
private Map<Program, List<TableChooserDialog>> programToDialogMap = new HashMap<>();
|
||||||
|
|
||||||
public TableServicePlugin(PluginTool tool) {
|
public TableServicePlugin(PluginTool tool) {
|
||||||
super(tool, false, false);
|
super(tool);
|
||||||
|
|
||||||
updateMgr = new SwingUpdateManager(1000, () -> updateProviders());
|
updateMgr = new SwingUpdateManager(1000, () -> updateProviders());
|
||||||
|
|
||||||
|
@ -88,14 +88,8 @@ public class TableServicePlugin extends ProgramPlugin
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void processEvent(PluginEvent event) {
|
protected void programClosed(Program program) {
|
||||||
if (event instanceof ProgramClosedPluginEvent) {
|
closeAllQueries(program);
|
||||||
Program p = ((ProgramClosedPluginEvent) event).getProgram();
|
|
||||||
closeAllQueries(p);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
super.processEvent(event);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -120,8 +114,7 @@ public class TableServicePlugin extends ProgramPlugin
|
||||||
}
|
}
|
||||||
// make a copy of the list because the provider updates the list
|
// make a copy of the list because the provider updates the list
|
||||||
List<TableComponentProvider<?>> list = new ArrayList<>(plist);
|
List<TableComponentProvider<?>> list = new ArrayList<>(plist);
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (TableComponentProvider<?> provider : list) {
|
||||||
ComponentProvider provider = list.get(i);
|
|
||||||
provider.closeComponent();
|
provider.closeComponent();
|
||||||
}
|
}
|
||||||
programMap.remove(program);
|
programMap.remove(program);
|
||||||
|
@ -134,8 +127,7 @@ public class TableServicePlugin extends ProgramPlugin
|
||||||
}
|
}
|
||||||
// make a copy of the list because the dialog updates the list
|
// make a copy of the list because the dialog updates the list
|
||||||
List<TableChooserDialog> list = new ArrayList<>(dlist);
|
List<TableChooserDialog> list = new ArrayList<>(dlist);
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (TableChooserDialog dialog : list) {
|
||||||
TableChooserDialog dialog = list.get(i);
|
|
||||||
dialog.close();
|
dialog.close();
|
||||||
}
|
}
|
||||||
programMap.remove(program);
|
programMap.remove(program);
|
||||||
|
@ -243,8 +235,7 @@ public class TableServicePlugin extends ProgramPlugin
|
||||||
|
|
||||||
private void updateProviders() {
|
private void updateProviders() {
|
||||||
List<TableComponentProvider<?>> list = getProviders();
|
List<TableComponentProvider<?>> list = getProviders();
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (TableComponentProvider<?> provider : list) {
|
||||||
TableComponentProvider<?> provider = list.get(i);
|
|
||||||
provider.refresh();
|
provider.refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class PropertyManagerPlugin extends ProgramPlugin implements DomainObject
|
||||||
private Timer updateTimer;
|
private Timer updateTimer;
|
||||||
|
|
||||||
public PropertyManagerPlugin(PluginTool tool) {
|
public PropertyManagerPlugin(PluginTool tool) {
|
||||||
super(tool, false, true);
|
super(tool);
|
||||||
|
|
||||||
propertyViewProvider = new PropertyManagerProvider(this);
|
propertyViewProvider = new PropertyManagerProvider(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class ScreenshotPlugin extends ProgramPlugin {
|
||||||
private JFileChooser fileChooser;
|
private JFileChooser fileChooser;
|
||||||
|
|
||||||
public ScreenshotPlugin(PluginTool tool) {
|
public ScreenshotPlugin(PluginTool tool) {
|
||||||
super(tool, true, false);
|
super(tool);
|
||||||
this.tool = tool;
|
this.tool = tool;
|
||||||
|
|
||||||
setupActions();
|
setupActions();
|
||||||
|
|
|
@ -58,6 +58,11 @@ public class GhidraTableColumnModelTest extends AbstractGhidraHeadedIntegrationT
|
||||||
private DockingActionIf showReferencesAction;
|
private DockingActionIf showReferencesAction;
|
||||||
private CodeBrowserPlugin codeBrowser;
|
private CodeBrowserPlugin codeBrowser;
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() throws Exception {
|
||||||
|
cleanupGhidraWithNotepad();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Test method for 'setVisible(TableColumn, boolean)' and 'isVisible(TableColumn)'
|
* Test method for 'setVisible(TableColumn, boolean)' and 'isVisible(TableColumn)'
|
||||||
*/
|
*/
|
||||||
|
@ -91,11 +96,6 @@ public class GhidraTableColumnModelTest extends AbstractGhidraHeadedIntegrationT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
|
||||||
public void tearDown() throws Exception {
|
|
||||||
cleanupGhidraWithNotepad();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Test method for 'addColumn(TableColumn)', 'removeColumn(TableColumn)', 'getColumnCount()',
|
* Test method for 'addColumn(TableColumn)', 'removeColumn(TableColumn)', 'getColumnCount()',
|
||||||
* 'getColumn(int)', 'getColumnIndex(Object)', 'getAllColumns()', and 'getColumns()'
|
* 'getColumn(int)', 'getColumnIndex(Object)', 'getAllColumns()', and 'getColumns()'
|
||||||
|
@ -569,10 +569,8 @@ public class GhidraTableColumnModelTest extends AbstractGhidraHeadedIntegrationT
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
executeOnSwingWithoutBlocking(() -> {
|
|
||||||
env.dispose();
|
env.dispose();
|
||||||
env = null;
|
env = null;
|
||||||
});
|
|
||||||
|
|
||||||
// this handles the save changes dialog and potential analysis dialogs
|
// this handles the save changes dialog and potential analysis dialogs
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
|
|
|
@ -25,6 +25,7 @@ import docking.ComponentProvider;
|
||||||
import docking.DialogComponentProvider;
|
import docking.DialogComponentProvider;
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import ghidra.app.cmd.data.CreateStructureCmd;
|
import ghidra.app.cmd.data.CreateStructureCmd;
|
||||||
|
import ghidra.app.context.ListingActionContext;
|
||||||
import ghidra.app.events.ProgramLocationPluginEvent;
|
import ghidra.app.events.ProgramLocationPluginEvent;
|
||||||
import ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin;
|
import ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin;
|
||||||
import ghidra.app.plugin.core.table.TableComponentProvider;
|
import ghidra.app.plugin.core.table.TableComponentProvider;
|
||||||
|
@ -224,7 +225,8 @@ public class XrefViewerTest extends AbstractGhidraHeadedIntegrationTest {
|
||||||
|
|
||||||
// go to new function
|
// go to new function
|
||||||
DockingActionIf thunkAction = getAction(tool, "Set Thunked Function");
|
DockingActionIf thunkAction = getAction(tool, "Set Thunked Function");
|
||||||
performAction(thunkAction, false);
|
performAction(thunkAction, new ListingActionContext(cb.getProvider(), cb.getProvider()),
|
||||||
|
false);
|
||||||
|
|
||||||
// get dialog
|
// get dialog
|
||||||
DialogComponentProvider dialog =
|
DialogComponentProvider dialog =
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class FunctionBitPatternsExplorerPlugin extends ProgramPlugin {
|
||||||
* @param tool tool
|
* @param tool tool
|
||||||
*/
|
*/
|
||||||
public FunctionBitPatternsExplorerPlugin(PluginTool tool) {
|
public FunctionBitPatternsExplorerPlugin(PluginTool tool) {
|
||||||
super(tool, false, false);
|
super(tool);
|
||||||
provider = new FunctionBitPatternsMainProvider(this);
|
provider = new FunctionBitPatternsMainProvider(this);
|
||||||
patterns = new HashSet<>();
|
patterns = new HashSet<>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ public class FunctionGraphPlugin extends ProgramPlugin implements OptionsChangeL
|
||||||
private List<FGLayoutProvider> layoutProviders;
|
private List<FGLayoutProvider> layoutProviders;
|
||||||
|
|
||||||
public FunctionGraphPlugin(PluginTool tool) {
|
public FunctionGraphPlugin(PluginTool tool) {
|
||||||
super(tool, true, true, true);
|
super(tool);
|
||||||
|
|
||||||
colorProvider = new IndependentColorProvider(tool);
|
colorProvider = new IndependentColorProvider(tool);
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,7 @@ public class FidDebugPlugin extends ProgramPlugin implements ChangeListener {
|
||||||
private DockingAction createRawFileAction;
|
private DockingAction createRawFileAction;
|
||||||
|
|
||||||
public FidDebugPlugin(PluginTool tool) {
|
public FidDebugPlugin(PluginTool tool) {
|
||||||
super(tool, true, true);
|
super(tool);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class FidPlugin extends ProgramPlugin implements ChangeListener {
|
||||||
private DockingAction populateAction;
|
private DockingAction populateAction;
|
||||||
|
|
||||||
public FidPlugin(PluginTool tool) {
|
public FidPlugin(PluginTool tool) {
|
||||||
super(tool, true, true);
|
super(tool);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class FunctionCallGraphPlugin extends ProgramPlugin implements OptionsCha
|
||||||
});
|
});
|
||||||
|
|
||||||
public FunctionCallGraphPlugin(PluginTool tool) {
|
public FunctionCallGraphPlugin(PluginTool tool) {
|
||||||
super(tool, true, false);
|
super(tool);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -154,7 +154,7 @@ public class ProgramDiffPlugin extends ProgramPlugin
|
||||||
* @param tool the tool that owns this plugin.
|
* @param tool the tool that owns this plugin.
|
||||||
*/
|
*/
|
||||||
public ProgramDiffPlugin(PluginTool tool) {
|
public ProgramDiffPlugin(PluginTool tool) {
|
||||||
super(tool, true, true);
|
super(tool);
|
||||||
|
|
||||||
markerManager = new MarkerManager(this);
|
markerManager = new MarkerManager(this);
|
||||||
|
|
||||||
|
@ -232,10 +232,8 @@ public class ProgramDiffPlugin extends ProgramPlugin
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void processEvent(PluginEvent event) {
|
public void processEvent(PluginEvent event) {
|
||||||
if (event instanceof ProgramClosedPluginEvent) {
|
|
||||||
programClosed(((ProgramClosedPluginEvent) event).getProgram());
|
if (event instanceof ViewChangedPluginEvent) {
|
||||||
}
|
|
||||||
else if (event instanceof ViewChangedPluginEvent) {
|
|
||||||
AddressSet set = ((ViewChangedPluginEvent) event).getView();
|
AddressSet set = ((ViewChangedPluginEvent) event).getView();
|
||||||
// If we are doing a Diff on the entire program then use the combined addresses for both programs.
|
// If we are doing a Diff on the entire program then use the combined addresses for both programs.
|
||||||
if (primaryProgram != null && showingSecondProgram) {
|
if (primaryProgram != null && showingSecondProgram) {
|
||||||
|
@ -267,6 +265,17 @@ public class ProgramDiffPlugin extends ProgramPlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void programClosed(Program program) {
|
||||||
|
if (primaryProgram == program) {
|
||||||
|
primaryProgram.removeListener(this);
|
||||||
|
if (secondaryDiffProgram != null) {
|
||||||
|
closeProgram2();
|
||||||
|
}
|
||||||
|
actionManager.programClosed(program);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void viewChanged(AddressSetView p1AddressSet) {
|
private void viewChanged(AddressSetView p1AddressSet) {
|
||||||
if (primaryProgram != null && !showingSecondProgram) {
|
if (primaryProgram != null && !showingSecondProgram) {
|
||||||
return;
|
return;
|
||||||
|
@ -478,23 +487,6 @@ public class ProgramDiffPlugin extends ProgramPlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when a program gets closed. If the closed program is the first program of the Diff
|
|
||||||
* then we need to close the second program.
|
|
||||||
*
|
|
||||||
* @param program
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected void programClosed(Program program) {
|
|
||||||
if (primaryProgram == program) {
|
|
||||||
primaryProgram.removeListener(this);
|
|
||||||
if (secondaryDiffProgram != null) {
|
|
||||||
closeProgram2();
|
|
||||||
}
|
|
||||||
actionManager.programClosed(program);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void setOpenDiffProgramDialog(OpenVersionedFileDialog dialog) {
|
void setOpenDiffProgramDialog(OpenVersionedFileDialog dialog) {
|
||||||
this.openProgramDialog = dialog;
|
this.openProgramDialog = dialog;
|
||||||
}
|
}
|
||||||
|
@ -844,8 +836,6 @@ public class ProgramDiffPlugin extends ProgramPlugin
|
||||||
/**
|
/**
|
||||||
* Set the highlight based on the current program differences, but do not set the highlight for
|
* Set the highlight based on the current program differences, but do not set the highlight for
|
||||||
* set of addresses to be ignored.
|
* set of addresses to be ignored.
|
||||||
*
|
|
||||||
* @param ignoreAddressSet the set of addresses to ignore.
|
|
||||||
*/
|
*/
|
||||||
private void setDiffHighlight() {
|
private void setDiffHighlight() {
|
||||||
if (diffControl == null) {
|
if (diffControl == null) {
|
||||||
|
@ -1600,9 +1590,8 @@ public class ProgramDiffPlugin extends ProgramPlugin
|
||||||
FieldPanel fp = diffListingPanel.getFieldPanel();
|
FieldPanel fp = diffListingPanel.getFieldPanel();
|
||||||
showSecondView();
|
showSecondView();
|
||||||
AddressIndexMap indexMap = diffListingPanel.getAddressIndexMap();
|
AddressIndexMap indexMap = diffListingPanel.getAddressIndexMap();
|
||||||
fp.setBackgroundColorModel(
|
fp.setBackgroundColorModel(new MarkerServiceBackgroundColorModel(markerManager,
|
||||||
new MarkerServiceBackgroundColorModel(markerManager, secondaryDiffProgram,
|
secondaryDiffProgram, indexMap));
|
||||||
indexMap));
|
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
settingLocation = false;
|
settingLocation = false;
|
||||||
|
@ -1852,28 +1841,28 @@ public class ProgramDiffPlugin extends ProgramPlugin
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(TaskMonitor taskMonitor) {
|
public void run(TaskMonitor tm) {
|
||||||
this.monitor = taskMonitor;
|
this.monitor = tm;
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
monitor.setMessage("Waiting on program file...");
|
monitor.setMessage("Waiting on program file...");
|
||||||
diffProgram =
|
diffProgram =
|
||||||
(Program) domainFile.getImmutableDomainObject(ProgramDiffPlugin.this,
|
(Program) domainFile.getImmutableDomainObject(ProgramDiffPlugin.this,
|
||||||
DomainFile.DEFAULT_VERSION, taskMonitor);
|
DomainFile.DEFAULT_VERSION, monitor);
|
||||||
}
|
}
|
||||||
catch (VersionException e) {
|
catch (VersionException e) {
|
||||||
if (e.isUpgradable()) {
|
if (e.isUpgradable()) {
|
||||||
try {
|
try {
|
||||||
diffProgram =
|
diffProgram =
|
||||||
(Program) domainFile.getReadOnlyDomainObject(ProgramDiffPlugin.this,
|
(Program) domainFile.getReadOnlyDomainObject(ProgramDiffPlugin.this,
|
||||||
DomainFile.DEFAULT_VERSION, taskMonitor);
|
DomainFile.DEFAULT_VERSION, monitor);
|
||||||
}
|
}
|
||||||
catch (VersionException exc) {
|
catch (VersionException exc) {
|
||||||
Msg.showError(this, null, "Error Getting Diff Program",
|
Msg.showError(this, null, "Error Getting Diff Program",
|
||||||
"Getting read only file failed");
|
"Getting read only file failed");
|
||||||
}
|
}
|
||||||
catch (IOException exc) {
|
catch (IOException exc) {
|
||||||
if (!taskMonitor.isCancelled()) {
|
if (!monitor.isCancelled()) {
|
||||||
Msg.showError(this, null, "Error Getting Diff Program",
|
Msg.showError(this, null, "Error Getting Diff Program",
|
||||||
"Getting read only file failed", exc);
|
"Getting read only file failed", exc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,7 @@ public class ProgramGraphPlugin extends ProgramPlugin
|
||||||
private GraphDisplayProvider defaultGraphService;
|
private GraphDisplayProvider defaultGraphService;
|
||||||
|
|
||||||
public ProgramGraphPlugin(PluginTool tool) {
|
public ProgramGraphPlugin(PluginTool tool) {
|
||||||
super(tool, true, true);
|
super(tool);
|
||||||
intializeOptions();
|
intializeOptions();
|
||||||
registerProgramFlowGraphDisplayOptionsWithTool();
|
registerProgramFlowGraphDisplayOptionsWithTool();
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,7 @@ public class PythonPlugin extends ProgramPlugin
|
||||||
* @param tool The tool associated with this plugin.
|
* @param tool The tool associated with this plugin.
|
||||||
*/
|
*/
|
||||||
public PythonPlugin(PluginTool tool) {
|
public PythonPlugin(PluginTool tool) {
|
||||||
super(tool, true, true, true);
|
super(tool);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class SourceCodeLookupPlugin extends ProgramPlugin {
|
||||||
private DockingAction lookupSourceCodeAction;
|
private DockingAction lookupSourceCodeAction;
|
||||||
|
|
||||||
public SourceCodeLookupPlugin(PluginTool tool) {
|
public SourceCodeLookupPlugin(PluginTool tool) {
|
||||||
super(tool, false, false);
|
super(tool);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1255,14 +1255,18 @@ public abstract class AbstractGenericTest extends AbstractGTest {
|
||||||
try {
|
try {
|
||||||
doRun(swingExceptionCatcher);
|
doRun(swingExceptionCatcher);
|
||||||
}
|
}
|
||||||
catch (InterruptedException | InvocationTargetException e) {
|
catch (InterruptedException e) {
|
||||||
// Assume that if we have an exception reported by our catcher, then that is
|
// Typically, this InterrruptedException that is caused by our test harness when it
|
||||||
// the root cause of this exception and do not report this one. The typical
|
// is interrupting the test thread after a previous Swing exception that we have
|
||||||
// exception here is an InterrruptedException that is caused by our test
|
// detected--we don't care to throw the InterruptedException, as we caused it.
|
||||||
// harness when it is interrupting the test thread after a previous Swing
|
// Log a message to signal that unusual things may happen when in this state.
|
||||||
// exception that we have detected--we don't care to report the
|
Msg.debug(this, "\n>>>>>>>>>>>>>>>> Test thread interrupted. Unusual/unexpected " +
|
||||||
// InterruptedException, as we caused it. The InvocationTargetException should
|
"errors may follow.\n\n");
|
||||||
// be handled by our runnable above.
|
}
|
||||||
|
catch (InvocationTargetException e) {
|
||||||
|
// Assume that if we have an exception reported by our catcher above, then that is
|
||||||
|
// the root cause of this exception and do not report this one. This should not
|
||||||
|
// happen, as we are catching the exception above.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -204,15 +204,6 @@ public abstract class Plugin implements ExtensionPoint, PluginEventListener, Ser
|
||||||
protected final PluginDescription pluginDescription =
|
protected final PluginDescription pluginDescription =
|
||||||
PluginDescription.getPluginDescription(getClass());
|
PluginDescription.getPluginDescription(getClass());
|
||||||
|
|
||||||
/**
|
|
||||||
* Temporary compatibility for Plugins that have not been updated to new PluginInfo API.
|
|
||||||
* <p>
|
|
||||||
* Contains the list of service classes that this plugin registered as being required.
|
|
||||||
* <p>
|
|
||||||
* Ignored if the PluginDescription has values for requiredServices.
|
|
||||||
*/
|
|
||||||
private List<Class<?>> legacyRequiredServices = new ArrayList<>();
|
|
||||||
|
|
||||||
private List<Class<? extends PluginEvent>> eventsProduced = new ArrayList<>();
|
private List<Class<? extends PluginEvent>> eventsProduced = new ArrayList<>();
|
||||||
private List<Class<? extends PluginEvent>> eventsConsumed = new ArrayList<>();
|
private List<Class<? extends PluginEvent>> eventsConsumed = new ArrayList<>();
|
||||||
private List<ServiceInterfaceImplementationPair> services = new ArrayList<>();
|
private List<ServiceInterfaceImplementationPair> services = new ArrayList<>();
|
||||||
|
@ -239,19 +230,6 @@ public abstract class Plugin implements ExtensionPoint, PluginEventListener, Ser
|
||||||
registerStaticEvents();
|
registerStaticEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Construct a new Plugin.
|
|
||||||
* <p>
|
|
||||||
* Deprecated, use {@link Plugin#Plugin(PluginTool)} instead.
|
|
||||||
*
|
|
||||||
* @param pluginName name of plugin - not used.
|
|
||||||
* @param tool tool that will contain this plugin
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
protected Plugin(String pluginName, PluginTool tool) {
|
|
||||||
this(tool);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Auto-registers any services directly implemented by this Plugin instance (i.e.,
|
* Auto-registers any services directly implemented by this Plugin instance (i.e.,
|
||||||
* the MyService in "class MyPlugin extends Plugin implements MyService { }" )
|
* the MyService in "class MyPlugin extends Plugin implements MyService { }" )
|
||||||
|
@ -278,22 +256,6 @@ public abstract class Plugin implements ExtensionPoint, PluginEventListener, Ser
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns plugin name or null if given class does not extend {@link Plugin}
|
|
||||||
* <p>
|
|
||||||
* Deprecated, use {@link PluginUtils#getPluginNameFromClass(Class)}
|
|
||||||
* <p>
|
|
||||||
* @param pluginClass the plugin class
|
|
||||||
* @return the plugin name
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static String getPluginName(Class<?> pluginClass) {
|
|
||||||
if (pluginClass != Plugin.class && Plugin.class.isAssignableFrom(pluginClass)) {
|
|
||||||
return pluginClass.getSimpleName();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void cleanup() {
|
protected void cleanup() {
|
||||||
if (!disposed) {
|
if (!disposed) {
|
||||||
Throwable thr = null;
|
Throwable thr = null;
|
||||||
|
@ -305,7 +267,6 @@ public abstract class Plugin implements ExtensionPoint, PluginEventListener, Ser
|
||||||
thr = t;
|
thr = t;
|
||||||
}
|
}
|
||||||
tool.removeServiceListener(this);
|
tool.removeServiceListener(this);
|
||||||
legacyRequiredServices.clear();
|
|
||||||
unregisterServices();
|
unregisterServices();
|
||||||
unregisterEvents();
|
unregisterEvents();
|
||||||
tool.removeAll(getName());
|
tool.removeAll(getName());
|
||||||
|
@ -527,8 +488,7 @@ public abstract class Plugin implements ExtensionPoint, PluginEventListener, Ser
|
||||||
* @return true if this plugin depends on the given plugin
|
* @return true if this plugin depends on the given plugin
|
||||||
*/
|
*/
|
||||||
public boolean dependsUpon(Plugin plugin) {
|
public boolean dependsUpon(Plugin plugin) {
|
||||||
for (Class<?> c : getList(pluginDescription.getServicesRequired(),
|
for (Class<?> c : pluginDescription.getServicesRequired()) {
|
||||||
legacyRequiredServices)) {
|
|
||||||
// If one of our required services is provided by a single Plugin,
|
// If one of our required services is provided by a single Plugin,
|
||||||
// then we depend on that Plugin. If multiple provide, we are not dependent.
|
// then we depend on that Plugin. If multiple provide, we are not dependent.
|
||||||
if (plugin.isOnlyProviderOfService(c)) {
|
if (plugin.isOnlyProviderOfService(c)) {
|
||||||
|
@ -540,8 +500,7 @@ public abstract class Plugin implements ExtensionPoint, PluginEventListener, Ser
|
||||||
|
|
||||||
public List<Class<?>> getMissingRequiredServices() {
|
public List<Class<?>> getMissingRequiredServices() {
|
||||||
List<Class<?>> missingServices = new ArrayList<>();
|
List<Class<?>> missingServices = new ArrayList<>();
|
||||||
for (Class<?> requiredServiceClass : getList(pluginDescription.getServicesRequired(),
|
for (Class<?> requiredServiceClass : pluginDescription.getServicesRequired()) {
|
||||||
legacyRequiredServices)) {
|
|
||||||
if (tool.getService(requiredServiceClass) == null) {
|
if (tool.getService(requiredServiceClass) == null) {
|
||||||
missingServices.add(requiredServiceClass);
|
missingServices.add(requiredServiceClass);
|
||||||
}
|
}
|
||||||
|
@ -555,8 +514,7 @@ public abstract class Plugin implements ExtensionPoint, PluginEventListener, Ser
|
||||||
* @return boolean true if a required service isn't available via the PluginTool.
|
* @return boolean true if a required service isn't available via the PluginTool.
|
||||||
*/
|
*/
|
||||||
public boolean hasMissingRequiredService() {
|
public boolean hasMissingRequiredService() {
|
||||||
for (Class<?> depClass : getList(pluginDescription.getServicesRequired(),
|
for (Class<?> depClass : pluginDescription.getServicesRequired()) {
|
||||||
legacyRequiredServices)) {
|
|
||||||
if (tool.getService(depClass) == null) {
|
if (tool.getService(depClass) == null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -564,31 +522,6 @@ public abstract class Plugin implements ExtensionPoint, PluginEventListener, Ser
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to choose between lists to support the old Plugin ABI backward compatible lists
|
|
||||||
*
|
|
||||||
* @param l1 the new list from the static PluginDescription config - preferred if it has any elements
|
|
||||||
* @param l2 the old list - only returned if l1 is empty
|
|
||||||
* @return either l1 or l2, depending on which one has elements.
|
|
||||||
*/
|
|
||||||
private static <T> List<T> getList(List<T> l1, List<T> l2) {
|
|
||||||
return !l1.isEmpty() ? l1 : l2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register event that this plugin produces.
|
|
||||||
* <p>
|
|
||||||
* Deprecated, use {@link PluginInfo @PluginInfo.eventsProduced} instead.
|
|
||||||
* <p>
|
|
||||||
* @param eventClass Class of the produced event; class is required to force it
|
|
||||||
* to be loaded
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
protected final void registerEventProduced(Class<? extends PluginEvent> eventClass) {
|
|
||||||
eventsProduced.add(eventClass);
|
|
||||||
tool.registerEventProduced(eventClass);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void unregisterEvents() {
|
private void unregisterEvents() {
|
||||||
for (Class<? extends PluginEvent> c : eventsConsumed) {
|
for (Class<? extends PluginEvent> c : eventsConsumed) {
|
||||||
tool.removeEventListener(c, this);
|
tool.removeEventListener(c, this);
|
||||||
|
@ -601,23 +534,11 @@ public abstract class Plugin implements ExtensionPoint, PluginEventListener, Ser
|
||||||
/**
|
/**
|
||||||
* Register event that this plugin consumes.
|
* Register event that this plugin consumes.
|
||||||
* <p>
|
* <p>
|
||||||
* Deprecated, use {@link PluginInfo @PluginInfo.eventsConsumed} instead.
|
* This method is for internal use. If plugins wish to manage events consumed, then they should
|
||||||
* <p>
|
* use the {@link PluginInfo} annotation to do so.
|
||||||
* @param eventClass Class for the event; class is required to force it
|
* @param eventClass Class for the event; class is required to force it to be loaded
|
||||||
* to be loaded
|
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
protected final void internalRegisterEventConsumed(Class<? extends PluginEvent> eventClass) {
|
||||||
protected final void registerEventConsumed(Class<? extends PluginEvent> eventClass) {
|
|
||||||
registerDynamicEventConsumed(eventClass);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register event that this plugin consumes.
|
|
||||||
* <p>
|
|
||||||
* @param eventClass Class for the event; class is required to force it
|
|
||||||
* to be loaded
|
|
||||||
*/
|
|
||||||
protected final void registerDynamicEventConsumed(Class<? extends PluginEvent> eventClass) {
|
|
||||||
eventsConsumed.add(eventClass);
|
eventsConsumed.add(eventClass);
|
||||||
tool.addEventListener(eventClass, this);
|
tool.addEventListener(eventClass, this);
|
||||||
}
|
}
|
||||||
|
@ -710,7 +631,7 @@ public abstract class Plugin implements ExtensionPoint, PluginEventListener, Ser
|
||||||
protected final List<Class<?>> getServicesRequired() {
|
protected final List<Class<?>> getServicesRequired() {
|
||||||
// return either the new PluginDescription servicesRequired or the old
|
// return either the new PluginDescription servicesRequired or the old
|
||||||
// deprecated legacyRequiredServices.
|
// deprecated legacyRequiredServices.
|
||||||
return getList(pluginDescription.getServicesRequired(), legacyRequiredServices);
|
return pluginDescription.getServicesRequired();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void unregisterServices() {
|
private void unregisterServices() {
|
||||||
|
@ -719,26 +640,6 @@ public abstract class Plugin implements ExtensionPoint, PluginEventListener, Ser
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Registers a dependency on a service interface Class.
|
|
||||||
* <p>
|
|
||||||
* This method is deprecated. Use {@link PluginInfo#servicesRequired() @PluginInfo.servicesRequired}
|
|
||||||
* instead.
|
|
||||||
* <p>
|
|
||||||
* @param interfaceClass interface class that this plugin depends on
|
|
||||||
* @param isDependency boolean flag, if true this plugin will not work without the
|
|
||||||
* specified service, if false this service can work without it. If false, this
|
|
||||||
* method is a no-op as non-dependency registration information is now discarded.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
protected final void registerServiceUsed(Class<?> interfaceClass, boolean isDependency) {
|
|
||||||
if (isDependency) {
|
|
||||||
legacyRequiredServices.add(interfaceClass);
|
|
||||||
}
|
|
||||||
// information about non-dependency used-services is discarded. Only
|
|
||||||
// required services are retained.
|
|
||||||
}
|
|
||||||
|
|
||||||
protected final void deregisterService(Class<?> interfaceClass, Object service) {
|
protected final void deregisterService(Class<?> interfaceClass, Object service) {
|
||||||
|
|
||||||
for (int i = 0; i < services.size(); i++) {
|
for (int i = 0; i < services.size(); i++) {
|
||||||
|
|
|
@ -107,7 +107,7 @@ public @interface PluginInfo {
|
||||||
/**
|
/**
|
||||||
* List of PluginEvent (classes) that this Plugin produces.
|
* List of PluginEvent (classes) that this Plugin produces.
|
||||||
*
|
*
|
||||||
* @return PluginEvent class list, defaults to emtpy.
|
* @return PluginEvent class list, defaults to empty.
|
||||||
*/
|
*/
|
||||||
Class<? extends PluginEvent>[] eventsProduced() default {};
|
Class<? extends PluginEvent>[] eventsProduced() default {};
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class SkeletonPlugin extends ProgramPlugin {
|
||||||
* @param tool The plugin tool that this plugin is added to.
|
* @param tool The plugin tool that this plugin is added to.
|
||||||
*/
|
*/
|
||||||
public SkeletonPlugin(PluginTool tool) {
|
public SkeletonPlugin(PluginTool tool) {
|
||||||
super(tool, true, true);
|
super(tool);
|
||||||
|
|
||||||
// TODO: Customize provider (or remove if a provider is not desired)
|
// TODO: Customize provider (or remove if a provider is not desired)
|
||||||
String pluginName = getName();
|
String pluginName = getName();
|
||||||
|
|
Loading…
Reference in a new issue