GP-5438: Fix 'Select All' and others in Dynamic Listing. (syncing needs follow-up work.)

This commit is contained in:
Dan 2025-04-01 12:48:30 +00:00
parent b319b3df7f
commit d7f63a9075
42 changed files with 432 additions and 358 deletions

View file

@ -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,8 +26,8 @@ import ghidra.program.util.ProgramLocation;
import ghidra.util.task.TaskMonitor;
/**
* A service that provides the ability to go to a particular address or location in the
* right-hand listing of the Diff.
* A service that provides the ability to go to a particular address or location in the right-hand
* listing of the Diff.
*/
public class DiffGoToService implements GoToService {
@ -36,10 +36,11 @@ public class DiffGoToService implements GoToService {
private GoToHelper helper;
/**
* Creates a service that provides the ability to go to a particular address or location
* in the right-hand listing of the Diff.
* @param goToService basic GoToService for the left-side listing that this will override
* so it can go to addresses and locations in the right-side listing.
* Creates a service that provides the ability to go to a particular address or location in the
* right-hand listing of the Diff.
*
* @param goToService basic GoToService for the left-side listing that this will override so it
* can go to addresses and locations in the right-side listing.
* @param diffPlugin the plugin which provides the Diff capability.
*/
public DiffGoToService(GoToService goToService, ProgramDiffPlugin diffPlugin) {
@ -171,12 +172,13 @@ public class DiffGoToService implements GoToService {
}
private void showProgramFailureStatus() {
diffPlugin.getTool().setStatusInfo(
"Can't navigate from the Diff program to another program.");
diffPlugin.getTool()
.setStatusInfo("Can't navigate from the Diff program to another program.");
}
/**
* Go to the specified program location in the right hand Diff listing.
*
* @param loc go to this location
* @return true if the listing went to the location.
*/
@ -196,6 +198,7 @@ public class DiffGoToService implements GoToService {
/**
* Go to the specified address in the right hand Diff listing.
*
* @param addr go to this address
* @return true if the listing went to the address.
*/
@ -210,12 +213,11 @@ public class DiffGoToService implements GoToService {
}
/**
* Saving the first program's location (the left listing) in the navigation history.
* The second program's location (the right listing) isn't saved since the navigation is
* relative to a program in the tool's main listing. Also, if the second program's
* locations were saved in the history, their program wouldn't be found and would cause
* errors when restarting the application with the tool and primary program displayed, but
* no Diff program.
* Saving the first program's location (the left listing) in the navigation history. The second
* program's location (the right listing) isn't saved since the navigation is relative to a
* program in the tool's main listing. Also, if the second program's locations were saved in the
* history, their program wouldn't be found and would cause errors when restarting the
* application with the tool and primary program displayed, but no Diff program.
*/
private void saveLocation() {
Program firstProgram = diffPlugin.getFirstProgram();

View file

@ -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.
@ -27,9 +27,8 @@ import ghidra.util.datastruct.WeakDataStructureFactory;
import ghidra.util.datastruct.WeakSet;
/**
* This is a navigatable for use by the right-hand listing of the Diff.
* It should navigate within the Diff's listing, which would then reposition
* the CodeViewer's listing.
* This is a navigatable for use by the right-hand listing of the Diff. It should navigate within
* the Diff's listing, which would then reposition the CodeViewer's listing.
*/
class DiffNavigatable implements Navigatable {
@ -40,8 +39,11 @@ class DiffNavigatable implements Navigatable {
WeakDataStructureFactory.createCopyOnWriteWeakSet();
/**
* The navigatable for the Diff. The CodeViewerService provides Diff with a listing,
* so where appropriate this navigatable will defer to the CodeViewerService navigatable.
* The navigatable for the Diff.
* <p>
* 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);
}