diff --git a/Ghidra/Debug/Debugger-api/src/main/java/ghidra/app/services/DebuggerListingService.java b/Ghidra/Debug/Debugger-api/src/main/java/ghidra/app/services/DebuggerListingService.java index 742bb228fb..c8d5e725b2 100644 --- a/Ghidra/Debug/Debugger-api/src/main/java/ghidra/app/services/DebuggerListingService.java +++ b/Ghidra/Debug/Debugger-api/src/main/java/ghidra/app/services/DebuggerListingService.java @@ -4,9 +4,9 @@ * 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. diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/diff/DebuggerTraceViewDiffPlugin.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/diff/DebuggerTraceViewDiffPlugin.java index 66ea77c363..7a2af04404 100644 --- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/diff/DebuggerTraceViewDiffPlugin.java +++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/diff/DebuggerTraceViewDiffPlugin.java @@ -4,9 +4,9 @@ * 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. @@ -31,7 +31,8 @@ import docking.action.ToggleDockingAction; import generic.theme.GColor; import ghidra.app.plugin.PluginCategoryNames; import ghidra.app.plugin.core.codebrowser.MarkerServiceBackgroundColorModel; -import ghidra.app.plugin.core.debug.*; +import ghidra.app.plugin.core.debug.AbstractDebuggerPlugin; +import ghidra.app.plugin.core.debug.DebuggerPluginPackage; import ghidra.app.plugin.core.debug.event.TraceClosedPluginEvent; import ghidra.app.plugin.core.debug.gui.DebuggerResources.*; import ghidra.app.plugin.core.debug.gui.action.DebuggerTrackLocationTrait; @@ -58,12 +59,21 @@ import ghidra.trace.model.program.TraceProgramView; import ghidra.trace.model.time.schedule.TraceSchedule; import ghidra.util.Msg; -@PluginInfo(shortDescription = "Compare memory state between times in a trace", description = "Provides a side-by-side diff view between snapshots (points in time) in a " + - "trace. The comparison is limited to raw bytes.", category = PluginCategoryNames.DEBUGGER, packageName = DebuggerPluginPackage.NAME, status = PluginStatus.RELEASED, eventsConsumed = { +@PluginInfo( + shortDescription = "Compare memory state between times in a trace", + description = "Provides a side-by-side diff view between snapshots (points in time) in a " + + "trace. The comparison is limited to raw bytes.", + category = PluginCategoryNames.DEBUGGER, + packageName = DebuggerPluginPackage.NAME, + status = PluginStatus.RELEASED, + eventsConsumed = { TraceClosedPluginEvent.class, - }, eventsProduced = {}, servicesRequired = { + }, + eventsProduced = {}, + servicesRequired = { DebuggerListingService.class, - }, servicesProvided = {}) + }, + servicesProvided = {}) public class DebuggerTraceViewDiffPlugin extends AbstractDebuggerPlugin { static final Color COLOR_DIFF = new GColor("color.bg.highlight.listing.diff"); diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/listing/DebuggerListingActionContext.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/listing/DebuggerListingActionContext.java index 29e5d4fb6d..6204f0c210 100644 --- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/listing/DebuggerListingActionContext.java +++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/listing/DebuggerListingActionContext.java @@ -4,9 +4,9 @@ * 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. @@ -41,9 +41,4 @@ public class DebuggerListingActionContext extends ListingActionContext public TraceProgramView getProgram() { return (TraceProgramView) super.getProgram(); } - - @Override - public DebuggerListingProvider getComponentProvider() { - return (DebuggerListingProvider) super.getComponentProvider(); - } } diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/listing/DebuggerListingPlugin.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/listing/DebuggerListingPlugin.java index f6820791f4..a2fd97c6f2 100644 --- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/listing/DebuggerListingPlugin.java +++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/listing/DebuggerListingPlugin.java @@ -4,9 +4,9 @@ * 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. diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/listing/DebuggerListingProvider.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/listing/DebuggerListingProvider.java index ae7cffee69..e81963aca8 100644 --- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/listing/DebuggerListingProvider.java +++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/listing/DebuggerListingProvider.java @@ -408,7 +408,7 @@ public class DebuggerListingProvider extends CodeViewerProvider { protected MarkerMarginProvider markerMarginProvider; protected MarkerOverviewProvider markerOverviewProvider; - private SuppressableCallback cbGoTo = new SuppressableCallback<>(); + private final SuppressableCallback cbGoTo = new SuppressableCallback<>(); protected final ForStaticSyncMappingChangeListener mappingChangeListener = new ForStaticSyncMappingChangeListener(); diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/memview/MemviewTable.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/memview/MemviewTable.java index 49ab9795b4..631cc3b301 100644 --- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/memview/MemviewTable.java +++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/memview/MemviewTable.java @@ -4,9 +4,9 @@ * 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. diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/context/NavigatableRangeActionContext.java b/Ghidra/Features/Base/src/main/java/ghidra/app/context/NavigatableRangeActionContext.java deleted file mode 100644 index 991b53c6b3..0000000000 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/context/NavigatableRangeActionContext.java +++ /dev/null @@ -1,25 +0,0 @@ -/* ### - * IP: GHIDRA - * REVIEWED: YES - * - * 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.app.context; - -/** - * Marker interface to signal a context specifically for actions that work on a range of - * program locations. - */ -public interface NavigatableRangeActionContext { - -} diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/context/NavigationActionContext.java b/Ghidra/Features/Base/src/main/java/ghidra/app/context/NavigationActionContext.java index b642400ef2..a2b26688d3 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/context/NavigationActionContext.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/context/NavigationActionContext.java @@ -4,9 +4,9 @@ * 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. @@ -15,12 +15,14 @@ */ package ghidra.app.context; +import docking.ActionContext; + /** * An interface that signals the client supports navigation. * *

Note: the {@link NavigatableActionContext} is tied to {@link ProgramLocationActionContext} * which has more baggage than just 'navigation'. */ -public interface NavigationActionContext { +public interface NavigationActionContext extends ActionContext { // marker interface } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/merge/ProgramMultiUserMergeManager.java b/Ghidra/Features/Base/src/main/java/ghidra/app/merge/ProgramMultiUserMergeManager.java index d4d03624ac..15273b1b48 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/merge/ProgramMultiUserMergeManager.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/merge/ProgramMultiUserMergeManager.java @@ -33,7 +33,6 @@ import ghidra.app.util.ListingHighlightProvider; import ghidra.app.util.viewer.util.FieldNavigator; import ghidra.framework.model.DomainObject; import ghidra.framework.plugintool.ModalPluginTool; -import ghidra.framework.plugintool.Plugin; import ghidra.framework.plugintool.util.PluginException; import ghidra.program.model.address.Address; import ghidra.program.model.listing.Program; @@ -45,9 +44,8 @@ import ghidra.util.SystemUtilities; import help.Help; import help.HelpService; -/** - * Top level object that manages each step of the merge/resolve conflicts - * process. +/** + * Top level object that manages each step of the merge/resolve conflicts process. */ public class ProgramMultiUserMergeManager extends MergeManager { @@ -113,6 +111,7 @@ public class ProgramMultiUserMergeManager extends MergeManager { /** * Returns one of the four programs involved in the merge as indicated by the version. + * * @param version the program version to return. (LATEST, MY, ORIGINAL, or RESULT). * @return the indicated program version or null if a valid version isn't specified. * @see MergeConstants @@ -165,9 +164,12 @@ public class ProgramMultiUserMergeManager extends MergeManager { } /** - * Show the default merge panel. The default merge panel now shows the status of each phase - * of the merge and also the progress in the current phase. - *@param description description of current merge process near the top of the merge tool. + * Show the default merge panel. + *

+ * The default merge panel now shows the status of each phase of the merge and also the progress + * in the current phase. + * + * @param description description of current merge process near the top of the merge tool. */ @Override public void showDefaultMergePanel(final String description) { @@ -179,14 +181,15 @@ public class ProgramMultiUserMergeManager extends MergeManager { } /** - * Show the component that is used to resolve conflicts. This method - * is called by the MergeResolvers when user input is required. If the - * component is not null, this method blocks until the user either - * cancels the merge process or resolves a conflict. If comp is null, - * then the default component is displayed, and the method does not + * Show the component that is used to resolve conflicts. + *

+ * This method is called by the MergeResolvers when user input is required. If the component is + * not null, this method blocks until the user either cancels the merge process or resolves a + * conflict. If comp is null, then the default component is displayed, and the method does not * wait for user input. - * @param comp component to show; if component is null, show the - * default component and do not block + * + * @param comp component to show; if component is null, show the default component and do not + * block * @param componentID id or name for the component */ @Override @@ -202,7 +205,7 @@ public class ProgramMultiUserMergeManager extends MergeManager { showMergeTool(); Dimension oldSize = mergeTool.getSize(); if (listingPlugin != null) { - mergeTool.removePlugins(new Plugin[] { listingPlugin, goToPlugin }); + mergeTool.removePlugins(java.util.List.of(listingPlugin, goToPlugin)); listingPlugin = null; goToPlugin = null; } @@ -227,6 +230,7 @@ public class ProgramMultiUserMergeManager extends MergeManager { /** * Show the listing merge panel. + * * @param goToAddress the address to goto. */ public void showListingMergePanel(final Address goToAddress) { @@ -265,7 +269,9 @@ public class ProgramMultiUserMergeManager extends MergeManager { /** * Show the listing merge panel with each listing positioned to the indicated address. + *

* A null can be passed for any address to indicate that listing should be empty. + * * @param resultAddress the address for positioning the Result program's listing. * @param latestAddress the address for positioning the Latest program's listing. * @param myAddress the address for positioning the My program's listing. @@ -291,7 +297,9 @@ public class ProgramMultiUserMergeManager extends MergeManager { /** * Show the listing merge panel with each listing positioned to the indicated address. + *

* A null can be passed for any address to indicate that listing should be empty. + * * @param resultAddress the address for positioning the Result program's listing. * @param latestAddress the address for positioning the Latest program's listing. * @param myAddress the address for positioning the My program's listing. @@ -368,16 +376,19 @@ public class ProgramMultiUserMergeManager extends MergeManager { return; } mergePanel.removeDomainObjectListener(); - mergeTool.removePlugins(new Plugin[] { listingPlugin, goToPlugin }); + mergeTool.removePlugins(java.util.List.of(listingPlugin, goToPlugin)); isShowingListingMergePanel = false; mergePlugin.showDefaultComponent(); }); } /** - * Returns the listing merge panel. This is the panel containing the four - * listing windows: result, latest, my, and original. The four listings are - * the center component of JPanel with a BorderLayout. + * Returns the listing merge panel. + *

+ * This is the panel containing the four listing windows: result, latest, my, and original. The + * four listings are the center component of {@link JPanel} with a {@link BorderLayout}. + * + * @return the merge panel */ public ListingMergePanel getListingMergePanel() { return mergePanel; @@ -385,6 +396,7 @@ public class ProgramMultiUserMergeManager extends MergeManager { /** * Determines if the modal merge tool is currently displayed on the screen. + * * @return true if the merge tool is displayed. */ @Override @@ -394,6 +406,7 @@ public class ProgramMultiUserMergeManager extends MergeManager { /** * Determines if the four program Listing merge panel is currently displayed in the merge tool. + * * @return true if the Listing merge panel is displayed. */ public boolean isShowingListingMergePanel() { @@ -402,7 +415,9 @@ public class ProgramMultiUserMergeManager extends MergeManager { /** * Determine if the listing panels should be rendered. + *

* NOTE: This is provided for testing performance reasons only. + * * @return true if listing panels should be rendered */ public boolean isShowListingPanel() { diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/merge/tool/ListingMergePanel.java b/Ghidra/Features/Base/src/main/java/ghidra/app/merge/tool/ListingMergePanel.java index 6dcb0b384b..2af6ed829a 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/merge/tool/ListingMergePanel.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/merge/tool/ListingMergePanel.java @@ -299,6 +299,7 @@ public class ListingMergePanel extends JPanel /** * Color the background of all 4 listings to the indicated color for the indicated addresses. + * * @param addrSet the addresses */ public void paintAllBackgrounds(AddressSetView addrSet) { @@ -365,6 +366,7 @@ public class ListingMergePanel extends JPanel /** * Adds a button press listener. + * * @param listener the listener to add. */ public void addButtonPressedListener(ButtonPressedListener listener) { @@ -375,6 +377,7 @@ public class ListingMergePanel extends JPanel /** * Get the indicated program version. + * * @param version LATEST, CHECKED_OUT, ORIGINAL, RESULT from MergeConstants * @return the program */ @@ -383,8 +386,8 @@ public class ListingMergePanel extends JPanel } /** - * Add the result program's listing model as a listener to the result program - * for domain object events. + * Add the result program's listing model as a listener to the result program for domain object + * events. */ public void addDomainObjectListener() { DomainObjectListener listingModel = (DomainObjectListener) multiModel.getModel(RESULT); @@ -392,8 +395,8 @@ public class ListingMergePanel extends JPanel } /** - * Remove the result program's listing model as a listener to the result program - * for domain object events. + * Remove the result program's listing model as a listener to the result program for domain + * object events. */ public void removeDomainObjectListener() { DomainObjectListener listingModel = (DomainObjectListener) multiModel.getModel(RESULT); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/merge/tool/ListingMergePanelPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/merge/tool/ListingMergePanelPlugin.java index 087c5e301f..f4db8e5b05 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/merge/tool/ListingMergePanelPlugin.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/merge/tool/ListingMergePanelPlugin.java @@ -4,9 +4,9 @@ * 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. @@ -41,6 +41,7 @@ public class ListingMergePanelPlugin extends Plugin implements ProgramaticUseOnl /** * Constructor + * * @param tool merge tool * @param mergePanel merge panel */ @@ -91,9 +92,7 @@ public class ListingMergePanelPlugin extends Plugin implements ProgramaticUseOnl @Override public void processEvent(PluginEvent event) { - - if (event instanceof ProgramLocationPluginEvent) { - ProgramLocationPluginEvent evt = (ProgramLocationPluginEvent) event; + if (event instanceof ProgramLocationPluginEvent evt) { ProgramLocation location = evt.getLocation(); ListingMergePanel mergePanel = (ListingMergePanel) provider.getComponent(); mergePanel.goTo(location, true); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/nav/Navigatable.java b/Ghidra/Features/Base/src/main/java/ghidra/app/nav/Navigatable.java index 443c77a9b4..c354a0ca25 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/nav/Navigatable.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/nav/Navigatable.java @@ -39,7 +39,6 @@ public interface Navigatable { * Commands this navigatable to goto (display) the given program and location * * @param program the program - * * @param location the location in that program to display * @return true if the goto was successful */ @@ -81,8 +80,9 @@ public interface Navigatable { public Icon getNavigatableIcon(); /** - * Returns true if this Navigatable is "connected". Navigatables are connected if they produce - * and consume location and selection events. + * Returns true if this Navigatable is "connected". + *

+ * Navigatables are connected if they produce and consume location and selection events. * * @return true if this Navigatable is "connected" */ @@ -199,9 +199,11 @@ public interface Navigatable { Program program); /** - * Returns a source for providing byte values of the program associated with this - * navigatable. For a static program, this is just a wrapper for a program's memory. But - * dynamic programs require special handling for reading bytes. + * Returns a source for providing byte values of the program associated with this navigatable. + *

+ * For a static program, this is just a wrapper for a program's memory. But dynamic programs + * require special handling for reading bytes. + * * @return a source of bytes for the navigatable's program */ public default AddressableByteSource getByteSource() { diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/assembler/AbstractPatchAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/assembler/AbstractPatchAction.java index 595e9891db..9f8e17efb2 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/assembler/AbstractPatchAction.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/assembler/AbstractPatchAction.java @@ -4,9 +4,9 @@ * 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. @@ -296,11 +296,10 @@ public abstract class AbstractPatchAction extends DockingAction { ListingActionContext lac = (ListingActionContext) context; ComponentProvider provider = lac.getComponentProvider(); - if (!(provider instanceof CodeViewerProvider)) { + if (!(provider instanceof CodeViewerProvider codeViewer)) { return false; } - CodeViewerProvider codeViewer = (CodeViewerProvider) provider; if (codeViewer.isReadOnly()) { return false; } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/AbstractCodeBrowserPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/AbstractCodeBrowserPlugin.java index 6b24e22f6a..b1d4904a4c 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/AbstractCodeBrowserPlugin.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/AbstractCodeBrowserPlugin.java @@ -767,7 +767,6 @@ public abstract class AbstractCodeBrowserPlugin

ex @Override public boolean goTo(ProgramLocation location, boolean centerOnScreen) { - return Swing .runNow(() -> connectedProvider.getListingPanel().goTo(location, centerOnScreen)); } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/CodeBrowserPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/CodeBrowserPlugin.java index 01835cb441..6ba71da28e 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/CodeBrowserPlugin.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/CodeBrowserPlugin.java @@ -4,9 +4,9 @@ * 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. @@ -33,7 +33,8 @@ import ghidra.framework.model.DomainFile; import ghidra.framework.options.SaveState; import ghidra.framework.plugintool.*; import ghidra.framework.plugintool.util.PluginStatus; -import ghidra.program.model.address.*; +import ghidra.program.model.address.AddressSet; +import ghidra.program.model.address.AddressSetView; import ghidra.program.model.listing.Program; import ghidra.program.util.ProgramLocation; import ghidra.program.util.ProgramSelection; @@ -142,9 +143,7 @@ public class CodeBrowserPlugin extends AbstractCodeBrowserPlugin ((CodeViewerProvider) c.getComponentProvider()).selectAll()) .buildAndInstall(tool); @@ -90,7 +91,7 @@ public class CodeBrowserSelectionPlugin extends Plugin { .menuPath(ToolConstants.MENU_SELECTION, "&Clear Selection") .menuGroup(SELECT_GROUP, "b") .helpLocation(new HelpLocation(HelpTopics.SELECTION, "Clear Selection")) - .withContext(CodeViewerActionContext.class, true) + .withContext(ListingActionContext.class, true) .inWindow(ActionBuilder.When.CONTEXT_MATCHES) .enabledWhen(c -> c.hasSelection()) .onAction(c -> ((CodeViewerProvider) c.getComponentProvider()) @@ -101,7 +102,7 @@ public class CodeBrowserSelectionPlugin extends Plugin { .menuPath(ToolConstants.MENU_SELECTION, "&Complement") .menuGroup(SELECT_GROUP, "c") .helpLocation(new HelpLocation(HelpTopics.SELECTION, "Select Complement")) - .withContext(CodeViewerActionContext.class, true) + .withContext(ListingActionContext.class, true) .inWindow(ActionBuilder.When.CONTEXT_MATCHES) .onAction(c -> ((CodeViewerProvider) c.getComponentProvider()).selectComplement()) .buildAndInstall(tool); @@ -112,7 +113,7 @@ public class CodeBrowserSelectionPlugin extends Plugin { .menuPath(ToolConstants.MENU_SELECTION, "Create Table From Selection") .menuGroup("SelectUtils") .helpLocation(new HelpLocation(HelpTopics.CODE_BROWSER, "Selection_Tables")) - .withContext(CodeViewerActionContext.class, true) + .withContext(ListingActionContext.class, true) .inWindow(ActionBuilder.When.CONTEXT_MATCHES) .onAction(c -> createTable((CodeViewerProvider) c.getComponentProvider())) .buildAndInstall(tool); @@ -121,7 +122,7 @@ public class CodeBrowserSelectionPlugin extends Plugin { .menuPath(ToolConstants.MENU_SELECTION, CREATE_ADDRESS_RANGE_TABLE_ACTION_NAME) .menuGroup("SelectUtils") .helpLocation(new HelpLocation(HelpTopics.CODE_BROWSER, "Selection_Tables")) - .withContext(CodeViewerActionContext.class, true) + .withContext(ListingActionContext.class, true) .inWindow(ActionBuilder.When.CONTEXT_MATCHES) .onAction( c -> createAddressRangeTable((CodeViewerProvider) c.getComponentProvider())) @@ -150,7 +151,7 @@ public class CodeBrowserSelectionPlugin extends Plugin { String title = "Selected Ranges in " + program.getName(); TableComponentProvider tableProvider = tableService.showTableWithMarkers(title, "Address Ranges", model, - SearchConstants.SEARCH_HIGHLIGHT_COLOR, markerIcon, title, null); + SearchConstants.SEARCH_HIGHLIGHT_COLOR, markerIcon, title, componentProvider); tableProvider.installRemoveItemsAction(); SelectEndpointsAction selectMin = @@ -186,7 +187,7 @@ public class CodeBrowserSelectionPlugin extends Plugin { Icon markerIcon = new GIcon("icon.plugin.codebrowser.cursor.marker"); TableComponentProvider

tableProvider = tableService.showTableWithMarkers(title + " " + model.getName(), "Selections", model, - SearchConstants.SEARCH_HIGHLIGHT_COLOR, markerIcon, title, null); + SearchConstants.SEARCH_HIGHLIGHT_COLOR, markerIcon, title, componentProvider); tableProvider.installRemoveItemsAction(); } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/CodeViewerActionContext.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/CodeViewerActionContext.java index 3ad0101c65..d0e889b166 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/CodeViewerActionContext.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/CodeViewerActionContext.java @@ -4,9 +4,9 @@ * 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. @@ -16,11 +16,9 @@ package ghidra.app.plugin.core.codebrowser; import ghidra.app.context.ListingActionContext; -import ghidra.app.context.NavigatableRangeActionContext; import ghidra.program.util.ProgramLocation; -public class CodeViewerActionContext extends ListingActionContext implements - NavigatableRangeActionContext { +public class CodeViewerActionContext extends ListingActionContext { public CodeViewerActionContext(CodeViewerProvider provider) { super(provider, provider); @@ -29,5 +27,4 @@ public class CodeViewerActionContext extends ListingActionContext implements public CodeViewerActionContext(CodeViewerProvider provider, ProgramLocation location) { super(provider, provider, location); } - } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/CodeViewerProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/CodeViewerProvider.java index 0d88763289..fa996e73c4 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/CodeViewerProvider.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/CodeViewerProvider.java @@ -943,14 +943,14 @@ public class CodeViewerProvider extends NavigatableComponentProviderAdapter public void selectAll() { listingPanel.getFieldPanel().requestFocus(); - ProgramSelection sel = new ProgramSelection(program.getAddressFactory(), + ProgramSelection sel = new ProgramSelection( listingPanel.getAddressIndexMap().getOriginalAddressSet()); doSetSelection(sel); } public void selectComplement() { AddressSet complement = listingPanel.selectComplement(); - ProgramSelection sel = new ProgramSelection(program.getAddressFactory(), complement); + ProgramSelection sel = new ProgramSelection(complement); doSetSelection(sel); } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/MarkAndSelectionAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/MarkAndSelectionAction.java index 93a3a5c36f..3b4f189c5b 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/MarkAndSelectionAction.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/MarkAndSelectionAction.java @@ -4,9 +4,9 @@ * 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. @@ -30,9 +30,9 @@ import ghidra.program.util.ProgramSelection; import ghidra.util.HelpLocation; /** - * Actions for creating a selection using two distinct steps. The first time the action - * is invoked, it records the current location as the start of a selection. The second time the - * action is invoked it creates a selection from the recorded location to the current location. + * Actions for creating a selection using two distinct steps. The first time the action is invoked, + * it records the current location as the start of a selection. The second time the action is + * invoked it creates a selection from the recorded location to the current location. */ public class MarkAndSelectionAction extends ToggleDockingAction { private Navigatable markedNavigatable; diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/gotoquery/GoToHelper.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/gotoquery/GoToHelper.java index 9bdea6975e..dec2876359 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/gotoquery/GoToHelper.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/gotoquery/GoToHelper.java @@ -15,7 +15,7 @@ */ package ghidra.app.plugin.core.gotoquery; -import static ghidra.framework.main.DataTreeDialogType.*; +import static ghidra.framework.main.DataTreeDialogType.OPEN; import java.util.Stack; @@ -170,27 +170,27 @@ public class GoToHelper { } /** - * GoTo external address linkage location (pointer or thunk) within the current program - * which is associated with the specified external location. + * GoTo external address linkage location (pointer or thunk) within the current program which is + * associated with the specified external location. *

- * For those use cases which should not popup a window the popupAllowed - * option should be false. + * For those use cases which should not popup a window the popupAllowed option should be + * false. *

- * This method will generally cause navigation to a linkage location associated with - * the specified external location. A linkage location is either a pointer to the - * external location (identified by reference) or a thunk to the external - * location, provided the thunk does not reference a linkage pointer. If more than one - * linkage location exists and popupAllowed is true, a table will be displayed allowing - * the user to navigate to any of the linkage locations. If navigation is initiated from the - * only known linkage location, and popupAllowed is true, navigation to the external - * program will be attempted regardless of the current - * {@link NavigationOptions#isGotoExternalProgramEnabled} setting. + * This method will generally cause navigation to a linkage location associated with the + * specified external location. A linkage location is either a pointer to the external location + * (identified by reference) or a thunk to the external location, provided the thunk does not + * reference a linkage pointer. If more than one linkage location exists and popupAllowed is + * true, a table will be displayed allowing the user to navigate to any of the linkage + * locations. If navigation is initiated from the only known linkage location, and popupAllowed + * is true, navigation to the external program will be attempted regardless of the + * current {@link NavigationOptions#isGotoExternalProgramEnabled} setting. + * * @param nav Navigatable * @param externalLoc external location - * @param popupAllowed if true a table may be displayed when multiple linkage locations - * exist, otherwise navigation to the first linkage location will be performed - * @return true if navigation was successful or a list of possible linkage locations - * was displayed. + * @param popupAllowed if true a table may be displayed when multiple linkage locations exist, + * otherwise navigation to the first linkage location will be performed + * @return true if navigation was successful or a list of possible linkage locations was + * displayed. */ protected boolean goToExternalLinkage(Navigatable nav, ExternalLocation externalLoc, boolean popupAllowed) { @@ -237,27 +237,28 @@ public class GoToHelper { /** * Navigate to either the external program location or address linkage location. - * This method will only navigate to the - * external program associated with the specified location if either checkNavigationOption - * is false, or the navigation option is set to Show External Program, or - * the current location is the same as the single linkage location. See - * {@link #goToExternalLinkage(Navigatable, ExternalLocation, boolean)} method for - * external linkage navigation behavior. *

- * If navigation to an external program will be performed, the associated program will - * be identified and the location within that program found. Once this occurs, the - * external program will be opened within the current tool and navigation completed. If an - * external program association has not yet been established, the user will be prompted to make - * an association if they choose before completing the navigation. + * This method will only navigate to the external program associated with the specified location + * if either checkNavigationOption is false, or the navigation option is set to Show External + * Program, or the current location is the same as the single linkage location. See + * {@link #goToExternalLinkage(Navigatable, ExternalLocation, boolean)} method for external + * linkage navigation behavior. + *

+ * If navigation to an external program will be performed, the associated program will be + * identified and the location within that program found. Once this occurs, the external program + * will be opened within the current tool and navigation completed. If an external program + * association has not yet been established, the user will be prompted to make an association if + * they choose before completing the navigation. + * * @param nav Navigatable * @param externalLocation external location - * @param checkNavigationOption if true the {@link NavigationOptions#isGotoExternalProgramEnabled} - * option will be used to determine if navigation to the external program will be - * attempted, or if navigation to the external linkage location within the current - * program will be attempted. If false, only navigation to the external linkage will be - * attempted. - * @return true if navigation to the external program was successful or navigation to a - * linkage location was performed. + * @param checkNavigationOption if true the + * {@link NavigationOptions#isGotoExternalProgramEnabled} option will be used to + * determine if navigation to the external program will be attempted, or if + * navigation to the external linkage location within the current program will be + * attempted. If false, only navigation to the external linkage will be attempted. + * @return true if navigation to the external program was successful or navigation to a linkage + * location was performed. */ public boolean goToExternalLocation(Navigatable nav, ExternalLocation externalLocation, boolean checkNavigationOption) { 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 0e4cb2ddf9..22b7594e95 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 @@ -58,6 +58,7 @@ public final class GoToServicePlugin extends ProgramPlugin { /** * Creates a new instance of the GoToServicePlugin + * * @param tool the tool */ public GoToServicePlugin(PluginTool tool) { diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/highlight/SetHighlightPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/highlight/SetHighlightPlugin.java index bbf67b279e..25c8aec00c 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/highlight/SetHighlightPlugin.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/highlight/SetHighlightPlugin.java @@ -4,9 +4,9 @@ * 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. @@ -66,6 +66,7 @@ public class SetHighlightPlugin extends Plugin { /** * Constructor + * * @param tool */ public SetHighlightPlugin(PluginTool tool) { diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NavigationHistoryPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NavigationHistoryPlugin.java index 1df6b2d952..6313742df1 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NavigationHistoryPlugin.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NavigationHistoryPlugin.java @@ -4,9 +4,9 @@ * 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. diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/string/translate/AbstractTranslateAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/string/translate/AbstractTranslateAction.java index 0d505d0f14..f2d3c35791 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/string/translate/AbstractTranslateAction.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/string/translate/AbstractTranslateAction.java @@ -4,9 +4,9 @@ * 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. @@ -54,9 +54,9 @@ public abstract class AbstractTranslateAction extends DockingAction { setPopupMenuData(dataListMenuData); return isEnabledForContext((DataLocationListContext) context); } - else if (context instanceof CodeViewerActionContext) { + else if (context instanceof CodeViewerActionContext cvac) { setPopupMenuData(codeViewerMenuData); - return isEnabledForContext((CodeViewerActionContext) context); + return isEnabledForContext(cvac); } return false; } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/services/GoToService.java b/Ghidra/Features/Base/src/main/java/ghidra/app/services/GoToService.java index 1c005d70cc..b4ea7cd888 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/services/GoToService.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/services/GoToService.java @@ -4,9 +4,9 @@ * 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. @@ -26,29 +26,31 @@ import ghidra.util.Swing; import ghidra.util.task.TaskMonitor; /** - * The GoToService provides a general service for plugins to generate GoTo - * events. The provider of this service will take care of interfacing with - * any history service that may be available. + * The GoToService provides a general service for plugins to generate GoTo events. The provider of + * this service will take care of interfacing with any history service that may be available. *

- * This class will execute all {@code goTo} calls on the Java Swing thread. This will happen in - * a blocking manner if the client calls from any other thread. This has the potential to lead - * to deadlocks if the client is using custom synchronization. Care must be taken to not be - * holding any lock that will cause the Swing thread to block when using this class from any other - * thread. To work around this issue, clients can always call this service from within a + * This class will execute all {@code goTo} calls on the Java Swing thread. This will happen in a + * blocking manner if the client calls from any other thread. This has the potential to lead to + * deadlocks if the client is using custom synchronization. Care must be taken to not be holding any + * lock that will cause the Swing thread to block when using this class from any other thread. To + * work around this issue, clients can always call this service from within a * {@link Swing#runLater(Runnable)} call, which will prevent any deadlock issues. */ -@ServiceInfo(defaultProvider = GoToServicePlugin.class, description = "Navigate to a program location") +@ServiceInfo( + defaultProvider = GoToServicePlugin.class, + description = "Navigate to a program location") public interface GoToService { /** - * Characters that are allowed in words that the GoToService can use. These - * typically represent library name delimiters. + * Characters that are allowed in words that the GoToService can use. These typically represent + * library name delimiters. */ public static final char[] VALID_GOTO_CHARS = new char[] { '.', ':', '*' }; /** - * Generates a GoTo event and handles any history state that needs to be saved. This method - * will attempt to find the program that contains the given ProgramLocation. + * Generates a GoTo event and handles any history state that needs to be saved. + *

+ * This method will attempt to find the program that contains the given ProgramLocation. * * @param loc location to go to * @return true if the go to was successful @@ -57,11 +59,12 @@ public interface GoToService { public boolean goTo(ProgramLocation loc); /** - * Generates a GoTo event and handles any history state that needs to be saved. This - * overloaded version of {@link #goTo(Address)} uses the given program as the program within - * which to perform the GoTo. If the given program does not contain the given address, then - * the GoTo will not be performed and false will be returned. Passing null as the - * program parameter will cause this method to attempt to find a program that + * Generates a GoTo event and handles any history state that needs to be saved. + *

+ * This overloaded version of {@link #goTo(Address)} uses the given program as the program + * within which to perform the GoTo. If the given program does not contain the given address, + * then the GoTo will not be performed and false will be returned. Passing null as + * the program parameter will cause this method to attempt to find a program that * contains the given ProgramLocation. * * @param loc location to go to @@ -82,8 +85,10 @@ public interface GoToService { public boolean goTo(Navigatable navigatable, ProgramLocation loc, Program program); /** - * Generates a GoTo event to the given address. The refAddress is used to determine if - * there is a specific symbol reference from that reference. + * Generates a GoTo event to the given address. + *

+ * The refAddress is used to determine if there is a specific symbol reference from that + * reference. * * @param navigatable the destination navigatable * @param program program @@ -95,8 +100,10 @@ public interface GoToService { Address refAddress); /** - * Generates a GoTo event to the given address. The fromAddress is used to determine if - * there is a specific symbol reference from the current address. + * Generates a GoTo event to the given address. + *

+ * The fromAddress is used to determine if there is a specific symbol reference from the current + * address. * * @param fromAddress the current address * @param address the address to goto @@ -115,6 +122,7 @@ public interface GoToService { /** * Generates a GoTo event to the gotoAddress. + * * @param goToAddress the address to goto * @return true if the go to was successful * @see #goTo(Address, Program) @@ -122,12 +130,13 @@ public interface GoToService { public boolean goTo(Address goToAddress); /** - * Generates a GoTo event to the gotoAddress. This overloaded version of - * {@link #goTo(Address)} uses the given program as the program within which to perform the - * GoTo. If the given program does not contain the given address, then the GoTo will not be - * performed and false will be returned. Passing null as the program - * parameter will cause this method to attempt to find a program that contains the given - * ProgramLocation. + * Generates a GoTo event to the gotoAddress. + *

+ * This overloaded version of {@link #goTo(Address)} uses the given program as the program + * within which to perform the GoTo. If the given program does not contain the given address, + * then the GoTo will not be performed and false will be returned. Passing null as + * the program parameter will cause this method to attempt to find a program that + * contains the given ProgramLocation. * * @param goToAddress the address to goto * @param program the program within which to perform the GoTo @@ -137,32 +146,34 @@ public interface GoToService { public boolean goTo(Address goToAddress, Program program); /** - * Navigate to either the external program location or address linkage location. Specific - * behavior may vary based upon implementation. + * Navigate to either the external program location or address linkage location. + *

+ * Specific behavior may vary based upon implementation. * * @param externalLoc external location * @param checkNavigationOption if true the service navigation option will be used to determine - * if navigation to the external program will be attempted, or if navigation to the - * external linkage location within the current program will be attempted. If false, the - * implementations default behavior will be performed. + * if navigation to the external program will be attempted, or if navigation to the + * external linkage location within the current program will be attempted. If false, + * the implementations default behavior will be performed. * @return true if either navigation to the external program or to a linkage location was - * completed successfully. + * completed successfully. */ public boolean goToExternalLocation(ExternalLocation externalLoc, boolean checkNavigationOption); /** - * Navigate to either the external program location or address linkage location. Specific - * behavior may vary based upon implementation. + * Navigate to either the external program location or address linkage location. + *

+ * Specific behavior may vary based upon implementation. * * @param navigatable Navigatable * @param externalLoc external location * @param checkNavigationOption if true the service navigation option will be used to determine - * if navigation to the external program will be attempted, or if navigation to the - * external linkage location within the current program will be attempted. If false, the - * implementations default behavior will be performed. + * if navigation to the external program will be attempted, or if navigation to the + * external linkage location within the current program will be attempted. If false, + * the implementations default behavior will be performed. * @return true if either navigation to the external program or to a linkage location was - * completed successfully. + * completed successfully. */ public boolean goToExternalLocation(Navigatable navigatable, ExternalLocation externalLoc, boolean checkNavigationOption); @@ -170,9 +181,9 @@ public interface GoToService { /** * Generates a GoTo event for the given query. *

- * If the query results in more than one location, a list of locations will be displayed. - * If the query results in only one location, then a goto event will be fired(except for a - * wildcard query in which case a list will still be displayed. + * If the query results in more than one location, a list of locations will be displayed. If the + * query results in only one location, then a goto event will be fired(except for a wildcard + * query in which case a list will still be displayed. *

* The listener will be notified after query and will indicate the query status. * @@ -188,9 +199,9 @@ public interface GoToService { /** * Generates a GoTo event for the given query. *

- * If the query results in more than one location, a list of locations will be displayed. - * If the query results in only one location, then a goto event will be fired(except for a - * wildcard query in which case a list will still be displayed. + * If the query results in more than one location, a list of locations will be displayed. If the + * query results in only one location, then a goto event will be fired(except for a wildcard + * query in which case a list will still be displayed. *

* The listener will be notified after query and will indicate the query status. * @@ -205,8 +216,10 @@ public interface GoToService { GoToServiceListener listener, TaskMonitor monitor); /** - * Returns the default navigatable that is the destination for GoTo events. This navigatable - * will not be null. + * Returns the default navigatable that is the destination for GoTo events. + *

+ * This navigatable will not be null. + * * @return the navigatable */ public Navigatable getDefaultNavigatable(); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/listingpanel/ListingPanel.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/listingpanel/ListingPanel.java index b81c2fea63..f27ec1a0fc 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/listingpanel/ListingPanel.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/listingpanel/ListingPanel.java @@ -106,7 +106,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc private String currentTextSelection; /** - * Constructs a new ListingPanel using the given FormatManager and ServiceProvider. + * Constructs a new ListingPanel using the given FormatManager * * @param manager the FormatManager to use. */ @@ -152,10 +152,10 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc } /** - * Constructs a new ListingPanel with the given FormatManager and ListingLayoutModel + * Constructs a new ListingPanel with the given FormatManager and ListingModel * * @param mgr the FormatManager to use - * @param model the ListingLayoutModel to use. + * @param model the ListingModel to use. */ public ListingPanel(FormatManager mgr, ListingModel model) { this(mgr); @@ -171,8 +171,9 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc return preferredSize; } - /** + /** * A width for new windows that shows a reasonable amount of the Listing + * * @return the width */ protected int getNewWindowDefaultWidth() { @@ -203,7 +204,9 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc } /** - * Sets the ProgramLocationListener. Only one listener is supported + * Sets the ProgramLocationListener. + *

+ * Only one listener is supported * * @param listener the ProgramLocationListener to use. */ @@ -212,7 +215,9 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc } /** - * Sets the ProgramSelectionListener. Only one listener is supported + * Sets the ProgramSelectionListener. + *

+ * Only one listener is supported * * @param listener the ProgramSelectionListener to use. */ @@ -221,8 +226,9 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc } /** - * Sets the ProgramSelectionListener for selection changes while dragging. Only one listener is - * supported + * Sets the ProgramSelectionListener for selection changes while dragging. + *

+ * Only one listener is supported * * @param listener the ProgramSelectionListener to use. */ @@ -235,7 +241,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc } /** - * Sets the ListingLayoutModel to use. + * Sets the ListingModel to use. * * @param newModel the model to use. */ @@ -249,6 +255,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc /** * Returns the current ListingModel used by this panel. + * * @return the model */ public ListingModel getListingModel() { @@ -285,6 +292,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc /** * Returns true if the field header component is showing. + * * @return true if showing */ public boolean isHeaderShowing() { @@ -493,8 +501,10 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc } /** - * Adds a {@link ListingHighlightProvider} to this listing. This highlight provider will be used with - * any other registered providers to paint all the highlights for this listing. + * Adds a {@link ListingHighlightProvider} to this listing. + *

+ * This highlight provider will be used with any other registered providers to paint all the + * highlights for this listing. * * @param highlightProvider The provider to add */ @@ -504,6 +514,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc /** * Returns the FieldPanel used by this ListingPanel. + * * @return the field panel */ public FieldPanel getFieldPanel() { @@ -536,6 +547,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc /** * Returns the divider location between the left margin areas and the main display. + * * @return the location */ public int getDividerLocation() { @@ -604,8 +616,9 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc } /** - * Moves the cursor to the given program location. Also, repositions the scrollbar to show that - * location, if the location is not on the screen. + * Moves the cursor to the given program location. + *

+ * Also, repositions the scrollbar to show that location, if the location is not on the screen. * * @param loc the location to move to. * @param centerWhenNotVisible this variable only has an effect if the given location is not on @@ -615,7 +628,6 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc * @return true if successful */ public boolean goTo(ProgramLocation loc, boolean centerWhenNotVisible) { - Swing.assertSwingThread("goTo() must be called on the Swing thread"); final FieldLocation floc = getFieldLocation(loc); @@ -635,11 +647,12 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc return true; } - /** + /** * Scroll the view of the listing to the given location. * *

* If the given location is not displayed, this has no effect. + * * @param location the location */ public void scrollTo(ProgramLocation location) { @@ -650,8 +663,9 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc fieldPanel.scrollTo(fieldLocation); } - /** + /** * Center the view of the listing around the given location. + * * @param location the location */ public void center(ProgramLocation location) { @@ -866,6 +880,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc /** * Gets the view of this listing panel (meant to be used in conjunction with * {@link #setView(AddressSetView)}. + * * @return the addresses */ public AddressSetView getView() { @@ -893,8 +908,10 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc } /** - * Sets the background color for the listing panel. This will set the background for the main - * listing display. + * Sets the background color for the listing panel. + *

+ * This will set the background for the main listing display. + * * @param c the color */ public void setTextBackgroundColor(Color c) { @@ -912,6 +929,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc /** * Returns true if this component has focus. + * * @return true if this component has focus. */ public boolean isActive() { @@ -920,6 +938,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc /** * Returns the current program location of the cursor. + * * @return the location */ public ProgramLocation getProgramLocation() { @@ -933,6 +952,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc /** * Get a program location for the given point. + * * @param point the point * @return program location, or null if point does not correspond to a program location */ @@ -947,6 +967,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc /** * Get the margin providers in this ListingPanel. + * * @return the providers */ public List getMarginProviders() { @@ -955,6 +976,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc /** * Get the overview providers in this ListingPanel. + * * @return the providers */ public List getOverviewProviders() { @@ -963,6 +985,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc /** * Returns true if the mouse is at a location that can be dragged. + * * @return true if the mouse is at a location that can be dragged. */ public boolean isStartDragOk() { @@ -980,7 +1003,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc /** * Sets the cursor to the given program location with a given trigger - * + *

* This method should only be used in automated testing to programmatically simulate a user * navigating within the listing panel. * @@ -1013,6 +1036,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc /** * Returns the AddressIndexMap currently used by this listing panel. + * * @return the map */ public AddressIndexMap getAddressIndexMap() { @@ -1021,6 +1045,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc /** * Returns the vertical scrollbar used by this panel. + * * @return the scroll bar */ public JScrollBar getVerticalScrollBar() { @@ -1029,6 +1054,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc /** * Returns the FormatManager used by this listing panel. + * * @return the format manager */ public FormatManager getFormatManager() { @@ -1070,6 +1096,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc /** * Returns the current program selection. + * * @return the selection */ public ProgramSelection getProgramSelection() { @@ -1091,6 +1118,7 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc /** * Sets the selection to the complement of the current selection in the listing view. + * * @return the addresses */ public AddressSet selectComplement() { @@ -1196,8 +1224,9 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc } /** - * Returns the currently selected text. The value will only be non-null for selections within a - * single field. + * Returns the currently selected text. + *

+ * The value will only be non-null for selections within a single field. * * @return the selected text or null */ @@ -1210,8 +1239,9 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc } /** - * Sets listing panel to never show scroll bars. This is useful when you want this listing's - * parent to always be as big as this listing. + * Sets listing panel to never show scroll bars. + *

+ * This is useful when you want this listing's parent to always be as big as this listing. */ public void setNeverSroll() { scroller.setNeverScroll(true); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/features/base/codecompare/listing/ListingDisplayGoToService.java b/Ghidra/Features/Base/src/main/java/ghidra/features/base/codecompare/listing/ListingDisplayGoToService.java index 9173aa8f11..1d1c7fbd0e 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/features/base/codecompare/listing/ListingDisplayGoToService.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/features/base/codecompare/listing/ListingDisplayGoToService.java @@ -4,9 +4,9 @@ * 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. @@ -39,6 +39,7 @@ class ListingDisplayGoToService implements GoToService { /** * Constructs a goTo service for a dual listing panel. + * * @param listingPanel the listing panel to be navigated to */ ListingDisplayGoToService(ListingPanel listingPanel) { @@ -154,9 +155,9 @@ class ListingDisplayGoToService implements GoToService { } /** - * Checks the address to make sure the listing won't navigate outside the addresses - * it currently has loaded. If it is not a valid address it will set a status message - * on the dual listing. + * Checks the address to make sure the listing won't navigate outside the addresses it currently + * has loaded. If it is not a valid address it will set a status message on the dual listing. + * * @param addr the address to check * @return true if the address is valid for navigation. */ @@ -167,8 +168,8 @@ class ListingDisplayGoToService implements GoToService { AddressIndexMap map = listingPanel.getAddressIndexMap(); AddressSetView addresses = map.getOriginalAddressSet(); if (!addresses.contains(addr)) { - DockingWindowManager.getActiveInstance().setStatusText( - "\"" + addr.toString() + "\" is outside the current listing's view."); + DockingWindowManager.getActiveInstance().setStatusText(""" + "%s" is outside the current listing's view""".formatted(addr)); return false; } return true; diff --git a/Ghidra/Features/Base/src/main/java/ghidra/features/base/codecompare/listing/ListingDisplayNavigator.java b/Ghidra/Features/Base/src/main/java/ghidra/features/base/codecompare/listing/ListingDisplayNavigator.java index a489f5db65..6a9fd898ce 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/features/base/codecompare/listing/ListingDisplayNavigator.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/features/base/codecompare/listing/ListingDisplayNavigator.java @@ -4,9 +4,9 @@ * 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. @@ -37,9 +37,9 @@ class ListingDisplayNavigator implements Navigatable { /** * Constructor for a dual listing navigator. + * * @param listingPanel the dual listing whose left or right listing panel is to be controlled. - * @param goToService which side LEFT or RIGHT - * false means it's for the right side listing. + * @param goToService which side LEFT or RIGHT. false means it's for the right side listing. */ ListingDisplayNavigator(ListingPanel listingPanel, GoToService goToService) { diff --git a/Ghidra/Features/Base/src/main/java/ghidra/features/base/memsearch/gui/MemorySearchPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/features/base/memsearch/gui/MemorySearchPlugin.java index 033b982df5..fc16ef3c58 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/features/base/memsearch/gui/MemorySearchPlugin.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/features/base/memsearch/gui/MemorySearchPlugin.java @@ -46,7 +46,7 @@ import ghidra.util.exception.CancelledException; import ghidra.util.task.*; /** - * Plugin for searching program memory. + * Plugin for searching program memory. */ //@formatter:off @PluginInfo( diff --git a/Ghidra/Features/Base/src/main/java/ghidra/features/base/memsearch/gui/MemorySearchProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/features/base/memsearch/gui/MemorySearchProvider.java index 485467af62..1530f7a23c 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/features/base/memsearch/gui/MemorySearchProvider.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/features/base/memsearch/gui/MemorySearchProvider.java @@ -275,7 +275,7 @@ public class MemorySearchProvider extends ComponentProviderAdapter * Performs a scan on the current results, keeping only the results that match the type of scan. * Note: this method is public to facilitate testing. * - * @param scanner the scanner to use to reduce the results. + * @param scanner the scanner to use to reduce the results. */ public void scan(Scanner scanner) { setBusy(true); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/util/table/GhidraTable.java b/Ghidra/Features/Base/src/main/java/ghidra/util/table/GhidraTable.java index a9bb0f745e..22059abe04 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/util/table/GhidraTable.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/util/table/GhidraTable.java @@ -35,12 +35,11 @@ import ghidra.program.util.ProgramSelection; import ghidra.util.Msg; /** - * Navigation is only supported if the underlying table model - * implements ProgramTableModel and the setGoToService() method - * has been called with a valid reference. When both of these conditions are met, then the - * table will navigate on a user's double-click or on an Enter key press. Also, if - * selection navigation is enabled, then this table will navigate any time the selection of - * the table changes. To prevent this feature call + * Navigation is only supported if the underlying table model implements {@link ProgramTableModel} + * and the setGoToService() method has been called with a valid reference. When both of + * these conditions are met, then the table will navigate on a user's double-click or on an + * Enter key press. Also, if selection navigation is enabled, then this table will + * navigate any time the selection of the table changes. To prevent this feature call * {@link #setNavigateOnSelectionEnabled(boolean)} with a value of false. */ public class GhidraTable extends GTable { @@ -61,6 +60,7 @@ public class GhidraTable extends GTable { /** * Installs the default {@link TableCellRenderer}s for known Ghidra table cell data classes. + *

* Subclasses can override this method to add additional types or to change the default * associations. */ @@ -79,10 +79,11 @@ public class GhidraTable extends GTable { /** * Sets the GoTo service to use when navigation is enabled on this table. + * * @param goToService the GoTo service * @param nav the navigable * @deprecated use {@link #installNavigation(ServiceProvider)} or - * {@link #installNavigation(ServiceProvider,Navigatable)} + * {@link #installNavigation(ServiceProvider,Navigatable)} */ @Deprecated public void installNavigation(GoToService goToService, Navigatable nav) { @@ -90,9 +91,10 @@ public class GhidraTable extends GTable { } /** - * Sets the service provider to use when navigation is enabled on this table. The service - * provider will be used to retrieve the {@link GoToService}, as needed after the system has - * been initialized. If you do not have a {@link Navigatable} preferences, then call + * Sets the service provider to use when navigation is enabled on this table. + *

+ * The service provider will be used to retrieve the {@link GoToService}, as needed after the + * system has been initialized. If you do not have a {@link Navigatable} preferences, then call * {@link #installNavigation(ServiceProvider)} instead. * * @param sp the service provider @@ -112,9 +114,10 @@ public class GhidraTable extends GTable { } /** - * Sets the service provider to use when navigation is enabled on this table. The service - * provider will be used to retrieve the {@link GoToService}, as needed after the system has - * been initialized. + * Sets the service provider to use when navigation is enabled on this table. + *

+ * The service provider will be used to retrieve the {@link GoToService}, as needed after the + * system has been initialized. * * @param sp the service provider */ @@ -164,8 +167,8 @@ public class GhidraTable extends GTable { } /** - * Removes any installed navigation components, such as listeners, a navigatable and the - * service provider. + * Removes any installed navigation components, such as listeners, a navigatable and the service + * provider. */ public void removeNavigation() { removeKeyListener(navigationKeyListener); @@ -178,11 +181,13 @@ public class GhidraTable extends GTable { /** * Returns the program selection equivalent to the rows currently selected in the table. + *

* This method is only valid when the underlying table model implements * {@link ProgramTableModel}. *

- * Returns null if no rows are selected or - * the underlying model does not implement ProgramTableModel. + * Returns null if no rows are selected or the underlying model does not implement + * ProgramTableModel. + * * @return the program selection or null. */ public ProgramSelection getProgramSelection() { @@ -200,8 +205,8 @@ public class GhidraTable extends GTable { } /** - * Returns the program being used by this table; null if the underlying model does not - * implement {@link ProgramTableModel} + * Returns the program being used by this table; null if the underlying model does not implement + * {@link ProgramTableModel} * * @return the table's program */ @@ -222,11 +227,11 @@ public class GhidraTable extends GTable { } /** + * Navigate to the program location denoted by the given row and column + *

* Does nothing if no {@link GoToService} has been installed from - * {@link #installNavigation(GoToService, Navigatable)}. Also, this method will do - * nothing if this table's TableModel is not an instance of {@link ProgramTableModel}. - * Otherwise, this method will attempt to go to the program location denoted by the - * given row and column. + * {@link #installNavigation(GoToService, Navigatable)}. Also, this method will do nothing if + * this table's TableModel is not an instance of {@link ProgramTableModel}. * * @param row the row * @param column the column @@ -269,12 +274,13 @@ public class GhidraTable extends GTable { } /** - * Does nothing if no {@link GoToService} has been installed from - * {@link #installNavigation(GoToService, Navigatable)}. Otherwise, this method will attempt - * to go to the program location denoted by the given row and column. + * Navigate to the program location denoted by the given row and column *

- * This method differs from {@link #navigate(int, int)} in that this method will not - * navigate if {@link #navigateOnSelection} is false. + * Does nothing if no {@link GoToService} has been installed from + * {@link #installNavigation(GoToService, Navigatable)}. + *

+ * This method differs from {@link #navigate(int, int)} in that this method will not navigate if + * {@link #navigateOnSelection} is false. */ protected void navigateOnCurrentSelection(int row, int column) { if (!navigateOnSelection) { @@ -289,8 +295,9 @@ public class GhidraTable extends GTable { } /** - * Allows the user to enable and disable the table's feature that triggers navigation on - * certain selection events, like mouse clicking and pressing the 'Enter' key. + * Allows the user to enable and disable the table's feature that triggers navigation on certain + * selection events, like mouse clicking and pressing the 'Enter' key. + * * @param enabled true enables the navigation on selection feature. */ public void setNavigateOnSelectionEnabled(boolean enabled) { @@ -328,6 +335,7 @@ public class GhidraTable extends GTable { /** * Selects the given row and performs a goto, if applicable. + * * @param row The row to select */ @Override diff --git a/Ghidra/Features/Base/src/main/java/ghidra/util/table/actions/MakeProgramSelectionAction.java b/Ghidra/Features/Base/src/main/java/ghidra/util/table/actions/MakeProgramSelectionAction.java index 7c09aecbcb..1840107564 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/util/table/actions/MakeProgramSelectionAction.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/util/table/actions/MakeProgramSelectionAction.java @@ -34,10 +34,10 @@ import ghidra.util.table.GhidraTable; import resources.Icons; /** - * An action to make a program selection based on the given table's selection. For the context to - * work, the provider using this action must create an {@link ActionContext} that returns a - * context object that is the table passed to this action's constructor; otherwise, this action - * will not be enabled correctly. + * An action to make a program selection based on the given table's selection. For the context to + * work, the provider using this action must create an {@link ActionContext} that returns a context + * object that is the table passed to this action's constructor; otherwise, this action will not be + * enabled correctly. */ public class MakeProgramSelectionAction extends DockingAction { @@ -48,10 +48,13 @@ public class MakeProgramSelectionAction extends DockingAction { private GhidraTable table; /** - * Special constructor for clients that do not have a plugin. Clients using this - * constructor must override {@link #makeProgramSelection(ProgramSelection, ActionContext)}. + * Special constructor for clients that do not have a plugin. + *

+ * Clients using this constructor must override + * {@link #makeProgramSelection(ProgramSelection, ActionContext)}. * - *

Update: the preferred constructor for clients without a plugin is + *

+ * Update: the preferred constructor for clients without a plugin is * {@link #MakeProgramSelectionAction(Navigatable, String, GhidraTable)}. * * @param owner the action's owner @@ -66,8 +69,10 @@ public class MakeProgramSelectionAction extends DockingAction { } /** - * Special constructor for clients that do not have a plugin. Clients using this - * constructor must override {@link #makeProgramSelection(ProgramSelection, ActionContext)}. + * Special constructor for clients that do not have a plugin. + *

+ * Clients using this constructor must override + * {@link #makeProgramSelection(ProgramSelection, ActionContext)}. * * @param navigatable the navigatable that will be used to make selections; may not be null * @param owner the action's owner @@ -78,8 +83,10 @@ public class MakeProgramSelectionAction extends DockingAction { } /** - * Special constructor for clients that do not have a plugin. Clients using this - * constructor must override {@link #makeProgramSelection(ProgramSelection, ActionContext)}. + * Special constructor for clients that do not have a plugin. + *

+ * Clients using this constructor must override + * {@link #makeProgramSelection(ProgramSelection, ActionContext)}. * * @param navigatable the navigatable that will be used to make selections; may not be null * @param owner the action's owner @@ -95,8 +102,10 @@ public class MakeProgramSelectionAction extends DockingAction { } /** - * This normal constructor for this action. The given plugin will be used along with the - * given table to fire program selection events as the action is executed. + * The normal constructor for this action. + *

+ * The given plugin will be used along with the given table to fire program selection events as + * the action is executed. * * @param plugin the plugin * @param table the table diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/codebrowser/ExternalCodeBrowserNavigationTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/codebrowser/ExternalCodeBrowserNavigationTest.java index a5f9cb83fb..3cd9e69bdc 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/codebrowser/ExternalCodeBrowserNavigationTest.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/codebrowser/ExternalCodeBrowserNavigationTest.java @@ -4,9 +4,9 @@ * 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. @@ -15,7 +15,8 @@ */ package ghidra.app.plugin.core.codebrowser; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import javax.swing.table.TableColumnModel; import javax.swing.table.TableModel; @@ -57,7 +58,6 @@ public class ExternalCodeBrowserNavigationTest extends AbstractCodeBrowserNaviga GoToHelper spyGoToHelper = new GoToHelper(tool) { @Override public boolean goTo(final Navigatable navigatable, ProgramLocation loc, Program p) { - Msg.debug(this, "goTo() called with " + loc); // Track last navigation location diff --git a/Ghidra/Features/Base/src/test/java/ghidra/app/nav/TestDummyNavigatable.java b/Ghidra/Features/Base/src/test/java/ghidra/app/nav/TestDummyNavigatable.java index 1043cee0c5..f4bb5d1b01 100644 --- a/Ghidra/Features/Base/src/test/java/ghidra/app/nav/TestDummyNavigatable.java +++ b/Ghidra/Features/Base/src/test/java/ghidra/app/nav/TestDummyNavigatable.java @@ -4,9 +4,9 @@ * 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. @@ -23,8 +23,8 @@ import ghidra.program.util.ProgramLocation; import ghidra.program.util.ProgramSelection; /** - * A stub of the {@link Navigatable} interface. This can be used to supply a test navigatable - * or to spy on system internals by overriding methods as needed. + * A stub of the {@link Navigatable} interface. This can be used to supply a test navigatable or to + * spy on system internals by overriding methods as needed. */ public class TestDummyNavigatable implements Navigatable { @@ -148,7 +148,8 @@ public class TestDummyNavigatable implements Navigatable { } @Override - public void removeHighlightProvider(ListingHighlightProvider highlightProvider, Program program) { + public void removeHighlightProvider(ListingHighlightProvider highlightProvider, + Program program) { // stub } } diff --git a/Ghidra/Features/Base/src/test/java/ghidra/app/services/TestDummyGoToService.java b/Ghidra/Features/Base/src/test/java/ghidra/app/services/TestDummyGoToService.java index d82a4e61c2..3e332dce56 100644 --- a/Ghidra/Features/Base/src/test/java/ghidra/app/services/TestDummyGoToService.java +++ b/Ghidra/Features/Base/src/test/java/ghidra/app/services/TestDummyGoToService.java @@ -4,9 +4,9 @@ * 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. @@ -23,8 +23,8 @@ import ghidra.program.util.ProgramLocation; import ghidra.util.task.TaskMonitor; /** - * A stub of the {@link GoToService} interface. This can be used to supply a test version - * of the service or to spy on system internals by overriding methods as needed. + * A stub of the {@link GoToService} interface. This can be used to supply a test version of the + * service or to spy on system internals by overriding methods as needed. */ public class TestDummyGoToService implements GoToService { diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/DecompilerProvider.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/DecompilerProvider.java index a65db5a018..f3a0e582af 100644 --- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/DecompilerProvider.java +++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/DecompilerProvider.java @@ -252,7 +252,6 @@ public class DecompilerProvider extends NavigatableComponentProviderAdapter @Override public boolean goTo(Program gotoProgram, ProgramLocation location) { - if (!isConnected()) { if (program == null) { // Special Case: this 'disconnected' provider is waiting to be initialized diff --git a/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/FGProvider.java b/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/FGProvider.java index ba1362dde8..2eac2e26fd 100644 --- a/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/FGProvider.java +++ b/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/FGProvider.java @@ -4,9 +4,9 @@ * 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. @@ -15,7 +15,7 @@ */ package ghidra.app.plugin.core.functiongraph; -import static ghidra.framework.model.DomainObjectEvent.*; +import static ghidra.framework.model.DomainObjectEvent.RESTORED; import static ghidra.program.util.ProgramEvent.*; import java.awt.event.MouseEvent; @@ -243,8 +243,9 @@ public class FGProvider extends VisualGraphComponentProvider + * This will prime the clipboard such that a copy action will copy the given string. * * @param string the string to set */ @@ -354,9 +355,11 @@ public class FGProvider extends VisualGraphComponentProvider + * The UI is updated by the controller without this provider's knowledge. This call here is to + * signal that the provider needs to update its metadata. */ public void functionGraphDataChanged() { updateTitle(); @@ -480,8 +483,8 @@ public class FGProvider extends VisualGraphComponentProviderexternal to the function graph (e.g., - * when the user clicks in Ghidra's Listing window) + * Called when for location changes that are external to the function graph (e.g., when + * the user clicks in Ghidra's Listing window) * * @param newLocation the new location */ @@ -533,8 +536,7 @@ public class FGProvider extends VisualGraphComponentProviderand will zoom the graph such that it fits on the screen and - * is centered. + * Rebuilds the graph and will zoom the graph such that it fits on the screen and is + * centered. */ public void refreshAndResetPerspective() { refresh(false); @@ -643,8 +645,8 @@ public class FGProvider extends VisualGraphComponentProvider + * The CodeViewerService provides Diff with a listing, so where appropriate this navigatable + * will defer to the CodeViewerService navigatable. + * * @param diffPlugin the plugin for the Diff which can be used to obtain needed info. * @param navigatable navigatable that the CodeViewerService provides. */ @@ -179,7 +181,8 @@ class DiffNavigatable implements Navigatable { } @Override - public void removeHighlightProvider(ListingHighlightProvider highlightProvider, Program program) { + public void removeHighlightProvider(ListingHighlightProvider highlightProvider, + Program program) { // CodeViewerProvider handles the other listing (the Diff listing) highlights. navigatable.removeHighlightProvider(highlightProvider, program); } diff --git a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/duallisting/VTListingNavigator.java b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/duallisting/VTListingNavigator.java index 934c82ac9b..bf1a9103a6 100644 --- a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/duallisting/VTListingNavigator.java +++ b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/duallisting/VTListingNavigator.java @@ -4,9 +4,9 @@ * 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. diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/fieldpanel/FieldPanel.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/fieldpanel/FieldPanel.java index 0f6436b48c..2b9741c409 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/fieldpanel/FieldPanel.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/fieldpanel/FieldPanel.java @@ -15,7 +15,8 @@ */ package docking.widgets.fieldpanel; -import static docking.widgets.EventTrigger.*; +import static docking.widgets.EventTrigger.API_CALL; +import static docking.widgets.EventTrigger.INTERNAL_ONLY; import java.awt.*; import java.awt.event.*; @@ -347,6 +348,7 @@ public class FieldPanel extends JPanel /** * Returns true if the given field location is rendered on the screen; false if scrolled * offscreen + * * @param location the location * @return true if the location is on the screen */ @@ -689,8 +691,9 @@ public class FieldPanel extends JPanel } /** - * Returns the Field at the given x,y coordinates. Note the x,y must currently be visible on the - * screen or else this method will return null. + * Returns the Field at the given x,y coordinates. + *

+ * Note the x,y must currently be visible on the screen or else this method will return null. * * @param x the x mouse coordinate in the component. * @param y the y mouse coordinate in the component. @@ -841,8 +844,9 @@ public class FieldPanel extends JPanel } /** - * Sets the cursor on or off. When the cursor is turned off, there is no visible cursor - * displayed on the screen. + * Sets the cursor on or off. + *

+ * When the cursor is turned off, there is no visible cursor displayed on the screen. * * @param cursorOn true turns the cursor on, false turns it off. */ @@ -871,6 +875,7 @@ public class FieldPanel extends JPanel * @param fieldNum the field on the line to go to. * @param row the row in the field to go to. * @param col the column in the field to go to. + * @param trigger the cause of the go to * @param alwaysCenterCursor if true, centers cursor on screen. Otherwise, only centers cursor * if cursor is offscreen. */ @@ -945,8 +950,9 @@ public class FieldPanel extends JPanel } /** - * Returns a ViewerPosition object which contains the top of screen information. The - * ViewerPosition will have the index of the layout at the top of the screen and the yPos of + * Returns a ViewerPosition object which contains the top of screen information. + *

+ * The ViewerPosition will have the index of the layout at the top of the screen and the yPos of * that layout. For example, if the layout is completely displayed, yPos will be 0. If part of * the layout is off the top off the screen, then yPos will have a negative value (indicating * that it begins above the displayable part of the screen. @@ -962,8 +968,10 @@ public class FieldPanel extends JPanel /** * Scrolls the display to show the layout specified by index at the vertical position specified - * by yPos. Generally, the index will be layout at the top of the screen and the yPos will be - * <= 0, meaning the layout may be partially off the top of the screen. + * by yPos. + *

+ * Generally, the index will be layout at the top of the screen and the yPos will be <= 0, + * meaning the layout may be partially off the top of the screen. * * @param index the index of the layout to show at the top of the screen. * @param xPos the x position to set. @@ -1329,6 +1337,7 @@ public class FieldPanel extends JPanel /** * Finds the layout containing the given y position. + * * @param y the y location * @return the layout. */ diff --git a/Ghidra/Framework/Graph/src/main/java/ghidra/graph/featurette/VgSatelliteFeaturette.java b/Ghidra/Framework/Graph/src/main/java/ghidra/graph/featurette/VgSatelliteFeaturette.java index 0dda9713d9..e562ac76fb 100644 --- a/Ghidra/Framework/Graph/src/main/java/ghidra/graph/featurette/VgSatelliteFeaturette.java +++ b/Ghidra/Framework/Graph/src/main/java/ghidra/graph/featurette/VgSatelliteFeaturette.java @@ -172,11 +172,10 @@ public class VgSatelliteFeaturette