mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 10:19:23 +02:00
GP-1433: Refactor Magin and Overview Providers. Add marker margin and overview to dynamic listings.
This commit is contained in:
parent
c0b644b8b9
commit
25dd729323
23 changed files with 1264 additions and 875 deletions
|
@ -65,12 +65,11 @@ import ghidra.util.task.*;
|
|||
import resources.ResourceManager;
|
||||
|
||||
/**
|
||||
* Plugin that shows the differences between two programs, and allows the
|
||||
* user to apply differences to the currently open program. This allows only one
|
||||
* tabbed program to display a second program (possibly with an active Diff).
|
||||
* It allows the active program to change without losing the current Diff or
|
||||
* second program that is opened. De-activation of the first program for the Diff
|
||||
* will result in termination of the Diff or the Diff can be closed directly by the user.
|
||||
* Plugin that shows the differences between two programs, and allows the user to apply differences
|
||||
* to the currently open program. This allows only one tabbed program to display a second program
|
||||
* (possibly with an active Diff). It allows the active program to change without losing the current
|
||||
* Diff or second program that is opened. De-activation of the first program for the Diff will
|
||||
* result in termination of the Diff or the Diff can be closed directly by the user.
|
||||
*/
|
||||
//@formatter:off
|
||||
@PluginInfo(
|
||||
|
@ -151,6 +150,7 @@ public class ProgramDiffPlugin extends ProgramPlugin
|
|||
|
||||
/**
|
||||
* Creates the plugin for indicating program differences to the user.
|
||||
*
|
||||
* @param tool the tool that owns this plugin.
|
||||
*/
|
||||
public ProgramDiffPlugin(PluginTool tool) {
|
||||
|
@ -282,7 +282,7 @@ public class ProgramDiffPlugin extends ProgramPlugin
|
|||
AddressSet p1AddressSetAsP2 =
|
||||
DiffUtility.getCompatibleAddressSet(p1AddressSet, secondaryDiffProgram);
|
||||
AddressIndexMap p2IndexMap = new AddressIndexMap(p1AddressSetAsP2);
|
||||
markerManager.getOverviewProvider().setAddressIndexMap(p2IndexMap);
|
||||
markerManager.getOverviewProvider().setProgram(secondaryDiffProgram, p2IndexMap);
|
||||
fp.setBackgroundColorModel(
|
||||
new MarkerServiceBackgroundColorModel(markerManager, p2IndexMap));
|
||||
|
||||
|
@ -479,8 +479,9 @@ public class ProgramDiffPlugin extends ProgramPlugin
|
|||
}
|
||||
|
||||
/**
|
||||
* Called when a program gets closed.
|
||||
* If the closed program is the first program of the Diff then we need to close the second program.
|
||||
* Called when a program gets closed. If the closed program is the first program of the Diff
|
||||
* then we need to close the second program.
|
||||
*
|
||||
* @param program
|
||||
*/
|
||||
@Override
|
||||
|
@ -719,8 +720,8 @@ public class ProgramDiffPlugin extends ProgramPlugin
|
|||
/**
|
||||
* Callback when user changes selection in the program2 diff panel.
|
||||
*
|
||||
* Note: A P2 selection is handed to this method when a selection is made in the diff
|
||||
* listing which displays P2.
|
||||
* Note: A P2 selection is handed to this method when a selection is made in the diff listing
|
||||
* which displays P2.
|
||||
*/
|
||||
@Override
|
||||
public void programSelectionChanged(ProgramSelection newP2Selection) {
|
||||
|
@ -838,8 +839,9 @@ public class ProgramDiffPlugin extends ProgramPlugin
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the highlight based on the current program differences, but
|
||||
* do not set the highlight for set of addresses to be ignored.
|
||||
* Set the highlight based on the current program differences, but do not set the highlight for
|
||||
* set of addresses to be ignored.
|
||||
*
|
||||
* @param ignoreAddressSet the set of addresses to ignore.
|
||||
*/
|
||||
private void setDiffHighlight() {
|
||||
|
@ -849,7 +851,7 @@ public class ProgramDiffPlugin extends ProgramPlugin
|
|||
|
||||
AddressSetView p1DiffSet = null;
|
||||
try {
|
||||
p1DiffSet = diffControl.getFilteredDifferences(TaskMonitorAdapter.DUMMY_MONITOR);
|
||||
p1DiffSet = diffControl.getFilteredDifferences(TaskMonitor.DUMMY);
|
||||
}
|
||||
catch (CancelledException e) {
|
||||
// Shouldn't get this, since using a DUMMY_MONITOR.
|
||||
|
@ -940,16 +942,17 @@ public class ProgramDiffPlugin extends ProgramPlugin
|
|||
}
|
||||
|
||||
/**
|
||||
* Computes the differences between program1 and program2 that are displayed
|
||||
* in the browser using the current Limiting set. It allows the user to specify the Diff settings to use.
|
||||
* Computes the differences between program1 and program2 that are displayed in the browser
|
||||
* using the current Limiting set. It allows the user to specify the Diff settings to use.
|
||||
*/
|
||||
void diff() {
|
||||
diff(createLimitingSet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the differences between program1 and program2 that are displayed
|
||||
* in the browser. It allows the user to specify the Diff settings to use.
|
||||
* Computes the differences between program1 and program2 that are displayed in the browser. It
|
||||
* allows the user to specify the Diff settings to use.
|
||||
*
|
||||
* @param p1LimitSet an address set to use to limit the extent of the Diff.
|
||||
*/
|
||||
void diff(AddressSetView p1LimitSet) {
|
||||
|
@ -1055,7 +1058,6 @@ public class ProgramDiffPlugin extends ProgramPlugin
|
|||
setProgram2Selection(p2Selection);
|
||||
clearDiff();
|
||||
if (secondaryDiffProgram != null) {
|
||||
markerManager.setProgram(null);
|
||||
Iterator<BookmarkNavigator> iter = bookmarkMap.values().iterator();
|
||||
while (iter.hasNext()) {
|
||||
BookmarkNavigator nav = iter.next();
|
||||
|
@ -1171,10 +1173,11 @@ public class ProgramDiffPlugin extends ProgramPlugin
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the first program for the current Diff.
|
||||
* <br><b>Note</b>: This may not be the currently active program.
|
||||
* @return the Diff's first program or null if don't currently have a
|
||||
* second program associated for a Diff.
|
||||
* Get the first program for the current Diff. <br>
|
||||
* <b>Note</b>: This may not be the currently active program.
|
||||
*
|
||||
* @return the Diff's first program or null if don't currently have a second program associated
|
||||
* for a Diff.
|
||||
*/
|
||||
Program getFirstProgram() {
|
||||
return primaryProgram;
|
||||
|
@ -1182,8 +1185,9 @@ public class ProgramDiffPlugin extends ProgramPlugin
|
|||
|
||||
/**
|
||||
* Get the second program for the current Diff.
|
||||
* @return the Diff's second program or null if don't currently have a
|
||||
* second program associated for a Diff.
|
||||
*
|
||||
* @return the Diff's second program or null if don't currently have a second program associated
|
||||
* for a Diff.
|
||||
*/
|
||||
Program getSecondProgram() {
|
||||
return secondaryDiffProgram;
|
||||
|
@ -1238,10 +1242,11 @@ public class ProgramDiffPlugin extends ProgramPlugin
|
|||
* Gets the address set where detailed differences will be determined for details at the
|
||||
* indicated address. An address set is returned since the indicated address may be in different
|
||||
* sized code units in each of the two programs.
|
||||
*
|
||||
* @param p1Address the current address from program1 where details are desired.
|
||||
* @return the address set for code units containing that address within the programs being
|
||||
* compared to determine differences.
|
||||
* Otherwise null if a diff of two programs isn't being performed.
|
||||
* compared to determine differences. Otherwise null if a diff of two programs isn't
|
||||
* being performed.
|
||||
*/
|
||||
AddressSetView getDetailsAddressSet(Address p1Address) {
|
||||
if (diffDetails != null) {
|
||||
|
@ -1598,7 +1603,6 @@ public class ProgramDiffPlugin extends ProgramPlugin
|
|||
finally {
|
||||
settingLocation = false;
|
||||
}
|
||||
markerManager.setProgram(secondaryDiffProgram);
|
||||
setupBookmarkNavigators();
|
||||
|
||||
sameProgramContext = ProgramMemoryComparator.sameProgramContextRegisterNames(primaryProgram,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue