mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 18:29:37 +02:00
Merge remote-tracking branch
'origin/dev747368_GT-2698_hostile_html_whack_a_mole_UI_stuff' Conflicts: Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AnalysisPanel.java
This commit is contained in:
commit
45222ad4d3
423 changed files with 6234 additions and 5902 deletions
|
@ -28,6 +28,7 @@ import ghidra.app.services.CodeViewerService;
|
|||
import ghidra.app.util.HelpTopics;
|
||||
import ghidra.framework.plugintool.util.ToolConstants;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.util.HTMLUtilities;
|
||||
import ghidra.util.HelpLocation;
|
||||
import resources.ResourceManager;
|
||||
|
||||
|
@ -172,9 +173,10 @@ class DiffActionManager {
|
|||
String secondName = secondProgram.getName();
|
||||
|
||||
//@formatter:off
|
||||
openCloseProgram2Action.setDescription("<html><center>Close Diff View</center><br>" +
|
||||
"Current diff: " +
|
||||
"<b>"+firstName+"</b> to <b>" +secondName+"</b>");
|
||||
openCloseProgram2Action.setDescription(
|
||||
"<html><center>Close Diff View</center><br>" +
|
||||
"Current diff: " +
|
||||
"<b>"+HTMLUtilities.escapeHTML(firstName)+"</b> to <b>" +HTMLUtilities.escapeHTML(secondName)+"</b>");
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
|
@ -280,9 +282,8 @@ class DiffActionManager {
|
|||
}
|
||||
};
|
||||
icon = ResourceManager.loadImage("images/eraser_arrow16.png");
|
||||
ignoreDiffsAction.setPopupMenuData(
|
||||
new MenuData(new String[] { "Ignore Selection and Goto Next Difference" }, icon,
|
||||
GROUP));
|
||||
ignoreDiffsAction.setPopupMenuData(new MenuData(
|
||||
new String[] { "Ignore Selection and Goto Next Difference" }, icon, GROUP));
|
||||
ignoreDiffsAction.setDescription(
|
||||
"Ignores the selected program differences and moves the cursor to the next difference.");
|
||||
ignoreDiffsAction.setToolBarData(new ToolBarData(icon, GROUP));
|
||||
|
|
|
@ -26,6 +26,8 @@ import javax.swing.*;
|
|||
|
||||
import docking.WindowPosition;
|
||||
import docking.widgets.VariableHeightPanel;
|
||||
import docking.widgets.combobox.GComboBox;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import ghidra.app.plugin.core.diff.DiffApplySettingsOptionManager.*;
|
||||
import ghidra.framework.plugintool.ComponentProviderAdapter;
|
||||
import ghidra.framework.plugintool.Plugin;
|
||||
|
@ -259,12 +261,12 @@ public class DiffApplySettingsProvider extends ComponentProviderAdapter {
|
|||
createChoices();
|
||||
VariableHeightPanel panel = new VariableHeightPanel(false, 10, 3);
|
||||
|
||||
panel.setToolTipText(
|
||||
"<HTML>" + "For each difference type, select whether to ignore, replace, or merge." +
|
||||
"<BR>  <B>Ignore</B> - don't apply this type of difference." +
|
||||
"<BR>  <B>Replace</B> - replace the difference type with the one from program 2." +
|
||||
"<BR>  <B>Merge</B> - merge the difference type from program 2 with what's there." +
|
||||
"</HTML>");
|
||||
panel.setToolTipText("<HTML>" +
|
||||
"For each difference type, select whether to ignore, replace, or merge." +
|
||||
"<BR>  <B>Ignore</B> - don't apply this type of difference." +
|
||||
"<BR>  <B>Replace</B> - replace the difference type with the one from program 2." +
|
||||
"<BR>  <B>Merge</B> - merge the difference type from program 2 with what's there." +
|
||||
"</HTML>");
|
||||
for (Choice choice : choices) {
|
||||
panel.add(choice);
|
||||
}
|
||||
|
@ -404,14 +406,14 @@ public class DiffApplySettingsProvider extends ComponentProviderAdapter {
|
|||
|
||||
protected void init() {
|
||||
applyCB =
|
||||
new JComboBox<>(allowMerge ? DiffApplySettingsOptionManager.MERGE_CHOICE.values()
|
||||
new GComboBox<>(allowMerge ? DiffApplySettingsOptionManager.MERGE_CHOICE.values()
|
||||
: DiffApplySettingsOptionManager.REPLACE_CHOICE.values());
|
||||
applyCB.setName(type + " Diff Apply CB");
|
||||
String typeName = type;
|
||||
if (typeName.endsWith(" Comments")) {
|
||||
typeName = "Comments, " + typeName.substring(0, typeName.length() - 9);
|
||||
}
|
||||
label = new JLabel(" " + typeName + " ");
|
||||
label = new GDLabel(" " + typeName + " ");
|
||||
label.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
add(applyCB, BorderLayout.EAST);
|
||||
add(label, BorderLayout.CENTER);
|
||||
|
@ -457,9 +459,9 @@ public class DiffApplySettingsProvider extends ComponentProviderAdapter {
|
|||
|
||||
@Override
|
||||
protected void init() {
|
||||
applyCB = new JComboBox<>(DiffApplySettingsOptionManager.SYMBOL_MERGE_CHOICE.values());
|
||||
applyCB = new GComboBox<>(DiffApplySettingsOptionManager.SYMBOL_MERGE_CHOICE.values());
|
||||
applyCB.setName(type + " Diff Apply CB");
|
||||
label = new JLabel(" " + type + " ");
|
||||
label = new GDLabel(" " + type + " ");
|
||||
label.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
add(applyCB, BorderLayout.EAST);
|
||||
add(label, BorderLayout.CENTER);
|
||||
|
|
|
@ -28,6 +28,7 @@ import docking.ActionContext;
|
|||
import docking.WindowPosition;
|
||||
import docking.action.DockingAction;
|
||||
import docking.action.ToolBarData;
|
||||
import docking.widgets.checkbox.GCheckBox;
|
||||
import ghidra.app.util.HelpTopics;
|
||||
import ghidra.framework.plugintool.ComponentProviderAdapter;
|
||||
import ghidra.framework.plugintool.Plugin;
|
||||
|
@ -131,7 +132,7 @@ public class DiffDetailsProvider extends ComponentProviderAdapter {
|
|||
*/
|
||||
private void createAutoUpdateCheckBox() {
|
||||
|
||||
autoUpdateCB = new JCheckBox("Automatically Update Details", false);
|
||||
autoUpdateCB = new GCheckBox("Automatically Update Details", false);
|
||||
autoUpdateCB.setName(AUTO_UPDATE_CHECK_BOX);
|
||||
autoUpdateCB.addActionListener(e -> {
|
||||
autoUpdate = autoUpdateCB.isSelected();
|
||||
|
@ -147,7 +148,7 @@ public class DiffDetailsProvider extends ComponentProviderAdapter {
|
|||
*/
|
||||
private void createFilterDiffsCheckBox() {
|
||||
|
||||
filterDiffsCB = new JCheckBox("Only Show Expected Difference Types", false);
|
||||
filterDiffsCB = new GCheckBox("Only Show Expected Difference Types", false);
|
||||
filterDiffsCB.setName(FILTER_DIFFS_CHECK_BOX);
|
||||
filterDiffsCB.addActionListener(e -> {
|
||||
filterDiffs = filterDiffsCB.isSelected();
|
||||
|
|
|
@ -15,12 +15,6 @@
|
|||
*/
|
||||
package ghidra.app.plugin.core.diff;
|
||||
|
||||
import ghidra.program.model.address.*;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.util.ProgramDiffFilter;
|
||||
import ghidra.program.util.ProgramMemoryComparator;
|
||||
import ghidra.util.HelpLocation;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.ArrayList;
|
||||
|
@ -32,6 +26,12 @@ import javax.swing.border.TitledBorder;
|
|||
import docking.DialogComponentProvider;
|
||||
import docking.DockingUtils;
|
||||
import docking.ToolTipManager;
|
||||
import docking.widgets.checkbox.GCheckBox;
|
||||
import ghidra.program.model.address.*;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.util.ProgramDiffFilter;
|
||||
import ghidra.program.util.ProgramMemoryComparator;
|
||||
import ghidra.util.HelpLocation;
|
||||
|
||||
/**
|
||||
* The ExecuteDiffDialog is used whenever initiating a Program Diff.
|
||||
|
@ -70,7 +70,7 @@ public class ExecuteDiffDialog extends DialogComponentProvider {
|
|||
|
||||
private ProgramDiffFilter diffFilter;
|
||||
private JPanel diffPanel;
|
||||
private ArrayList<ActionListener> listenerList = new ArrayList<ActionListener>();
|
||||
private ArrayList<ActionListener> listenerList = new ArrayList<>();
|
||||
private boolean limitToSelection;
|
||||
private AddressSetView pgm1MemorySet;
|
||||
private AddressSetView pgm1SelectionSet;
|
||||
|
@ -178,16 +178,13 @@ public class ExecuteDiffDialog extends DialogComponentProvider {
|
|||
private JPanel createLimitPanel() {
|
||||
JPanel panel = new JPanel();
|
||||
|
||||
limitToSelectionCB = new JCheckBox("Limit To Selection");
|
||||
limitToSelectionCB = new GCheckBox("Limit To Selection");
|
||||
limitToSelectionCB.setName("LimitToSelectionDiffCB");
|
||||
ToolTipManager.setToolTipText(limitToSelectionCB, "Limits the Diff to the selection.");
|
||||
limitToSelectionCB.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent ev) {
|
||||
limitToSelection = limitToSelectionCB.isSelected();
|
||||
updateDiffSetText();
|
||||
clearStatusText();
|
||||
}
|
||||
limitToSelectionCB.addActionListener(ev -> {
|
||||
limitToSelection = limitToSelectionCB.isSelected();
|
||||
updateDiffSetText();
|
||||
clearStatusText();
|
||||
});
|
||||
|
||||
panel.add(limitToSelectionCB);
|
||||
|
@ -201,8 +198,8 @@ public class ExecuteDiffDialog extends DialogComponentProvider {
|
|||
private JPanel createDiffFilterPanel() {
|
||||
JPanel checkBoxPanel = new JPanel();
|
||||
ToolTipManager.setToolTipText(checkBoxPanel,
|
||||
"Check the types of differences between the two "
|
||||
+ "programs that you want detected and highlighted.");
|
||||
"Check the types of differences between the two " +
|
||||
"programs that you want detected and highlighted.");
|
||||
|
||||
createBytesCheckBox();
|
||||
createLabelsCheckBox();
|
||||
|
@ -239,136 +236,109 @@ public class ExecuteDiffDialog extends DialogComponentProvider {
|
|||
}
|
||||
|
||||
private void createBytesCheckBox() {
|
||||
diffBytesCB = new JCheckBox("Bytes", diffBytes);
|
||||
diffBytesCB = new GCheckBox("Bytes", diffBytes);
|
||||
diffBytesCB.setName("BytesDiffCB");
|
||||
ToolTipManager.setToolTipText(diffBytesCB, "Highlight byte differences.");
|
||||
diffBytesCB.addItemListener(new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent event) {
|
||||
diffBytes = (event.getStateChange() == ItemEvent.SELECTED);
|
||||
diffFilter.setFilter(ProgramDiffFilter.BYTE_DIFFS, diffBytes);
|
||||
clearStatusText();
|
||||
}
|
||||
diffBytesCB.addItemListener(event -> {
|
||||
diffBytes = (event.getStateChange() == ItemEvent.SELECTED);
|
||||
diffFilter.setFilter(ProgramDiffFilter.BYTE_DIFFS, diffBytes);
|
||||
clearStatusText();
|
||||
});
|
||||
}
|
||||
|
||||
private void createLabelsCheckBox() {
|
||||
diffLabelsCB = new JCheckBox("Labels", diffLabels);
|
||||
diffLabelsCB = new GCheckBox("Labels", diffLabels);
|
||||
diffLabelsCB.setName("LabelsDiffCB");
|
||||
ToolTipManager.setToolTipText(diffLabelsCB, "Highlight label differences.");
|
||||
diffLabelsCB.addItemListener(new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent event) {
|
||||
diffLabels = (event.getStateChange() == ItemEvent.SELECTED);
|
||||
diffFilter.setFilter(ProgramDiffFilter.SYMBOL_DIFFS, diffLabels);
|
||||
clearStatusText();
|
||||
}
|
||||
diffLabelsCB.addItemListener(event -> {
|
||||
diffLabels = (event.getStateChange() == ItemEvent.SELECTED);
|
||||
diffFilter.setFilter(ProgramDiffFilter.SYMBOL_DIFFS, diffLabels);
|
||||
clearStatusText();
|
||||
});
|
||||
}
|
||||
|
||||
private void createCodeUnitsCheckBox() {
|
||||
diffCodeUnitsCB = new JCheckBox("Code Units", diffCodeUnits);
|
||||
diffCodeUnitsCB = new GCheckBox("Code Units", diffCodeUnits);
|
||||
diffCodeUnitsCB.setName("CodeUnitsDiffCB");
|
||||
ToolTipManager.setToolTipText(diffCodeUnitsCB, "Highlight the instruction, data, "
|
||||
+ "and equate differences.");
|
||||
diffCodeUnitsCB.addItemListener(new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent event) {
|
||||
diffCodeUnits = (event.getStateChange() == ItemEvent.SELECTED);
|
||||
diffFilter.setFilter(ProgramDiffFilter.CODE_UNIT_DIFFS, diffCodeUnits);
|
||||
diffFilter.setFilter(ProgramDiffFilter.EQUATE_DIFFS, diffCodeUnits);
|
||||
clearStatusText();
|
||||
}
|
||||
ToolTipManager.setToolTipText(diffCodeUnitsCB,
|
||||
"Highlight the instruction, data, " + "and equate differences.");
|
||||
diffCodeUnitsCB.addItemListener(event -> {
|
||||
diffCodeUnits = (event.getStateChange() == ItemEvent.SELECTED);
|
||||
diffFilter.setFilter(ProgramDiffFilter.CODE_UNIT_DIFFS, diffCodeUnits);
|
||||
diffFilter.setFilter(ProgramDiffFilter.EQUATE_DIFFS, diffCodeUnits);
|
||||
clearStatusText();
|
||||
});
|
||||
}
|
||||
|
||||
private void createReferencesCheckBox() {
|
||||
diffReferencesCB = new JCheckBox("References", diffReferences);
|
||||
diffReferencesCB = new GCheckBox("References", diffReferences);
|
||||
diffReferencesCB.setName("ReferencesDiffCB");
|
||||
ToolTipManager.setToolTipText(diffReferencesCB, "Highlight the reference differences.");
|
||||
diffReferencesCB.addItemListener(new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent event) {
|
||||
diffReferences = (event.getStateChange() == ItemEvent.SELECTED);
|
||||
diffFilter.setFilter(ProgramDiffFilter.REFERENCE_DIFFS, diffReferences);
|
||||
clearStatusText();
|
||||
}
|
||||
diffReferencesCB.addItemListener(event -> {
|
||||
diffReferences = (event.getStateChange() == ItemEvent.SELECTED);
|
||||
diffFilter.setFilter(ProgramDiffFilter.REFERENCE_DIFFS, diffReferences);
|
||||
clearStatusText();
|
||||
});
|
||||
}
|
||||
|
||||
private void createProgramContextCheckBox() {
|
||||
diffProgramContextCB = new JCheckBox("Program Context", diffProgramContext);
|
||||
diffProgramContextCB = new GCheckBox("Program Context", diffProgramContext);
|
||||
diffProgramContextCB.setName("ProgramContextDiffCB");
|
||||
ToolTipManager.setToolTipText(diffProgramContextCB,
|
||||
"Highlight the program context register differences.");
|
||||
diffProgramContextCB.addItemListener(new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent event) {
|
||||
diffProgramContext = (event.getStateChange() == ItemEvent.SELECTED);
|
||||
diffFilter.setFilter(ProgramDiffFilter.PROGRAM_CONTEXT_DIFFS, diffProgramContext);
|
||||
clearStatusText();
|
||||
}
|
||||
diffProgramContextCB.addItemListener(event -> {
|
||||
diffProgramContext = (event.getStateChange() == ItemEvent.SELECTED);
|
||||
diffFilter.setFilter(ProgramDiffFilter.PROGRAM_CONTEXT_DIFFS, diffProgramContext);
|
||||
clearStatusText();
|
||||
});
|
||||
}
|
||||
|
||||
private void createCommentsCheckBox() {
|
||||
diffCommentsCB = new JCheckBox("Comments", diffComments);
|
||||
diffCommentsCB = new GCheckBox("Comments", diffComments);
|
||||
diffCommentsCB.setName("CommentsDiffCB");
|
||||
ToolTipManager.setToolTipText(diffCommentsCB, "Highlight comment differences.");
|
||||
diffCommentsCB.addItemListener(new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent event) {
|
||||
diffComments = (event.getStateChange() == ItemEvent.SELECTED);
|
||||
diffFilter.setFilter(ProgramDiffFilter.COMMENT_DIFFS, diffComments);
|
||||
clearStatusText();
|
||||
}
|
||||
diffCommentsCB.addItemListener(event -> {
|
||||
diffComments = (event.getStateChange() == ItemEvent.SELECTED);
|
||||
diffFilter.setFilter(ProgramDiffFilter.COMMENT_DIFFS, diffComments);
|
||||
clearStatusText();
|
||||
});
|
||||
}
|
||||
|
||||
private void createBookmarksCheckBox() {
|
||||
diffBookmarksCB = new JCheckBox("Bookmarks", diffBookmarks);
|
||||
diffBookmarksCB = new GCheckBox("Bookmarks", diffBookmarks);
|
||||
diffBookmarksCB.setName("BookmarksDiffCB");
|
||||
ToolTipManager.setToolTipText(diffBookmarksCB, "Highlight bookmark differences. "
|
||||
+ "(for example, bookmark differences)");
|
||||
diffBookmarksCB.addItemListener(new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent event) {
|
||||
diffBookmarks = (event.getStateChange() == ItemEvent.SELECTED);
|
||||
diffFilter.setFilter(ProgramDiffFilter.BOOKMARK_DIFFS, diffBookmarks);
|
||||
clearStatusText();
|
||||
}
|
||||
ToolTipManager.setToolTipText(diffBookmarksCB,
|
||||
"Highlight bookmark differences. " + "(for example, bookmark differences)");
|
||||
diffBookmarksCB.addItemListener(event -> {
|
||||
diffBookmarks = (event.getStateChange() == ItemEvent.SELECTED);
|
||||
diffFilter.setFilter(ProgramDiffFilter.BOOKMARK_DIFFS, diffBookmarks);
|
||||
clearStatusText();
|
||||
});
|
||||
}
|
||||
|
||||
private void createPropertiesCheckBox() {
|
||||
diffPropertiesCB = new JCheckBox("Properties", diffProperties);
|
||||
diffPropertiesCB = new GCheckBox("Properties", diffProperties);
|
||||
diffPropertiesCB.setName("PropertiesDiffCB");
|
||||
ToolTipManager.setToolTipText(diffPropertiesCB,
|
||||
"Highlight user defined property differences. "
|
||||
+ "(for example, Format (space) differences)");
|
||||
diffPropertiesCB.addItemListener(new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent event) {
|
||||
diffProperties = (event.getStateChange() == ItemEvent.SELECTED);
|
||||
diffFilter.setFilter(ProgramDiffFilter.USER_DEFINED_DIFFS, diffProperties);
|
||||
clearStatusText();
|
||||
}
|
||||
"Highlight user defined property differences. " +
|
||||
"(for example, Format (space) differences)");
|
||||
diffPropertiesCB.addItemListener(event -> {
|
||||
diffProperties = (event.getStateChange() == ItemEvent.SELECTED);
|
||||
diffFilter.setFilter(ProgramDiffFilter.USER_DEFINED_DIFFS, diffProperties);
|
||||
clearStatusText();
|
||||
});
|
||||
}
|
||||
|
||||
private void createFunctionsCheckBox() {
|
||||
diffFunctionsCB = new JCheckBox("Functions", diffFunctions);
|
||||
diffFunctionsCB = new GCheckBox("Functions", diffFunctions);
|
||||
diffFunctionsCB.setName("FunctionsDiffCB");
|
||||
ToolTipManager.setToolTipText(diffFunctionsCB, "Highlight function differences.");
|
||||
diffFunctionsCB.addItemListener(new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent event) {
|
||||
diffFunctions = (event.getStateChange() == ItemEvent.SELECTED);
|
||||
// Functions check box controls both functions and function tags.
|
||||
diffFilter.setFilter(ProgramDiffFilter.FUNCTION_DIFFS, diffFunctions);
|
||||
diffFilter.setFilter(ProgramDiffFilter.FUNCTION_TAG_DIFFS, diffFunctions);
|
||||
clearStatusText();
|
||||
}
|
||||
diffFunctionsCB.addItemListener(event -> {
|
||||
diffFunctions = (event.getStateChange() == ItemEvent.SELECTED);
|
||||
// Functions check box controls both functions and function tags.
|
||||
diffFilter.setFilter(ProgramDiffFilter.FUNCTION_DIFFS, diffFunctions);
|
||||
diffFilter.setFilter(ProgramDiffFilter.FUNCTION_TAG_DIFFS, diffFunctions);
|
||||
clearStatusText();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -730,14 +730,14 @@ public class DiffTestAdapter extends AbstractGhidraHeadedIntegrationTest {
|
|||
performAction(action);
|
||||
}
|
||||
|
||||
Component getComponentOfType(Container container, Class<?> componentClass) {
|
||||
<T extends Component> T getComponentOfType(Container container, Class<T> componentClass) {
|
||||
Component[] comps = container.getComponents();
|
||||
for (Component element : comps) {
|
||||
if (element.getClass().isAssignableFrom(componentClass)) {
|
||||
return element;
|
||||
if (componentClass.isInstance(element)) {
|
||||
return componentClass.cast(element);
|
||||
}
|
||||
else if (element instanceof Container) {
|
||||
Component subComp = getComponentOfType((Container) element, componentClass);
|
||||
T subComp = getComponentOfType((Container) element, componentClass);
|
||||
if (subComp != null) {
|
||||
return subComp;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue