Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-2663 - Removed deprecated methods

dragonmachera2a5a6e354d0
diff --git a/Ghidra/Extensions/MachineLearning/src/main/java/ghidra/machinelearning/functionfinding/RandomForestFunctionFinderPlugin.java b/Ghidra/Extensions/MachineLearning/src/main/java/ghidra/machinelearning/functionfinding/RandomForestFunctionFinderPlugin.java
index e8fb3e2272..b73431cb2f 100644
--- a/Ghidra/Extensions/MachineLearning/src/main/java/ghidra/machinelearning/functionfinding/RandomForestFunctionFinderPlugin.java
+++ b/Ghidra/Extensions/MachineLearning/src/main/java/ghidra/machinelearning/functionfinding/RandomForestFunctionFinderPlugin.java
@@ -55,7 +55,7 @@ import ghidra.util.bean.opteditor.OptionsVetoException;
//@formatter:on
/**
- * A {@link ProgramPlugin} for training a model on the starts of known functions in a
+ * A {@link ProgramPlugin} for training a model on the starts of known functions in a
* program and then using that model to look for more functions (in the source program or
* another program selected by the user).
*/
@@ -85,7 +85,7 @@ public class RandomForestFunctionFinderPlugin extends ProgramPlugin
* @param tool tool for plugin
*/
public RandomForestFunctionFinderPlugin(PluginTool tool) {
- super(tool, false, true);
+ super(tool);
programsToProviders = new HashMap<>();
}
@@ -122,7 +122,7 @@ public class RandomForestFunctionFinderPlugin extends ProgramPlugin
}
/**
- * Record the existence of a {@link ProgramAssociatedComponentProviderAdapter} so that it can
+ * Record the existence of a {@link ProgramAssociatedComponentProviderAdapter} so that it can
* be closed if its associated program is closed
* @param provider provider
*/
@@ -175,7 +175,7 @@ public class RandomForestFunctionFinderPlugin extends ProgramPlugin
@Override
protected void programClosed(Program p) {
- //ProgramAssociatedComponentProviderAdapter.closeComponent modifies values of
+ //ProgramAssociatedComponentProviderAdapter.closeComponent modifies values of
//programsToProviders, so make a copy to avoid a ConcurrentModificationException
List<ProgramAssociatedComponentProviderAdapter> providersToClose =
Lists.copyOf(programsToProviders.getOrDefault(p, Collections.emptyList()));
diff --git a/Ghidra/Extensions/SampleTablePlugin/src/main/java/ghidra/examples/SampleTablePlugin.java b/Ghidra/Extensions/SampleTablePlugin/src/main/java/ghidra/examples/SampleTablePlugin.java
index 8b93b6556a..96a1e984f6 100644
--- a/Ghidra/Extensions/SampleTablePlugin/src/main/java/ghidra/examples/SampleTablePlugin.java
+++ b/Ghidra/Extensions/SampleTablePlugin/src/main/java/ghidra/examples/SampleTablePlugin.java
@@ -43,7 +43,7 @@ public class SampleTablePlugin extends ProgramPlugin {
private Function currentFunction;
public SampleTablePlugin(PluginTool tool) {
- super(tool, true /*location changes*/, true/*selection changes*/);
+ super(tool);
provider = new SampleTableProvider(this);
provider.addToTool();
diff --git a/Ghidra/Extensions/SampleTablePlugin/src/main/java/ghidra/examples2/SampleSearchTablePlugin.java b/Ghidra/Extensions/SampleTablePlugin/src/main/java/ghidra/examples2/SampleSearchTablePlugin.java
index 328cf2f29d..5ddc7cadfd 100644
--- a/Ghidra/Extensions/SampleTablePlugin/src/main/java/ghidra/examples2/SampleSearchTablePlugin.java
+++ b/Ghidra/Extensions/SampleTablePlugin/src/main/java/ghidra/examples2/SampleSearchTablePlugin.java
@@ -40,7 +40,7 @@ public class SampleSearchTablePlugin extends ProgramPlugin {
private SampleSearchTableProvider provider;
public SampleSearchTablePlugin(PluginTool tool) {
- super(tool, false, false);
+ super(tool);
createActions();
}
diff --git a/Ghidra/Extensions/sample/src/main/java/ghidra/examples/KitchenSinkPlugin.java b/Ghidra/Extensions/sample/src/main/java/ghidra/examples/KitchenSinkPlugin.java
index 38414f85c7..dcfd61bd58 100644
--- a/Ghidra/Extensions/sample/src/main/java/ghidra/examples/KitchenSinkPlugin.java
+++ b/Ghidra/Extensions/sample/src/main/java/ghidra/examples/KitchenSinkPlugin.java
@@ -65,7 +65,7 @@ public class KitchenSinkPlugin extends ProgramPlugin {
*/
public KitchenSinkPlugin(PluginTool tool) {
- super(tool, false, false);
+ super(tool);
// set up list of services.
setupServices();
diff --git a/Ghidra/Extensions/sample/src/main/java/ghidra/examples/SampleProgramTreePlugin.java b/Ghidra/Extensions/sample/src/main/java/ghidra/examples/SampleProgramTreePlugin.java
index a8cc03eed6..1034c64285 100644
--- a/Ghidra/Extensions/sample/src/main/java/ghidra/examples/SampleProgramTreePlugin.java
+++ b/Ghidra/Extensions/sample/src/main/java/ghidra/examples/SampleProgramTreePlugin.java
@@ -60,7 +60,7 @@ public class SampleProgramTreePlugin extends ProgramPlugin {
* @param tool tool that will contain this plugin
*/
public SampleProgramTreePlugin(PluginTool tool) {
- super(tool, false, false); // we consume neither location nor selection events
+ super(tool);
createActions();
}
diff --git a/Ghidra/Extensions/sample/src/main/java/ghidra/examples/ShowInfoPlugin.java b/Ghidra/Extensions/sample/src/main/java/ghidra/examples/ShowInfoPlugin.java
index 8c79044dc6..db3b49e2d6 100644
--- a/Ghidra/Extensions/sample/src/main/java/ghidra/examples/ShowInfoPlugin.java
+++ b/Ghidra/Extensions/sample/src/main/java/ghidra/examples/ShowInfoPlugin.java
@@ -42,7 +42,7 @@ public class ShowInfoPlugin extends ProgramPlugin {
private ShowInfoComponentProvider provider;
public ShowInfoPlugin(PluginTool tool) {
- super(tool, true, false);
+ super(tool);
provider = new ShowInfoComponentProvider(tool, getName());
}
diff --git a/Ghidra/Extensions/sample/src/main/java/ghidra/examples/Template.java b/Ghidra/Extensions/sample/src/main/java/ghidra/examples/Template.java
deleted file mode 100644
index a256f5e387..0000000000
--- a/Ghidra/Extensions/sample/src/main/java/ghidra/examples/Template.java
+++ /dev/null
@@ -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);
- }
- }
-
-}
diff --git a/Ghidra/Extensions/sample/src/main/java/ghidra/examples/TemplateProgramPlugin.java b/Ghidra/Extensions/sample/src/main/java/ghidra/examples/TemplateProgramPlugin.java
deleted file mode 100644
index 7eb6e75d99..0000000000
--- a/Ghidra/Extensions/sample/src/main/java/ghidra/examples/TemplateProgramPlugin.java
+++ /dev/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);
- }
-
-}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/ProgramPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/ProgramPlugin.java
index 6bfd35f9d5..b42366287c 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/ProgramPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/ProgramPlugin.java
@@ -15,44 +15,31 @@
*/
package ghidra.app.plugin;
-import java.util.ArrayList;
-
-import docking.ActionContext;
-import docking.action.DockingAction;
import ghidra.app.events.*;
import ghidra.app.services.GoToService;
import ghidra.framework.plugintool.*;
import ghidra.program.model.address.Address;
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.ProgramSelection;
/**
- * Base class to handle common program events: Program Open/Close,
- * Program Location, Program Selection, and Program Highlight.
+ * Base class to handle common program events: Program Open/Close, Program Activated,
+ * 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>
- * Subclasses should override the following methods if they are interested
- * in the corresponding events:
- * <ul>
- * <LI> <code>programOpened(Program)</code>
- * <LI> <code>programClosed(Program)</code>
- * <LI> <code>locationChanged(ProgramLocation)</code>
- * <LI> <code>selectionChanged(ProgramSelection) </code>
- * <LI> <code>highlightChanged(ProgramSelection) </code>
- * </LI>
- * </ul>
- * <br>
- * This class will handle the enablement and add to popup state for
- * plugin actions when subclasses call any of the following methods:
+ * Subclasses should override the following methods if they are interested in the corresponding
+ * events:
* <ul>
- * <LI><code>enableOnHighlight(PluginAction)</code>
- * <LI><code>enableOnLocation(PluginAction)</code>
- * <LI><code>enableOnProgram(PluginAction)</code>
- * <LI><code>enableOnSelection(PluginAction)</code>
- * </LI>
+ * <LI> {@link #programOpened(Program)}
+ * <LI> {@link #programClosed(Program)}
+ * <LI> {@link #locationChanged(ProgramLocation)}
+ * <LI> {@link #selectionChanged(ProgramSelection)}
+ * <LI> {@link #highlightChanged(ProgramSelection)}
* </ul>
- *
*/
public abstract class ProgramPlugin extends Plugin {
@@ -60,53 +47,58 @@ public abstract class ProgramPlugin extends Plugin {
protected ProgramLocation currentLocation;
protected ProgramSelection currentSelection;
protected ProgramSelection currentHighlight;
- private ArrayList<DockingAction> programActionList;
- private ArrayList<DockingAction> locationActionList;
- private ArrayList<DockingAction> selectionActionList;
- private ArrayList<DockingAction> highlightActionList;
/**
* Constructs a new program 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, boolean consumeLocationChange,
- boolean consumeSelectionChange, boolean consumeHighlightChange) {
+ public ProgramPlugin(PluginTool plugintool) {
super(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);
+ internalRegisterEventConsumed(ProgramActivatedPluginEvent.class);
+ internalRegisterEventConsumed(ProgramLocationPluginEvent.class);
+ internalRegisterEventConsumed(ProgramSelectionPluginEvent.class);
+ internalRegisterEventConsumed(ProgramHighlightPluginEvent.class);
+ internalRegisterEventConsumed(ProgramOpenedPluginEvent.class);
+ internalRegisterEventConsumed(ProgramClosedPluginEvent.class);
}
- public ProgramPlugin(PluginTool tool, boolean consumeLocationChange,
+ /**
+ * 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(tool, consumeLocationChange, consumeSelectionChange, false);
+ 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,
+ boolean consumeSelectionChange, boolean consumeHighlightChange) {
+ this(plugintool);
}
/**
* Process the plugin event.
- * When a program closed event or focus changed event comes in,
- * the locationChanged() and selectionChanged() methods are called
- * with null arguments; currentProgram and currentLocation are cleared.
- * <p>Note: if the subclass overrides processEvent(), it should call
- * super.processEvent().
+ * <p>
+ * When a program closed event or focus changed event comes in, the locationChanged() and
+ * selectionChanged() methods are called with null arguments; currentProgram and
+ * currentLocation are cleared.
+ * <p>
+ * Note: if the subclass overrides processEvent(), it should call super.processEvent().
*/
@Override
public void processEvent(PluginEvent event) {
@@ -130,14 +122,10 @@ public abstract class ProgramPlugin extends Plugin {
locationChanged(null);
selectionChanged(null);
highlightChanged(null);
- enableActions(locationActionList, false);
- enableActions(selectionActionList, false);
- enableActions(highlightActionList, false);
}
if (currentProgram != null) {
programActivated(currentProgram);
}
- enableActions(programActionList, currentProgram != null);
}
else if (event instanceof ProgramLocationPluginEvent) {
@@ -147,27 +135,11 @@ public abstract class ProgramPlugin extends Plugin {
if (currentLocation != null && currentLocation.getAddress() == null ||
(currentProgram == null && ev.getProgram() == 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) {
- // currentProgram is null because we haven't gotten the
- // open program event yet (a plugin is firing location change
- // in response to open program that we haven't gotten yet),
- // so just pull it out of the
- // location event...
- //currentProgram = ev.getProgram();
- //programOpened(currentProgram);
+ // currentProgram is null because we haven't gotten the open program event yet (a
+ // plugin is firing location change in response to open program that we haven't
+ // gotten yet)
return;
}
locationChanged(currentLocation);
@@ -175,11 +147,7 @@ public abstract class ProgramPlugin extends Plugin {
else if (event instanceof ProgramSelectionPluginEvent) {
ProgramSelectionPluginEvent ev = (ProgramSelectionPluginEvent) event;
currentSelection = ev.getSelection();
- if (currentSelection != null && !currentSelection.isEmpty()) {
- enableActions(selectionActionList, true);
- }
- else {
- enableActions(selectionActionList, false);
+ if (currentSelection != null && currentSelection.isEmpty()) {
currentSelection = null;
}
selectionChanged(currentSelection);
@@ -187,159 +155,65 @@ public abstract class ProgramPlugin extends Plugin {
else if (event instanceof ProgramHighlightPluginEvent) {
ProgramHighlightPluginEvent ev = (ProgramHighlightPluginEvent) event;
currentHighlight = ev.getHighlight();
- if (currentHighlight != null && !currentHighlight.isEmpty()) {
- enableActions(highlightActionList, true);
- }
- else {
- enableActions(highlightActionList, false);
+ if (currentHighlight != null && currentHighlight.isEmpty()) {
currentHighlight = null;
}
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.
- * Note: this method is called in response to a ProgramActivatedPluginEvent.
- *
- * At the time this method is called,
+ * Note: this method is called in response to a ProgramActivatedPluginEvent.
+ *
+ * At the time this method is called,
* the "currentProgram" variable will be set the new active program.
- *
+ *
* @param program the new program going active.
*/
protected void programActivated(Program program) {
+ // override
}
/**
* Subclasses should override this method if it is interested when a program is closed.
- *
+ *
* This event has no affect on the "current Program". A "programDeactivated" call will
* occur that affects the active program.
- *
+ *
* @param program the program being closed.
*/
protected void programClosed(Program program) {
+ // override
}
/**
* Subclasses should override this method if it is interested when a program is opened.
- *
+ *
* This event has no affect on the "current Program". A "programActivated" call will
* occur that affects the active program.
- *
+ *
* @param program the program being opened.
*/
protected void programOpened(Program program) {
+ // override
}
/**
* Subclass should override this method if it is interested when programs become inactive.
- * Note: this method is called in response to a ProgramActivatedPluginEvent and there is
+ * Note: this method is called in response to a ProgramActivatedPluginEvent and there is
* a currently active program.
- *
- * At the time this method is called,
- * the "currentProgram" variable will be set the
+ *
+ * At the time this method is called,
+ * the "currentProgram" variable will be set the
* new active program or null if there is no new active program.
- *
+ *
* @param program the old program going inactive.
*/
protected void programDeactivated(Program program) {
+ // override
}
/**
@@ -348,6 +222,7 @@ public abstract class ProgramPlugin extends Plugin {
* @param loc location could be null
*/
protected void locationChanged(ProgramLocation loc) {
+ // override
}
/**
@@ -356,6 +231,7 @@ public abstract class ProgramPlugin extends Plugin {
* @param sel selection could be null
*/
protected void selectionChanged(ProgramSelection sel) {
+ // override
}
/**
@@ -364,10 +240,13 @@ public abstract class ProgramPlugin extends Plugin {
* @param hl highlight could be null
*/
protected void highlightChanged(ProgramSelection hl) {
+ // override
}
/**
* Convenience method to go to the specified address.
+ * @param addr the address to go to
+ * @return true if successful
*/
protected boolean goTo(Address addr) {
GoToService service = tool.getService(GoToService.class);
@@ -396,45 +275,6 @@ public abstract class ProgramPlugin extends Plugin {
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() {
return currentLocation;
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/algorithmtree/ModuleAlgorithmPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/algorithmtree/ModuleAlgorithmPlugin.java
index 78435fd670..11bdc7711b 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/algorithmtree/ModuleAlgorithmPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/algorithmtree/ModuleAlgorithmPlugin.java
@@ -60,7 +60,7 @@ public class ModuleAlgorithmPlugin extends ProgramPlugin implements BlockModelSe
private BlockModelService blockModelService;
public ModuleAlgorithmPlugin(PluginTool tool) {
- super(tool, false, false);
+ super(tool);
}
@Override
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/assembler/AssemblerPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/assembler/AssemblerPlugin.java
index 04e3dee701..33793c0598 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/assembler/AssemblerPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/assembler/AssemblerPlugin.java
@@ -59,7 +59,7 @@ public class AssemblerPlugin extends ProgramPlugin {
/*test*/ PatchDataAction patchDataAction;
public AssemblerPlugin(PluginTool tool) {
- super(tool, false, false, false);
+ super(tool);
createActions();
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/blockmodel/BlockModelServicePlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/blockmodel/BlockModelServicePlugin.java
index 8676814e11..bbf155d607 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/blockmodel/BlockModelServicePlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/blockmodel/BlockModelServicePlugin.java
@@ -83,7 +83,7 @@ public class BlockModelServicePlugin extends ProgramPlugin
public BlockModelServicePlugin(PluginTool tool) {
- super(tool, false, false);
+ super(tool);
// Add standard simple block model
BlockModelInfo info = new BlockModelInfo(SimpleBlockModel.NAME, SimpleBlockModel.class);
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/bookmark/BookmarkPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/bookmark/BookmarkPlugin.java
index 198519e00a..7759366a64 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/bookmark/BookmarkPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/bookmark/BookmarkPlugin.java
@@ -85,7 +85,7 @@ public class BookmarkPlugin extends ProgramPlugin
private NavUpdater navUpdater;
public BookmarkPlugin(PluginTool tool) {
- super(tool, true, true);
+ super(tool);
provider = new BookmarkProvider(tool, this);
provider.addToTool();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/calltree/CallTreePlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/calltree/CallTreePlugin.java
index 056dbdd006..61a457b56b 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/calltree/CallTreePlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/calltree/CallTreePlugin.java
@@ -67,7 +67,7 @@ public class CallTreePlugin extends ProgramPlugin {
private CallTreeProvider primaryProvider;
public CallTreePlugin(PluginTool tool) {
- super(tool, true, false, false);
+ super(tool);
createActions();
primaryProvider = new CallTreeProvider(this, true);
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/checksums/ComputeChecksumsPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/checksums/ComputeChecksumsPlugin.java
index 20a7c608a2..e781305efb 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/checksums/ComputeChecksumsPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/checksums/ComputeChecksumsPlugin.java
@@ -51,7 +51,7 @@ public class ComputeChecksumsPlugin extends ProgramPlugin {
* @param tool
*/
public ComputeChecksumsPlugin(PluginTool tool) {
- super(tool, true, true);
+ super(tool);
createActions();
provider = new ComputeChecksumsProvider(this);
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/clipboard/ClipboardPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/clipboard/ClipboardPlugin.java
index 0734f7e6ca..31f5717463 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/clipboard/ClipboardPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/clipboard/ClipboardPlugin.java
@@ -78,7 +78,7 @@ public class ClipboardPlugin extends ProgramPlugin implements ClipboardOwner, Cl
private boolean isClipboardOwner;
public ClipboardPlugin(PluginTool tool) {
- super(tool, true, true);
+ super(tool);
}
@Override
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/hover/DataTypeListingHoverPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/hover/DataTypeListingHoverPlugin.java
index f0d3e99009..517f64c3f6 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/hover/DataTypeListingHoverPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/hover/DataTypeListingHoverPlugin.java
@@ -40,7 +40,7 @@ public class DataTypeListingHoverPlugin extends ProgramPlugin {
private DataTypeListingHover hoverService;
public DataTypeListingHoverPlugin(PluginTool tool) {
- super(tool, true, false);
+ super(tool);
hoverService = new DataTypeListingHover(tool);
registerServiceProvided(ListingHoverService.class, hoverService);
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/colorizer/ColorizingPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/colorizer/ColorizingPlugin.java
index 5874f13ec1..04de35dbbd 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/colorizer/ColorizingPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/colorizer/ColorizingPlugin.java
@@ -88,7 +88,7 @@ public class ColorizingPlugin extends ProgramPlugin implements DomainObjectListe
});
public ColorizingPlugin(PluginTool tool) {
- super(tool, true, true);
+ super(tool);
service = new ColorizingServiceProvider(tool);
registerServiceProvided(ColorizingService.class, service);
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/commentwindow/CommentWindowPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/commentwindow/CommentWindowPlugin.java
index 85df4d7d90..e3949d5030 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/commentwindow/CommentWindowPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/commentwindow/CommentWindowPlugin.java
@@ -55,7 +55,7 @@ public class CommentWindowPlugin extends ProgramPlugin implements DomainObjectLi
private SwingUpdateManager reloadUpdateMgr;
public CommentWindowPlugin(PluginTool tool) {
- super(tool, true, true);
+ super(tool);
reloadUpdateMgr = new SwingUpdateManager(1000, 60000, () -> doReload());
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/console/ConsolePlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/console/ConsolePlugin.java
index 2e37bb9a71..1b368a3450 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/console/ConsolePlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/console/ConsolePlugin.java
@@ -20,10 +20,10 @@ import ghidra.app.events.ProgramLocationPluginEvent;
import ghidra.app.plugin.PluginCategoryNames;
import ghidra.app.plugin.ProgramPlugin;
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.program.model.listing.Program;
-import ghidra.program.util.ProgramLocation;
//@formatter:off
@PluginInfo(
@@ -41,7 +41,7 @@ public class ConsolePlugin extends ProgramPlugin {
private ConsoleComponentProvider provider;
public ConsolePlugin(PluginTool tool) {
- super(tool, false, false);
+ super(tool);
provider = new ConsoleComponentProvider(tool, getName());
registerServiceProvided(ConsoleService.class, provider);
}
@@ -67,15 +67,4 @@ public class ConsolePlugin extends ProgramPlugin {
protected void programDeactivated(Program program) {
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());
- }
- }
-
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/cparser/CParserPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/cparser/CParserPlugin.java
index 1130564c6e..ddfab279d0 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/cparser/CParserPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/cparser/CParserPlugin.java
@@ -66,7 +66,7 @@ public class CParserPlugin extends ProgramPlugin {
"Parse C and C Header files, extracting data definitions and function signatures.";
public CParserPlugin(PluginTool plugintool) {
- super(plugintool, false, false);
+ super(plugintool);
createActions();
setUserProfileDir(USER_PROFILES_DIR);
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/DataTypeManagerPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/DataTypeManagerPlugin.java
index b4b2713e61..2d8a5df43f 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/DataTypeManagerPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/DataTypeManagerPlugin.java
@@ -105,7 +105,7 @@ public class DataTypeManagerPlugin extends ProgramPlugin
private DataTypePropertyManager dataTypePropertyManager;
public DataTypeManagerPlugin(PluginTool tool) {
- super(tool, true, true);
+ super(tool);
}
@Override
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datapreview/DataTypePreviewPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datapreview/DataTypePreviewPlugin.java
index e38fc48f40..4bee7cfac9 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datapreview/DataTypePreviewPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datapreview/DataTypePreviewPlugin.java
@@ -79,7 +79,7 @@ public class DataTypePreviewPlugin extends ProgramPlugin {
private SwingUpdateManager updateManager = new SwingUpdateManager(650, () -> updatePreview());
public DataTypePreviewPlugin(PluginTool tool) {
- super(tool, true, true);
+ super(tool);
}
DTPPTableModel getTableModel() {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datawindow/DataWindowPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datawindow/DataWindowPlugin.java
index e483081b6e..ac48780d16 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datawindow/DataWindowPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datawindow/DataWindowPlugin.java
@@ -65,7 +65,7 @@ public class DataWindowPlugin extends ProgramPlugin implements DomainObjectListe
private boolean resetTypesNeeded;
public DataWindowPlugin(PluginTool tool) {
- super(tool, true, true);
+ super(tool);
resetUpdateMgr = new SwingUpdateManager(100, 60000, () -> doReset());
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/disassembler/AutoTableDisassemblerPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/disassembler/AutoTableDisassemblerPlugin.java
index 67e6edfa92..a33002a7a9 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/disassembler/AutoTableDisassemblerPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/disassembler/AutoTableDisassemblerPlugin.java
@@ -67,7 +67,7 @@ public class AutoTableDisassemblerPlugin extends ProgramPlugin implements Domain
final static String SEARCH_ACTION_NAME = "Search for Address Tables";
public AutoTableDisassemblerPlugin(PluginTool tool) {
- super(tool, true, true);
+ super(tool);
}
@Override
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/disassembler/DisassembledViewPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/disassembler/DisassembledViewPlugin.java
index a3efa81be4..81eef78479 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/disassembler/DisassembledViewPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/disassembler/DisassembledViewPlugin.java
@@ -111,7 +111,7 @@ public class DisassembledViewPlugin extends ProgramPlugin implements DomainObjec
// 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
// constructor
- super(plugintool, true, true);
+ super(plugintool);
}
/**
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/eclipse/EclipseIntegrationPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/eclipse/EclipseIntegrationPlugin.java
index 1dc86d978b..c12c525a65 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/eclipse/EclipseIntegrationPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/eclipse/EclipseIntegrationPlugin.java
@@ -58,7 +58,7 @@ public class EclipseIntegrationPlugin extends ProgramPlugin implements EclipseIn
private ToolOptions options;
public EclipseIntegrationPlugin(PluginTool tool) {
- super(tool, true, true, true);
+ super(tool);
}
@Override
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/editor/TextEditorManagerPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/editor/TextEditorManagerPlugin.java
index f5aaf6ca1e..b336fe4b90 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/editor/TextEditorManagerPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/editor/TextEditorManagerPlugin.java
@@ -47,7 +47,7 @@ public class TextEditorManagerPlugin extends ProgramPlugin implements TextEditor
private List<TextEditorComponentProvider> editors = new ArrayList<>();
public TextEditorManagerPlugin(PluginTool tool) {
- super(tool, true, true, true);
+ super(tool);
}
@Override
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/equate/EquateTablePlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/equate/EquateTablePlugin.java
index 5449bcc647..fde3b1e341 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/equate/EquateTablePlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/equate/EquateTablePlugin.java
@@ -52,7 +52,7 @@ public class EquateTablePlugin extends ProgramPlugin implements DomainObjectList
private SwingUpdateManager updateMgr;
public EquateTablePlugin(PluginTool tool) {
- super(tool, true, false);
+ super(tool);
updateMgr = new SwingUpdateManager(1000, 3000, () -> provider.updateEquates());
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/tags/FunctionTagPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/tags/FunctionTagPlugin.java
index 77842e29c8..98b0f8eda3 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/tags/FunctionTagPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/tags/FunctionTagPlugin.java
@@ -50,7 +50,7 @@ public class FunctionTagPlugin extends ProgramPlugin {
private FunctionTagProvider provider;
public FunctionTagPlugin(PluginTool tool) {
- super(tool, true, false);
+ super(tool);
provider = new FunctionTagProvider(this, getCurrentProgram());
createActions();
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/functioncompare/FunctionComparisonPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/functioncompare/FunctionComparisonPlugin.java
index 31f06bd218..dac1846608 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/functioncompare/FunctionComparisonPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/functioncompare/FunctionComparisonPlugin.java
@@ -70,7 +70,7 @@ public class FunctionComparisonPlugin extends ProgramPlugin
* @param tool the tool that owns this plugin
*/
public FunctionComparisonPlugin(PluginTool tool) {
- super(tool, true, true);
+ super(tool);
functionComparisonManager = new FunctionComparisonProviderManager(this);
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/functionwindow/FunctionWindowPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/functionwindow/FunctionWindowPlugin.java
index dfd5217867..07a9aaeafb 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/functionwindow/FunctionWindowPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/functionwindow/FunctionWindowPlugin.java
@@ -59,7 +59,7 @@ public class FunctionWindowPlugin extends ProgramPlugin implements DomainObjectL
private FunctionComparisonService functionComparisonService;
public FunctionWindowPlugin(PluginTool tool) {
- super(tool, true, false);
+ super(tool);
swingMgr = new SwingUpdateManager(1000, () -> provider.reload());
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/gotoquery/GoToServicePlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/gotoquery/GoToServicePlugin.java
index 34276ea156..abe5715358 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/gotoquery/GoToServicePlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/gotoquery/GoToServicePlugin.java
@@ -62,7 +62,7 @@ public final class GoToServicePlugin extends ProgramPlugin {
* @param tool the tool
*/
public GoToServicePlugin(PluginTool tool) {
- super(tool, true, true);
+ super(tool);
Options opt = tool.getOptions(PluginConstants.SEARCH_OPTION_NAME);
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/instructionsearch/InstructionSearchPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/instructionsearch/InstructionSearchPlugin.java
index 1b4eeb833f..aa6f1c81f9 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/instructionsearch/InstructionSearchPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/instructionsearch/InstructionSearchPlugin.java
@@ -88,7 +88,7 @@ public class InstructionSearchPlugin extends ProgramPlugin {
* @param tool the plugin tool
*/
public InstructionSearchPlugin(PluginTool tool) {
- super(tool, true, true);
+ super(tool);
// Creates the menu actions used with this plugin.
createActions();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/memory/MemoryMapPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/memory/MemoryMapPlugin.java
index 784bdc3bdc..8c580ea169 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/memory/MemoryMapPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/memory/MemoryMapPlugin.java
@@ -59,7 +59,7 @@ public class MemoryMapPlugin extends ProgramPlugin implements DomainObjectListen
private MemoryMapManager memManager;
public MemoryMapPlugin(PluginTool tool) {
- super(tool, true, false);
+ super(tool);
memManager = new MemoryMapManager(this);
provider = new MemoryMapProvider(this);
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/misc/MyProgramChangesDisplayPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/misc/MyProgramChangesDisplayPlugin.java
index a7eebb21ba..24aaf0a191 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/misc/MyProgramChangesDisplayPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/misc/MyProgramChangesDisplayPlugin.java
@@ -99,7 +99,7 @@ public class MyProgramChangesDisplayPlugin extends ProgramPlugin implements Doma
public MyProgramChangesDisplayPlugin(PluginTool tool) {
- super(tool, false, false);
+ super(tool);
folderListener = new ProgramFolderListener();
transactionListener = new ProgramTransactionListener();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/module/AutoRenamePlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/module/AutoRenamePlugin.java
index a4461639ba..cb03b4223a 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/module/AutoRenamePlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/module/AutoRenamePlugin.java
@@ -79,7 +79,7 @@ public class AutoRenamePlugin extends ProgramPlugin {
* Constructor.
*/
public AutoRenamePlugin(PluginTool tool) {
- super(tool, true, false);
+ super(tool);
createActions();
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/module/ModuleSortPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/module/ModuleSortPlugin.java
index 98267d6dd7..90803e5d97 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/module/ModuleSortPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/module/ModuleSortPlugin.java
@@ -77,7 +77,7 @@ public class ModuleSortPlugin extends ProgramPlugin {
private ModuleSortAction sortByNameAction;
public ModuleSortPlugin(PluginTool tool) {
- super(tool, false, false);
+ super(tool);
createActions();
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/overview/OverviewColorPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/overview/OverviewColorPlugin.java
index 7410fbaedc..c4b89cfbe5 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/overview/OverviewColorPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/overview/OverviewColorPlugin.java
@@ -62,7 +62,7 @@ public class OverviewColorPlugin extends ProgramPlugin {
private MultiActionDockingAction multiAction;
public OverviewColorPlugin(PluginTool tool) {
- super(tool, false, false);
+ super(tool);
}
@Override
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/printing/PrintingPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/printing/PrintingPlugin.java
index 58cfe51b4d..ba418b1de9 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/printing/PrintingPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/printing/PrintingPlugin.java
@@ -66,7 +66,7 @@ public class PrintingPlugin extends ProgramPlugin {
private PageFormat format;
public PrintingPlugin(PluginTool tool) {
- super(tool, true, true);
+ super(tool);
setupActions();
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/processors/ShowInstructionInfoPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/processors/ShowInstructionInfoPlugin.java
index 10b05a01e9..a2d608eef8 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/processors/ShowInstructionInfoPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/processors/ShowInstructionInfoPlugin.java
@@ -83,7 +83,7 @@ public class ShowInstructionInfoPlugin extends ProgramPlugin {
public ShowInstructionInfoPlugin(PluginTool tool) {
- super(tool, true, false);
+ super(tool);
createStatusPanels();
createActions();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/programtree/ProgramTreeModularizationPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/programtree/ProgramTreeModularizationPlugin.java
index 7163b35b85..8fc3b1edbd 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/programtree/ProgramTreeModularizationPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/programtree/ProgramTreeModularizationPlugin.java
@@ -57,7 +57,7 @@ import docking.action.MenuData;
public class ProgramTreeModularizationPlugin extends ProgramPlugin {
public ProgramTreeModularizationPlugin(PluginTool tool) {
- super(tool, false, false);
+ super(tool);
}
@Override
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/programtree/ProgramTreePlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/programtree/ProgramTreePlugin.java
index 4b8dae81c6..6f38511c1e 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/programtree/ProgramTreePlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/programtree/ProgramTreePlugin.java
@@ -107,7 +107,7 @@ public class ProgramTreePlugin extends ProgramPlugin
private boolean isReplaceViewMode = true;
public ProgramTreePlugin(PluginTool tool) {
- super(tool, true, false);
+ super(tool);
viewProvider = new ViewManagerComponentProvider(tool, getName());
registerServiceProvided(ViewManagerService.class, viewProvider);
@@ -332,11 +332,7 @@ public class ProgramTreePlugin extends ProgramPlugin
@Override
public void processEvent(PluginEvent event) {
- super.processEvent(event);
- if (event instanceof ProgramActivatedPluginEvent) {
- ProgramActivatedPluginEvent ev = (ProgramActivatedPluginEvent) event;
- viewProvider.setCurrentProgram(ev.getActiveProgram());
- }
+
if (event instanceof TreeSelectionPluginEvent) {
TreeSelectionPluginEvent ev = (TreeSelectionPluginEvent) event;
String treeName = ev.getTreeName();
@@ -346,6 +342,16 @@ public class ProgramTreePlugin extends ProgramPlugin
}
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) {
@@ -384,12 +390,6 @@ public class ProgramTreePlugin extends ProgramPlugin
setProgram(null);
}
- @Override
- protected void programActivated(Program program) {
- program.addListener(programListener);
- setProgram(program);
- }
-
@Override
protected void locationChanged(ProgramLocation loc) {
// select fragment that corresponds to the location
@@ -479,7 +479,7 @@ public class ProgramTreePlugin extends ProgramPlugin
/**
* Close the view if we are not trying to close the last view.
- *
+ *
* @param treeViewProvider
* @return true if the view can be closed
*/
@@ -496,7 +496,7 @@ public class ProgramTreePlugin extends ProgramPlugin
/**
* Notification that the view is deleted
- *
+ *
* @param treeViewProvider the deleted provider
* @return true if the view can be deleted
*/
@@ -516,7 +516,7 @@ public class ProgramTreePlugin extends ProgramPlugin
/**
* Method renameView.
- *
+ *
* @param treeViewProvider
* @param newName
* @return boolean
@@ -561,7 +561,7 @@ public class ProgramTreePlugin extends ProgramPlugin
/**
* Method called by the program change listener when a tree is removed.
- *
+ *
* @param treeName name of tree that was removed
*/
void treeRemoved(String treeName) {
@@ -581,7 +581,7 @@ public class ProgramTreePlugin extends ProgramPlugin
/**
* Get the program tree for the given tree name.
- *
+ *
* @param treeName name of tree in the program (also the name of the view)
* @return ProgramDnDTree tree, or null if there is no provider for the
* given name
@@ -596,7 +596,7 @@ public class ProgramTreePlugin extends ProgramPlugin
/**
* Method getCurrentProvider.
- *
+ *
* @return TreeViewProvider
*/
TreeViewProvider getCurrentProvider() {
@@ -622,9 +622,9 @@ public class ProgramTreePlugin extends ProgramPlugin
/**
* The program was restored from an Undo/Redo operation so reload it
- *
- * @param checkRoot if true, only rebuild the tree if the root node is invalid; if false,
- * force a rebuild of the tree
+ *
+ * @param checkRoot if true, only rebuild the tree if the root node is invalid; if false,
+ * force a rebuild of the tree
*/
void reloadProgram(boolean checkRoot) {
if (currentProgram == null) {
@@ -696,17 +696,15 @@ public class ProgramTreePlugin extends ProgramPlugin
}
tree.reload();
- for (int i = 0; i < selectList.size(); i++) {
- GroupPath gp = (GroupPath) selectList.get(i);
+ for (Object element : selectList) {
+ GroupPath gp = (GroupPath) element;
tree.addGroupSelectionPath(gp);
}
- for (int i = 0; i < expandList.size(); i++) {
- GroupPath gp = expandList.get(i);
+ for (GroupPath gp : expandList) {
tree.expand(gp);
}
- for (int i = 0; i < newViewList.size(); i++) {
- GroupPath gp = newViewList.get(i);
+ for (GroupPath gp : newViewList) {
tree.addGroupViewPath(gp);
}
if (newViewList.size() > 0 && tree.getViewList().size() == 0) {
@@ -756,7 +754,7 @@ public class ProgramTreePlugin extends ProgramPlugin
/**
* Return true if a tree with the given name exists in the program. If
* program is null and if the tree name is the default name, return true.
- *
+ *
* @param treeName tree name to look for
* @return boolean
*/
@@ -779,7 +777,7 @@ public class ProgramTreePlugin extends ProgramPlugin
/**
* Set the program on each of the providers.
- *
+ *
* @param p program that is being opened; if p is null, then program is
* being closed.
*/
@@ -907,7 +905,7 @@ public class ProgramTreePlugin extends ProgramPlugin
* Open an existing view in the program. If a provider already exists for
* the given tree name, make this the current view provider in the view
* manager service.
- *
+ *
* @param treeName name of tree
*/
private void openView(String treeName) {
@@ -968,8 +966,8 @@ public class ProgramTreePlugin extends ProgramPlugin
selectionToggleAction.setDescription(
HTMLUtilities.toHTML("Toggle <b>On</b> means to select the fragment(s)\n" +
"that corresponds to the current location."));
- selectionToggleAction.setHelpLocation(
- new HelpLocation(getName(), selectionToggleAction.getName()));
+ selectionToggleAction
+ .setHelpLocation(new HelpLocation(getName(), selectionToggleAction.getName()));
}
private void selectFragments() {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/reachability/FunctionReachabilityPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/reachability/FunctionReachabilityPlugin.java
index 4cb38f2190..f3bf1fa77f 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/reachability/FunctionReachabilityPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/reachability/FunctionReachabilityPlugin.java
@@ -57,7 +57,7 @@ public class FunctionReachabilityPlugin extends ProgramPlugin {
new ArrayList<>();
public FunctionReachabilityPlugin(PluginTool tool) {
- super(tool, true, true);
+ super(tool);
createActions();
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/register/RegisterPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/register/RegisterPlugin.java
index 503292d609..c9bcd500a9 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/register/RegisterPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/register/RegisterPlugin.java
@@ -69,7 +69,7 @@ public class RegisterPlugin extends ProgramPlugin {
private RegisterTransitionFieldMouseHandler fieldMouseHandler;
public RegisterPlugin(PluginTool tool) {
- super(tool, true, true);
+ super(tool);
}
@Override
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/reloc/RelocationFixupPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/reloc/RelocationFixupPlugin.java
index fa9ba0d50b..8514583658 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/reloc/RelocationFixupPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/reloc/RelocationFixupPlugin.java
@@ -45,7 +45,7 @@ public class RelocationFixupPlugin extends ProgramPlugin implements DomainObject
new ArrayList<RelocationFixupHandler>();
public RelocationFixupPlugin(PluginTool tool) {
- super(tool, false, false);
+ super(tool);
initializeRelocationHandlers();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/scalartable/ScalarSearchPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/scalartable/ScalarSearchPlugin.java
index 376a6f21d3..1b43313c57 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/scalartable/ScalarSearchPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/scalartable/ScalarSearchPlugin.java
@@ -61,7 +61,7 @@ public class ScalarSearchPlugin extends ProgramPlugin implements DomainObjectLis
private Set<ScalarSearchProvider> providers = new HashSet<>();
public ScalarSearchPlugin(PluginTool tool) {
- super(tool, true, true);
+ super(tool);
reloadUpdateMgr =
new SwingUpdateManager(1000, 60000, () -> providers.forEach(p -> p.reload()));
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/script/GhidraScriptMgrPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/script/GhidraScriptMgrPlugin.java
index 942be4f4f1..f8d22be170 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/script/GhidraScriptMgrPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/script/GhidraScriptMgrPlugin.java
@@ -58,7 +58,7 @@ public class GhidraScriptMgrPlugin extends ProgramPlugin implements GhidraScript
* @param tool the tool this plugin is added to
*/
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.
// GhidraScriptUtil (creates and) manages one instance.
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/searchtext/SearchTextPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/searchtext/SearchTextPlugin.java
index d0b45c54f5..ee8deba1ec 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/searchtext/SearchTextPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/searchtext/SearchTextPlugin.java
@@ -115,7 +115,7 @@ public class SearchTextPlugin extends ProgramPlugin implements OptionsChangeList
* @param plugintool The tool required by this plugin.
*/
public SearchTextPlugin(PluginTool plugintool) {
- super(plugintool, true, false);
+ super(plugintool);
createActions();
initializeOptions();
tool.addContextListener(this);
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/select/RestoreSelectionPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/select/RestoreSelectionPlugin.java
index 742cb12604..3d304b8278 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/select/RestoreSelectionPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/select/RestoreSelectionPlugin.java
@@ -56,7 +56,7 @@ public class RestoreSelectionPlugin extends ProgramPlugin {
private Map<Program, SelectionState> programToSelectionMap = new HashMap<Program, SelectionState>();
public RestoreSelectionPlugin( PluginTool tool ) {
- super( tool, false, true );
+ super( tool );
}
@Override
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/select/flow/SelectByScopedFlowPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/select/flow/SelectByScopedFlowPlugin.java
index 6fff8e4147..d28aea00ac 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/select/flow/SelectByScopedFlowPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/select/flow/SelectByScopedFlowPlugin.java
@@ -64,7 +64,7 @@ import ghidra.util.task.TaskMonitorAdapter;
//@formatter:on
public class SelectByScopedFlowPlugin extends ProgramPlugin {
public SelectByScopedFlowPlugin(PluginTool tool) {
- super(tool, true, true);
+ super(tool);
createActions();
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/select/programtree/ProgramTreeSelectionPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/select/programtree/ProgramTreeSelectionPlugin.java
index f21e70dd17..9af6dcc58f 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/select/programtree/ProgramTreeSelectionPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/select/programtree/ProgramTreeSelectionPlugin.java
@@ -55,7 +55,7 @@ public class ProgramTreeSelectionPlugin extends ProgramPlugin {
private TreeSelectAction selectModuleAction;
public ProgramTreeSelectionPlugin(PluginTool tool) {
- super(tool, true, true);
+ super(tool);
createActions();
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/string/StringTablePlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/string/StringTablePlugin.java
index ddec8afab5..ba7c75a7ee 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/string/StringTablePlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/string/StringTablePlugin.java
@@ -51,7 +51,7 @@ public class StringTablePlugin extends ProgramPlugin {
private List<StringTableProvider> transientProviders = new ArrayList<>();
public StringTablePlugin(PluginTool tool) {
- super(tool, false, true);
+ super(tool);
}
@Override
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/strings/ViewStringsPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/strings/ViewStringsPlugin.java
index 1f949249cc..d840d2a72d 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/strings/ViewStringsPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/strings/ViewStringsPlugin.java
@@ -69,7 +69,7 @@ public class ViewStringsPlugin extends ProgramPlugin implements DomainObjectList
private SwingUpdateManager reloadUpdateMgr;
public ViewStringsPlugin(PluginTool tool) {
- super(tool, false, false);
+ super(tool);
}
void doReload() {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/table/TableServicePlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/table/TableServicePlugin.java
index 51d75c9561..04fb38fa79 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/table/TableServicePlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/table/TableServicePlugin.java
@@ -20,7 +20,6 @@ import java.util.*;
import javax.swing.ImageIcon;
-import docking.ComponentProvider;
import ghidra.app.CorePluginPackage;
import ghidra.app.events.ProgramClosedPluginEvent;
import ghidra.app.nav.Navigatable;
@@ -33,7 +32,8 @@ import ghidra.app.tablechooser.TableChooserExecutor;
import ghidra.app.util.query.TableService;
import ghidra.framework.model.DomainObjectChangedEvent;
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.program.model.listing.Program;
import ghidra.util.Swing;
@@ -62,7 +62,7 @@ public class TableServicePlugin extends ProgramPlugin
private Map<Program, List<TableChooserDialog>> programToDialogMap = new HashMap<>();
public TableServicePlugin(PluginTool tool) {
- super(tool, false, false);
+ super(tool);
updateMgr = new SwingUpdateManager(1000, () -> updateProviders());
@@ -88,14 +88,8 @@ public class TableServicePlugin extends ProgramPlugin
}
@Override
- public void processEvent(PluginEvent event) {
- if (event instanceof ProgramClosedPluginEvent) {
- Program p = ((ProgramClosedPluginEvent) event).getProgram();
- closeAllQueries(p);
- }
- else {
- super.processEvent(event);
- }
+ protected void programClosed(Program program) {
+ closeAllQueries(program);
}
@Override
@@ -120,8 +114,7 @@ public class TableServicePlugin extends ProgramPlugin
}
// make a copy of the list because the provider updates the list
List<TableComponentProvider<?>> list = new ArrayList<>(plist);
- for (int i = 0; i < list.size(); i++) {
- ComponentProvider provider = list.get(i);
+ for (TableComponentProvider<?> provider : list) {
provider.closeComponent();
}
programMap.remove(program);
@@ -134,8 +127,7 @@ public class TableServicePlugin extends ProgramPlugin
}
// make a copy of the list because the dialog updates the list
List<TableChooserDialog> list = new ArrayList<>(dlist);
- for (int i = 0; i < list.size(); i++) {
- TableChooserDialog dialog = list.get(i);
+ for (TableChooserDialog dialog : list) {
dialog.close();
}
programMap.remove(program);
@@ -243,8 +235,7 @@ public class TableServicePlugin extends ProgramPlugin
private void updateProviders() {
List<TableComponentProvider<?>> list = getProviders();
- for (int i = 0; i < list.size(); i++) {
- TableComponentProvider<?> provider = list.get(i);
+ for (TableComponentProvider<?> provider : list) {
provider.refresh();
}
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/debug/propertymanager/PropertyManagerPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/debug/propertymanager/PropertyManagerPlugin.java
index 981f9b3dca..9efce398e4 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/debug/propertymanager/PropertyManagerPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/debug/propertymanager/PropertyManagerPlugin.java
@@ -67,7 +67,7 @@ public class PropertyManagerPlugin extends ProgramPlugin implements DomainObject
private Timer updateTimer;
public PropertyManagerPlugin(PluginTool tool) {
- super(tool, false, true);
+ super(tool);
propertyViewProvider = new PropertyManagerProvider(this);
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/prototype/debug/ScreenshotPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/prototype/debug/ScreenshotPlugin.java
index 34603d1cf2..2b911b4412 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/prototype/debug/ScreenshotPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/prototype/debug/ScreenshotPlugin.java
@@ -53,7 +53,7 @@ public class ScreenshotPlugin extends ProgramPlugin {
private JFileChooser fileChooser;
public ScreenshotPlugin(PluginTool tool) {
- super(tool, true, false);
+ super(tool);
this.tool = tool;
setupActions();
diff --git a/Ghidra/Features/Base/src/test.slow/java/docking/widgets/table/GhidraTableColumnModelTest.java b/Ghidra/Features/Base/src/test.slow/java/docking/widgets/table/GhidraTableColumnModelTest.java
index 7ee8177b7c..bfaa89db78 100644
--- a/Ghidra/Features/Base/src/test.slow/java/docking/widgets/table/GhidraTableColumnModelTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/docking/widgets/table/GhidraTableColumnModelTest.java
@@ -58,6 +58,11 @@ public class GhidraTableColumnModelTest extends AbstractGhidraHeadedIntegrationT
private DockingActionIf showReferencesAction;
private CodeBrowserPlugin codeBrowser;
+ @After
+ public void tearDown() throws Exception {
+ cleanupGhidraWithNotepad();
+ }
+
/*
* 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()',
* 'getColumn(int)', 'getColumnIndex(Object)', 'getAllColumns()', and 'getColumns()'
@@ -106,7 +106,7 @@ public class GhidraTableColumnModelTest extends AbstractGhidraHeadedIntegrationT
GhidraTable table = new GhidraTable(tableModel);
// NOTE: we have to make the table visible for the full persistence mechanism to work. So,
- // perform the tests *before* the table is visible, and then perform them after it has
+ // perform the tests *before* the table is visible, and then perform them after it has
// been made visible
shakeupTable(table);
@@ -131,8 +131,8 @@ public class GhidraTableColumnModelTest extends AbstractGhidraHeadedIntegrationT
// we need a tool in order to get the DockingWindowManager
loadGhidraWithNotepad();
- // NOTE: must make sure that the table is visible, or the persistence will not be activated
- // 010039fe - LAB_010039fe
+ // NOTE: must make sure that the table is visible, or the persistence will not be activated
+ // 010039fe - LAB_010039fe
Address address = getAddress(program, 0x010039fe);
int column = 3;
assertTrue(codeBrowser.goToField(address, "Label", 0, 0, column));
@@ -158,7 +158,7 @@ public class GhidraTableColumnModelTest extends AbstractGhidraHeadedIntegrationT
String preferenceKey = (String) invokeInstanceMethod("getPreferenceKey", columnModelState);
PreferenceState preferenceState = dockingWindowManager.getPreferenceState(preferenceKey);
- // test moving
+ // test moving
// moveColumn() triggers a saveState()
int columnIndex = 0;
int newColumnIndex = 1;
@@ -166,7 +166,7 @@ public class GhidraTableColumnModelTest extends AbstractGhidraHeadedIntegrationT
moveColumn(columnModel, columnIndex, newColumnIndex);
waitForSwing();
- // get the updated preference state data
+ // get the updated preference state data
preferenceState = dockingWindowManager.getPreferenceState(preferenceKey);
List<TableColumn> newColumnList =
getTableColumnsFromPreferencesState(table, preferenceState, columnModelState);
@@ -191,8 +191,8 @@ public class GhidraTableColumnModelTest extends AbstractGhidraHeadedIntegrationT
// we need a tool in order to get the DockingWindowManager
loadGhidraWithNotepad();
- // NOTE: must make sure that the table is visible, or the persistence will not be activated
- // 010039fe - LAB_010039fe
+ // NOTE: must make sure that the table is visible, or the persistence will not be activated
+ // 010039fe - LAB_010039fe
Address address = getAddress(program, 0x010039fe);
int column = 3;
assertTrue(codeBrowser.goToField(address, "Label", 0, 0, column));
@@ -221,7 +221,7 @@ public class GhidraTableColumnModelTest extends AbstractGhidraHeadedIntegrationT
PreferenceState preferenceState =
getSavedSortStatePreference(preferenceKey, dockingWindowManager);
- // test moving
+ // test moving
// moveColumn() triggers a saveState()
int columnZero = 0;
int columnOne = 1;
@@ -307,8 +307,8 @@ public class GhidraTableColumnModelTest extends AbstractGhidraHeadedIntegrationT
// we need a tool in order to get the DockingWindowManager
loadGhidraWithNotepad();
- // NOTE: must make sure that the table is visible, or the persistence will not be activated
- // 010039fe - LAB_010039fe
+ // NOTE: must make sure that the table is visible, or the persistence will not be activated
+ // 010039fe - LAB_010039fe
Address address = getAddress(program, 0x010039fe);
int column = 3;
assertTrue(codeBrowser.goToField(address, "Label", 0, 0, column));
@@ -317,7 +317,7 @@ public class GhidraTableColumnModelTest extends AbstractGhidraHeadedIntegrationT
// given location
performAction(showReferencesAction, codeBrowser.getProvider(), true);
- // launch the
+ // launch the
LocationReferencesProvider provider = findProvider();
GhidraTable table = getTable(provider);
waitForTable(table);
@@ -366,8 +366,8 @@ public class GhidraTableColumnModelTest extends AbstractGhidraHeadedIntegrationT
// we need a tool in order to get the DockingWindowManager
loadGhidraWithNotepad();
- // NOTE: must make sure that the table is visible, or the persistence will not be activated
- // 010039fe - LAB_010039fe
+ // NOTE: must make sure that the table is visible, or the persistence will not be activated
+ // 010039fe - LAB_010039fe
Address address = getAddress(program, 0x010039fe);
int column = 3;
assertTrue(codeBrowser.goToField(address, "Label", 0, 0, column));
@@ -376,7 +376,7 @@ public class GhidraTableColumnModelTest extends AbstractGhidraHeadedIntegrationT
// given location
performAction(showReferencesAction, codeBrowser.getProvider(), true);
- // launch the
+ // launch the
LocationReferencesProvider provider = findProvider();
GhidraTable table = getTable(provider);
@@ -419,7 +419,7 @@ public class GhidraTableColumnModelTest extends AbstractGhidraHeadedIntegrationT
//==================================================================================================
// Private methods
-//==================================================================================================
+//==================================================================================================
private void waitForTable(GhidraTable table) {
int maxWait = 50;
@@ -569,10 +569,8 @@ public class GhidraTableColumnModelTest extends AbstractGhidraHeadedIntegrationT
return;
}
- executeOnSwingWithoutBlocking(() -> {
- env.dispose();
- env = null;
- });
+ env.dispose();
+ env = null;
// this handles the save changes dialog and potential analysis dialogs
closeAllWindows();
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/viewer/field/XrefViewerTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/viewer/field/XrefViewerTest.java
index c98eb160bc..f16497c397 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/viewer/field/XrefViewerTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/viewer/field/XrefViewerTest.java
@@ -25,6 +25,7 @@ import docking.ComponentProvider;
import docking.DialogComponentProvider;
import docking.action.DockingActionIf;
import ghidra.app.cmd.data.CreateStructureCmd;
+import ghidra.app.context.ListingActionContext;
import ghidra.app.events.ProgramLocationPluginEvent;
import ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin;
import ghidra.app.plugin.core.table.TableComponentProvider;
@@ -224,7 +225,8 @@ public class XrefViewerTest extends AbstractGhidraHeadedIntegrationTest {
// go to new function
DockingActionIf thunkAction = getAction(tool, "Set Thunked Function");
- performAction(thunkAction, false);
+ performAction(thunkAction, new ListingActionContext(cb.getProvider(), cb.getProvider()),
+ false);
// get dialog
DialogComponentProvider dialog =
diff --git a/Ghidra/Features/BytePatterns/src/main/java/ghidra/bitpatterns/gui/FunctionBitPatternsExplorerPlugin.java b/Ghidra/Features/BytePatterns/src/main/java/ghidra/bitpatterns/gui/FunctionBitPatternsExplorerPlugin.java
index 462c2db184..ed38da1674 100644
--- a/Ghidra/Features/BytePatterns/src/main/java/ghidra/bitpatterns/gui/FunctionBitPatternsExplorerPlugin.java
+++ b/Ghidra/Features/BytePatterns/src/main/java/ghidra/bitpatterns/gui/FunctionBitPatternsExplorerPlugin.java
@@ -49,7 +49,7 @@ public class FunctionBitPatternsExplorerPlugin extends ProgramPlugin {
* @param tool tool
*/
public FunctionBitPatternsExplorerPlugin(PluginTool tool) {
- super(tool, false, false);
+ super(tool);
provider = new FunctionBitPatternsMainProvider(this);
patterns = new HashSet<>();
}
diff --git a/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/FunctionGraphPlugin.java b/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/FunctionGraphPlugin.java
index c519a0a3ae..d5478cf390 100644
--- a/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/FunctionGraphPlugin.java
+++ b/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/FunctionGraphPlugin.java
@@ -86,7 +86,7 @@ public class FunctionGraphPlugin extends ProgramPlugin implements OptionsChangeL
private List<FGLayoutProvider> layoutProviders;
public FunctionGraphPlugin(PluginTool tool) {
- super(tool, true, true, true);
+ super(tool);
colorProvider = new IndependentColorProvider(tool);
}
diff --git a/Ghidra/Features/FunctionID/src/main/java/ghidra/feature/fid/plugin/FidDebugPlugin.java b/Ghidra/Features/FunctionID/src/main/java/ghidra/feature/fid/plugin/FidDebugPlugin.java
index 217ccf192a..22787ba9e7 100644
--- a/Ghidra/Features/FunctionID/src/main/java/ghidra/feature/fid/plugin/FidDebugPlugin.java
+++ b/Ghidra/Features/FunctionID/src/main/java/ghidra/feature/fid/plugin/FidDebugPlugin.java
@@ -80,7 +80,7 @@ public class FidDebugPlugin extends ProgramPlugin implements ChangeListener {
private DockingAction createRawFileAction;
public FidDebugPlugin(PluginTool tool) {
- super(tool, true, true);
+ super(tool);
}
@Override
diff --git a/Ghidra/Features/FunctionID/src/main/java/ghidra/feature/fid/plugin/FidPlugin.java b/Ghidra/Features/FunctionID/src/main/java/ghidra/feature/fid/plugin/FidPlugin.java
index 168c2bb3ad..5437953705 100644
--- a/Ghidra/Features/FunctionID/src/main/java/ghidra/feature/fid/plugin/FidPlugin.java
+++ b/Ghidra/Features/FunctionID/src/main/java/ghidra/feature/fid/plugin/FidPlugin.java
@@ -74,7 +74,7 @@ public class FidPlugin extends ProgramPlugin implements ChangeListener {
private DockingAction populateAction;
public FidPlugin(PluginTool tool) {
- super(tool, true, true);
+ super(tool);
}
@Override
diff --git a/Ghidra/Features/GraphFunctionCalls/src/main/java/functioncalls/plugin/FunctionCallGraphPlugin.java b/Ghidra/Features/GraphFunctionCalls/src/main/java/functioncalls/plugin/FunctionCallGraphPlugin.java
index a6bc2a0ffb..b35dea5d95 100644
--- a/Ghidra/Features/GraphFunctionCalls/src/main/java/functioncalls/plugin/FunctionCallGraphPlugin.java
+++ b/Ghidra/Features/GraphFunctionCalls/src/main/java/functioncalls/plugin/FunctionCallGraphPlugin.java
@@ -64,7 +64,7 @@ public class FunctionCallGraphPlugin extends ProgramPlugin implements OptionsCha
});
public FunctionCallGraphPlugin(PluginTool tool) {
- super(tool, true, false);
+ super(tool);
}
@Override
diff --git a/Ghidra/Features/ProgramDiff/src/main/java/ghidra/app/plugin/core/diff/ProgramDiffPlugin.java b/Ghidra/Features/ProgramDiff/src/main/java/ghidra/app/plugin/core/diff/ProgramDiffPlugin.java
index 74abc0e85d..77fc090912 100644
--- a/Ghidra/Features/ProgramDiff/src/main/java/ghidra/app/plugin/core/diff/ProgramDiffPlugin.java
+++ b/Ghidra/Features/ProgramDiff/src/main/java/ghidra/app/plugin/core/diff/ProgramDiffPlugin.java
@@ -150,11 +150,11 @@ public class ProgramDiffPlugin extends ProgramPlugin
/**
* Creates the plugin for indicating program differences to the user.
- *
+ *
* @param tool the tool that owns this plugin.
*/
public ProgramDiffPlugin(PluginTool tool) {
- super(tool, true, true);
+ super(tool);
markerManager = new MarkerManager(this);
@@ -232,10 +232,8 @@ public class ProgramDiffPlugin extends ProgramPlugin
@Override
public void processEvent(PluginEvent event) {
- if (event instanceof ProgramClosedPluginEvent) {
- programClosed(((ProgramClosedPluginEvent) event).getProgram());
- }
- else if (event instanceof ViewChangedPluginEvent) {
+
+ if (event instanceof ViewChangedPluginEvent) {
AddressSet set = ((ViewChangedPluginEvent) event).getView();
// If we are doing a Diff on the entire program then use the combined addresses for both programs.
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) {
if (primaryProgram != null && !showingSecondProgram) {
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) {
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 of addresses to be ignored.
- *
- * @param ignoreAddressSet the set of addresses to ignore.
*/
private void setDiffHighlight() {
if (diffControl == null) {
@@ -955,7 +945,7 @@ public class ProgramDiffPlugin extends ProgramPlugin
/**
* Computes the differences between program1 and program2 that are displayed in the browser. It
* allows the user to specify the Diff settings to use.
- *
+ *
* @param p1LimitSet an address set to use to limit the extent of the Diff.
*/
void diff(AddressSetView p1LimitSet) {
@@ -1178,7 +1168,7 @@ public class ProgramDiffPlugin extends ProgramPlugin
/**
* Get the first program for the current Diff. <br>
* <b>Note</b>: This may not be the currently active program.
- *
+ *
* @return the Diff's first program or null if don't currently have a second program associated
* for a Diff.
*/
@@ -1188,7 +1178,7 @@ public class ProgramDiffPlugin extends ProgramPlugin
/**
* Get the second program for the current Diff.
- *
+ *
* @return the Diff's second program or null if don't currently have a second program associated
* for a Diff.
*/
@@ -1245,7 +1235,7 @@ public class ProgramDiffPlugin extends ProgramPlugin
* Gets the address set where detailed differences will be determined for details at the
* indicated address. An address set is returned since the indicated address may be in different
* sized code units in each of the two programs.
- *
+ *
* @param p1Address the current address from program1 where details are desired.
* @return the address set for code units containing that address within the programs being
* compared to determine differences. Otherwise null if a diff of two programs isn't
@@ -1600,9 +1590,8 @@ public class ProgramDiffPlugin extends ProgramPlugin
FieldPanel fp = diffListingPanel.getFieldPanel();
showSecondView();
AddressIndexMap indexMap = diffListingPanel.getAddressIndexMap();
- fp.setBackgroundColorModel(
- new MarkerServiceBackgroundColorModel(markerManager, secondaryDiffProgram,
- indexMap));
+ fp.setBackgroundColorModel(new MarkerServiceBackgroundColorModel(markerManager,
+ secondaryDiffProgram, indexMap));
}
finally {
settingLocation = false;
@@ -1852,28 +1841,28 @@ public class ProgramDiffPlugin extends ProgramPlugin
}
@Override
- public void run(TaskMonitor taskMonitor) {
- this.monitor = taskMonitor;
+ public void run(TaskMonitor tm) {
+ this.monitor = tm;
try {
try {
monitor.setMessage("Waiting on program file...");
diffProgram =
(Program) domainFile.getImmutableDomainObject(ProgramDiffPlugin.this,
- DomainFile.DEFAULT_VERSION, taskMonitor);
+ DomainFile.DEFAULT_VERSION, monitor);
}
catch (VersionException e) {
if (e.isUpgradable()) {
try {
diffProgram =
(Program) domainFile.getReadOnlyDomainObject(ProgramDiffPlugin.this,
- DomainFile.DEFAULT_VERSION, taskMonitor);
+ DomainFile.DEFAULT_VERSION, monitor);
}
catch (VersionException exc) {
Msg.showError(this, null, "Error Getting Diff Program",
"Getting read only file failed");
}
catch (IOException exc) {
- if (!taskMonitor.isCancelled()) {
+ if (!monitor.isCancelled()) {
Msg.showError(this, null, "Error Getting Diff Program",
"Getting read only file failed", exc);
}
diff --git a/Ghidra/Features/ProgramGraph/src/main/java/ghidra/graph/program/ProgramGraphPlugin.java b/Ghidra/Features/ProgramGraph/src/main/java/ghidra/graph/program/ProgramGraphPlugin.java
index 1a9a0b92ad..ba88f53d4f 100644
--- a/Ghidra/Features/ProgramGraph/src/main/java/ghidra/graph/program/ProgramGraphPlugin.java
+++ b/Ghidra/Features/ProgramGraph/src/main/java/ghidra/graph/program/ProgramGraphPlugin.java
@@ -105,7 +105,7 @@ public class ProgramGraphPlugin extends ProgramPlugin
private GraphDisplayProvider defaultGraphService;
public ProgramGraphPlugin(PluginTool tool) {
- super(tool, true, true);
+ super(tool);
intializeOptions();
registerProgramFlowGraphDisplayOptionsWithTool();
}
diff --git a/Ghidra/Features/Python/src/main/java/ghidra/python/PythonPlugin.java b/Ghidra/Features/Python/src/main/java/ghidra/python/PythonPlugin.java
index 667ce8f270..c260b490a9 100644
--- a/Ghidra/Features/Python/src/main/java/ghidra/python/PythonPlugin.java
+++ b/Ghidra/Features/Python/src/main/java/ghidra/python/PythonPlugin.java
@@ -80,7 +80,7 @@ public class PythonPlugin extends ProgramPlugin
* @param tool The tool associated with this plugin.
*/
public PythonPlugin(PluginTool tool) {
- super(tool, true, true, true);
+ super(tool);
}
/**
diff --git a/Ghidra/Features/SourceCodeLookup/src/main/java/ghidra/app/plugin/core/scl/SourceCodeLookupPlugin.java b/Ghidra/Features/SourceCodeLookup/src/main/java/ghidra/app/plugin/core/scl/SourceCodeLookupPlugin.java
index 1aecdb75da..529d03f734 100644
--- a/Ghidra/Features/SourceCodeLookup/src/main/java/ghidra/app/plugin/core/scl/SourceCodeLookupPlugin.java
+++ b/Ghidra/Features/SourceCodeLookup/src/main/java/ghidra/app/plugin/core/scl/SourceCodeLookupPlugin.java
@@ -61,7 +61,7 @@ public class SourceCodeLookupPlugin extends ProgramPlugin {
private DockingAction lookupSourceCodeAction;
public SourceCodeLookupPlugin(PluginTool tool) {
- super(tool, false, false);
+ super(tool);
}
@Override
diff --git a/Ghidra/Framework/Generic/src/main/java/generic/test/AbstractGenericTest.java b/Ghidra/Framework/Generic/src/main/java/generic/test/AbstractGenericTest.java
index de70698a0f..c5fae10fef 100644
--- a/Ghidra/Framework/Generic/src/main/java/generic/test/AbstractGenericTest.java
+++ b/Ghidra/Framework/Generic/src/main/java/generic/test/AbstractGenericTest.java
@@ -1255,14 +1255,18 @@ public abstract class AbstractGenericTest extends AbstractGTest {
try {
doRun(swingExceptionCatcher);
}
- catch (InterruptedException | InvocationTargetException e) {
- // Assume that if we have an exception reported by our catcher, then that is
- // the root cause of this exception and do not report this one. The typical
- // exception here is an InterrruptedException that is caused by our test
- // harness when it is interrupting the test thread after a previous Swing
- // exception that we have detected--we don't care to report the
- // InterruptedException, as we caused it. The InvocationTargetException should
- // be handled by our runnable above.
+ catch (InterruptedException e) {
+ // Typically, this InterrruptedException that is caused by our test harness when it
+ // is interrupting the test thread after a previous Swing exception that we have
+ // detected--we don't care to throw the InterruptedException, as we caused it.
+ // Log a message to signal that unusual things may happen when in this state.
+ Msg.debug(this, "\n>>>>>>>>>>>>>>>> Test thread interrupted. Unusual/unexpected " +
+ "errors may follow.\n\n");
+ }
+ 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.
}
}
diff --git a/Ghidra/Framework/Project/src/main/java/ghidra/framework/plugintool/Plugin.java b/Ghidra/Framework/Project/src/main/java/ghidra/framework/plugintool/Plugin.java
index b96c19ebfc..3b67a286b4 100644
--- a/Ghidra/Framework/Project/src/main/java/ghidra/framework/plugintool/Plugin.java
+++ b/Ghidra/Framework/Project/src/main/java/ghidra/framework/plugintool/Plugin.java
@@ -204,15 +204,6 @@ public abstract class Plugin implements ExtensionPoint, PluginEventListener, Ser
protected final PluginDescription pluginDescription =
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>> eventsConsumed = new ArrayList<>();
private List<ServiceInterfaceImplementationPair> services = new ArrayList<>();
@@ -239,19 +230,6 @@ public abstract class Plugin implements ExtensionPoint, PluginEventListener, Ser
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.,
* 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() {
if (!disposed) {
Throwable thr = null;
@@ -305,7 +267,6 @@ public abstract class Plugin implements ExtensionPoint, PluginEventListener, Ser
thr = t;
}
tool.removeServiceListener(this);
- legacyRequiredServices.clear();
unregisterServices();
unregisterEvents();
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
*/
public boolean dependsUpon(Plugin plugin) {
- for (Class<?> c : getList(pluginDescription.getServicesRequired(),
- legacyRequiredServices)) {
+ for (Class<?> c : pluginDescription.getServicesRequired()) {
// 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.
if (plugin.isOnlyProviderOfService(c)) {
@@ -540,8 +500,7 @@ public abstract class Plugin implements ExtensionPoint, PluginEventListener, Ser
public List<Class<?>> getMissingRequiredServices() {
List<Class<?>> missingServices = new ArrayList<>();
- for (Class<?> requiredServiceClass : getList(pluginDescription.getServicesRequired(),
- legacyRequiredServices)) {
+ for (Class<?> requiredServiceClass : pluginDescription.getServicesRequired()) {
if (tool.getService(requiredServiceClass) == null) {
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.
*/
public boolean hasMissingRequiredService() {
- for (Class<?> depClass : getList(pluginDescription.getServicesRequired(),
- legacyRequiredServices)) {
+ for (Class<?> depClass : pluginDescription.getServicesRequired()) {
if (tool.getService(depClass) == null) {
return true;
}
@@ -564,31 +522,6 @@ public abstract class Plugin implements ExtensionPoint, PluginEventListener, Ser
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() {
for (Class<? extends PluginEvent> c : eventsConsumed) {
tool.removeEventListener(c, this);
@@ -601,23 +534,11 @@ public abstract class Plugin implements ExtensionPoint, PluginEventListener, Ser
/**
* Register event that this plugin consumes.
* <p>
- * Deprecated, use {@link PluginInfo @PluginInfo.eventsConsumed} instead.
- * <p>
- * @param eventClass Class for the event; class is required to force it
- * to be loaded
- */
- @Deprecated
- 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
+ * This method is for internal use. If plugins wish to manage events consumed, then they should
+ * use the {@link PluginInfo} annotation to do so.
+ * @param eventClass Class for the event; class is required to force it to be loaded
*/
- protected final void registerDynamicEventConsumed(Class<? extends PluginEvent> eventClass) {
+ protected final void internalRegisterEventConsumed(Class<? extends PluginEvent> eventClass) {
eventsConsumed.add(eventClass);
tool.addEventListener(eventClass, this);
}
@@ -710,7 +631,7 @@ public abstract class Plugin implements ExtensionPoint, PluginEventListener, Ser
protected final List<Class<?>> getServicesRequired() {
// return either the new PluginDescription servicesRequired or the old
// deprecated legacyRequiredServices.
- return getList(pluginDescription.getServicesRequired(), legacyRequiredServices);
+ return pluginDescription.getServicesRequired();
}
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) {
for (int i = 0; i < services.size(); i++) {
diff --git a/Ghidra/Framework/Project/src/main/java/ghidra/framework/plugintool/PluginInfo.java b/Ghidra/Framework/Project/src/main/java/ghidra/framework/plugintool/PluginInfo.java
index b16899b05c..abd8acfc27 100644
--- a/Ghidra/Framework/Project/src/main/java/ghidra/framework/plugintool/PluginInfo.java
+++ b/Ghidra/Framework/Project/src/main/java/ghidra/framework/plugintool/PluginInfo.java
@@ -107,7 +107,7 @@ public @interface PluginInfo {
/**
* 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 {};
diff --git a/GhidraBuild/Skeleton/src/main/java/skeleton/SkeletonPlugin.java b/GhidraBuild/Skeleton/src/main/java/skeleton/SkeletonPlugin.java
index 6ee0ec9738..521e7880a3 100644
--- a/GhidraBuild/Skeleton/src/main/java/skeleton/SkeletonPlugin.java
+++ b/GhidraBuild/Skeleton/src/main/java/skeleton/SkeletonPlugin.java
@@ -54,7 +54,7 @@ public class SkeletonPlugin extends ProgramPlugin {
* @param tool The plugin tool that this plugin is added to.
*/
public SkeletonPlugin(PluginTool tool) {
- super(tool, true, true);
+ super(tool);
// TODO: Customize provider (or remove if a provider is not desired)
String pluginName = getName();