mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-25 05:32:14 +00: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
@ -24,6 +24,7 @@ import javax.swing.*;
|
||||
|
||||
import docking.ActionContext;
|
||||
import docking.action.*;
|
||||
import docking.widgets.checkbox.GCheckBox;
|
||||
import docking.widgets.filechooser.GhidraFileChooserPanel;
|
||||
import docking.widgets.table.GFilterTable;
|
||||
import ghidra.framework.options.OptionsChangeListener;
|
||||
@ -47,7 +48,7 @@ public class SampleTableProvider extends ComponentProviderAdapter implements Opt
|
||||
private SampleTableModel model;
|
||||
|
||||
private List<FunctionAlgorithm> discoveredAlgorithms;
|
||||
private JCheckBox[] checkBoxes;
|
||||
private GCheckBox[] checkBoxes;
|
||||
|
||||
private GhidraFileChooserPanel fileChooserPanel;
|
||||
|
||||
@ -94,9 +95,9 @@ public class SampleTableProvider extends ComponentProviderAdapter implements Opt
|
||||
|
||||
JPanel checkBoxPanel = new JPanel(new GridLayout(0, 1));
|
||||
checkBoxPanel.setBorder(BorderFactory.createTitledBorder("Discovered Algorithms"));
|
||||
checkBoxes = new JCheckBox[discoveredAlgorithms.size()];
|
||||
checkBoxes = new GCheckBox[discoveredAlgorithms.size()];
|
||||
for (int i = 0; i < discoveredAlgorithms.size(); i++) {
|
||||
checkBoxes[i] = new JCheckBox(discoveredAlgorithms.get(i).getName());
|
||||
checkBoxes[i] = new GCheckBox(discoveredAlgorithms.get(i).getName());
|
||||
checkBoxPanel.add(checkBoxes[i]);
|
||||
}
|
||||
|
||||
@ -162,7 +163,7 @@ public class SampleTableProvider extends ComponentProviderAdapter implements Opt
|
||||
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
buffer.append("Writing the following objects to file: ");
|
||||
buffer.append(fileChooserPanel.getFileName());
|
||||
buffer.append(HTMLUtilities.escapeHTML(fileChooserPanel.getFileName()));
|
||||
|
||||
List<FunctionStatsRowObject> selectedObjects = filterTable.getSelectedRowObjects();
|
||||
for (FunctionStatsRowObject stats : selectedObjects) {
|
||||
|
@ -35,6 +35,9 @@ import docking.action.ToolBarData;
|
||||
import docking.menu.ActionState;
|
||||
import docking.menu.MultiStateDockingAction;
|
||||
import docking.widgets.*;
|
||||
import docking.widgets.button.GRadioButton;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import docking.widgets.label.GLabel;
|
||||
import ghidra.examples.graph.layout.SampleGraphPluginDependencyLayoutProvider;
|
||||
import ghidra.framework.plugintool.*;
|
||||
import ghidra.graph.job.FilterVerticesJob;
|
||||
@ -146,7 +149,7 @@ public class SampleGraphProvider extends ComponentProviderAdapter {
|
||||
|
||||
JPanel panel = new JPanel();
|
||||
panel.setLayout(new BoxLayout(panel, BoxLayout.LINE_AXIS));
|
||||
JLabel label = new JLabel("Vertex Filter: ");
|
||||
JLabel label = new GDLabel("Vertex Filter: ");
|
||||
label.setToolTipText(
|
||||
"Vertices with names matching the filter will remain, along with connected vertices");
|
||||
panel.add(label);
|
||||
@ -187,9 +190,9 @@ public class SampleGraphProvider extends ComponentProviderAdapter {
|
||||
//
|
||||
// How should we display the filtered-out vertices?
|
||||
//
|
||||
fadedButton = new JRadioButton("Faded");
|
||||
fadedButton = new GRadioButton("Faded");
|
||||
fadedButton.setToolTipText("Filtered vertices remain in the graph, but are grayed-out");
|
||||
removedButton = new JRadioButton("Removed");
|
||||
removedButton = new GRadioButton("Removed");
|
||||
removedButton.setToolTipText("Filtered vertices are removed from the graph");
|
||||
|
||||
ButtonGroup group = new ButtonGroup();
|
||||
@ -198,7 +201,7 @@ public class SampleGraphProvider extends ComponentProviderAdapter {
|
||||
fadedButton.setSelected(true);
|
||||
|
||||
JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||
panel.add(new JLabel("Filtered Display: "));
|
||||
panel.add(new GLabel("Filtered Display: "));
|
||||
panel.add(fadedButton);
|
||||
panel.add(removedButton);
|
||||
return panel;
|
||||
@ -207,7 +210,7 @@ public class SampleGraphProvider extends ComponentProviderAdapter {
|
||||
private void installTooltipProvider() {
|
||||
|
||||
VertexTooltipProvider<SampleVertex, SampleEdge> tooltipProvider =
|
||||
new VertexTooltipProvider<SampleVertex, SampleEdge>() {
|
||||
new VertexTooltipProvider<>() {
|
||||
|
||||
@Override
|
||||
public JComponent getTooltip(SampleVertex v) {
|
||||
@ -342,8 +345,7 @@ public class SampleGraphProvider extends ComponentProviderAdapter {
|
||||
private void addLayoutAction() {
|
||||
|
||||
MultiStateDockingAction<LayoutProvider<SampleVertex, SampleEdge, SampleGraph>> layoutAction =
|
||||
new MultiStateDockingAction<LayoutProvider<SampleVertex, SampleEdge, SampleGraph>>(
|
||||
RELAYOUT_GRAPH_ACTION_NAME, plugin.getName()) {
|
||||
new MultiStateDockingAction<>(RELAYOUT_GRAPH_ACTION_NAME, plugin.getName()) {
|
||||
|
||||
@Override
|
||||
protected void doActionPerformed(ActionContext context) {
|
||||
|
@ -23,6 +23,9 @@ import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import docking.widgets.checkbox.GCheckBox;
|
||||
import docking.widgets.label.GDLabel;
|
||||
|
||||
public class SearchGuiSingle extends SearchBaseExtended {
|
||||
|
||||
private JButton searchButton;
|
||||
@ -43,12 +46,12 @@ public class SearchGuiSingle extends SearchBaseExtended {
|
||||
|
||||
frame = new JFrame();
|
||||
jPanel1 = new JPanel();
|
||||
mnemonicCheckBox = new JCheckBox("Mnemonics", true);
|
||||
opOneCheckBox = new JCheckBox("Operand 1", false);
|
||||
opTwoCheckBox = new JCheckBox("Operand 2", false);
|
||||
constCheckBox = new JCheckBox("Constants", false);
|
||||
mnemonicCheckBox = new GCheckBox("Mnemonics", true);
|
||||
opOneCheckBox = new GCheckBox("Operand 1", false);
|
||||
opTwoCheckBox = new GCheckBox("Operand 2", false);
|
||||
constCheckBox = new GCheckBox("Constants", false);
|
||||
searchButton = new JButton();
|
||||
jLabel1 = new JLabel();
|
||||
jLabel1 = new GDLabel();
|
||||
|
||||
GroupLayout jPanel1Layout = new GroupLayout(jPanel1);
|
||||
jPanel1.setLayout(jPanel1Layout);
|
||||
|
@ -24,6 +24,7 @@ import docking.ActionContext;
|
||||
import docking.WindowPosition;
|
||||
import docking.options.editor.ButtonPanelFactory;
|
||||
import docking.widgets.OptionDialog;
|
||||
import docking.widgets.label.*;
|
||||
import ghidra.app.context.ListingActionContext;
|
||||
import ghidra.app.merge.tool.ListingMergePanel;
|
||||
import ghidra.app.nav.Navigatable;
|
||||
@ -106,9 +107,9 @@ class MergeManagerProvider extends ComponentProviderAdapter {
|
||||
ListingMergePanel listingMergePanel = (ListingMergePanel) currentComponent;
|
||||
Object actionContext = listingMergePanel.getActionContext(event);
|
||||
if (actionContext instanceof ProgramLocation) {
|
||||
ListingActionContext listingActionContext =
|
||||
new ListingActionContext(this, navigatable, (ProgramLocation) actionContext);
|
||||
return listingActionContext;
|
||||
ListingActionContext listingActionContext = new ListingActionContext(this,
|
||||
navigatable, (ProgramLocation) actionContext);
|
||||
return listingActionContext;
|
||||
}
|
||||
}
|
||||
ProgramLocation programLocation = navigatable.getLocation();
|
||||
@ -206,13 +207,12 @@ class MergeManagerProvider extends ComponentProviderAdapter {
|
||||
|
||||
mainPanel.setLayout(new BorderLayout(0, 10));
|
||||
mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
nameLabel = new JLabel("Merge Programs", SwingConstants.LEFT);
|
||||
nameLabel = new GDLabel("Merge Programs", SwingConstants.LEFT);
|
||||
|
||||
JPanel iconPanel = new JPanel();
|
||||
new BoxLayout(iconPanel, BoxLayout.X_AXIS);
|
||||
JLabel iconLabel = new JLabel(MERGE_ICON);
|
||||
iconPanel.add(Box.createHorizontalStrut(5));
|
||||
iconPanel.add(iconLabel);
|
||||
iconPanel.add(new GIconLabel(MERGE_ICON));
|
||||
iconPanel.add(Box.createHorizontalStrut(5));
|
||||
iconPanel.add(nameLabel);
|
||||
|
||||
@ -248,9 +248,8 @@ class MergeManagerProvider extends ComponentProviderAdapter {
|
||||
}
|
||||
});
|
||||
|
||||
JPanel panel =
|
||||
ButtonPanelFactory.createButtonPanel(new JButton[] { applyButton, cancelButton },
|
||||
ButtonPanelFactory.X_AXIS);
|
||||
JPanel panel = ButtonPanelFactory.createButtonPanel(
|
||||
new JButton[] { applyButton, cancelButton }, ButtonPanelFactory.X_AXIS);
|
||||
|
||||
return panel;
|
||||
}
|
||||
@ -264,7 +263,7 @@ class MergeManagerProvider extends ComponentProviderAdapter {
|
||||
phasePanel = new PhaseProgressPanel("Progress In Current Phase");
|
||||
|
||||
defaultPanel.add(progressPanel); // panel with each phase and their status indicators.
|
||||
defaultPanel.add(new JLabel(" ")); // Blank separator label.
|
||||
defaultPanel.add(new GLabel(" ")); // Blank separator label.
|
||||
defaultPanel.add(phasePanel); // panel for the current phase's progress and message.
|
||||
conflictPanel.add(defaultPanel, DEFAULT_ID);
|
||||
conflictPanel.setPreferredSize(new Dimension(610, 500));
|
||||
|
@ -22,6 +22,8 @@ import java.util.HashMap;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
|
||||
import docking.widgets.label.GIconLabel;
|
||||
import docking.widgets.label.GLabel;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.layout.VerticalLayout;
|
||||
import resources.ResourceManager;
|
||||
@ -36,7 +38,7 @@ public class MergeProgressPanel extends JPanel {
|
||||
public static ImageIcon IN_PROGRESS_ICON = ResourceManager.loadImage("images/right.png");
|
||||
public static ImageIcon COMPLETED_ICON =
|
||||
ResourceManager.loadImage("images/checkmark_green.gif");
|
||||
private HashMap<String, JLabel> imageMap = new HashMap<String, JLabel>();
|
||||
private HashMap<String, JLabel> imageMap = new HashMap<>();
|
||||
private static int INDENT_IN_PIXELS = 20;
|
||||
|
||||
/**
|
||||
@ -56,18 +58,18 @@ public class MergeProgressPanel extends JPanel {
|
||||
BoxLayout bl = new BoxLayout(phasesTitlePanel, BoxLayout.X_AXIS);
|
||||
phasesTitlePanel.setLayout(bl);
|
||||
phasesTitlePanel.add(Box.createHorizontalStrut(5));
|
||||
phasesTitlePanel.add(new JLabel("Merge Status"));
|
||||
phasesTitlePanel.add(new GLabel("Merge Status"));
|
||||
phasesTitlePanel.add(Box.createHorizontalStrut(15));
|
||||
phasesTitlePanel.add(new JLabel("( "));
|
||||
phasesTitlePanel.add(new JLabel(DEFINED_ICON));
|
||||
phasesTitlePanel.add(new JLabel(" = Pending"));
|
||||
phasesTitlePanel.add(new GLabel("( "));
|
||||
phasesTitlePanel.add(new GIconLabel(DEFINED_ICON));
|
||||
phasesTitlePanel.add(new GLabel(" = Pending"));
|
||||
phasesTitlePanel.add(Box.createHorizontalStrut(10));
|
||||
phasesTitlePanel.add(new JLabel(IN_PROGRESS_ICON));
|
||||
phasesTitlePanel.add(new JLabel(" = In Progress"));
|
||||
phasesTitlePanel.add(new GIconLabel(IN_PROGRESS_ICON));
|
||||
phasesTitlePanel.add(new GLabel(" = In Progress"));
|
||||
phasesTitlePanel.add(Box.createHorizontalStrut(10));
|
||||
phasesTitlePanel.add(new JLabel(COMPLETED_ICON));
|
||||
phasesTitlePanel.add(new JLabel(" = Completed"));
|
||||
phasesTitlePanel.add(new JLabel(" )"));
|
||||
phasesTitlePanel.add(new GIconLabel(COMPLETED_ICON));
|
||||
phasesTitlePanel.add(new GLabel(" = Completed"));
|
||||
phasesTitlePanel.add(new GLabel(" )"));
|
||||
phasesTitlePanel.add(Box.createHorizontalStrut(5));
|
||||
return phasesTitlePanel;
|
||||
}
|
||||
@ -83,8 +85,7 @@ public class MergeProgressPanel extends JPanel {
|
||||
*/
|
||||
public JPanel addInfo(String[] phase) {
|
||||
int phaseDepth = phase.length - 1;
|
||||
JLabel imageLabel = new JLabel(DEFINED_ICON);
|
||||
JLabel infoLabel = new JLabel(phase[phaseDepth]);
|
||||
JLabel imageLabel = new GIconLabel(DEFINED_ICON);
|
||||
JPanel labelPanel = new JPanel();
|
||||
labelPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
|
||||
BoxLayout bl = new BoxLayout(labelPanel, BoxLayout.X_AXIS);
|
||||
@ -93,7 +94,7 @@ public class MergeProgressPanel extends JPanel {
|
||||
labelPanel.add(Box.createHorizontalStrut(5));
|
||||
labelPanel.add(imageLabel);
|
||||
labelPanel.add(Box.createHorizontalStrut(5));
|
||||
labelPanel.add(infoLabel);
|
||||
labelPanel.add(new GLabel(phase[phaseDepth]));
|
||||
imageMap.put(getPhaseString(phase), imageLabel);
|
||||
add(labelPanel);
|
||||
return labelPanel;
|
||||
|
@ -22,9 +22,10 @@ import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import docking.widgets.label.GDLabel;
|
||||
import docking.widgets.label.GIconLabel;
|
||||
import resources.ResourceManager;
|
||||
|
||||
|
||||
/**
|
||||
* The PhaseProgressPanel provides a title, progress bar and message for the current phase that is
|
||||
* in progress
|
||||
@ -33,7 +34,7 @@ public class PhaseProgressPanel extends JPanel {
|
||||
|
||||
private final static String DEFAULT_INFO = "Merge programs in progress...";
|
||||
private ImageIcon INFORM_ICON = ResourceManager.loadImage("images/information.png");
|
||||
|
||||
|
||||
private JLabel titleLabel;
|
||||
private JProgressBar progressBar;
|
||||
private JPanel progressMessagePanel;
|
||||
@ -43,13 +44,13 @@ public class PhaseProgressPanel extends JPanel {
|
||||
private boolean isShowingMessage = false;
|
||||
private String title;
|
||||
private SpringLayout progressLayout;
|
||||
|
||||
|
||||
private Timer updateTimer;
|
||||
private boolean isTimerRunning;
|
||||
private String message;
|
||||
private int progress;
|
||||
private int lastProgress =-1;
|
||||
|
||||
private int lastProgress = -1;
|
||||
|
||||
public PhaseProgressPanel(String title) {
|
||||
this.title = title;
|
||||
progressLayout = new SpringLayout();
|
||||
@ -57,13 +58,13 @@ public class PhaseProgressPanel extends JPanel {
|
||||
createProgressPanel();
|
||||
adjustPreferredSize();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determines and sets the preferred size of this panel.
|
||||
*/
|
||||
private void adjustPreferredSize() {
|
||||
int width = titleLabel.getPreferredSize().width+5;
|
||||
int height = titleLabel.getPreferredSize().height+5;
|
||||
int width = titleLabel.getPreferredSize().width + 5;
|
||||
int height = titleLabel.getPreferredSize().height + 5;
|
||||
if (isShowingProgress) {
|
||||
height += 5;
|
||||
height += progressBar.getPreferredSize().height;
|
||||
@ -79,28 +80,30 @@ public class PhaseProgressPanel extends JPanel {
|
||||
}
|
||||
|
||||
private void createProgressPanel() {
|
||||
|
||||
titleLabel = new JLabel(title);
|
||||
|
||||
titleLabel = new GDLabel(title);
|
||||
add(titleLabel);
|
||||
progressLayout.putConstraint(SpringLayout.WEST, titleLabel, 5, SpringLayout.WEST, this);
|
||||
progressLayout.putConstraint(SpringLayout.NORTH, titleLabel, 5, SpringLayout.NORTH, this);
|
||||
|
||||
|
||||
progressBar = new JProgressBar(SwingConstants.HORIZONTAL);
|
||||
Dimension dim = progressBar.getPreferredSize();
|
||||
progressBar.setPreferredSize(new Dimension(500, (int)dim.getHeight()));
|
||||
progressBar.setPreferredSize(new Dimension(500, (int) dim.getHeight()));
|
||||
progressBar.setMaximum(100);
|
||||
progressLayout.putConstraint(SpringLayout.NORTH, progressBar, 5, SpringLayout.SOUTH, titleLabel);
|
||||
progressLayout.putConstraint(SpringLayout.WEST, progressBar, 0, SpringLayout.WEST, titleLabel);
|
||||
progressLayout.putConstraint(SpringLayout.NORTH, progressBar, 5, SpringLayout.SOUTH,
|
||||
titleLabel);
|
||||
progressLayout.putConstraint(SpringLayout.WEST, progressBar, 0, SpringLayout.WEST,
|
||||
titleLabel);
|
||||
doSetProgress(0);
|
||||
|
||||
|
||||
progressMessagePanel = new JPanel(new BorderLayout());
|
||||
messageIcon = new JLabel(INFORM_ICON);
|
||||
messageIcon = new GIconLabel(INFORM_ICON);
|
||||
messageIcon.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
|
||||
messageLabel = new JLabel(DEFAULT_INFO);
|
||||
messageLabel = new GDLabel(DEFAULT_INFO);
|
||||
progressMessagePanel.add(messageIcon, BorderLayout.WEST);
|
||||
progressMessagePanel.add(messageLabel, BorderLayout.CENTER);
|
||||
doSetMessage(DEFAULT_INFO);
|
||||
|
||||
|
||||
// Sets up the timer for updating the GUI.
|
||||
updateTimer = new Timer(250, new ActionListener() {
|
||||
@Override
|
||||
@ -109,7 +112,7 @@ public class PhaseProgressPanel extends JPanel {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Method for use by the timer to update the progress bar or message.
|
||||
private synchronized void update() {
|
||||
boolean changed = false;
|
||||
@ -128,7 +131,7 @@ public class PhaseProgressPanel extends JPanel {
|
||||
isTimerRunning = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Method to get the panel to update with changes when already on the screen.
|
||||
*/
|
||||
@ -137,7 +140,7 @@ public class PhaseProgressPanel extends JPanel {
|
||||
repaint();
|
||||
adjustPreferredSize();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the title line displayed by this panel.
|
||||
* @param newTitle the new title string
|
||||
@ -146,7 +149,7 @@ public class PhaseProgressPanel extends JPanel {
|
||||
titleLabel.setText(newTitle);
|
||||
doValidate();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the progress message within this panel.
|
||||
* @param newMessage the new message text to be displayed.
|
||||
@ -155,15 +158,15 @@ public class PhaseProgressPanel extends JPanel {
|
||||
messageLabel.setText(newMessage);
|
||||
if (!isShowingMessage) {
|
||||
add(progressMessagePanel);
|
||||
progressLayout.putConstraint(SpringLayout.WEST, progressMessagePanel, 0,
|
||||
SpringLayout.WEST, titleLabel);
|
||||
progressLayout.putConstraint(SpringLayout.NORTH, progressMessagePanel, 5,
|
||||
SpringLayout.SOUTH, (isShowingProgress ? progressBar : titleLabel));
|
||||
isShowingMessage = true;
|
||||
}
|
||||
doValidate();
|
||||
progressLayout.putConstraint(SpringLayout.WEST, progressMessagePanel, 0,
|
||||
SpringLayout.WEST, titleLabel);
|
||||
progressLayout.putConstraint(SpringLayout.NORTH, progressMessagePanel, 5,
|
||||
SpringLayout.SOUTH, (isShowingProgress ? progressBar : titleLabel));
|
||||
isShowingMessage = true;
|
||||
}
|
||||
doValidate();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the progress message within this panel.
|
||||
* @param message the new message text to be displayed.
|
||||
@ -175,23 +178,24 @@ public class PhaseProgressPanel extends JPanel {
|
||||
isTimerRunning = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fills in the progress bar to the indicated percent.
|
||||
* @param progressPercentage total percent of the progress bar that should be filled in.
|
||||
*/
|
||||
private void doSetProgress(final int progressPercentage) {
|
||||
if (progressPercentage < 0 || progressPercentage > 100) {
|
||||
throw new RuntimeException("Invalid progress value ("+progressPercentage+"). Must be from 0 to 100.");
|
||||
throw new RuntimeException(
|
||||
"Invalid progress value (" + progressPercentage + "). Must be from 0 to 100.");
|
||||
}
|
||||
if (!isShowingProgress) {
|
||||
add(progressBar);
|
||||
isShowingProgress = true;
|
||||
}
|
||||
isShowingProgress = true;
|
||||
}
|
||||
progressBar.setValue(progressPercentage);
|
||||
doValidate();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fills in the progress bar to the indicated percent.
|
||||
* @param progressPercentage total percent of the progress bar that should be filled in.
|
||||
@ -203,7 +207,7 @@ public class PhaseProgressPanel extends JPanel {
|
||||
isTimerRunning = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes the message from being displayed by this panel.
|
||||
* Setting the message text will cause it to get added again.
|
||||
@ -213,7 +217,7 @@ public class PhaseProgressPanel extends JPanel {
|
||||
isShowingMessage = false;
|
||||
doValidate();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes the progress bar from being displayed by this panel.
|
||||
* Setting progress will cause it to get added again.
|
||||
@ -221,12 +225,13 @@ public class PhaseProgressPanel extends JPanel {
|
||||
public void removeProgress() {
|
||||
remove(progressBar);
|
||||
if (isShowingMessage) {
|
||||
progressLayout.putConstraint(SpringLayout.NORTH, messageIcon, 5, SpringLayout.SOUTH, titleLabel);
|
||||
progressLayout.putConstraint(SpringLayout.NORTH, messageIcon, 5, SpringLayout.SOUTH,
|
||||
titleLabel);
|
||||
}
|
||||
isShowingProgress = false;
|
||||
doValidate();
|
||||
}
|
||||
|
||||
|
||||
// /**
|
||||
// * @param args
|
||||
// */
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* ###
|
||||
* 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.
|
||||
@ -23,6 +22,9 @@ import java.awt.event.ItemListener;
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import docking.widgets.button.GRadioButton;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import docking.widgets.label.GLabel;
|
||||
import ghidra.app.merge.MergeConstants;
|
||||
|
||||
/**
|
||||
@ -31,10 +33,10 @@ import ghidra.app.merge.MergeConstants;
|
||||
*
|
||||
*/
|
||||
class CategoryConflictPanel extends JPanel {
|
||||
|
||||
public static final String LATEST_BUTTON_NAME = "LatestVersionRB";
|
||||
public static final String CHECKED_OUT_BUTTON_NAME = "CheckedOutVersionRB";
|
||||
public static final String ORIGINAL_BUTTON_NAME = "OriginalVersionRB";
|
||||
|
||||
public static final String LATEST_BUTTON_NAME = "LatestVersionRB";
|
||||
public static final String CHECKED_OUT_BUTTON_NAME = "CheckedOutVersionRB";
|
||||
public static final String ORIGINAL_BUTTON_NAME = "OriginalVersionRB";
|
||||
private ChangeListener listener;
|
||||
private JRadioButton latestRB;
|
||||
private JRadioButton myRB;
|
||||
@ -42,7 +44,6 @@ class CategoryConflictPanel extends JPanel {
|
||||
private ButtonGroup group;
|
||||
private JPanel rbPanel;
|
||||
private JLabel categoryLabel;
|
||||
|
||||
|
||||
CategoryConflictPanel(String title, ChangeListener listener) {
|
||||
super(new BorderLayout());
|
||||
@ -50,24 +51,24 @@ class CategoryConflictPanel extends JPanel {
|
||||
create();
|
||||
this.listener = listener;
|
||||
}
|
||||
void setConflictInfo(String categoryName,
|
||||
String latestStr, String myStr, String origStr) {
|
||||
|
||||
void setConflictInfo(String categoryName, String latestStr, String myStr, String origStr) {
|
||||
categoryLabel.setText(categoryName);
|
||||
group.remove(latestRB);
|
||||
group.remove(myRB);
|
||||
group.remove(originalRB);
|
||||
|
||||
latestRB.setText(latestStr);
|
||||
|
||||
|
||||
latestRB.setText(latestStr);
|
||||
|
||||
myRB.setText(myStr);
|
||||
originalRB.setText(origStr);
|
||||
|
||||
|
||||
latestRB.setSelected(false);
|
||||
myRB.setSelected(false);
|
||||
originalRB.setSelected(false);
|
||||
addToButtonGroup();
|
||||
}
|
||||
|
||||
|
||||
int getSelectedOption() {
|
||||
if (latestRB.isSelected()) {
|
||||
return DataTypeMergeManager.OPTION_LATEST;
|
||||
@ -85,39 +86,39 @@ class CategoryConflictPanel extends JPanel {
|
||||
JPanel panel = new JPanel();
|
||||
panel.setLayout(new BorderLayout());
|
||||
panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
|
||||
|
||||
JLabel clabel = new JLabel("Category: ");
|
||||
categoryLabel = new JLabel("CategoryName");
|
||||
|
||||
categoryLabel = new GDLabel("CategoryName");
|
||||
categoryLabel.setForeground(MergeConstants.CONFLICT_COLOR);
|
||||
|
||||
|
||||
JPanel labelPanel = new JPanel();
|
||||
labelPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
|
||||
labelPanel.setLayout(new BoxLayout(labelPanel, BoxLayout.X_AXIS));
|
||||
labelPanel.add(clabel);
|
||||
labelPanel.add(new GLabel("Category: "));
|
||||
labelPanel.add(Box.createHorizontalStrut(5));
|
||||
labelPanel.add(categoryLabel);
|
||||
|
||||
latestRB = new JRadioButton("Use Latest");
|
||||
myRB = new JRadioButton("Use My Version");
|
||||
originalRB = new JRadioButton("Use Original");
|
||||
|
||||
latestRB = new GRadioButton("Use Latest");
|
||||
myRB = new GRadioButton("Use My Version");
|
||||
originalRB = new GRadioButton("Use Original");
|
||||
latestRB.setName(LATEST_BUTTON_NAME);
|
||||
myRB.setName(CHECKED_OUT_BUTTON_NAME);
|
||||
originalRB.setName(ORIGINAL_BUTTON_NAME);
|
||||
|
||||
|
||||
group = new ButtonGroup();
|
||||
addToButtonGroup();
|
||||
|
||||
|
||||
rbPanel = new JPanel();
|
||||
rbPanel.setLayout(new BoxLayout(rbPanel, BoxLayout.Y_AXIS));
|
||||
|
||||
|
||||
rbPanel.add(latestRB);
|
||||
rbPanel.add(myRB);
|
||||
rbPanel.add(originalRB);
|
||||
panel.add(labelPanel, BorderLayout.NORTH);
|
||||
panel.add(rbPanel, BorderLayout.CENTER);
|
||||
|
||||
|
||||
add(panel);
|
||||
ItemListener itemListener = new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
if (listener != null) {
|
||||
listener.stateChanged(null);
|
||||
@ -129,9 +130,10 @@ class CategoryConflictPanel extends JPanel {
|
||||
originalRB.addItemListener(itemListener);
|
||||
|
||||
}
|
||||
|
||||
private void addToButtonGroup() {
|
||||
group.add(latestRB);
|
||||
group.add(myRB);
|
||||
group.add(originalRB);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* ###
|
||||
* 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.
|
||||
@ -16,16 +15,17 @@
|
||||
*/
|
||||
package ghidra.app.merge.datatypes;
|
||||
|
||||
import ghidra.app.merge.MergeConstants;
|
||||
import ghidra.app.merge.util.ConflictCountPanel;
|
||||
import ghidra.framework.data.DomainObjectMergeManager;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import docking.widgets.checkbox.GCheckBox;
|
||||
import ghidra.app.merge.MergeConstants;
|
||||
import ghidra.app.merge.util.ConflictCountPanel;
|
||||
import ghidra.framework.data.DomainObjectMergeManager;
|
||||
|
||||
/**
|
||||
* Panel that shows a conflict for a category; gets user input to resolve
|
||||
* the conflict.
|
||||
@ -86,6 +86,7 @@ class CategoryMergePanel extends JPanel {
|
||||
private void create() {
|
||||
countPanel = new ConflictCountPanel();
|
||||
resolvePanel = new CategoryConflictPanel("Resolve Conflict", new ChangeListener() {
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
mergeManager.clearStatusText();
|
||||
mergeManager.setApplyEnabled(true);
|
||||
@ -112,7 +113,7 @@ class CategoryMergePanel extends JPanel {
|
||||
}
|
||||
|
||||
private JCheckBox createUseForAllCheckBox() {
|
||||
useForAllCB = new JCheckBox(getUseAllString("Category"));
|
||||
useForAllCB = new GCheckBox(getUseAllString("Category"));
|
||||
useForAllCB.setName(USE_FOR_ALL_CHECKBOX);
|
||||
return useForAllCB;
|
||||
}
|
||||
|
@ -23,6 +23,9 @@ import java.awt.event.ItemListener;
|
||||
import javax.swing.*;
|
||||
|
||||
import docking.widgets.MultiLineLabel;
|
||||
import docking.widgets.button.GRadioButton;
|
||||
import docking.widgets.checkbox.GCheckBox;
|
||||
import docking.widgets.label.GIconLabel;
|
||||
import ghidra.app.merge.MergeConstants;
|
||||
import ghidra.app.merge.util.ConflictCountPanel;
|
||||
import ghidra.framework.data.DomainObjectMergeManager;
|
||||
@ -112,15 +115,15 @@ class DataTypeMergePanel extends JPanel {
|
||||
}
|
||||
};
|
||||
|
||||
latestRB = new JRadioButton(MergeConstants.LATEST_TITLE);
|
||||
latestRB = new GRadioButton(MergeConstants.LATEST_TITLE);
|
||||
latestRB.setName(LATEST_BUTTON_NAME);
|
||||
latestRB.addItemListener(listener);
|
||||
|
||||
myRB = new JRadioButton(MergeConstants.MY_TITLE);
|
||||
myRB = new GRadioButton(MergeConstants.MY_TITLE);
|
||||
myRB.setName(CHECKED_OUT_BUTTON_NAME);
|
||||
myRB.addItemListener(listener);
|
||||
|
||||
originalRB = new JRadioButton(MergeConstants.ORIGINAL_TITLE);
|
||||
originalRB = new GRadioButton(MergeConstants.ORIGINAL_TITLE);
|
||||
originalRB.setName(ORIGINAL_BUTTON_NAME);
|
||||
originalRB.addItemListener(listener);
|
||||
|
||||
@ -178,13 +181,13 @@ class DataTypeMergePanel extends JPanel {
|
||||
private JPanel createInfoPanel() {
|
||||
|
||||
Icon icon = ResourceManager.loadImage("images/information.png");
|
||||
JLabel imageLabel = new JLabel(icon);
|
||||
JLabel imageLabel = new GIconLabel(icon);
|
||||
|
||||
MultiLineLabel label =
|
||||
new MultiLineLabel("A data type change in your checked out version conflicts with a "
|
||||
+ "data type change in the latest version.\n"
|
||||
+ "Select the data type change you want included in the version "
|
||||
+ "that will result from this check-in.");
|
||||
new MultiLineLabel("A data type change in your checked out version conflicts with a " +
|
||||
"data type change in the latest version.\n" +
|
||||
"Select the data type change you want included in the version " +
|
||||
"that will result from this check-in.");
|
||||
|
||||
JPanel labelPanel = new JPanel();
|
||||
labelPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 0));
|
||||
@ -199,7 +202,7 @@ class DataTypeMergePanel extends JPanel {
|
||||
}
|
||||
|
||||
private JCheckBox createUseForAllCheckBox() {
|
||||
useForAllCB = new JCheckBox(getUseAllString("Data Type"));
|
||||
useForAllCB = new GCheckBox(getUseAllString("Data Type"));
|
||||
useForAllCB.setName(USE_FOR_ALL_CHECKBOX);
|
||||
return useForAllCB;
|
||||
}
|
||||
|
@ -23,6 +23,9 @@ import java.awt.event.ItemListener;
|
||||
import javax.swing.*;
|
||||
|
||||
import docking.widgets.MultiLineLabel;
|
||||
import docking.widgets.button.GRadioButton;
|
||||
import docking.widgets.checkbox.GCheckBox;
|
||||
import docking.widgets.label.GIconLabel;
|
||||
import ghidra.app.merge.MergeConstants;
|
||||
import ghidra.app.merge.util.ConflictCountPanel;
|
||||
import ghidra.app.plugin.core.datamgr.archive.SourceArchive;
|
||||
@ -111,15 +114,15 @@ class SourceArchiveMergePanel extends JPanel {
|
||||
}
|
||||
};
|
||||
|
||||
latestRB = new JRadioButton(MergeConstants.LATEST_TITLE);
|
||||
latestRB = new GRadioButton(MergeConstants.LATEST_TITLE);
|
||||
latestRB.setName(LATEST_BUTTON_NAME);
|
||||
latestRB.addItemListener(listener);
|
||||
|
||||
myRB = new JRadioButton(MergeConstants.MY_TITLE);
|
||||
myRB = new GRadioButton(MergeConstants.MY_TITLE);
|
||||
myRB.setName(CHECKED_OUT_BUTTON_NAME);
|
||||
myRB.addItemListener(listener);
|
||||
|
||||
originalRB = new JRadioButton(MergeConstants.ORIGINAL_TITLE);
|
||||
originalRB = new GRadioButton(MergeConstants.ORIGINAL_TITLE);
|
||||
originalRB.setName(ORIGINAL_BUTTON_NAME);
|
||||
originalRB.addItemListener(listener);
|
||||
|
||||
@ -173,14 +176,13 @@ class SourceArchiveMergePanel extends JPanel {
|
||||
private JPanel createInfoPanel() {
|
||||
|
||||
Icon icon = ResourceManager.loadImage("images/information.png");
|
||||
JLabel imageLabel = new JLabel(icon);
|
||||
JLabel imageLabel = new GIconLabel(icon);
|
||||
|
||||
MultiLineLabel label =
|
||||
new MultiLineLabel(
|
||||
"A source archive change in your checked out version conflicts with a "
|
||||
+ "source archive change in the latest version.\n"
|
||||
+ "Select the source archive you want included in the version "
|
||||
+ "that will result from this check-in.");
|
||||
MultiLineLabel label = new MultiLineLabel(
|
||||
"A source archive change in your checked out version conflicts with a " +
|
||||
"source archive change in the latest version.\n" +
|
||||
"Select the source archive you want included in the version " +
|
||||
"that will result from this check-in.");
|
||||
|
||||
JPanel labelPanel = new JPanel();
|
||||
labelPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 0));
|
||||
@ -195,7 +197,7 @@ class SourceArchiveMergePanel extends JPanel {
|
||||
}
|
||||
|
||||
private JCheckBox createUseForAllCheckBox() {
|
||||
useForAllCB = new JCheckBox(getUseAllString("Source Archive"));
|
||||
useForAllCB = new GCheckBox(getUseAllString("Source Archive"));
|
||||
useForAllCB.setName(USE_FOR_ALL_CHECKBOX);
|
||||
return useForAllCB;
|
||||
}
|
||||
|
@ -20,8 +20,10 @@ import java.awt.BorderLayout;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.TitledBorder;
|
||||
|
||||
import docking.widgets.label.GDHtmlLabel;
|
||||
import ghidra.app.merge.util.ConflictUtility;
|
||||
import ghidra.program.model.address.*;
|
||||
import ghidra.util.HTMLUtilities;
|
||||
|
||||
/**
|
||||
* <code>ConflictInfoPanel</code> appears above the 4 listings in the ListingMergeWindow.
|
||||
@ -58,8 +60,8 @@ public class ConflictInfoPanel extends JPanel {
|
||||
setLayout(new BorderLayout());
|
||||
setBorder(BorderFactory.createTitledBorder("Resolve Current Conflict"));
|
||||
|
||||
westLabel = new JLabel("<html></html>");
|
||||
eastLabel = new JLabel("<html></html>");
|
||||
westLabel = new GDHtmlLabel("<html></html>");
|
||||
eastLabel = new GDHtmlLabel("<html></html>");
|
||||
add(westLabel, BorderLayout.WEST);
|
||||
add(eastLabel, BorderLayout.EAST);
|
||||
}
|
||||
@ -154,7 +156,8 @@ public class ConflictInfoPanel extends JPanel {
|
||||
}
|
||||
|
||||
private void addAddress(StringBuffer buf, Address addr) {
|
||||
buf.append("<font color=\"#990000\">" + addr.toString() + "</font>");
|
||||
buf.append(
|
||||
"<font color=\"#990000\">" + HTMLUtilities.escapeHTML(addr.toString()) + "</font>");
|
||||
}
|
||||
|
||||
private void updateWest() {
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* ###
|
||||
* 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.
|
||||
@ -20,6 +19,8 @@ import java.awt.LayoutManager;
|
||||
|
||||
import javax.swing.JCheckBox;
|
||||
|
||||
import docking.widgets.checkbox.GCheckBox;
|
||||
|
||||
/**
|
||||
* Abstract class that should be implemented by the conflict panel that appears
|
||||
* below the 4 listings in the merge window.
|
||||
@ -76,7 +77,7 @@ public abstract class ConflictPanel extends ChoiceComponent {
|
||||
public abstract void clear();
|
||||
|
||||
protected JCheckBox createUseForAllCheckBox() {
|
||||
useForAllCB = new JCheckBox(getUseAllString("unknown"));
|
||||
useForAllCB = new GCheckBox(getUseAllString("unknown"));
|
||||
useForAllCB.setName(USE_FOR_ALL_CHECKBOX);
|
||||
return useForAllCB;
|
||||
}
|
||||
|
@ -22,8 +22,10 @@ import java.awt.event.ItemListener;
|
||||
import javax.swing.*;
|
||||
|
||||
import docking.widgets.EmptyBorderButton;
|
||||
import docking.widgets.button.GRadioButton;
|
||||
import docking.widgets.fieldpanel.FieldPanel;
|
||||
import docking.widgets.fieldpanel.internal.FieldPanelCoordinator;
|
||||
import docking.widgets.label.GIconLabel;
|
||||
import ghidra.app.merge.MergeConstants;
|
||||
import ghidra.app.merge.MergeManager;
|
||||
import ghidra.app.merge.util.ConflictCountPanel;
|
||||
@ -223,19 +225,19 @@ class ExternalAddConflictPanel extends JPanel implements CodeFormatService {
|
||||
}
|
||||
};
|
||||
|
||||
keepLatestRB = new JRadioButton(MergeConstants.LATEST_TITLE);
|
||||
keepLatestRB = new GRadioButton(MergeConstants.LATEST_TITLE);
|
||||
keepLatestRB.setName(KEEP_LATEST_BUTTON_NAME);
|
||||
keepLatestRB.addItemListener(listener);
|
||||
|
||||
keepMyRB = new JRadioButton(MergeConstants.MY_TITLE);
|
||||
keepMyRB = new GRadioButton(MergeConstants.MY_TITLE);
|
||||
keepMyRB.setName(KEEP_MY_BUTTON_NAME);
|
||||
keepMyRB.addItemListener(listener);
|
||||
|
||||
keepBothRB = new JRadioButton("Both");
|
||||
keepBothRB = new GRadioButton("Both");
|
||||
keepBothRB.setName(KEEP_BOTH_BUTTON_NAME);
|
||||
keepBothRB.addItemListener(listener);
|
||||
|
||||
mergeBothRB = new JRadioButton("Merge");
|
||||
mergeBothRB = new GRadioButton("Merge");
|
||||
mergeBothRB.setName(MERGE_BOTH_BUTTON_NAME);
|
||||
mergeBothRB.addItemListener(listener);
|
||||
|
||||
@ -253,7 +255,7 @@ class ExternalAddConflictPanel extends JPanel implements CodeFormatService {
|
||||
myTitlePanel = new TitledPanel(MergeConstants.MY_TITLE, myPanel, 5);
|
||||
|
||||
latestTitlePanel.addTitleComponent(new ShowHeaderButton());
|
||||
myTitlePanel.addTitleComponent(new JLabel(new EmptyIcon(22, 22)));
|
||||
myTitlePanel.addTitleComponent(new GIconLabel(new EmptyIcon(22, 22)));
|
||||
|
||||
JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
|
||||
splitPane.setResizeWeight(0.5);
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* ###
|
||||
* 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.
|
||||
@ -16,13 +15,14 @@
|
||||
*/
|
||||
package ghidra.app.merge.listing;
|
||||
|
||||
import ghidra.app.merge.util.ConflictUtility;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.TitledBorder;
|
||||
|
||||
import docking.widgets.label.GDHtmlLabel;
|
||||
import ghidra.app.merge.util.ConflictUtility;
|
||||
|
||||
/**
|
||||
* <code>ExternalConflictInfoPanel</code> appears above the 4 listings in the ListingMergeWindow.
|
||||
* It indicates the Externals phase.
|
||||
@ -54,8 +54,8 @@ public class ExternalConflictInfoPanel extends JPanel {
|
||||
setLayout(new BorderLayout());
|
||||
setBorder(BorderFactory.createTitledBorder("Resolve External Location Conflict"));
|
||||
|
||||
westLabel = new JLabel("<html></html>");
|
||||
eastLabel = new JLabel("<html></html>");
|
||||
westLabel = new GDHtmlLabel("<html></html>");
|
||||
eastLabel = new GDHtmlLabel("<html></html>");
|
||||
add(westLabel, BorderLayout.WEST);
|
||||
add(eastLabel, BorderLayout.EAST);
|
||||
}
|
||||
|
@ -25,6 +25,8 @@ import javax.swing.border.TitledBorder;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import javax.swing.table.TableModel;
|
||||
|
||||
import docking.widgets.button.GRadioButton;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import docking.widgets.table.AbstractSortedTableModel;
|
||||
import docking.widgets.table.GTable;
|
||||
import ghidra.app.merge.util.ConflictUtility;
|
||||
@ -69,7 +71,7 @@ public class ScrollingListChoicesPanel extends ConflictPanel {
|
||||
gbl = new GridBagLayout();
|
||||
rowPanel = new JPanel(gbl);
|
||||
setLayout(new BorderLayout());
|
||||
headerLabel = new JLabel(" ");
|
||||
headerLabel = new GDLabel(" ");
|
||||
headerLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
add(headerLabel, BorderLayout.NORTH);
|
||||
setHeader(null);
|
||||
@ -252,12 +254,12 @@ class ListChoice extends JPanel {
|
||||
|
||||
setLayout(new BorderLayout());
|
||||
|
||||
rb = new JRadioButton("UNKNOWN");
|
||||
rb = new GRadioButton("UNKNOWN");
|
||||
rb.addItemListener(radioButtonListener);
|
||||
group.add(rb);
|
||||
add(rb, BorderLayout.NORTH);
|
||||
|
||||
model = new AbstractSortedTableModel<String[]>() {
|
||||
model = new AbstractSortedTableModel<>() {
|
||||
@Override
|
||||
public Object getColumnValueForRow(String[] t, int columnIndex) {
|
||||
return t[columnIndex];
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* ###
|
||||
* 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.
|
||||
@ -16,9 +15,6 @@
|
||||
*/
|
||||
package ghidra.app.merge.listing;
|
||||
|
||||
import ghidra.app.merge.util.ConflictUtility;
|
||||
import ghidra.util.layout.MaximizeSpecificColumnGridLayout;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.ArrayList;
|
||||
@ -29,6 +25,14 @@ import javax.swing.border.Border;
|
||||
import javax.swing.border.TitledBorder;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import docking.widgets.button.GRadioButton;
|
||||
import docking.widgets.checkbox.GCheckBox;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import docking.widgets.label.GLabel;
|
||||
import ghidra.app.merge.util.ConflictUtility;
|
||||
import ghidra.util.HTMLUtilities;
|
||||
import ghidra.util.layout.MaximizeSpecificColumnGridLayout;
|
||||
|
||||
/**
|
||||
* <code>VariousChoicesPanel</code> provides a table type of format for resolving
|
||||
* multiple conflicts in one panel. Each row that has choices represents the
|
||||
@ -40,8 +44,8 @@ import javax.swing.event.ChangeListener;
|
||||
public class VariousChoicesPanel extends ConflictPanel {
|
||||
|
||||
private final static long serialVersionUID = 1;
|
||||
private static final Border UNDERLINE_BORDER = BorderFactory.createMatteBorder(0, 0, 1, 0,
|
||||
Color.BLACK);
|
||||
private static final Border UNDERLINE_BORDER =
|
||||
BorderFactory.createMatteBorder(0, 0, 1, 0, Color.BLACK);
|
||||
|
||||
private JPanel rowPanel;
|
||||
private JLabel headerLabel;
|
||||
@ -71,12 +75,12 @@ public class VariousChoicesPanel extends ConflictPanel {
|
||||
|
||||
private void init() {
|
||||
setBorder(BorderFactory.createTitledBorder("Resolve Conflict"));
|
||||
rows = new ArrayList<ChoiceRow>();
|
||||
rows = new ArrayList<>();
|
||||
layout = new MaximizeSpecificColumnGridLayout(5, 5, columnCount);
|
||||
rowPanel = new JPanel(layout);
|
||||
rowPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
setLayout(new BorderLayout());
|
||||
headerLabel = new JLabel(" ");
|
||||
headerLabel = new GDLabel(" ");
|
||||
headerLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
add(headerLabel, BorderLayout.NORTH);
|
||||
setHeader(null);
|
||||
@ -86,9 +90,8 @@ public class VariousChoicesPanel extends ConflictPanel {
|
||||
indent = Math.max(rb.getPreferredSize().width, cb.getPreferredSize().width);
|
||||
int radioButtonOffset = (rb.getPreferredSize().height - lbl.getPreferredSize().height) / 2;
|
||||
int checkBoxOffset = (cb.getPreferredSize().height - lbl.getPreferredSize().height) / 2;
|
||||
radioButtonBorder =
|
||||
BorderFactory.createEmptyBorder((radioButtonOffset > 0 ? radioButtonOffset : 0), 0, 0,
|
||||
0);
|
||||
radioButtonBorder = BorderFactory.createEmptyBorder(
|
||||
(radioButtonOffset > 0 ? radioButtonOffset : 0), 0, 0, 0);
|
||||
checkBoxBorder =
|
||||
BorderFactory.createEmptyBorder((checkBoxOffset > 0 ? checkBoxOffset : 0), 0, 0, 0);
|
||||
|
||||
@ -171,7 +174,8 @@ public class VariousChoicesPanel extends ConflictPanel {
|
||||
* @param listener listener that gets notified whenever the state of
|
||||
* one of the radiobuttons in this row changes.
|
||||
*/
|
||||
void addSingleChoice(final String title, final String[] choices, final ChangeListener listener) {
|
||||
void addSingleChoice(final String title, final String[] choices,
|
||||
final ChangeListener listener) {
|
||||
adjustColumnCount(choices.length + 1);
|
||||
for (int i = 0; i < choices.length; i++) {
|
||||
if (choices[i] == null) {
|
||||
@ -225,7 +229,8 @@ public class VariousChoicesPanel extends ConflictPanel {
|
||||
* @param listener listener that gets notified whenever the state of
|
||||
* one of the checkboxes in this row changes.
|
||||
*/
|
||||
void addMultipleChoice(final String title, final String[] choices, final ChangeListener listener) {
|
||||
void addMultipleChoice(final String title, final String[] choices,
|
||||
final ChangeListener listener) {
|
||||
adjustColumnCount(choices.length + 1);
|
||||
MyLabel titleComp = new MyLabel(title);
|
||||
MyCheckBox[] cb = new MyCheckBox[choices.length];
|
||||
@ -498,13 +503,12 @@ public class VariousChoicesPanel extends ConflictPanel {
|
||||
return rows.size() > 0;
|
||||
}
|
||||
|
||||
private class MyLabel extends JLabel {
|
||||
private final static long serialVersionUID = 1;
|
||||
private class MyLabel extends GLabel {
|
||||
|
||||
/**
|
||||
* @param text the text of this label.
|
||||
*/
|
||||
public MyLabel(final String text) {
|
||||
public MyLabel(String text) {
|
||||
super(text);
|
||||
addComponentListener(new ComponentListener() {
|
||||
|
||||
@ -522,7 +526,9 @@ public class VariousChoicesPanel extends ConflictPanel {
|
||||
(displayedFont != null) ? getFontMetrics(displayedFont) : null;
|
||||
int stringWidth =
|
||||
(fontMetrics != null) ? fontMetrics.stringWidth(displayedText) : 0;
|
||||
setToolTipText((stringWidth > displayedWidth) ? text : null);
|
||||
setToolTipText(
|
||||
(stringWidth > displayedWidth) ? "<html>" + HTMLUtilities.escapeHTML(text)
|
||||
: null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -543,7 +549,7 @@ public class VariousChoicesPanel extends ConflictPanel {
|
||||
}
|
||||
}
|
||||
|
||||
private class MyRadioButton extends JRadioButton {
|
||||
private class MyRadioButton extends GRadioButton {
|
||||
private final static long serialVersionUID = 1;
|
||||
|
||||
/**
|
||||
@ -588,7 +594,7 @@ public class VariousChoicesPanel extends ConflictPanel {
|
||||
}
|
||||
}
|
||||
|
||||
private class MyCheckBox extends JCheckBox {
|
||||
private class MyCheckBox extends GCheckBox {
|
||||
private final static long serialVersionUID = 1;
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* ###
|
||||
* 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.
|
||||
@ -16,10 +15,6 @@
|
||||
*/
|
||||
package ghidra.app.merge.listing;
|
||||
|
||||
import ghidra.app.merge.util.ConflictUtility;
|
||||
import ghidra.util.datastruct.LongArrayList;
|
||||
import ghidra.util.layout.MaximizeSpecificColumnGridLayout;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.*;
|
||||
@ -29,6 +24,15 @@ import javax.swing.border.Border;
|
||||
import javax.swing.border.TitledBorder;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import docking.widgets.button.GRadioButton;
|
||||
import docking.widgets.checkbox.GCheckBox;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import docking.widgets.label.GLabel;
|
||||
import ghidra.app.merge.util.ConflictUtility;
|
||||
import ghidra.util.HTMLUtilities;
|
||||
import ghidra.util.datastruct.LongArrayList;
|
||||
import ghidra.util.layout.MaximizeSpecificColumnGridLayout;
|
||||
|
||||
/**
|
||||
* <CODE>VerticalChoicesPanel</CODE> is a conflict panel for the Listing Merge.
|
||||
* It lays out rows of information vertically in a table format.
|
||||
@ -88,12 +92,12 @@ public class VerticalChoicesPanel extends ConflictPanel {
|
||||
setBorder(BorderFactory.createTitledBorder("Resolve Conflict"));
|
||||
setLayout(new BorderLayout());
|
||||
|
||||
headerLabel = new JLabel(" ");
|
||||
headerLabel = new GDLabel(" ");
|
||||
headerLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
add(headerLabel, BorderLayout.NORTH);
|
||||
|
||||
rowComps = new ArrayList<ArrayList<JComponent>>();
|
||||
rows = new ArrayList<String[]>();
|
||||
rowComps = new ArrayList<>();
|
||||
rows = new ArrayList<>();
|
||||
rowTypes = new LongArrayList();
|
||||
group = new ButtonGroup();
|
||||
layout = new MaximizeSpecificColumnGridLayout(5, 5, columnCount);
|
||||
@ -102,31 +106,29 @@ public class VerticalChoicesPanel extends ConflictPanel {
|
||||
add(rowPanel, BorderLayout.CENTER);
|
||||
rowPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
|
||||
JRadioButton rb = new JRadioButton();
|
||||
JCheckBox cb = new JCheckBox();
|
||||
GRadioButton rb = new GRadioButton();
|
||||
JCheckBox cb = new GCheckBox();
|
||||
indent = Math.max(rb.getPreferredSize().width, cb.getPreferredSize().width);
|
||||
|
||||
defaultInsets = new Insets(DEFAULT_TOP, DEFAULT_LEFT, DEFAULT_BOTTOM, DEFAULT_RIGHT);
|
||||
int labelHeight = (int) new JLabel("A").getPreferredSize().getHeight();
|
||||
double buttonHeight =
|
||||
new MyRadioButton("A", ListingMergeConstants.KEEP_LATEST).getPreferredSize().getHeight();
|
||||
int labelHeight = (int) new GDLabel("A").getPreferredSize().getHeight();
|
||||
double buttonHeight = new MyRadioButton("A",
|
||||
ListingMergeConstants.KEEP_LATEST).getPreferredSize().getHeight();
|
||||
int borderHeight;
|
||||
borderHeight = (int) ((buttonHeight - labelHeight) / 2);
|
||||
if (borderHeight < 0) {
|
||||
borderHeight = 0;
|
||||
}
|
||||
textVsButtonInsets =
|
||||
new Insets(DEFAULT_TOP + borderHeight, DEFAULT_LEFT, DEFAULT_BOTTOM + borderHeight,
|
||||
DEFAULT_RIGHT);
|
||||
textVsButtonInsets = new Insets(DEFAULT_TOP + borderHeight, DEFAULT_LEFT,
|
||||
DEFAULT_BOTTOM + borderHeight, DEFAULT_RIGHT);
|
||||
double checkBoxHeight =
|
||||
new MyCheckBox("A", ListingMergeConstants.KEEP_LATEST).getPreferredSize().getHeight();
|
||||
borderHeight = (int) ((checkBoxHeight - labelHeight) / 2);
|
||||
if (borderHeight < 0) {
|
||||
borderHeight = 0;
|
||||
}
|
||||
textVsCheckBoxInsets =
|
||||
new Insets(DEFAULT_TOP + borderHeight, DEFAULT_LEFT, DEFAULT_BOTTOM + borderHeight,
|
||||
DEFAULT_RIGHT);
|
||||
textVsCheckBoxInsets = new Insets(DEFAULT_TOP + borderHeight, DEFAULT_LEFT,
|
||||
DEFAULT_BOTTOM + borderHeight, DEFAULT_RIGHT);
|
||||
|
||||
add(createUseForAllCheckBox(), BorderLayout.SOUTH);
|
||||
}
|
||||
@ -453,8 +455,7 @@ public class VerticalChoicesPanel extends ConflictPanel {
|
||||
return allChoicesAreResolved();
|
||||
}
|
||||
|
||||
private class MyLabel extends JLabel {
|
||||
private final static long serialVersionUID = 1;
|
||||
private class MyLabel extends GLabel {
|
||||
|
||||
/**
|
||||
* @param text the text of this label.
|
||||
@ -481,7 +482,9 @@ public class VerticalChoicesPanel extends ConflictPanel {
|
||||
(displayedFont != null) ? getFontMetrics(displayedFont) : null;
|
||||
int stringWidth =
|
||||
(fontMetrics != null) ? fontMetrics.stringWidth(displayedText) : 0;
|
||||
setToolTipText((stringWidth > displayedWidth) ? text : null);
|
||||
setToolTipText(
|
||||
(stringWidth > displayedWidth) ? "<html>" + HTMLUtilities.escapeHTML(text)
|
||||
: null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -502,7 +505,7 @@ public class VerticalChoicesPanel extends ConflictPanel {
|
||||
}
|
||||
}
|
||||
|
||||
private class MyRadioButton extends JRadioButton {
|
||||
private class MyRadioButton extends GRadioButton {
|
||||
private final static long serialVersionUID = 1;
|
||||
private int option;
|
||||
|
||||
@ -558,7 +561,7 @@ public class VerticalChoicesPanel extends ConflictPanel {
|
||||
|
||||
}
|
||||
|
||||
private class MyCheckBox extends JCheckBox {
|
||||
private class MyCheckBox extends GCheckBox {
|
||||
private final static long serialVersionUID = 1;
|
||||
private int option;
|
||||
|
||||
@ -622,7 +625,8 @@ public class VerticalChoicesPanel extends ConflictPanel {
|
||||
JComponent[] comps = getRowComponents(row);
|
||||
for (int i = 0; i < comps.length; i++) {
|
||||
JComponent component = comps[i];
|
||||
if (component instanceof MyRadioButton && ((MyRadioButton) component).isSelected()) {
|
||||
if (component instanceof MyRadioButton &&
|
||||
((MyRadioButton) component).isSelected()) {
|
||||
conflictOption |= ((MyRadioButton) component).option;
|
||||
}
|
||||
else if (component instanceof MyCheckBox && ((MyCheckBox) component).isSelected()) {
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* ###
|
||||
* 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.
|
||||
@ -22,6 +21,8 @@ import java.awt.event.ItemListener;
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import docking.widgets.button.GRadioButton;
|
||||
|
||||
/**
|
||||
* Panel to show radio buttons to choose a name or a set of permissions
|
||||
* for a memory block, or to resolve the conflict for the image base
|
||||
@ -89,6 +90,7 @@ class BlockConflictPanel extends JPanel {
|
||||
group = new ButtonGroup();
|
||||
|
||||
ItemListener itemListener = new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
if (e.getStateChange() == ItemEvent.SELECTED) {
|
||||
listener.stateChanged(null);
|
||||
@ -96,13 +98,13 @@ class BlockConflictPanel extends JPanel {
|
||||
}
|
||||
};
|
||||
|
||||
latestRB = new JRadioButton("Latest");
|
||||
latestRB = new GRadioButton("Latest");
|
||||
latestRB.setName(MemoryMergePanel.LATEST_BUTTON_NAME);
|
||||
latestRB.addItemListener(itemListener);
|
||||
myRB = new JRadioButton("My");
|
||||
myRB = new GRadioButton("My");
|
||||
myRB.addItemListener(itemListener);
|
||||
myRB.setName(MemoryMergePanel.MY_BUTTON_NAME);
|
||||
originalRB = new JRadioButton("Original");
|
||||
originalRB = new GRadioButton("Original");
|
||||
originalRB.addItemListener(itemListener);
|
||||
originalRB.setName(MemoryMergePanel.ORIGINAL_BUTTON_NAME);
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* ###
|
||||
* 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.
|
||||
@ -16,15 +15,16 @@
|
||||
*/
|
||||
package ghidra.app.merge.memory;
|
||||
|
||||
import ghidra.app.merge.MergeConstants;
|
||||
import ghidra.util.layout.PairLayout;
|
||||
|
||||
import java.awt.event.ItemEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import docking.widgets.button.GRadioButton;
|
||||
import ghidra.app.merge.MergeConstants;
|
||||
import ghidra.util.layout.PairLayout;
|
||||
|
||||
/**
|
||||
* Panel that shows the block comments; has radio buttons to choose
|
||||
* which comment to use.
|
||||
@ -123,8 +123,9 @@ class CommentsConflictPanel extends JPanel {
|
||||
case MergeConstants.ORIGINAL:
|
||||
str = MergeConstants.ORIGINAL_TITLE;
|
||||
}
|
||||
JRadioButton rb = new JRadioButton("Use comments from " + str);
|
||||
GRadioButton rb = new GRadioButton("Use comments from " + str);
|
||||
rb.addItemListener(new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
if (e.getStateChange() == ItemEvent.SELECTED) {
|
||||
listener.stateChanged(null);
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* ###
|
||||
* 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.
|
||||
@ -16,10 +15,6 @@
|
||||
*/
|
||||
package ghidra.app.merge.memory;
|
||||
|
||||
import ghidra.app.merge.MergeConstants;
|
||||
import ghidra.app.merge.ProgramMultiUserMergeManager;
|
||||
import ghidra.app.merge.util.ConflictCountPanel;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.CardLayout;
|
||||
|
||||
@ -27,6 +22,11 @@ import javax.swing.*;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import docking.widgets.checkbox.GCheckBox;
|
||||
import ghidra.app.merge.MergeConstants;
|
||||
import ghidra.app.merge.ProgramMultiUserMergeManager;
|
||||
import ghidra.app.merge.util.ConflictCountPanel;
|
||||
|
||||
/**
|
||||
*
|
||||
* Panel to resolve conflicts on memory blocks.
|
||||
@ -111,6 +111,7 @@ class MemoryMergePanel extends JPanel {
|
||||
cardPanel = new JPanel(cardLayout);
|
||||
cardPanel.setBorder(BorderFactory.createTitledBorder("Resolve Block Conflict"));
|
||||
ChangeListener listener = new ChangeListener() {
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
mergeManager.setApplyEnabled(true);
|
||||
}
|
||||
@ -133,7 +134,7 @@ class MemoryMergePanel extends JPanel {
|
||||
}
|
||||
|
||||
private JCheckBox createUseForAllCheckBox() {
|
||||
useForAllCB = new JCheckBox(getUseAllString("Memory Block"));
|
||||
useForAllCB = new GCheckBox(getUseAllString("Memory Block"));
|
||||
useForAllCB.setName(USE_FOR_ALL_CHECKBOX);
|
||||
return useForAllCB;
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* ###
|
||||
* 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.
|
||||
@ -16,8 +15,6 @@
|
||||
*/
|
||||
package ghidra.app.merge.propertylist;
|
||||
|
||||
import ghidra.app.merge.MergeConstants;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.event.ItemEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
@ -25,6 +22,11 @@ import java.awt.event.ItemListener;
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import docking.widgets.button.GRadioButton;
|
||||
import docking.widgets.checkbox.GCheckBox;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import ghidra.app.merge.MergeConstants;
|
||||
|
||||
/**
|
||||
* Panel that shows differences for properties in Property Lists.
|
||||
*/
|
||||
@ -63,27 +65,27 @@ class ConflictPanel extends JPanel {
|
||||
}
|
||||
|
||||
if (info.isTypeMatch()) {
|
||||
setBorder(BorderFactory.createTitledBorder("Resolve Type Mismatch for Property " +
|
||||
info.getDisplayedPropertyName()));
|
||||
setBorder(BorderFactory.createTitledBorder(
|
||||
"Resolve Type Mismatch for Property " + info.getDisplayedPropertyName()));
|
||||
|
||||
latestRB.setText("Use type '" + info.getLatestTypeString() + "', value = '" +
|
||||
info.getLatestValue() + "' (" + MergeConstants.LATEST_TITLE + ")");
|
||||
myRB.setText("Use type '" + info.getMyTypeString() + "', value = '" +
|
||||
info.getMyValue() + "' (" + MergeConstants.MY_TITLE + ")");
|
||||
if (origValue != null) {
|
||||
origText =
|
||||
"Use type '" + info.getOrigTypeString() + "', value = '" + info.getOrigValue() +
|
||||
"' (" + MergeConstants.ORIGINAL_TITLE + ")";
|
||||
origText = "Use type '" + info.getOrigTypeString() + "', value = '" +
|
||||
info.getOrigValue() + "' (" + MergeConstants.ORIGINAL_TITLE + ")";
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
setBorder(BorderFactory.createTitledBorder("Resolve Property Conflict for " +
|
||||
info.getDisplayedPropertyName()));
|
||||
setBorder(BorderFactory.createTitledBorder(
|
||||
"Resolve Property Conflict for " + info.getDisplayedPropertyName()));
|
||||
|
||||
latestRB.setText("Use value '" + info.getLatestValue() + "' (" +
|
||||
MergeConstants.LATEST_TITLE + ")");
|
||||
myRB.setText("Use value '" + info.getMyValue() + "' (" + MergeConstants.MY_TITLE + " )");
|
||||
latestRB.setText(
|
||||
"Use value '" + info.getLatestValue() + "' (" + MergeConstants.LATEST_TITLE + ")");
|
||||
myRB.setText(
|
||||
"Use value '" + info.getMyValue() + "' (" + MergeConstants.MY_TITLE + " )");
|
||||
if (origValue != null) {
|
||||
origText = "Use value '" + origValue + "' (" + MergeConstants.ORIGINAL_TITLE + " )";
|
||||
}
|
||||
@ -133,15 +135,15 @@ class ConflictPanel extends JPanel {
|
||||
panel.setLayout(new BorderLayout());
|
||||
panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
|
||||
|
||||
propertyGroupLabel = new JLabel("Property Group: ");
|
||||
propertyGroupLabel = new GDLabel("Property Group: ");
|
||||
|
||||
JPanel namePanel = new JPanel(new BorderLayout());
|
||||
namePanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 10, 5));
|
||||
namePanel.add(propertyGroupLabel);
|
||||
|
||||
latestRB = new JRadioButton("Use " + MergeConstants.LATEST_TITLE);
|
||||
myRB = new JRadioButton("Use " + MergeConstants.MY_TITLE);
|
||||
originalRB = new JRadioButton("Use " + MergeConstants.ORIGINAL_TITLE);
|
||||
latestRB = new GRadioButton("Use " + MergeConstants.LATEST_TITLE);
|
||||
myRB = new GRadioButton("Use " + MergeConstants.MY_TITLE);
|
||||
originalRB = new GRadioButton("Use " + MergeConstants.ORIGINAL_TITLE);
|
||||
|
||||
latestRB.setName(LATEST_BUTTON_NAME);
|
||||
myRB.setName(CHECKED_OUT_BUTTON_NAME);
|
||||
@ -163,6 +165,7 @@ class ConflictPanel extends JPanel {
|
||||
panel.add(createUseForAllCheckBox(), BorderLayout.SOUTH);
|
||||
|
||||
ItemListener itemListener = new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
if (listener != null) {
|
||||
listener.stateChanged(null);
|
||||
@ -177,7 +180,7 @@ class ConflictPanel extends JPanel {
|
||||
}
|
||||
|
||||
protected JCheckBox createUseForAllCheckBox() {
|
||||
useForAllCB = new JCheckBox(getUseAllString("Property"));
|
||||
useForAllCB = new GCheckBox(getUseAllString("Property"));
|
||||
useForAllCB.setName(USE_FOR_ALL_CHECKBOX);
|
||||
return useForAllCB;
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import docking.widgets.EmptyBorderButton;
|
||||
import docking.widgets.checkbox.GCheckBox;
|
||||
import docking.widgets.fieldpanel.FieldPanel;
|
||||
import docking.widgets.fieldpanel.internal.FieldPanelCoordinator;
|
||||
import docking.widgets.fieldpanel.support.BackgroundColorModel;
|
||||
@ -607,7 +608,7 @@ public class ListingMergePanel extends JPanel
|
||||
|
||||
}
|
||||
|
||||
class LockComponent extends JCheckBox {
|
||||
class LockComponent extends GCheckBox {
|
||||
private static final Icon lock = ResourceManager.loadImage("images/lock.gif");
|
||||
private static final Icon unlock = ResourceManager.loadImage("images/unlock.gif");
|
||||
|
||||
|
@ -22,6 +22,9 @@ import java.awt.event.ItemListener;
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import docking.widgets.button.GRadioButton;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import docking.widgets.label.GIconLabel;
|
||||
import ghidra.app.merge.MergeConstants;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import resources.ResourceManager;
|
||||
@ -58,17 +61,15 @@ class NameConflictsPanel extends JPanel {
|
||||
text = "Use name '" + latestName + "' (" + MergeConstants.LATEST_TITLE + ")";
|
||||
}
|
||||
else {
|
||||
text =
|
||||
"Use '" + latestName + "' (" + MergeConstants.LATEST_TITLE + ") & lose '" + myName +
|
||||
"' (" + MergeConstants.MY_TITLE + ")";
|
||||
text = "Use '" + latestName + "' (" + MergeConstants.LATEST_TITLE + ") & lose '" +
|
||||
myName + "' (" + MergeConstants.MY_TITLE + ")";
|
||||
}
|
||||
keepOtherRB.setText(text);
|
||||
|
||||
String myText;
|
||||
if (myName.equals(latestName)) {
|
||||
myText =
|
||||
"Add '" + myName + "' (" + MergeConstants.MY_TITLE + ") as '" +
|
||||
ProgramTreeMergeManager.getUniqueTreeName(resultProgram, myName) + "'";
|
||||
myText = "Add '" + myName + "' (" + MergeConstants.MY_TITLE + ") as '" +
|
||||
ProgramTreeMergeManager.getUniqueTreeName(resultProgram, myName) + "'";
|
||||
}
|
||||
else {
|
||||
myText = "Add tree '" + myName + "' (" + MergeConstants.MY_TITLE + ")";
|
||||
@ -82,15 +83,13 @@ class NameConflictsPanel extends JPanel {
|
||||
}
|
||||
else {
|
||||
if (origName.equals(latestName)) {
|
||||
origText =
|
||||
"Restore '" + origName + "' (" + MergeConstants.ORIGINAL_TITLE + ") as '" +
|
||||
ProgramTreeMergeManager.getUniqueTreeName(resultProgram, origName) + "'" +
|
||||
" & lose '" + myName + "' (" + MergeConstants.MY_TITLE + ")";
|
||||
origText = "Restore '" + origName + "' (" + MergeConstants.ORIGINAL_TITLE +
|
||||
") as '" + ProgramTreeMergeManager.getUniqueTreeName(resultProgram, origName) +
|
||||
"'" + " & lose '" + myName + "' (" + MergeConstants.MY_TITLE + ")";
|
||||
}
|
||||
else {
|
||||
origText =
|
||||
"Restore '" + origName + "' (" + MergeConstants.ORIGINAL_TITLE + ") & lose '" +
|
||||
myName + "' (" + MergeConstants.MY_TITLE + ")";
|
||||
origText = "Restore '" + origName + "' (" + MergeConstants.ORIGINAL_TITLE +
|
||||
") & lose '" + myName + "' (" + MergeConstants.MY_TITLE + ")";
|
||||
}
|
||||
}
|
||||
originalRB.setText(origText);
|
||||
@ -129,16 +128,16 @@ class NameConflictsPanel extends JPanel {
|
||||
JPanel iconPanel = new JPanel();
|
||||
iconPanel.setLayout(new BoxLayout(iconPanel, BoxLayout.X_AXIS));
|
||||
|
||||
conflictsLabel = new JLabel("'My' name already exists in Latest Version");
|
||||
conflictsLabel = new GDLabel("'My' name already exists in Latest Version");
|
||||
ImageIcon icon = ResourceManager.loadImage("images/information.png");
|
||||
iconPanel.add(new JLabel(icon));
|
||||
iconPanel.add(new GIconLabel(icon));
|
||||
iconPanel.add(Box.createHorizontalStrut(5));
|
||||
iconPanel.add(conflictsLabel);
|
||||
iconPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
|
||||
|
||||
keepOtherRB = new JRadioButton("Keep 'Other' Name");
|
||||
addOrRenameRB = new JRadioButton("Rename 'My' name to My.username");
|
||||
originalRB = new JRadioButton("Use 'Original' name");
|
||||
keepOtherRB = new GRadioButton("Keep 'Other' Name");
|
||||
addOrRenameRB = new GRadioButton("Rename 'My' name to My.username");
|
||||
originalRB = new GRadioButton("Use 'Original' name");
|
||||
|
||||
keepOtherRB.setName(ProgramTreeMergePanel.KEEP_OTHER_BUTTON_NAME);
|
||||
addOrRenameRB.setName(ProgramTreeMergePanel.RENAME_PRIVATE_BUTTON_NAME);
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* ###
|
||||
* 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.
|
||||
@ -16,8 +15,6 @@
|
||||
*/
|
||||
package ghidra.app.merge.tree;
|
||||
|
||||
import ghidra.app.merge.MergeConstants;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.event.ItemEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
@ -25,6 +22,9 @@ import java.awt.event.ItemListener;
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import docking.widgets.button.GRadioButton;
|
||||
import ghidra.app.merge.MergeConstants;
|
||||
|
||||
/**
|
||||
* Panel for resolving name conflicts among program trees when private
|
||||
* name of tree does not exist in destination program.
|
||||
@ -88,10 +88,10 @@ class NamePanel extends JPanel {
|
||||
panel.setLayout(new BorderLayout());
|
||||
panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
|
||||
|
||||
keepOtherRB = new JRadioButton("Keep 'Other' Name");
|
||||
keepMyRB = new JRadioButton("Keep 'My' Name");
|
||||
newTreeRB = new JRadioButton("Add New Tree");
|
||||
originalRB = new JRadioButton("Use Original Name");
|
||||
keepOtherRB = new GRadioButton("Keep 'Other' Name");
|
||||
keepMyRB = new GRadioButton("Keep 'My' Name");
|
||||
newTreeRB = new GRadioButton("Add New Tree");
|
||||
originalRB = new GRadioButton("Use Original Name");
|
||||
|
||||
keepOtherRB.setName(ProgramTreeMergePanel.KEEP_OTHER_BUTTON_NAME);
|
||||
keepMyRB.setName(ProgramTreeMergePanel.KEEP_PRIVATE_BUTTON_NAME);
|
||||
@ -112,6 +112,7 @@ class NamePanel extends JPanel {
|
||||
|
||||
add(panel);
|
||||
ItemListener itemListener = new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
if (listener != null) {
|
||||
listener.stateChanged(null);
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* ###
|
||||
* 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.
|
||||
@ -16,11 +15,6 @@
|
||||
*/
|
||||
package ghidra.app.merge.tree;
|
||||
|
||||
import ghidra.app.merge.MergeConstants;
|
||||
import ghidra.app.merge.ProgramMultiUserMergeManager;
|
||||
import ghidra.app.merge.util.ConflictCountPanel;
|
||||
import ghidra.program.model.listing.Program;
|
||||
|
||||
import java.awt.CardLayout;
|
||||
import java.awt.Dimension;
|
||||
|
||||
@ -28,6 +22,12 @@ import javax.swing.*;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import docking.widgets.checkbox.GCheckBox;
|
||||
import ghidra.app.merge.MergeConstants;
|
||||
import ghidra.app.merge.ProgramMultiUserMergeManager;
|
||||
import ghidra.app.merge.util.ConflictCountPanel;
|
||||
import ghidra.program.model.listing.Program;
|
||||
|
||||
/**
|
||||
* Panel for getting user input to resolve tree conflicts.
|
||||
*
|
||||
@ -95,8 +95,8 @@ class ProgramTreeMergePanel extends JPanel {
|
||||
}
|
||||
else {
|
||||
currentPanel = conflictsPanel;
|
||||
conflictsPanel.setNames(resultProgram, name1, name2, origName, !structure1Changed &&
|
||||
!structure2Changed);
|
||||
conflictsPanel.setNames(resultProgram, name1, name2, origName,
|
||||
!structure1Changed && !structure2Changed);
|
||||
}
|
||||
countPanel.updateCount(conflictIndex, totalConflicts);
|
||||
|
||||
@ -137,6 +137,7 @@ class ProgramTreeMergePanel extends JPanel {
|
||||
|
||||
private JPanel createConflictPanel() {
|
||||
ChangeListener changeListener = new ChangeListener() {
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
mergeManager.clearStatusText();
|
||||
mergeManager.setApplyEnabled(true);
|
||||
@ -155,7 +156,7 @@ class ProgramTreeMergePanel extends JPanel {
|
||||
}
|
||||
|
||||
private JCheckBox createUseForAllCheckBox() {
|
||||
useForAllCB = new JCheckBox(getUseAllString(""));
|
||||
useForAllCB = new GCheckBox(getUseAllString(""));
|
||||
useForAllCB.setName(USE_FOR_ALL_CHECKBOX);
|
||||
return useForAllCB;
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* ###
|
||||
* 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.
|
||||
@ -16,12 +15,13 @@
|
||||
*/
|
||||
package ghidra.app.merge.tree;
|
||||
|
||||
import ghidra.util.layout.PairLayout;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import docking.widgets.label.GDLabel;
|
||||
import docking.widgets.label.GIconLabel;
|
||||
import ghidra.util.layout.PairLayout;
|
||||
import resources.ResourceManager;
|
||||
|
||||
/**
|
||||
@ -30,7 +30,7 @@ import resources.ResourceManager;
|
||||
*
|
||||
*/
|
||||
class TreeChangePanel extends JPanel {
|
||||
|
||||
|
||||
private JLabel treeNameLabel;
|
||||
private JLabel nameLabel;
|
||||
private JLabel structureLabel;
|
||||
@ -38,67 +38,65 @@ class TreeChangePanel extends JPanel {
|
||||
private JPanel structurePanel;
|
||||
private JLabel nameIconLabel;
|
||||
private JLabel structureIconLabel;
|
||||
|
||||
private final static ImageIcon CHANGED_ICON =
|
||||
ResourceManager.loadImage("images/changed16.gif");
|
||||
|
||||
private final static ImageIcon CHANGED_ICON = ResourceManager.loadImage("images/changed16.gif");
|
||||
private final static ImageIcon NO_CHANGE_ICON =
|
||||
ResourceManager.loadImage("images/EmptyIcon16.gif");
|
||||
private final static Color CHANGED_COLOR = Color.BLACK;
|
||||
private final static Color NO_CHANGE_COLOR = Color.GRAY;
|
||||
|
||||
|
||||
TreeChangePanel(String title) {
|
||||
super(new BorderLayout());
|
||||
setBorder(BorderFactory.createTitledBorder(title));
|
||||
create();
|
||||
}
|
||||
|
||||
|
||||
void setStates(String treeName, boolean nameChanged, boolean structureChanged) {
|
||||
|
||||
|
||||
treeNameLabel.setText(treeName);
|
||||
nameLabel.setText(nameChanged? "Name Changed" : "Name Not Changed");
|
||||
nameLabel.setForeground(nameChanged? CHANGED_COLOR : NO_CHANGE_COLOR);
|
||||
nameLabel.setText(nameChanged ? "Name Changed" : "Name Not Changed");
|
||||
nameLabel.setForeground(nameChanged ? CHANGED_COLOR : NO_CHANGE_COLOR);
|
||||
namePanel.remove(nameIconLabel);
|
||||
nameIconLabel = new JLabel(nameChanged? CHANGED_ICON : NO_CHANGE_ICON);
|
||||
nameIconLabel = new GIconLabel(nameChanged ? CHANGED_ICON : NO_CHANGE_ICON);
|
||||
namePanel.add(nameIconLabel, 0);
|
||||
|
||||
structureLabel.setText(structureChanged?
|
||||
"Structure Changed" : "Structure Not Changed");
|
||||
structureLabel.setForeground(structureChanged? CHANGED_COLOR : NO_CHANGE_COLOR);
|
||||
|
||||
structureLabel.setText(structureChanged ? "Structure Changed" : "Structure Not Changed");
|
||||
structureLabel.setForeground(structureChanged ? CHANGED_COLOR : NO_CHANGE_COLOR);
|
||||
structurePanel.remove(structureIconLabel);
|
||||
structureIconLabel = new JLabel(structureChanged? CHANGED_ICON : NO_CHANGE_ICON);
|
||||
structureIconLabel = new GIconLabel(structureChanged ? CHANGED_ICON : NO_CHANGE_ICON);
|
||||
structurePanel.add(structureIconLabel, 0);
|
||||
}
|
||||
|
||||
|
||||
private void create() {
|
||||
JPanel panel = new JPanel(new BorderLayout(0, 5));
|
||||
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
|
||||
treeNameLabel = new JLabel("Tree Name");
|
||||
|
||||
treeNameLabel = new GDLabel("Tree Name");
|
||||
Font font = treeNameLabel.getFont();
|
||||
font = new Font(font.getName(), Font.BOLD, font.getSize());
|
||||
treeNameLabel.setFont(font);
|
||||
|
||||
nameLabel = new JLabel("Name Changed");
|
||||
nameIconLabel = new JLabel(CHANGED_ICON);
|
||||
|
||||
structureLabel = new JLabel("Structure Changed");
|
||||
structureIconLabel = new JLabel(CHANGED_ICON);
|
||||
|
||||
namePanel = new JPanel(new PairLayout(0,5));
|
||||
nameLabel = new GDLabel("Name Changed");
|
||||
nameIconLabel = new GIconLabel(CHANGED_ICON);
|
||||
|
||||
structureLabel = new GDLabel("Structure Changed");
|
||||
structureIconLabel = new GIconLabel(CHANGED_ICON);
|
||||
|
||||
namePanel = new JPanel(new PairLayout(0, 5));
|
||||
namePanel.add(nameIconLabel);
|
||||
namePanel.add(nameLabel);
|
||||
|
||||
structurePanel = new JPanel(new PairLayout(0,5));
|
||||
|
||||
structurePanel = new JPanel(new PairLayout(0, 5));
|
||||
structurePanel.add(structureIconLabel);
|
||||
structurePanel.add(structureLabel);
|
||||
|
||||
|
||||
JPanel labelPanel = new JPanel();
|
||||
labelPanel.setLayout(new BoxLayout(labelPanel, BoxLayout.Y_AXIS));
|
||||
labelPanel.add(namePanel);
|
||||
labelPanel.add(structurePanel);
|
||||
|
||||
|
||||
panel.add(treeNameLabel, BorderLayout.NORTH);
|
||||
panel.add(labelPanel, BorderLayout.CENTER);
|
||||
add(panel);
|
||||
add(panel);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* ###
|
||||
* 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.
|
||||
@ -19,6 +18,7 @@ package ghidra.app.merge.util;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.address.AddressRange;
|
||||
import ghidra.program.util.DiffUtility;
|
||||
import ghidra.util.HTMLUtilities;
|
||||
|
||||
/**
|
||||
* <code>ConflictUtility</code> provides some constants and static methods
|
||||
@ -169,7 +169,8 @@ public class ConflictUtility {
|
||||
* @param isRange true if the current conflict is for an address range.
|
||||
* @return the message string containing HTML tags.
|
||||
*/
|
||||
public static String getAddressConflictCount(int addressNum, int totalAddresses, boolean isRange) {
|
||||
public static String getAddressConflictCount(int addressNum, int totalAddresses,
|
||||
boolean isRange) {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
if (isRange) {
|
||||
buf.append("Address range #");
|
||||
@ -238,7 +239,8 @@ public class ConflictUtility {
|
||||
* @return the message string containing HTML tags.
|
||||
*/
|
||||
public static String getAddressString(Address address) {
|
||||
return colorString(ADDRESS_COLOR, ((address != null) ? address.toString() : ""));
|
||||
return colorString(ADDRESS_COLOR,
|
||||
((address != null) ? HTMLUtilities.escapeHTML(address.toString()) : ""));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -248,8 +250,9 @@ public class ConflictUtility {
|
||||
* @return the message string containing HTML tags.
|
||||
*/
|
||||
public static String getAddressString(Address address, boolean showAddressSpace) {
|
||||
return colorString(ADDRESS_COLOR, ((address != null) ? address.toString(showAddressSpace)
|
||||
: ""));
|
||||
return colorString(ADDRESS_COLOR,
|
||||
((address != null) ? HTMLUtilities.escapeHTML(address.toString(showAddressSpace))
|
||||
: ""));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -32,6 +32,7 @@ import org.apache.commons.collections4.CollectionUtils;
|
||||
|
||||
import docking.options.editor.GenericOptionsComponent;
|
||||
import docking.widgets.OptionDialog;
|
||||
import docking.widgets.label.GLabel;
|
||||
import docking.widgets.table.*;
|
||||
import ghidra.GhidraOptions;
|
||||
import ghidra.app.services.Analyzer;
|
||||
@ -63,15 +64,14 @@ class AnalysisPanel extends JPanel implements PropertyChangeListener {
|
||||
private List<Boolean> analyzerEnablement = new ArrayList<>();
|
||||
private Set<String> prototypeAnalyzers = new HashSet<>();
|
||||
private Map<String, Component> analyzerToOptionsPanelMap = new HashMap<>();
|
||||
private Map<String, List<Component>> analyzerManagedComponentsMap =
|
||||
new HashMap<>();
|
||||
private Map<String, List<Component>> analyzerManagedComponentsMap = new HashMap<>();
|
||||
private EditorStateFactory editorStateFactory;
|
||||
|
||||
private JPanel noOptionsPanel;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
*
|
||||
* @param program the programs to be analyzed
|
||||
* @param editorStateFactory the editor factory
|
||||
* @param propertyChangeListener subscriber for property change notifications
|
||||
@ -80,33 +80,33 @@ class AnalysisPanel extends JPanel implements PropertyChangeListener {
|
||||
PropertyChangeListener propertyChangeListener) {
|
||||
this(List.of(program), editorStateFactory, propertyChangeListener);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
*
|
||||
* @param programs list of programs that will be analyzed
|
||||
* @param editorStateFactory the editor factory
|
||||
* @param propertyChangeListener subscriber for property change notifications
|
||||
*/
|
||||
AnalysisPanel(List<Program> programs, EditorStateFactory editorStateFactory,
|
||||
PropertyChangeListener propertyChangeListener) {
|
||||
|
||||
// Do a quick check to make sure we have at least one program. If not, we
|
||||
|
||||
// Do a quick check to make sure we have at least one program. If not, we
|
||||
// shouldn't even be here (the menus should be disabled).
|
||||
if (CollectionUtils.isEmpty(programs)) {
|
||||
throw new AssertException("Must provide a program to run analysis");
|
||||
}
|
||||
|
||||
|
||||
this.programs = programs;
|
||||
this.propertyChangeListener = propertyChangeListener;
|
||||
this.editorStateFactory = editorStateFactory;
|
||||
analysisOptions = programs.get(0).getOptions(Program.ANALYSIS_PROPERTIES);
|
||||
|
||||
|
||||
setName("Analysis Panel");
|
||||
build();
|
||||
load();
|
||||
}
|
||||
|
||||
|
||||
private void load() {
|
||||
editorList.clear();
|
||||
analyzerNames.clear();
|
||||
@ -128,9 +128,9 @@ class AnalysisPanel extends JPanel implements PropertyChangeListener {
|
||||
}
|
||||
|
||||
private void loadAnalyzers() {
|
||||
|
||||
|
||||
AutoAnalysisManager manager = AutoAnalysisManager.getAnalysisManager(programs.get(0));
|
||||
|
||||
|
||||
List<String> propertyNames = analysisOptions.getOptionNames();
|
||||
Collections.sort(propertyNames, new Comparator<String>() {
|
||||
@Override
|
||||
@ -481,7 +481,7 @@ class AnalysisPanel extends JPanel implements PropertyChangeListener {
|
||||
if (currEnabled != origEnabled) {
|
||||
changes = true;
|
||||
propertyChangeListener.propertyChange(
|
||||
new PropertyChangeEvent(this, analyzerName, origEnabled, currEnabled));
|
||||
new PropertyChangeEvent(this, analyzerName, origEnabled, currEnabled));
|
||||
}
|
||||
}
|
||||
if (changes) {
|
||||
@ -500,14 +500,14 @@ class AnalysisPanel extends JPanel implements PropertyChangeListener {
|
||||
* <p>
|
||||
* Details: This loops over every analyzer name in this panel and for
|
||||
* each, updates the associated enablement for all programs being
|
||||
* analyzed.
|
||||
* analyzed.
|
||||
*/
|
||||
void applyChanges() {
|
||||
|
||||
|
||||
for (int i = 0; i < analyzerNames.size(); ++i) {
|
||||
String analyzerName = analyzerNames.get(i);
|
||||
boolean enabled = analyzerEnablement.get(i);
|
||||
|
||||
|
||||
int id = programs.get(0).startTransaction("setting analysis options");
|
||||
boolean commit = false;
|
||||
try {
|
||||
@ -520,7 +520,7 @@ class AnalysisPanel extends JPanel implements PropertyChangeListener {
|
||||
|
||||
updateOptionForAllPrograms(analyzerName, enabled);
|
||||
}
|
||||
|
||||
|
||||
for (EditorState info : editorList) {
|
||||
info.applyValue();
|
||||
}
|
||||
@ -530,7 +530,7 @@ class AnalysisPanel extends JPanel implements PropertyChangeListener {
|
||||
List<Options> optionGroups = analysisOptions.getChildOptions();
|
||||
noOptionsPanel = new JPanel(new VerticalLayout(5));
|
||||
noOptionsPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
|
||||
noOptionsPanel.add(new JLabel("No options available."));
|
||||
noOptionsPanel.add(new GLabel("No options available."));
|
||||
|
||||
for (Options optionsGroup : optionGroups) {
|
||||
String analyzerName = optionsGroup.getName();
|
||||
@ -547,8 +547,7 @@ class AnalysisPanel extends JPanel implements PropertyChangeListener {
|
||||
List<String> optionNames = getOptionNames(optionsGroup);
|
||||
Collections.sort(optionNames);
|
||||
|
||||
List<GenericOptionsComponent> optionComponents =
|
||||
new ArrayList<>();
|
||||
List<GenericOptionsComponent> optionComponents = new ArrayList<>();
|
||||
|
||||
for (String childOptionName : optionNames) {
|
||||
EditorState childState =
|
||||
@ -587,7 +586,7 @@ class AnalysisPanel extends JPanel implements PropertyChangeListener {
|
||||
PropertyEditor editor = options.getPropertyEditor(optionName);
|
||||
return options.getObject(optionName, null) != null || editor != null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Updates the enablement of the given analyzer for all programs being analyzed.
|
||||
* <p>
|
||||
@ -595,23 +594,23 @@ class AnalysisPanel extends JPanel implements PropertyChangeListener {
|
||||
* <OL>
|
||||
* <LI>
|
||||
* When a user toggles the status of an analyzer we need to update that status for
|
||||
* EVERY open program. We don't want a situation where a user turns a particular
|
||||
* EVERY open program. We don't want a situation where a user turns a particular
|
||||
* analyzer off, but it's only turned off for the selected program.
|
||||
* </LI>
|
||||
* <LI>
|
||||
* Programs with different architectures may have different available analyzers, but we
|
||||
* Programs with different architectures may have different available analyzers, but we
|
||||
* don't worry about that here because this class is only handed programs with
|
||||
* similar architectures. If this were to ever change we would need to revisit this.
|
||||
* </LI>
|
||||
* </OL>
|
||||
*
|
||||
*
|
||||
* @param analyzerName the name of the analyzer to update
|
||||
* @param enabled if true, enable the analyzer; otherwise disable it
|
||||
*/
|
||||
public void updateOptionForAllPrograms(String analyzerName, boolean enabled) {
|
||||
for (Program program : programs) {
|
||||
|
||||
// Check to make sure we're only handling events that relate to analyzers. If we
|
||||
// Check to make sure we're only handling events that relate to analyzers. If we
|
||||
// receive something else (eg: "analyze.apply") ignore it.
|
||||
Options options = program.getOptions(Program.ANALYSIS_PROPERTIES);
|
||||
if (!options.getOptionNames().contains(analyzerName)) {
|
||||
|
@ -25,6 +25,7 @@ import javax.swing.*;
|
||||
import javax.swing.text.html.HTMLEditorKit;
|
||||
|
||||
import docking.widgets.OptionDialog;
|
||||
import docking.widgets.label.GLabel;
|
||||
import ghidra.GhidraOptions;
|
||||
import ghidra.app.services.ProgramManager;
|
||||
import ghidra.framework.model.DomainObject;
|
||||
@ -35,6 +36,7 @@ import ghidra.program.model.lang.CompilerSpecID;
|
||||
import ghidra.program.model.lang.LanguageID;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.util.GhidraProgramUtilities;
|
||||
import ghidra.util.HTMLUtilities;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.exception.CancelledException;
|
||||
import ghidra.util.task.*;
|
||||
@ -98,7 +100,7 @@ class AnalyzeAllOpenProgramsTask extends Task {
|
||||
}
|
||||
else {
|
||||
// no options dialog--analyze all programs
|
||||
validPrograms = new ArrayList<Program>(programs);
|
||||
validPrograms = new ArrayList<>(programs);
|
||||
}
|
||||
|
||||
analyzePrograms(prototypeAnalysisOptions, validPrograms, monitor);
|
||||
@ -175,7 +177,8 @@ class AnalyzeAllOpenProgramsTask extends Task {
|
||||
SwingUtilities.invokeAndWait(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
AnalysisOptionsDialog dialog = new AnalysisOptionsDialog(getValidProgramsByArchitecture());
|
||||
AnalysisOptionsDialog dialog =
|
||||
new AnalysisOptionsDialog(getValidProgramsByArchitecture());
|
||||
tool.showDialog(dialog);
|
||||
boolean shouldAnalyze = dialog.wasAnalyzeButtonSelected();
|
||||
analyze.set(shouldAnalyze);
|
||||
@ -202,7 +205,7 @@ class AnalyzeAllOpenProgramsTask extends Task {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a list of all programs that should be analyzed.
|
||||
* <p>
|
||||
@ -213,7 +216,7 @@ class AnalyzeAllOpenProgramsTask extends Task {
|
||||
* @return the list of programs to analyze
|
||||
*/
|
||||
private List<Program> getValidProgramsByArchitecture() {
|
||||
List<Program> validList = new ArrayList<Program>(programs);
|
||||
List<Program> validList = new ArrayList<>(programs);
|
||||
|
||||
ProgramID protoTypeProgramID = new ProgramID(prototypeProgram);
|
||||
|
||||
@ -223,7 +226,7 @@ class AnalyzeAllOpenProgramsTask extends Task {
|
||||
validList.remove(program);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return validList;
|
||||
}
|
||||
|
||||
@ -244,7 +247,7 @@ class AnalyzeAllOpenProgramsTask extends Task {
|
||||
List<Program> validList = getValidProgramsByArchitecture();
|
||||
|
||||
if (validList.size() != programs.size()) {
|
||||
List<Program> invalidList = new ArrayList<Program>(programs);
|
||||
List<Program> invalidList = new ArrayList<>(programs);
|
||||
invalidList.removeAll(validList);
|
||||
|
||||
if (!showNonMatchingArchitecturesWarning(validList, invalidList)) {
|
||||
@ -274,7 +277,8 @@ class AnalyzeAllOpenProgramsTask extends Task {
|
||||
|
||||
StringBuilder buffy = new StringBuilder();
|
||||
buffy.append("<html><BR>");
|
||||
buffy.append("Found open programs with architectures differing from the current program.<BR><BR><BR>");
|
||||
buffy.append(
|
||||
"Found open programs with architectures differing from the current program.<BR><BR><BR>");
|
||||
buffy.append("These programs <B>will</B> be analyzed: <BR><BR>");
|
||||
|
||||
buffy.append("<TABLE BORDER=\"0\" CELLPADDING=\"5\">");
|
||||
@ -294,7 +298,7 @@ class AnalyzeAllOpenProgramsTask extends Task {
|
||||
buffy.append("<TR>");
|
||||
buffy.append("<TD>");
|
||||
buffy.append(specialFontOpen);
|
||||
buffy.append(program.getName());
|
||||
buffy.append(HTMLUtilities.escapeHTML(program.getName()));
|
||||
buffy.append(specialFontClose);
|
||||
buffy.append("</TD>");
|
||||
buffy.append("<TD>");
|
||||
@ -321,7 +325,7 @@ class AnalyzeAllOpenProgramsTask extends Task {
|
||||
for (Program program : invalidList) {
|
||||
buffy.append("<TR>");
|
||||
buffy.append("<TD>");
|
||||
buffy.append(program.getName());
|
||||
buffy.append(HTMLUtilities.escapeHTML(program.getName()));
|
||||
buffy.append("</TD>");
|
||||
buffy.append("<TD>");
|
||||
buffy.append(program.getLanguageID());
|
||||
@ -334,9 +338,8 @@ class AnalyzeAllOpenProgramsTask extends Task {
|
||||
|
||||
buffy.append("</TABLE>");
|
||||
|
||||
OptionDialog dialog =
|
||||
new ScrollingOptionDialog("Found Differing Architectures--Continue?",
|
||||
buffy.toString(), "Continue", OptionDialog.WARNING_MESSAGE);
|
||||
OptionDialog dialog = new ScrollingOptionDialog("Found Differing Architectures--Continue?",
|
||||
buffy.toString(), "Continue", OptionDialog.WARNING_MESSAGE);
|
||||
dialog.show(null);
|
||||
return dialog.getResult() == OptionDialog.OPTION_ONE;
|
||||
}
|
||||
@ -467,8 +470,9 @@ class AnalyzeAllOpenProgramsTask extends Task {
|
||||
}
|
||||
|
||||
if (compilerSpecID == null) {
|
||||
if (other.compilerSpecID != null)
|
||||
if (other.compilerSpecID != null) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (!compilerSpecID.equals(other.compilerSpecID)) {
|
||||
return false;
|
||||
@ -491,7 +495,8 @@ class AnalyzeAllOpenProgramsTask extends Task {
|
||||
|
||||
private class ScrollingOptionDialog extends OptionDialog {
|
||||
|
||||
public ScrollingOptionDialog(String title, String message, String option1, int messageType) {
|
||||
public ScrollingOptionDialog(String title, String message, String option1,
|
||||
int messageType) {
|
||||
super(title, message, option1, messageType, null);
|
||||
}
|
||||
|
||||
@ -503,8 +508,7 @@ class AnalyzeAllOpenProgramsTask extends Task {
|
||||
editorPane.setName("MESSAGE-COMPONENT");
|
||||
editorPane.setText(message);
|
||||
|
||||
JLabel label = new JLabel();
|
||||
editorPane.setBackground(label.getBackground());
|
||||
editorPane.setBackground(new GLabel().getBackground());
|
||||
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
|
||||
|
@ -1098,7 +1098,7 @@ public class AutoAnalysisManager implements DomainObjectListener, DomainObjectCl
|
||||
}
|
||||
if (GhidraProgramUtilities.shouldAskToAnalyze(program)) {
|
||||
int answer = OptionDialog.showYesNoDialog(tool.getToolFrame(), "Analyze",
|
||||
program.getDomainFile().getName() +
|
||||
"<html>" + HTMLUtilities.escapeHTML(program.getDomainFile().getName()) +
|
||||
" has not been analyzed. Would you like to analyze it now?");
|
||||
boolean analyzed = answer == OptionDialog.OPTION_ONE;
|
||||
GhidraProgramUtilities.setAnalyzedFlag(program, analyzed);
|
||||
|
@ -23,6 +23,7 @@ import javax.swing.*;
|
||||
import docking.DialogComponentProvider;
|
||||
import docking.widgets.OptionDialog;
|
||||
import docking.widgets.filechooser.GhidraFileChooser;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import ghidra.framework.GenericRunInfo;
|
||||
import ghidra.framework.model.ProjectLocator;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
@ -75,7 +76,7 @@ public class ArchiveDialog extends DialogComponentProvider {
|
||||
GridBagLayout gbl = new GridBagLayout();
|
||||
JPanel outerPanel = new JPanel(gbl);
|
||||
|
||||
archiveLabel = new JLabel(" Archive File ");
|
||||
archiveLabel = new GDLabel(" Archive File ");
|
||||
archiveField = new JTextField();
|
||||
archiveField.setName("archiveField");
|
||||
archiveField.setColumns(NUM_TEXT_COLUMNS);
|
||||
@ -153,7 +154,7 @@ public class ArchiveDialog extends DialogComponentProvider {
|
||||
}
|
||||
File file = new File(archive);
|
||||
if (file.exists() && OptionDialog.showOptionDialog(rootPanel, "Archive File Exists",
|
||||
archive + " exists.\n " + "Do you want to overwrite existing file?",
|
||||
"File " + archive + " exists.\n " + "Do you want to overwrite existing file?",
|
||||
"Yes") != OptionDialog.OPTION_ONE) {
|
||||
return;
|
||||
}
|
||||
|
@ -1,315 +0,0 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package ghidra.app.plugin.core.archive;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Font;
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarInputStream;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import generic.io.JarReader;
|
||||
import ghidra.framework.model.*;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.util.*;
|
||||
import ghidra.util.task.TaskMonitor;
|
||||
import utilities.util.FileUtilities;
|
||||
|
||||
/**
|
||||
* Class containing some methods for creating project files from a
|
||||
* Ghidra Version 1 archive file
|
||||
* that is input via the JarInputStream parameter.
|
||||
*/
|
||||
class ProjectJarReader extends JarReader {
|
||||
|
||||
private static final String PROJECT_FILE_SUFFIX = ProjectLocator.getProjectExtension();
|
||||
private static final String PROJECT_DIR_SUFFIX = ProjectLocator.getProjectDirExtension();
|
||||
private static final String XML_FILE_SUFFIX = ".xml";
|
||||
private static final String PROPERTIES_FILE_NAME = ".properties";
|
||||
private static final String ORIGINAL_PROPERTIES_FILE_NAME = "original" + PROPERTIES_FILE_NAME;
|
||||
private static final int READ_BLOCK_SIZE = 4096;
|
||||
|
||||
/**
|
||||
* Construct a new ProjectJarReader.
|
||||
* @param jarIn the the jar file input stream the zip entries are
|
||||
* read from.
|
||||
*/
|
||||
ProjectJarReader(JarInputStream jarIn) {
|
||||
super(jarIn);
|
||||
}
|
||||
|
||||
private static final Pattern PROJECT_DATA_FILE_PATTERN = Pattern.compile(".+\\.rep/data(/.+)");
|
||||
|
||||
private static String filterDataPathsOnly(String path) {
|
||||
path = path.replace('\\', '/');
|
||||
Matcher matcher = PROJECT_DATA_FILE_PATTERN.matcher(path);
|
||||
if (matcher.find()) {
|
||||
return matcher.group(1);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the all zip entries from the jar input stream out to the specified
|
||||
* project using the reader and any needed services from the service registry.
|
||||
*
|
||||
* @param reader the reader for processing special files (entries).
|
||||
* @param services the service registry
|
||||
* @param project the project that the files are to be added to.
|
||||
* @param monitor a task monitor for indicating progress to the user.
|
||||
*
|
||||
* @return true if all files are successfully created.
|
||||
*/
|
||||
boolean createRecursively(XmlDataReader reader, File restoreDir, PluginTool tool,
|
||||
Project project, TaskMonitor monitor) throws IOException {
|
||||
boolean succeeded = true;
|
||||
StringBuffer errorBuf = new StringBuffer();
|
||||
|
||||
List<String> xmlFiles = new ArrayList<>();
|
||||
|
||||
boolean done = false;
|
||||
while (!done && succeeded) {
|
||||
if (monitor.isCancelled()) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
//Get the zip entry.
|
||||
JarEntry entry = jarIn.getNextJarEntry();
|
||||
if (entry == null) {
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
String name = entry.getName();
|
||||
|
||||
// discard property files
|
||||
if (name.endsWith(PropertyFile.PROPERTY_EXT) ||
|
||||
name.endsWith(ORIGINAL_PROPERTIES_FILE_NAME)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
name = filterDataPathsOnly(name);
|
||||
if (name == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
File file = new File(restoreDir, name);
|
||||
FileUtilities.mkdirs(file.getParentFile());
|
||||
|
||||
// Write it out to the file along with its data.
|
||||
FileOutputStream out = null;
|
||||
try {
|
||||
out = new FileOutputStream(file);
|
||||
}
|
||||
catch (FileNotFoundException fnfe) {
|
||||
String msg = fnfe.getMessage();
|
||||
if (msg == null) {
|
||||
msg = fnfe.toString();
|
||||
}
|
||||
Msg.showError(this, null, "Restore Failed",
|
||||
"Couldn't create file " + file.getAbsolutePath() + "\n" + msg);
|
||||
return false;
|
||||
}
|
||||
byte[] bytes = new byte[READ_BLOCK_SIZE];
|
||||
int numRead = 0;
|
||||
try {
|
||||
while ((numRead = jarIn.read(bytes)) != -1) {
|
||||
if (monitor.isCancelled()) {
|
||||
break;
|
||||
}
|
||||
out.write(bytes, 0, numRead);
|
||||
}
|
||||
}
|
||||
catch (IOException ioe) {
|
||||
succeeded = false;
|
||||
String msg = ioe.getMessage();
|
||||
if (msg == null) {
|
||||
msg = ioe.toString();
|
||||
}
|
||||
errorBuf.append(
|
||||
"Couldn't create file " + file.getAbsolutePath() + "\n" + msg + "\n");
|
||||
Msg.error(this, "Unexpected Exception: " + ioe.getMessage(), ioe);
|
||||
}
|
||||
finally {
|
||||
try {
|
||||
out.close();
|
||||
}
|
||||
catch (IOException ioe) {
|
||||
Msg.error(this, "Unexpected Exception: " + ioe.getMessage(), ioe);
|
||||
}
|
||||
}
|
||||
if (monitor.isCancelled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (name.endsWith(XML_FILE_SUFFIX) &&
|
||||
!name.endsWith("projectDataTypes" + XML_FILE_SUFFIX)) {
|
||||
// the extra check is for backwards compatibility
|
||||
xmlFiles.add(name);
|
||||
}
|
||||
|
||||
}
|
||||
catch (IOException ioe) {
|
||||
succeeded = false;
|
||||
String msg = ioe.getMessage();
|
||||
if (msg == null) {
|
||||
msg = ioe.toString();
|
||||
}
|
||||
errorBuf.append("Failed to restore archive entry.\n" + msg + "\n");
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Post-process the XML files that we created specially
|
||||
for (int i = 0; i < xmlFiles.size(); i++) {
|
||||
if (monitor.isCancelled()) {
|
||||
return false;
|
||||
}
|
||||
String relName = xmlFiles.get(i);
|
||||
try {
|
||||
if (!reader.addXMLObject(tool, restoreDir.getAbsolutePath(), relName, true,
|
||||
monitor) && !monitor.isCancelled()) {
|
||||
succeeded = false;
|
||||
errorBuf.append("Couldn't restore " + relName + ".\n" + "\n");
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
succeeded = false;
|
||||
String msg = e.getMessage();
|
||||
if (msg == null) {
|
||||
msg = e.toString();
|
||||
}
|
||||
errorBuf.append("Couldn't restore " + relName + ".\n" + e.getMessage() + "\n");
|
||||
}
|
||||
}
|
||||
|
||||
// Post-process the .property files to restore ghidra ownership.
|
||||
// for (int i = 0; i < propertyFiles.size(); i++) {
|
||||
// if (monitor.isCancelled()) {
|
||||
// return false;
|
||||
// }
|
||||
// String pName = propertyFiles.get(i);
|
||||
// if (!replacePropertyFile(basePath + pName)) {
|
||||
// succeeded = false;
|
||||
// errorBuf.append("Couldn't restore " + pName + ".\n" + "\n");
|
||||
// }
|
||||
// }
|
||||
|
||||
if (monitor.isCancelled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final String summary = reader.getSummary();
|
||||
if (summary != null) {
|
||||
SystemUtilities.runSwingNow(
|
||||
() -> showErrorDialog(null, "Please review the messages below:", summary));
|
||||
}
|
||||
|
||||
//TODO: Will still need to add code for changing actual file
|
||||
// ownership on the file system for the files that have been
|
||||
// created on behalf of restoring other users' stuff.
|
||||
|
||||
if (!succeeded) {
|
||||
String message = errorBuf.toString();
|
||||
String title = "Error Restoring Project Archive";
|
||||
project.releaseFiles(tool);
|
||||
Msg.showError(this, null, title, message);
|
||||
}
|
||||
return succeeded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays an error dialog.
|
||||
*
|
||||
* @param parent component to which dialog should be parented
|
||||
* @param title title of error dialog
|
||||
* @param message message(s) to display, can be multiple lines
|
||||
*/
|
||||
private static void showErrorDialog(Component parent, String title, String message) {
|
||||
if (message.indexOf("\n") >= 0) {
|
||||
showMultiLineMessage(parent, title, message, JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
else {
|
||||
showSingleLineMessage(parent, title, message, JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
private static void showMultiLineMessage(Component parent, String title, String message,
|
||||
int type) {
|
||||
JTextArea textArea = new JTextArea(20, 60);
|
||||
textArea.setFont(new Font("Monospaced", Font.BOLD, 12));
|
||||
textArea.setEditable(false);
|
||||
textArea.setText(message);
|
||||
textArea.setOpaque(false);
|
||||
JScrollPane scrollPane = new JScrollPane(textArea);
|
||||
JOptionPane.showMessageDialog(parent, scrollPane, title, type);
|
||||
}
|
||||
|
||||
private static void showSingleLineMessage(Component parent, String title, String message,
|
||||
int type) {
|
||||
JLabel textLabel = new JLabel();
|
||||
textLabel.setText(message);
|
||||
JOptionPane.showMessageDialog(parent, textLabel, title, type);
|
||||
}
|
||||
|
||||
private boolean replacePropertyFile(String filepath) {
|
||||
if (!filepath.endsWith(ORIGINAL_PROPERTIES_FILE_NAME)) {
|
||||
return false;
|
||||
}
|
||||
File origFile = new File(filepath);
|
||||
int endOffset = filepath.length() - ORIGINAL_PROPERTIES_FILE_NAME.length();
|
||||
filepath = filepath.substring(0, endOffset) + PROPERTIES_FILE_NAME;
|
||||
|
||||
File newFile = new File(filepath);
|
||||
if (newFile.exists() && !newFile.delete()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Need to rename the file from original.properties to .properties
|
||||
return origFile.renameTo(newFile);
|
||||
}
|
||||
|
||||
private String modifyName(String name, String projectName) {
|
||||
// Project File?
|
||||
name = name.replace("\\", File.separator);
|
||||
if (name.endsWith(PROJECT_FILE_SUFFIX)) {
|
||||
int start = name.lastIndexOf(File.separator);
|
||||
if (start == -1) {
|
||||
return projectName + PROJECT_FILE_SUFFIX;
|
||||
}
|
||||
String first = name.substring(0, start);
|
||||
return first + projectName + PROJECT_FILE_SUFFIX;
|
||||
}
|
||||
// Project Folder?
|
||||
int suffixIndex = name.indexOf(PROJECT_DIR_SUFFIX);
|
||||
if (suffixIndex > -1) {
|
||||
String prefix = name.substring(0, suffixIndex);
|
||||
String suffix = name.substring(suffixIndex);
|
||||
int end = prefix.lastIndexOf(File.separator);
|
||||
if (end == -1) {
|
||||
return projectName + suffix;
|
||||
}
|
||||
return prefix.substring(0, end) + projectName + suffix;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
}
|
@ -24,6 +24,7 @@ import javax.swing.*;
|
||||
|
||||
import docking.DialogComponentProvider;
|
||||
import docking.widgets.filechooser.GhidraFileChooser;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import ghidra.framework.GenericRunInfo;
|
||||
import ghidra.framework.model.ProjectLocator;
|
||||
import ghidra.framework.preferences.Preferences;
|
||||
@ -76,7 +77,7 @@ public class RestoreDialog extends DialogComponentProvider {
|
||||
protected JPanel buildMainPanel() {
|
||||
|
||||
// Create the individual components that make up the panel.
|
||||
archiveLabel = new JLabel(" Archive File ");
|
||||
archiveLabel = new GDLabel(" Archive File ");
|
||||
archiveField = new JTextField();
|
||||
archiveField.setColumns(NUM_TEXT_COLUMNS);
|
||||
archiveField.setName("archiveField");
|
||||
@ -115,7 +116,7 @@ public class RestoreDialog extends DialogComponentProvider {
|
||||
Font font = archiveBrowse.getFont();
|
||||
archiveBrowse.setFont(new Font(font.getName(), Font.BOLD, font.getSize()));
|
||||
|
||||
restoreLabel = new JLabel(" Restore Directory ");
|
||||
restoreLabel = new GDLabel(" Restore Directory ");
|
||||
restoreField = new JTextField();
|
||||
restoreField.setName("restoreField");
|
||||
restoreField.setColumns(RestoreDialog.NUM_TEXT_COLUMNS);
|
||||
@ -132,7 +133,7 @@ public class RestoreDialog extends DialogComponentProvider {
|
||||
font = restoreBrowse.getFont();
|
||||
restoreBrowse.setFont(new Font(font.getName(), Font.BOLD, font.getSize()));
|
||||
|
||||
projectNameLabel = new JLabel(" Project Name ");
|
||||
projectNameLabel = new GDLabel(" Project Name ");
|
||||
projectNameField = new JTextField();
|
||||
projectNameField.setName("projectNameField");
|
||||
projectNameField.setColumns(RestoreDialog.NUM_TEXT_COLUMNS);
|
||||
|
@ -25,6 +25,7 @@ import javax.swing.text.BadLocationException;
|
||||
|
||||
import docking.EmptyBorderToggleButton;
|
||||
import docking.widgets.autocomplete.*;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import docking.widgets.textfield.TextFieldLinker;
|
||||
import ghidra.GhidraApplicationLayout;
|
||||
import ghidra.GhidraLaunchable;
|
||||
@ -705,7 +706,7 @@ public class AssemblyDualTextField {
|
||||
Box hbox = Box.createHorizontalBox();
|
||||
dialog.add(hbox, BorderLayout.NORTH);
|
||||
|
||||
JLabel addrlabel = new JLabel(String.format(ADDR_FORMAT, curAddr));
|
||||
JLabel addrlabel = new GDLabel(String.format(ADDR_FORMAT, curAddr));
|
||||
hbox.add(addrlabel);
|
||||
|
||||
AssemblyDualTextField input = new AssemblyDualTextField();
|
||||
|
@ -26,6 +26,7 @@ import ghidra.program.model.address.AddressSet;
|
||||
import ghidra.program.model.listing.*;
|
||||
import ghidra.program.util.MarkerLocation;
|
||||
import ghidra.program.util.ProgramLocation;
|
||||
import ghidra.util.HTMLUtilities;
|
||||
import resources.ResourceManager;
|
||||
|
||||
/**
|
||||
@ -93,9 +94,8 @@ public class BookmarkNavigator {
|
||||
color = DEFAULT_COLOR;
|
||||
}
|
||||
|
||||
markerSet =
|
||||
markerService.createPointMarker(type + " Bookmarks", type + " Bookmarks",
|
||||
bookmarkMgr.getProgram(), priority, true, true, false, color, icon);
|
||||
markerSet = markerService.createPointMarker(type + " Bookmarks", type + " Bookmarks",
|
||||
bookmarkMgr.getProgram(), priority, true, true, false, color, icon);
|
||||
|
||||
markerSet.setNavigationListener(new MarkerListener() {
|
||||
@Override
|
||||
@ -118,11 +118,11 @@ public class BookmarkNavigator {
|
||||
String cat = bookmarks[i].getCategory();
|
||||
if (cat != null && cat.length() != 0) {
|
||||
buf.append(" [");
|
||||
buf.append(cat);
|
||||
buf.append(HTMLUtilities.escapeHTML(cat));
|
||||
buf.append("]");
|
||||
}
|
||||
buf.append(": ");
|
||||
buf.append(bookmarks[i].getComment());
|
||||
buf.append(HTMLUtilities.escapeHTML(bookmarks[i].getComment()));
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
@ -203,10 +203,10 @@ public class BookmarkNavigator {
|
||||
*/
|
||||
public static void defineBookmarkTypes(Program program) {
|
||||
BookmarkManager mgr = program.getBookmarkManager();
|
||||
mgr.defineType(BookmarkType.NOTE, BookmarkNavigator.NOTE_ICON,
|
||||
BookmarkNavigator.NOTE_COLOR, BookmarkNavigator.NOTE_PRIORITY);
|
||||
mgr.defineType(BookmarkType.INFO, BookmarkNavigator.INFO_ICON,
|
||||
BookmarkNavigator.INFO_COLOR, BookmarkNavigator.INFO_PRIORITY);
|
||||
mgr.defineType(BookmarkType.NOTE, BookmarkNavigator.NOTE_ICON, BookmarkNavigator.NOTE_COLOR,
|
||||
BookmarkNavigator.NOTE_PRIORITY);
|
||||
mgr.defineType(BookmarkType.INFO, BookmarkNavigator.INFO_ICON, BookmarkNavigator.INFO_COLOR,
|
||||
BookmarkNavigator.INFO_PRIORITY);
|
||||
mgr.defineType(BookmarkType.WARNING, BookmarkNavigator.WARNING_ICON,
|
||||
BookmarkNavigator.WARNING_COLOR, BookmarkNavigator.WARNING_PRIORITY);
|
||||
mgr.defineType(BookmarkType.ERROR, BookmarkNavigator.ERROR_ICON,
|
||||
|
@ -29,7 +29,10 @@ import javax.swing.*;
|
||||
|
||||
import docking.DialogComponentProvider;
|
||||
import docking.DockingUtils;
|
||||
import docking.widgets.checkbox.GCheckBox;
|
||||
import docking.widgets.combobox.GhidraComboBox;
|
||||
import docking.widgets.label.GIconLabel;
|
||||
import docking.widgets.label.GLabel;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.listing.*;
|
||||
import ghidra.util.HelpLocation;
|
||||
@ -112,7 +115,7 @@ public class CreateBookmarkDialog extends DialogComponentProvider {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Some items in the dialog change depending on whether we have multiple selection
|
||||
// ranges, so capture that information here.
|
||||
int ranges = 0;
|
||||
@ -120,11 +123,10 @@ public class CreateBookmarkDialog extends DialogComponentProvider {
|
||||
ranges = plugin.getProgramSelection().getNumAddressRanges();
|
||||
}
|
||||
|
||||
JLabel locationLabel = new JLabel("Address: ", SwingConstants.RIGHT);
|
||||
locationTextField = new JTextField(50);
|
||||
locationTextField.setText(address.toString());
|
||||
if (hasSelection && ranges > 1) {
|
||||
locationTextField.setText(address.toString() + " (plus " + (ranges-1) + " more)");
|
||||
locationTextField.setText(address.toString() + " (plus " + (ranges - 1) + " more)");
|
||||
}
|
||||
locationTextField.setCaretPosition(0);
|
||||
locationTextField.setEditable(false);
|
||||
@ -132,7 +134,6 @@ public class CreateBookmarkDialog extends DialogComponentProvider {
|
||||
locationTextField.setMinimumSize(locationTextField.getPreferredSize());
|
||||
locationTextField.addKeyListener(listener);
|
||||
|
||||
JLabel categoryLabel = new JLabel("Category: ", SwingConstants.RIGHT);
|
||||
categoryComboBox = new GhidraComboBox<>(getModel());
|
||||
categoryComboBox.setEditable(true);
|
||||
categoryComboBox.addKeyListener(listener);
|
||||
@ -140,11 +141,10 @@ public class CreateBookmarkDialog extends DialogComponentProvider {
|
||||
categoryTextField = (JTextField) categoryComboBox.getEditor().getEditorComponent();
|
||||
categoryTextField.addKeyListener(listener);
|
||||
|
||||
JLabel commentLabel = new JLabel("Description: ", SwingConstants.RIGHT);
|
||||
commentTextField = new JTextField(20);
|
||||
commentTextField.addKeyListener(listener);
|
||||
|
||||
selectionCB = new JCheckBox("Bookmark Top of Each Selection", hasSelection);
|
||||
selectionCB = new GCheckBox("Bookmark Top of Each Selection", hasSelection);
|
||||
selectionCB.setEnabled(false);
|
||||
if (hasSelection) {
|
||||
selectionCB.setEnabled(ranges > 1);
|
||||
@ -160,7 +160,7 @@ public class CreateBookmarkDialog extends DialogComponentProvider {
|
||||
gbc.weighty = 0;
|
||||
gbc.fill = GridBagConstraints.NONE;
|
||||
gbc.anchor = GridBagConstraints.EAST;
|
||||
mainPanel.add(categoryLabel, gbc);
|
||||
mainPanel.add(new GLabel("Category: ", SwingConstants.RIGHT), gbc);
|
||||
|
||||
gbc.gridx = 2;
|
||||
gbc.gridy = 1;
|
||||
@ -176,7 +176,7 @@ public class CreateBookmarkDialog extends DialogComponentProvider {
|
||||
gbc.weighty = 0;
|
||||
gbc.fill = GridBagConstraints.NONE;
|
||||
gbc.anchor = GridBagConstraints.EAST;
|
||||
mainPanel.add(locationLabel, gbc);
|
||||
mainPanel.add(new GLabel("Address: ", SwingConstants.RIGHT), gbc);
|
||||
|
||||
gbc.gridx = 2;
|
||||
gbc.gridy = 0;
|
||||
@ -192,7 +192,7 @@ public class CreateBookmarkDialog extends DialogComponentProvider {
|
||||
gbc.weighty = 0;
|
||||
gbc.fill = GridBagConstraints.NONE;
|
||||
gbc.anchor = GridBagConstraints.EAST;
|
||||
mainPanel.add(commentLabel, gbc);
|
||||
mainPanel.add(new GLabel("Description: ", SwingConstants.RIGHT), gbc);
|
||||
|
||||
gbc.gridx = 2;
|
||||
gbc.gridy = 2;
|
||||
@ -203,7 +203,7 @@ public class CreateBookmarkDialog extends DialogComponentProvider {
|
||||
mainPanel.add(commentTextField, gbc);
|
||||
|
||||
ImageIcon icon = BookmarkNavigator.NOTE_ICON;
|
||||
JLabel imageLabel = new JLabel(icon);
|
||||
JLabel imageLabel = new GIconLabel(icon);
|
||||
imageLabel.setPreferredSize(
|
||||
new Dimension(icon.getIconWidth() + 20, icon.getIconHeight() + 20));
|
||||
|
||||
|
@ -22,6 +22,8 @@ import java.util.List;
|
||||
import javax.swing.*;
|
||||
|
||||
import docking.DialogComponentProvider;
|
||||
import docking.widgets.checkbox.GCheckBox;
|
||||
import docking.widgets.label.GLabel;
|
||||
import ghidra.app.util.HelpTopics;
|
||||
import ghidra.program.model.listing.*;
|
||||
import ghidra.util.HelpLocation;
|
||||
@ -30,7 +32,7 @@ import ghidra.util.layout.VerticalLayout;
|
||||
|
||||
class FilterDialog extends DialogComponentProvider {
|
||||
private BookmarkProvider provider;
|
||||
private JCheckBox[] buttons;
|
||||
private GCheckBox[] buttons;
|
||||
private BookmarkType[] types;
|
||||
|
||||
FilterDialog(BookmarkProvider provider, Program p) {
|
||||
@ -51,16 +53,16 @@ class FilterDialog extends DialogComponentProvider {
|
||||
private JPanel getTypesPanel(Program program) {
|
||||
BookmarkManager bmMgr = program.getBookmarkManager();
|
||||
types = bmMgr.getBookmarkTypes();
|
||||
buttons = new JCheckBox[types.length];
|
||||
buttons = new GCheckBox[types.length];
|
||||
JPanel panel = new JPanel(new PairLayout(5, 20));
|
||||
panel.setBorder(BorderFactory.createTitledBorder("Include Bookmark Types"));
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
buttons[i] = new JCheckBox();
|
||||
buttons[i] = new GCheckBox();
|
||||
JPanel p = new JPanel(new BorderLayout());
|
||||
p.add(buttons[i], BorderLayout.WEST);
|
||||
buttons[i].setSelected(provider.isShowingType(types[i].getTypeString()));
|
||||
JLabel l =
|
||||
new JLabel(types[i].getTypeString(), types[i].getIcon(), SwingConstants.LEFT);
|
||||
new GLabel(types[i].getTypeString(), types[i].getIcon(), SwingConstants.LEFT);
|
||||
p.add(l, BorderLayout.CENTER);
|
||||
panel.add(p);
|
||||
}
|
||||
@ -69,7 +71,7 @@ class FilterDialog extends DialogComponentProvider {
|
||||
|
||||
@Override
|
||||
protected void okCallback() {
|
||||
List<String> typesList = new ArrayList<String>(types.length);
|
||||
List<String> typesList = new ArrayList<>(types.length);
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (buttons[i].isSelected()) {
|
||||
typesList.add(types[i].getTypeString());
|
||||
|
@ -29,6 +29,7 @@ import docking.WindowPosition;
|
||||
import docking.action.*;
|
||||
import docking.util.GraphicsUtils;
|
||||
import docking.widgets.dialogs.NumberInputDialog;
|
||||
import docking.widgets.label.GLabel;
|
||||
import docking.widgets.tree.*;
|
||||
import docking.widgets.tree.support.GTreeSelectionEvent.EventOrigin;
|
||||
import docking.widgets.tree.support.GTreeSelectionListener;
|
||||
@ -792,10 +793,7 @@ public class CallTreeProvider extends ComponentProviderAdapter implements Domain
|
||||
private JPanel createTreePanel(boolean isIncoming, GTree tree) {
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
|
||||
String name = isIncoming ? "Incoming Calls" : "Outgoing Calls";
|
||||
JLabel label = new JLabel(name);
|
||||
|
||||
panel.add(label, BorderLayout.NORTH);
|
||||
panel.add(new GLabel(isIncoming ? "Incoming Calls" : "Outgoing Calls"), BorderLayout.NORTH);
|
||||
panel.add(tree, BorderLayout.CENTER);
|
||||
|
||||
return panel;
|
||||
|
@ -24,6 +24,7 @@ import javax.swing.*;
|
||||
|
||||
import docking.ActionContext;
|
||||
import docking.action.*;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import ghidra.app.context.ProgramContextAction;
|
||||
import ghidra.framework.plugintool.ComponentProviderAdapter;
|
||||
import ghidra.util.HelpLocation;
|
||||
@ -92,7 +93,7 @@ public class ComputeChecksumsProvider extends ComponentProviderAdapter {
|
||||
resultsMainPanel.add(tablePanel);
|
||||
main.add(resultsMainPanel, BorderLayout.CENTER);
|
||||
|
||||
errorStatus = new JLabel(" ");
|
||||
errorStatus = new GDLabel(" ");
|
||||
errorStatus.setName("message");
|
||||
errorStatus.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
errorStatus.setForeground(Color.RED);
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* ###
|
||||
* 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.
|
||||
@ -16,9 +15,6 @@
|
||||
*/
|
||||
package ghidra.app.plugin.core.clear;
|
||||
|
||||
import ghidra.app.context.ListingActionContext;
|
||||
import ghidra.util.HelpLocation;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.event.*;
|
||||
@ -28,6 +24,11 @@ import java.util.List;
|
||||
import javax.swing.*;
|
||||
|
||||
import docking.DialogComponentProvider;
|
||||
import docking.widgets.checkbox.GCheckBox;
|
||||
import docking.widgets.checkbox.GHtmlCheckBox;
|
||||
import docking.widgets.label.GLabel;
|
||||
import ghidra.app.context.ListingActionContext;
|
||||
import ghidra.util.HelpLocation;
|
||||
|
||||
/**
|
||||
* Dialog that shows options for "Clear All." User can choose to clear
|
||||
@ -115,28 +116,26 @@ public class ClearDialog extends DialogComponentProvider {
|
||||
panel = new JPanel();
|
||||
panel.setLayout(new BorderLayout(10, 10));
|
||||
|
||||
JLabel label = new JLabel("Clear Options:");
|
||||
panel.add(label, BorderLayout.NORTH);
|
||||
panel.add(new GLabel("Clear Options:"), BorderLayout.NORTH);
|
||||
|
||||
JPanel cbPanel = new JPanel();
|
||||
BoxLayout bl = new BoxLayout(cbPanel, BoxLayout.Y_AXIS);
|
||||
cbPanel.setLayout(bl);
|
||||
|
||||
symbolsCb = new JCheckBox("Symbols");
|
||||
commentsCb =
|
||||
new JCheckBox(
|
||||
"<HTML>Comments <FONT SIZE=\"2\">(does not affect automatic comments)</FONT>");
|
||||
symbolsCb = new GCheckBox("Symbols");
|
||||
commentsCb = new GHtmlCheckBox(
|
||||
"<HTML>Comments <FONT SIZE=\"2\">(does not affect automatic comments)</FONT>");
|
||||
commentsCb.setVerticalTextPosition(SwingConstants.TOP);
|
||||
propertiesCb = new JCheckBox("Properties");
|
||||
codeCb = new JCheckBox("Code");
|
||||
functionsCb = new JCheckBox("Functions");
|
||||
registersCb = new JCheckBox("Registers");
|
||||
equatesCb = new JCheckBox("Equates");
|
||||
userReferencesCb = new JCheckBox("User-defined References");
|
||||
analysisReferencesCb = new JCheckBox("Analysis References");
|
||||
importReferencesCb = new JCheckBox("Import References");
|
||||
systemReferencesCb = new JCheckBox("Default References");
|
||||
bookmarksCb = new JCheckBox("Bookmarks");
|
||||
propertiesCb = new GCheckBox("Properties");
|
||||
codeCb = new GCheckBox("Code");
|
||||
functionsCb = new GCheckBox("Functions");
|
||||
registersCb = new GCheckBox("Registers");
|
||||
equatesCb = new GCheckBox("Equates");
|
||||
userReferencesCb = new GCheckBox("User-defined References");
|
||||
analysisReferencesCb = new GCheckBox("Analysis References");
|
||||
importReferencesCb = new GCheckBox("Import References");
|
||||
systemReferencesCb = new GCheckBox("Default References");
|
||||
bookmarksCb = new GCheckBox("Bookmarks");
|
||||
|
||||
symbolsCb.setSelected(true);
|
||||
symbolsCb.addKeyListener(listener);
|
||||
@ -179,6 +178,7 @@ public class ClearDialog extends DialogComponentProvider {
|
||||
// if a user clears the code, then we will force them
|
||||
// to clear all user references...
|
||||
codeCb.addItemListener(new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
if (codeCb.isSelected()) {
|
||||
userReferencesCb.setSelected(true);
|
||||
@ -205,7 +205,7 @@ public class ClearDialog extends DialogComponentProvider {
|
||||
systemReferencesCb.setEnabled(false);
|
||||
|
||||
// record the checkboxes for later use
|
||||
final List<JCheckBox> checkBoxList = new ArrayList<JCheckBox>(10);
|
||||
final List<JCheckBox> checkBoxList = new ArrayList<>(10);
|
||||
checkBoxList.add(symbolsCb);
|
||||
checkBoxList.add(commentsCb);
|
||||
checkBoxList.add(propertiesCb);
|
||||
@ -222,6 +222,7 @@ public class ClearDialog extends DialogComponentProvider {
|
||||
JPanel buttonPanel = new JPanel();
|
||||
JButton selectAllButton = new JButton("Select All");
|
||||
selectAllButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
setAllCheckBoxesSelected(true, checkBoxList);
|
||||
}
|
||||
@ -229,6 +230,7 @@ public class ClearDialog extends DialogComponentProvider {
|
||||
|
||||
JButton deselectAllbutton = new JButton("Deselect All");
|
||||
deselectAllbutton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
setAllCheckBoxesSelected(false, checkBoxList);
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* ###
|
||||
* 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.
|
||||
@ -16,9 +15,6 @@
|
||||
*/
|
||||
package ghidra.app.plugin.core.clear;
|
||||
|
||||
import ghidra.app.context.ListingActionContext;
|
||||
import ghidra.util.HelpLocation;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.event.*;
|
||||
@ -26,6 +22,10 @@ import java.awt.event.*;
|
||||
import javax.swing.*;
|
||||
|
||||
import docking.DialogComponentProvider;
|
||||
import docking.widgets.checkbox.GCheckBox;
|
||||
import docking.widgets.label.GLabel;
|
||||
import ghidra.app.context.ListingActionContext;
|
||||
import ghidra.util.HelpLocation;
|
||||
|
||||
/**
|
||||
* Dialog that shows options for "Clear Flow and Repair." User can choose to clear
|
||||
@ -92,16 +92,15 @@ public class ClearFlowDialog extends DialogComponentProvider {
|
||||
panel = new JPanel();
|
||||
panel.setLayout(new BorderLayout(10, 10));
|
||||
|
||||
JLabel label = new JLabel("Clear Flow Options:");
|
||||
panel.add(label, BorderLayout.NORTH);
|
||||
panel.add(new GLabel("Clear Flow Options:"), BorderLayout.NORTH);
|
||||
|
||||
JPanel cbPanel = new JPanel();
|
||||
BoxLayout bl = new BoxLayout(cbPanel, BoxLayout.Y_AXIS);
|
||||
cbPanel.setLayout(bl);
|
||||
|
||||
symbolsCb = new JCheckBox("Clear Symbols");
|
||||
dataCb = new JCheckBox("Clear Data");
|
||||
repairCb = new JCheckBox("Repair Flow");
|
||||
symbolsCb = new GCheckBox("Clear Symbols");
|
||||
dataCb = new GCheckBox("Clear Data");
|
||||
repairCb = new GCheckBox("Repair Flow");
|
||||
|
||||
symbolsCb.setSelected(false);
|
||||
symbolsCb.addKeyListener(listener);
|
||||
|
@ -32,6 +32,7 @@ import ghidra.program.model.listing.*;
|
||||
import ghidra.program.model.mem.MemoryBlock;
|
||||
import ghidra.program.util.AddressFieldLocation;
|
||||
import ghidra.program.util.ProgramLocation;
|
||||
import ghidra.util.HTMLUtilities;
|
||||
|
||||
/**
|
||||
* A hover service to show tool tip text for hovering over a program address in the listing.
|
||||
@ -92,7 +93,8 @@ public class ProgramAddressRelationshipListingHover extends AbstractConfigurable
|
||||
|
||||
MemoryBlock block = program.getMemory().getBlock(loc);
|
||||
long memblockOffset = loc.subtract(block.getStart());
|
||||
appendTableRow(sb, "Memory Block Offset", block.getName(), memblockOffset);
|
||||
appendTableRow(sb, "Memory Block Offset", HTMLUtilities.escapeHTML(block.getName()),
|
||||
memblockOffset);
|
||||
|
||||
addFunctionInfo(program, loc, sb);
|
||||
addDataInfo(program, loc, sb);
|
||||
@ -141,7 +143,8 @@ public class ProgramAddressRelationshipListingHover extends AbstractConfigurable
|
||||
Function function = program.getFunctionManager().getFunctionContaining(loc);
|
||||
if (function != null) {
|
||||
long functionOffset = loc.subtract(function.getEntryPoint());
|
||||
appendTableRow(sb, "Function Offset", function.getName(), functionOffset);
|
||||
appendTableRow(sb, "Function Offset", HTMLUtilities.escapeHTML(function.getName()),
|
||||
functionOffset);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* ###
|
||||
* 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.
|
||||
@ -16,12 +15,6 @@
|
||||
*/
|
||||
package ghidra.app.plugin.core.comments;
|
||||
|
||||
import ghidra.app.util.viewer.field.AnnotatedStringHandler;
|
||||
import ghidra.app.util.viewer.field.Annotation;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.program.model.listing.CodeUnit;
|
||||
import ghidra.util.HelpLocation;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.event.*;
|
||||
import java.util.*;
|
||||
@ -33,6 +26,13 @@ import javax.swing.text.JTextComponent;
|
||||
|
||||
import docking.*;
|
||||
import docking.widgets.OptionDialog;
|
||||
import docking.widgets.checkbox.GCheckBox;
|
||||
import docking.widgets.combobox.GComboBox;
|
||||
import ghidra.app.util.viewer.field.AnnotatedStringHandler;
|
||||
import ghidra.app.util.viewer.field.Annotation;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.program.model.listing.CodeUnit;
|
||||
import ghidra.util.HelpLocation;
|
||||
|
||||
/**
|
||||
* Dialog for setting the comments for a CodeUnit.
|
||||
@ -45,8 +45,7 @@ public class CommentsDialog extends DialogComponentProvider implements KeyListen
|
||||
private JTextArea plateField;
|
||||
private JTextArea repeatableField;
|
||||
|
||||
private Map<Document, UndoRedoKeeper> documentUndoRedoMap =
|
||||
new HashMap<Document, UndoRedoKeeper>(9);
|
||||
private Map<Document, UndoRedoKeeper> documentUndoRedoMap = new HashMap<>(9);
|
||||
|
||||
private String preComment;
|
||||
private String postComment;
|
||||
@ -62,7 +61,7 @@ public class CommentsDialog extends DialogComponentProvider implements KeyListen
|
||||
private boolean wasChanged;
|
||||
|
||||
private boolean enterMode = false;
|
||||
private JCheckBox enterBox = new JCheckBox("Enter accepts comment", enterMode);
|
||||
private JCheckBox enterBox = new GCheckBox("Enter accepts comment", enterMode);
|
||||
{
|
||||
enterBox.addChangeListener(new ChangeListener() {
|
||||
@Override
|
||||
@ -168,9 +167,8 @@ public class CommentsDialog extends DialogComponentProvider implements KeyListen
|
||||
protected void cancelCallback() {
|
||||
|
||||
if (wasChanged) {
|
||||
int result =
|
||||
OptionDialog.showYesNoCancelDialog(getComponent(), "Save Changes?",
|
||||
"Some comments were modified.\nSave Changes?");
|
||||
int result = OptionDialog.showYesNoCancelDialog(getComponent(), "Save Changes?",
|
||||
"Some comments were modified.\nSave Changes?");
|
||||
if (result == OptionDialog.OPTION_ONE) {
|
||||
applyCallback();
|
||||
}
|
||||
@ -267,9 +265,9 @@ public class CommentsDialog extends DialogComponentProvider implements KeyListen
|
||||
JPanel auxiliaryControlPanel = new JPanel(new BorderLayout());
|
||||
auxiliaryControlPanel.add(enterBox, BorderLayout.SOUTH);
|
||||
|
||||
final AnnotationAdapterWrapper[] annotations = getAnnotationAdapterWrappers();
|
||||
AnnotationAdapterWrapper[] annotations = getAnnotationAdapterWrappers();
|
||||
Arrays.sort(annotations);
|
||||
final JComboBox annotationsComboBox = new JComboBox(annotations);
|
||||
GComboBox<AnnotationAdapterWrapper> annotationsComboBox = new GComboBox<>(annotations);
|
||||
JButton addAnnotationButton = new JButton("Add Annotation");
|
||||
addAnnotationButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
@ -277,7 +275,8 @@ public class CommentsDialog extends DialogComponentProvider implements KeyListen
|
||||
JTextArea currentTextArea = getSelectedTextArea();
|
||||
AnnotationAdapterWrapper aaw =
|
||||
(AnnotationAdapterWrapper) annotationsComboBox.getSelectedItem();
|
||||
currentTextArea.insert(aaw.getPrototypeString(), currentTextArea.getCaretPosition());
|
||||
currentTextArea.insert(aaw.getPrototypeString(),
|
||||
currentTextArea.getCaretPosition());
|
||||
currentTextArea.setCaretPosition(currentTextArea.getCaretPosition() - 1);
|
||||
}
|
||||
});
|
||||
@ -289,6 +288,7 @@ public class CommentsDialog extends DialogComponentProvider implements KeyListen
|
||||
panel.add(auxiliaryControlPanel, BorderLayout.SOUTH);
|
||||
|
||||
preField = new JTextArea(5, 80) {
|
||||
@Override
|
||||
public boolean getScrollableTracksViewportWidth() {
|
||||
boolean b = super.getScrollableTracksViewportWidth();
|
||||
return b;
|
||||
|
@ -23,8 +23,7 @@ import ghidra.program.database.data.DataTypeUtilities;
|
||||
import ghidra.program.model.data.*;
|
||||
import ghidra.program.model.data.Composite.AlignmentType;
|
||||
import ghidra.program.model.lang.InsufficientBytesException;
|
||||
import ghidra.util.InvalidNameException;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.*;
|
||||
import ghidra.util.exception.*;
|
||||
|
||||
public abstract class CompEditorModel extends CompositeEditorModel {
|
||||
@ -1417,8 +1416,9 @@ public abstract class CompEditorModel extends CompositeEditorModel {
|
||||
*/
|
||||
@Override
|
||||
public boolean isMoveUpAllowed() {
|
||||
if (!isContiguousSelection())
|
||||
if (!isContiguousSelection()) {
|
||||
return false;
|
||||
}
|
||||
int start = selection.getFieldRange(0).getStart().getIndex().intValue();
|
||||
return ((start > 0) && (start < getNumComponents()));
|
||||
}
|
||||
@ -1466,7 +1466,8 @@ public abstract class CompEditorModel extends CompositeEditorModel {
|
||||
originalIsChanging = true;
|
||||
try {
|
||||
if (hadChanges) {
|
||||
String message = oldName + " has changed outside the editor.\n" +
|
||||
String message = "<html>" + HTMLUtilities.escapeHTML(oldName) +
|
||||
" has changed outside the editor.<br>" +
|
||||
"Discard edits & reload the " + getTypeName() + "?";
|
||||
String title = "Reload " + getTypeName() + " Editor?";
|
||||
int response = OptionDialog.showYesNoDialogWithNoAsDefaultButton(
|
||||
@ -1569,7 +1570,8 @@ public abstract class CompEditorModel extends CompositeEditorModel {
|
||||
consideringReplacedDataType = true;
|
||||
try {
|
||||
String message =
|
||||
oldPath.getPath() + " has changed outside the editor.\n" +
|
||||
"<html>" + HTMLUtilities.escapeHTML(oldPath.getPath()) +
|
||||
" has changed outside the editor.<br>" +
|
||||
"Discard edits & reload the " + getTypeName() + "?";
|
||||
String title = "Reload " + getTypeName() + " Editor?";
|
||||
int response = OptionDialog.showYesNoDialogWithNoAsDefaultButton(
|
||||
|
@ -27,6 +27,9 @@ import javax.swing.text.Document;
|
||||
|
||||
import docking.ToolTipManager;
|
||||
import docking.widgets.OptionDialog;
|
||||
import docking.widgets.button.GRadioButton;
|
||||
import docking.widgets.checkbox.GCheckBox;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import ghidra.program.model.data.Category;
|
||||
import ghidra.program.model.data.Composite;
|
||||
import ghidra.program.model.data.Composite.AlignmentType;
|
||||
@ -185,7 +188,7 @@ public class CompEditorPanel extends CompositeEditorPanel {
|
||||
private void setupName() {
|
||||
GridBagConstraints gridBagConstraints = new GridBagConstraints();
|
||||
|
||||
nameLabel = new JLabel("Name:");
|
||||
nameLabel = new GDLabel("Name:");
|
||||
gridBagConstraints.insets = LEFT_INSETS;
|
||||
gridBagConstraints.anchor = GridBagConstraints.LINE_END;
|
||||
gridBagConstraints.fill = GridBagConstraints.NONE;
|
||||
@ -216,7 +219,7 @@ public class CompEditorPanel extends CompositeEditorPanel {
|
||||
private void setupDescription() {
|
||||
GridBagConstraints gridBagConstraints = new GridBagConstraints();
|
||||
|
||||
descriptionLabel = new JLabel("Description:");
|
||||
descriptionLabel = new GDLabel("Description:");
|
||||
gridBagConstraints.insets = LEFT_INSETS;
|
||||
gridBagConstraints.anchor = GridBagConstraints.LINE_END;
|
||||
gridBagConstraints.fill = GridBagConstraints.NONE;
|
||||
@ -247,7 +250,7 @@ public class CompEditorPanel extends CompositeEditorPanel {
|
||||
private void setupCategory() {
|
||||
GridBagConstraints gridBagConstraints = new GridBagConstraints();
|
||||
|
||||
categoryLabel = new JLabel("Category:");
|
||||
categoryLabel = new GDLabel("Category:");
|
||||
gridBagConstraints.insets = LEFT_INSETS;
|
||||
gridBagConstraints.anchor = GridBagConstraints.LINE_END;
|
||||
gridBagConstraints.fill = GridBagConstraints.NONE;
|
||||
@ -274,7 +277,7 @@ public class CompEditorPanel extends CompositeEditorPanel {
|
||||
private void setupInternallyAligned() {
|
||||
GridBagConstraints gridBagConstraints = new GridBagConstraints();
|
||||
|
||||
internalAlignmentCheckBox = new JCheckBox("Align");
|
||||
internalAlignmentCheckBox = new GCheckBox("Align");
|
||||
gridBagConstraints.anchor = GridBagConstraints.LINE_END;
|
||||
gridBagConstraints.fill = GridBagConstraints.NONE;
|
||||
gridBagConstraints.gridx = 4;
|
||||
@ -330,9 +333,9 @@ public class CompEditorPanel extends CompositeEditorPanel {
|
||||
}
|
||||
|
||||
private void setupMinimumAlignment() {
|
||||
defaultMinAlignButton = new JRadioButton("none ");
|
||||
machineMinAlignButton = new JRadioButton("machine ");
|
||||
byValueMinAlignButton = new JRadioButton();
|
||||
defaultMinAlignButton = new GRadioButton("none ");
|
||||
machineMinAlignButton = new GRadioButton("machine ");
|
||||
byValueMinAlignButton = new GRadioButton();
|
||||
minAlignValueTextField = new JTextField();
|
||||
setupDefaultMinAlignButton();
|
||||
setupMachineMinAlignButton();
|
||||
@ -486,7 +489,7 @@ public class CompEditorPanel extends CompositeEditorPanel {
|
||||
"aligning this data type inside another data type." + "</HTML>";
|
||||
|
||||
JPanel actualAlignmentPanel = new JPanel(new BorderLayout());
|
||||
actualAlignmentLabel = new JLabel("Alignment:");
|
||||
actualAlignmentLabel = new GDLabel("Alignment:");
|
||||
gridBagConstraints.insets = new Insets(2, 7, 2, 2);
|
||||
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
||||
gridBagConstraints.fill = GridBagConstraints.NONE;
|
||||
@ -517,8 +520,8 @@ public class CompEditorPanel extends CompositeEditorPanel {
|
||||
}
|
||||
|
||||
private void setupPacking() {
|
||||
noPackingButton = new JRadioButton("none ");
|
||||
byValuePackingButton = new JRadioButton();
|
||||
noPackingButton = new GRadioButton("none ");
|
||||
byValuePackingButton = new GRadioButton();
|
||||
packingValueTextField = new JTextField();
|
||||
setupNoPackingButton();
|
||||
setupByValuePackingButton();
|
||||
@ -718,7 +721,7 @@ public class CompEditorPanel extends CompositeEditorPanel {
|
||||
protected void setupSize() {
|
||||
GridBagConstraints gridBagConstraints = new GridBagConstraints();
|
||||
|
||||
sizeLabel = new JLabel("Size:");
|
||||
sizeLabel = new GDLabel("Size:");
|
||||
ToolTipManager.setToolTipText(sizeLabel, "The current size in bytes.");
|
||||
gridBagConstraints.anchor = GridBagConstraints.LINE_END;
|
||||
gridBagConstraints.fill = GridBagConstraints.NONE;
|
||||
|
@ -26,7 +26,6 @@ import java.util.EventObject;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.BevelBorder;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.event.CellEditorListener;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
@ -43,6 +42,8 @@ import docking.widgets.DropDownSelectionTextField;
|
||||
import docking.widgets.OptionDialog;
|
||||
import docking.widgets.fieldpanel.support.FieldRange;
|
||||
import docking.widgets.fieldpanel.support.FieldSelection;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import docking.widgets.label.GLabel;
|
||||
import docking.widgets.table.GTable;
|
||||
import docking.widgets.table.GTableCellRenderer;
|
||||
import docking.widgets.textfield.GValidatedTextField;
|
||||
@ -603,7 +604,7 @@ public abstract class CompositeEditorPanel extends JPanel
|
||||
|
||||
private JPanel createStatusPanel() {
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
statusLabel = new JLabel(" ");
|
||||
statusLabel = new GDLabel(" ");
|
||||
statusLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
statusLabel.setForeground(Color.blue);
|
||||
statusLabel.addComponentListener(new ComponentAdapter() {
|
||||
@ -620,7 +621,7 @@ public abstract class CompositeEditorPanel extends JPanel
|
||||
/**
|
||||
* Sets the currently displayed status message.
|
||||
*
|
||||
* @param id the new size
|
||||
* @param status non-html message string to be displayed.
|
||||
*/
|
||||
public void setStatus(String status) {
|
||||
if (statusLabel != null) {
|
||||
@ -657,7 +658,7 @@ public abstract class CompositeEditorPanel extends JPanel
|
||||
JPanel panel = new JPanel();
|
||||
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
|
||||
|
||||
JLabel label = new JLabel(name + ":", SwingConstants.RIGHT);
|
||||
JLabel label = new GLabel(name + ":", SwingConstants.RIGHT);
|
||||
label.setPreferredSize(new Dimension(label.getPreferredSize()));
|
||||
panel.add(label);
|
||||
panel.add(Box.createHorizontalStrut(2));
|
||||
@ -1190,7 +1191,6 @@ public abstract class CompositeEditorPanel extends JPanel
|
||||
implements TableCellEditor {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private DataTypeSelectionEditor editor;
|
||||
private JLabel label = new JLabel();
|
||||
private DataType dt;
|
||||
private int maxLength;
|
||||
|
||||
@ -1199,11 +1199,6 @@ public abstract class CompositeEditorPanel extends JPanel
|
||||
@Override
|
||||
public Component getTableCellEditorComponent(JTable table1, Object value,
|
||||
boolean isSelected, int row, int column) {
|
||||
if (label == null) {
|
||||
label = new JLabel();
|
||||
label.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
|
||||
}
|
||||
|
||||
model.clearStatus();
|
||||
maxLength = model.getMaxAddLength(row);
|
||||
init();
|
||||
|
@ -24,6 +24,7 @@ import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
|
||||
import docking.widgets.EmptyBorderButton;
|
||||
import docking.widgets.label.GLabel;
|
||||
import resources.ResourceManager;
|
||||
|
||||
public class SearchControlPanel extends JPanel {
|
||||
@ -42,8 +43,7 @@ public class SearchControlPanel extends JPanel {
|
||||
this.editorPanel = editorPanel;
|
||||
|
||||
setLayout(new BorderLayout());
|
||||
JLabel label = new JLabel("Search: ");
|
||||
add(label, BorderLayout.WEST);
|
||||
add(new GLabel("Search: "), BorderLayout.WEST);
|
||||
textField = new JTextField(20);
|
||||
add(textField, BorderLayout.CENTER);
|
||||
add(buildButtonPanel(), BorderLayout.EAST);
|
||||
|
@ -41,8 +41,7 @@ import ghidra.framework.plugintool.util.ToolConstants;
|
||||
import ghidra.program.database.data.ProgramDataTypeManager;
|
||||
import ghidra.program.model.data.*;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.util.HelpLocation;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.*;
|
||||
import ghidra.util.task.TaskMonitor;
|
||||
|
||||
//@formatter:off
|
||||
@ -302,7 +301,8 @@ public class CParserPlugin extends ProgramPlugin {
|
||||
}
|
||||
list.add(openDTmanagers[i]);
|
||||
if (!(openDTmanagers[i] instanceof BuiltInDataTypeManager)) {
|
||||
htmlNamesList += "<li><b>" + openDTmanagers[i].getName() + "</b></li>";
|
||||
htmlNamesList += "<li><b>" +
|
||||
HTMLUtilities.escapeHTML(openDTmanagers[i].getName()) + "</b></li>";
|
||||
}
|
||||
}
|
||||
openDTmanagers = list.toArray(new DataTypeManager[0]);
|
||||
|
@ -29,14 +29,14 @@ import javax.swing.text.BadLocationException;
|
||||
import javax.swing.text.Document;
|
||||
|
||||
import docking.DialogComponentProvider;
|
||||
import docking.widgets.button.GRadioButton;
|
||||
import docking.widgets.table.*;
|
||||
import ghidra.app.services.DataTypeManagerService;
|
||||
import ghidra.app.util.ToolTipUtils;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.program.model.data.*;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.util.HelpLocation;
|
||||
import ghidra.util.InvalidNameException;
|
||||
import ghidra.util.*;
|
||||
import ghidra.util.exception.DuplicateNameException;
|
||||
import ghidra.util.table.GhidraTable;
|
||||
import ghidra.util.table.GhidraTableFilterPanel;
|
||||
@ -174,7 +174,7 @@ public class CreateStructureDialog extends DialogComponentProvider {
|
||||
structurePanel.setBorder(structureBorder);
|
||||
|
||||
GTable table = buildMatchingStructuresTable();
|
||||
filterPanel = new GhidraTableFilterPanel<StructureWrapper>(table, structureTableModel) {
|
||||
filterPanel = new GhidraTableFilterPanel<>(table, structureTableModel) {
|
||||
// make sure our height doesn't stretch
|
||||
@Override
|
||||
public Dimension getMaximumSize() {
|
||||
@ -246,8 +246,8 @@ public class CreateStructureDialog extends DialogComponentProvider {
|
||||
matchingStylePanel.setBorder(
|
||||
new TitledBorder(BorderFactory.createEmptyBorder(), "Matching: "));
|
||||
|
||||
exactMatchButton = new JRadioButton("Exact");
|
||||
sizeMatchButton = new JRadioButton("Size");
|
||||
exactMatchButton = new GRadioButton("Exact");
|
||||
sizeMatchButton = new GRadioButton("Size");
|
||||
|
||||
exactMatchButton.setToolTipText(
|
||||
"Match structures with the same " + "number and type of data elements");
|
||||
@ -570,7 +570,7 @@ public class CreateStructureDialog extends DialogComponentProvider {
|
||||
message = EXISITING_STRUCTURE_STATUS_PREFIX;
|
||||
}
|
||||
|
||||
setStatusText("<HTML>" + message + "<BR>\"" + name + "\"");
|
||||
setStatusText("<HTML>" + message + "<BR>\"" + HTMLUtilities.escapeHTML(name) + "\"");
|
||||
}
|
||||
|
||||
// this class is used instead of a cell renderer so that sorting will
|
||||
|
@ -27,6 +27,7 @@ import javax.swing.event.TableModelListener;
|
||||
import javax.swing.table.*;
|
||||
|
||||
import docking.DialogComponentProvider;
|
||||
import docking.widgets.combobox.GComboBox;
|
||||
import docking.widgets.dialogs.StringChoices;
|
||||
import docking.widgets.table.DefaultSortedTableModel;
|
||||
import docking.widgets.table.GTable;
|
||||
@ -719,7 +720,7 @@ public class DataSettingsDialog extends DialogComponentProvider {
|
||||
final static int BOOLEAN = 1;
|
||||
|
||||
private int mode;
|
||||
private JComboBox comboBox = new JComboBox();
|
||||
private GComboBox<String> comboBox = new GComboBox<>();
|
||||
|
||||
SettingsEditor() {
|
||||
comboBox.addItemListener(new ItemListener() {
|
||||
@ -747,7 +748,7 @@ public class DataSettingsDialog extends DialogComponentProvider {
|
||||
private StringChoices getComboBoxEnum() {
|
||||
String[] items = new String[comboBox.getItemCount()];
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
items[i] = (String) comboBox.getItemAt(i);
|
||||
items[i] = comboBox.getItemAt(i);
|
||||
}
|
||||
StringChoices enuum = new StringChoices(items);
|
||||
enuum.setSelectedValue(comboBox.getSelectedIndex());
|
||||
|
@ -1,100 +0,0 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package ghidra.app.plugin.core.datamgr;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import docking.DialogComponentProvider;
|
||||
import ghidra.program.model.data.*;
|
||||
|
||||
/**
|
||||
* The DataOrganizationDialog
|
||||
*/
|
||||
public class DataOrganizationDialog extends DialogComponentProvider {
|
||||
|
||||
private static String TITLE = "Data Type Alignment";
|
||||
private DataTypeManager dataTypeManager;
|
||||
private DataOrganization dataOrganization;
|
||||
private JPanel mainPanel;
|
||||
private DataOrganizationPanel alignPanel;
|
||||
private SizeAlignmentPanel sizePanel;
|
||||
private boolean actionComplete;
|
||||
|
||||
/**
|
||||
* Creates a data type organization dialog for specifying data type alignment information
|
||||
* for a single data type manager. This dialog allows the user to align all data types in
|
||||
* the associated data type manager.
|
||||
* @param dataTypeManager the data type manager
|
||||
* @param dataOrganization structure containing the alignment information.
|
||||
* This object will be modified by the information entered into the dialog.
|
||||
*/
|
||||
public DataOrganizationDialog(DataTypeManager dataTypeManager,
|
||||
DataOrganizationImpl dataOrganization) {
|
||||
super(TITLE, true);
|
||||
this.dataTypeManager = dataTypeManager;
|
||||
this.dataOrganization = dataOrganization;
|
||||
|
||||
JPanel headerPanel = new JPanel();
|
||||
headerPanel.add(new JLabel("<HTML>Alignment Information for <b>" +
|
||||
dataTypeManager.getName() + "</b>.</HTML>"));
|
||||
|
||||
alignPanel = new DataOrganizationPanel();
|
||||
alignPanel.setOrganization(dataOrganization);
|
||||
sizePanel = new SizeAlignmentPanel();
|
||||
sizePanel.setOrganization(dataOrganization);
|
||||
|
||||
JPanel infoPanel = new JPanel(new BorderLayout());
|
||||
infoPanel.add(alignPanel, BorderLayout.NORTH);
|
||||
infoPanel.add(sizePanel, BorderLayout.CENTER);
|
||||
|
||||
mainPanel = new JPanel(new BorderLayout());
|
||||
mainPanel.add(headerPanel, BorderLayout.NORTH);
|
||||
mainPanel.add(infoPanel, BorderLayout.CENTER);
|
||||
addWorkPanel(mainPanel);
|
||||
initialize();
|
||||
}
|
||||
|
||||
private void initialize() {
|
||||
actionComplete = false;
|
||||
addOKButton();
|
||||
setOkButtonText("Set");
|
||||
addCancelButton();
|
||||
// setHelpLocation(new HelpLocation(plugin, "Align_Data_Types_In_Archive"));
|
||||
}
|
||||
|
||||
public boolean userCanceled() {
|
||||
return !actionComplete && !isVisible();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void okCallback() {
|
||||
actionComplete = true;
|
||||
close();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void cancelCallback() {
|
||||
super.cancelCallback();
|
||||
actionComplete = false;
|
||||
}
|
||||
|
||||
public DataOrganization getDataOrganization() {
|
||||
return dataOrganization;
|
||||
}
|
||||
}
|
@ -21,6 +21,8 @@ import javax.swing.*;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import docking.widgets.checkbox.GCheckBox;
|
||||
import docking.widgets.label.GLabel;
|
||||
import ghidra.program.model.data.DataOrganizationImpl;
|
||||
import ghidra.util.layout.PairLayout;
|
||||
|
||||
@ -61,41 +63,41 @@ public class DataOrganizationPanel extends JPanel {
|
||||
setUpDoubleSize();
|
||||
setUpLongDoubleSize();
|
||||
|
||||
add(new JLabel(""));
|
||||
add(new JLabel(""));
|
||||
add(new JLabel("Absolute Max Alignment"));
|
||||
add(new GLabel(""));
|
||||
add(new GLabel(""));
|
||||
add(new GLabel("Absolute Max Alignment"));
|
||||
add(absoluteMaxAlignComponent);
|
||||
add(new JLabel("Machine Alignment"));
|
||||
add(new GLabel("Machine Alignment"));
|
||||
add(machineAlignComponent);
|
||||
add(new JLabel("Default Alignment"));
|
||||
add(new GLabel("Default Alignment"));
|
||||
add(defaultAlignComponent);
|
||||
add(new JLabel("Default Pointer Alignment"));
|
||||
add(new GLabel("Default Pointer Alignment"));
|
||||
add(pointerAlignComponent);
|
||||
|
||||
add(new JLabel(""));
|
||||
add(new JLabel(""));
|
||||
add(new JLabel("Signed-Char:"));
|
||||
add(new GLabel(""));
|
||||
add(new GLabel(""));
|
||||
add(new GLabel("Signed-Char:"));
|
||||
add(charIsSignedCheckbox);
|
||||
add(new JLabel("Char Size"));
|
||||
add(new GLabel("Char Size"));
|
||||
add(charSizeComponent);
|
||||
add(new JLabel("Wide-Char Size"));
|
||||
add(new GLabel("Wide-Char Size"));
|
||||
add(wcharSizeComponent);
|
||||
add(new JLabel("Short Size"));
|
||||
add(new GLabel("Short Size"));
|
||||
add(shortSizeComponent);
|
||||
add(new JLabel("Integer Size"));
|
||||
add(new GLabel("Integer Size"));
|
||||
add(integerSizeComponent);
|
||||
add(new JLabel("Long Size"));
|
||||
add(new GLabel("Long Size"));
|
||||
add(longSizeComponent);
|
||||
add(new JLabel("LongLong Size"));
|
||||
add(new GLabel("LongLong Size"));
|
||||
add(longLongSizeComponent);
|
||||
add(new JLabel("Float Size"));
|
||||
add(new GLabel("Float Size"));
|
||||
add(floatSizeComponent);
|
||||
add(new JLabel("Double Size"));
|
||||
add(new GLabel("Double Size"));
|
||||
add(doubleSizeComponent);
|
||||
add(new JLabel("LongDouble Size"));
|
||||
add(new GLabel("LongDouble Size"));
|
||||
add(longDoubleSizeComponent);
|
||||
add(new JLabel(""));
|
||||
add(new JLabel(""));
|
||||
add(new GLabel(""));
|
||||
add(new GLabel(""));
|
||||
}
|
||||
|
||||
public void setOrganization(DataOrganizationImpl dataOrganization) {
|
||||
@ -133,9 +135,9 @@ public class DataOrganizationPanel extends JPanel {
|
||||
doubleSizeComponent.setText(Integer.toString(doubleSize));
|
||||
longDoubleSizeComponent.setText(Integer.toString(longDoubleSize));
|
||||
}
|
||||
|
||||
|
||||
private void setUpSignedChar() {
|
||||
charIsSignedCheckbox = new JCheckBox();
|
||||
charIsSignedCheckbox = new GCheckBox();
|
||||
charIsSignedCheckbox.addChangeListener(new ChangeListener() {
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
@ -143,19 +145,22 @@ public class DataOrganizationPanel extends JPanel {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void setUpCharSize() {
|
||||
charSizeComponent = new JTextField(3);
|
||||
charSizeComponent.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
updatedCharSize();
|
||||
}
|
||||
});
|
||||
charSizeComponent.addFocusListener(new FocusListener() {
|
||||
@Override
|
||||
public void focusGained(FocusEvent e) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
updatedCharSize();
|
||||
}
|
||||
@ -165,15 +170,18 @@ public class DataOrganizationPanel extends JPanel {
|
||||
private void setUpWideCharSize() {
|
||||
wcharSizeComponent = new JTextField(3);
|
||||
wcharSizeComponent.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
updatedWideCharSize();
|
||||
}
|
||||
});
|
||||
wcharSizeComponent.addFocusListener(new FocusListener() {
|
||||
@Override
|
||||
public void focusGained(FocusEvent e) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
updatedWideCharSize();
|
||||
}
|
||||
@ -183,15 +191,18 @@ public class DataOrganizationPanel extends JPanel {
|
||||
private void setUpShortSize() {
|
||||
shortSizeComponent = new JTextField(3);
|
||||
shortSizeComponent.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
updatedShortSize();
|
||||
}
|
||||
});
|
||||
shortSizeComponent.addFocusListener(new FocusListener() {
|
||||
@Override
|
||||
public void focusGained(FocusEvent e) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
updatedShortSize();
|
||||
}
|
||||
@ -201,15 +212,18 @@ public class DataOrganizationPanel extends JPanel {
|
||||
private void setUpIntegerSize() {
|
||||
integerSizeComponent = new JTextField(3);
|
||||
integerSizeComponent.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
updatedIntegerSize();
|
||||
}
|
||||
});
|
||||
integerSizeComponent.addFocusListener(new FocusListener() {
|
||||
@Override
|
||||
public void focusGained(FocusEvent e) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
updatedIntegerSize();
|
||||
}
|
||||
@ -219,15 +233,18 @@ public class DataOrganizationPanel extends JPanel {
|
||||
private void setUpLongSize() {
|
||||
longSizeComponent = new JTextField(3);
|
||||
longSizeComponent.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
updatedLongSize();
|
||||
}
|
||||
});
|
||||
longSizeComponent.addFocusListener(new FocusListener() {
|
||||
@Override
|
||||
public void focusGained(FocusEvent e) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
updatedLongSize();
|
||||
}
|
||||
@ -237,15 +254,18 @@ public class DataOrganizationPanel extends JPanel {
|
||||
private void setUpLongLongSize() {
|
||||
longLongSizeComponent = new JTextField(3);
|
||||
longLongSizeComponent.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
updatedLongLongSize();
|
||||
}
|
||||
});
|
||||
longLongSizeComponent.addFocusListener(new FocusListener() {
|
||||
@Override
|
||||
public void focusGained(FocusEvent e) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
updatedLongLongSize();
|
||||
}
|
||||
@ -255,15 +275,18 @@ public class DataOrganizationPanel extends JPanel {
|
||||
private void setUpFloatSize() {
|
||||
floatSizeComponent = new JTextField(3);
|
||||
floatSizeComponent.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
updatedFloatSize();
|
||||
}
|
||||
});
|
||||
floatSizeComponent.addFocusListener(new FocusListener() {
|
||||
@Override
|
||||
public void focusGained(FocusEvent e) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
updatedFloatSize();
|
||||
}
|
||||
@ -273,15 +296,18 @@ public class DataOrganizationPanel extends JPanel {
|
||||
private void setUpDoubleSize() {
|
||||
doubleSizeComponent = new JTextField(3);
|
||||
doubleSizeComponent.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
updatedDoubleSize();
|
||||
}
|
||||
});
|
||||
doubleSizeComponent.addFocusListener(new FocusListener() {
|
||||
@Override
|
||||
public void focusGained(FocusEvent e) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
updatedDoubleSize();
|
||||
}
|
||||
@ -291,15 +317,18 @@ public class DataOrganizationPanel extends JPanel {
|
||||
private void setUpLongDoubleSize() {
|
||||
longDoubleSizeComponent = new JTextField(3);
|
||||
longDoubleSizeComponent.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
updatedLongDoubleSize();
|
||||
}
|
||||
});
|
||||
longDoubleSizeComponent.addFocusListener(new FocusListener() {
|
||||
@Override
|
||||
public void focusGained(FocusEvent e) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
updatedLongDoubleSize();
|
||||
}
|
||||
@ -309,15 +338,18 @@ public class DataOrganizationPanel extends JPanel {
|
||||
private void setUpAbsoluteMaxAlignment() {
|
||||
absoluteMaxAlignComponent = new JTextField(3);
|
||||
absoluteMaxAlignComponent.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
updatedAbsoluteMaxAlignment();
|
||||
}
|
||||
});
|
||||
absoluteMaxAlignComponent.addFocusListener(new FocusListener() {
|
||||
@Override
|
||||
public void focusGained(FocusEvent e) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
updatedAbsoluteMaxAlignment();
|
||||
}
|
||||
@ -327,15 +359,18 @@ public class DataOrganizationPanel extends JPanel {
|
||||
private void setUpMachineAlignment() {
|
||||
machineAlignComponent = new JTextField(3);
|
||||
machineAlignComponent.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
updatedMachineAlignment();
|
||||
}
|
||||
});
|
||||
machineAlignComponent.addFocusListener(new FocusListener() {
|
||||
@Override
|
||||
public void focusGained(FocusEvent e) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
updatedMachineAlignment();
|
||||
}
|
||||
@ -345,15 +380,18 @@ public class DataOrganizationPanel extends JPanel {
|
||||
private void setUpDefaultAlignment() {
|
||||
defaultAlignComponent = new JTextField(3);
|
||||
defaultAlignComponent.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
updatedDefaultAlignment();
|
||||
}
|
||||
});
|
||||
defaultAlignComponent.addFocusListener(new FocusListener() {
|
||||
@Override
|
||||
public void focusGained(FocusEvent e) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
updatedDefaultAlignment();
|
||||
}
|
||||
@ -363,15 +401,18 @@ public class DataOrganizationPanel extends JPanel {
|
||||
private void setUpPointerAlignment() {
|
||||
pointerAlignComponent = new JTextField(3);
|
||||
pointerAlignComponent.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
updatedDefaultPointerAlignment();
|
||||
}
|
||||
});
|
||||
pointerAlignComponent.addFocusListener(new FocusListener() {
|
||||
@Override
|
||||
public void focusGained(FocusEvent e) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
updatedDefaultPointerAlignment();
|
||||
}
|
||||
@ -382,7 +423,7 @@ public class DataOrganizationPanel extends JPanel {
|
||||
boolean isSigned = charIsSignedCheckbox.isSelected();
|
||||
dataOrganization.setCharIsSigned(isSigned);
|
||||
}
|
||||
|
||||
|
||||
protected void updatedCharSize() {
|
||||
int charSize = Integer.decode(charSizeComponent.getText()).intValue();
|
||||
dataOrganization.setCharSize(charSize);
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* ###
|
||||
* 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.
|
||||
@ -16,17 +15,18 @@
|
||||
*/
|
||||
package ghidra.app.plugin.core.datamgr;
|
||||
|
||||
import ghidra.app.util.ToolTipUtils;
|
||||
import ghidra.app.util.html.HTMLDataTypeRepresentation;
|
||||
import ghidra.program.model.data.DataType;
|
||||
import ghidra.util.HTMLUtilities;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import docking.widgets.label.GDHtmlLabel;
|
||||
import ghidra.app.util.ToolTipUtils;
|
||||
import ghidra.app.util.html.HTMLDataTypeRepresentation;
|
||||
import ghidra.program.model.data.DataType;
|
||||
import ghidra.util.HTMLUtilities;
|
||||
|
||||
/**
|
||||
* Panel that displays two data types side by side.
|
||||
*/
|
||||
@ -60,22 +60,22 @@ class DataTypeComparePanel extends JPanel {
|
||||
leftPanel = new JPanel(new BorderLayout());
|
||||
rightPanel = new JPanel(new BorderLayout());
|
||||
|
||||
leftPanelLabel = new JLabel();
|
||||
rightPanelLabel = new JLabel();
|
||||
leftPanelLabel = new GDHtmlLabel();
|
||||
rightPanelLabel = new GDHtmlLabel();
|
||||
leftPanelLabel.setBorder(BorderFactory.createEmptyBorder(2, 8, 2, 0));
|
||||
rightPanelLabel.setBorder(BorderFactory.createEmptyBorder(2, 8, 2, 0));
|
||||
|
||||
setLabelText(leftPanelLabel, clientName + ":");
|
||||
setLabelText(rightPanelLabel, sourceName + ":");
|
||||
setLabelText(leftPanelLabel, HTMLUtilities.escapeHTML(clientName) + ":");
|
||||
setLabelText(rightPanelLabel, HTMLUtilities.escapeHTML(sourceName) + ":");
|
||||
|
||||
add(leftPanel);
|
||||
add(rightPanel);
|
||||
dtLabel1 = new JLabel();
|
||||
dtLabel1 = new GDHtmlLabel();
|
||||
dtLabel1.setOpaque(true);
|
||||
dtLabel1.setBackground(Color.WHITE);
|
||||
dtLabel1.setBorder(BorderFactory.createEmptyBorder(2, 8, 0, 0));
|
||||
dtLabel1.setVerticalAlignment(SwingConstants.TOP);
|
||||
dtLabel2 = new JLabel();
|
||||
dtLabel2 = new GDHtmlLabel();
|
||||
dtLabel2.setOpaque(true);
|
||||
dtLabel2.setBackground(Color.WHITE);
|
||||
dtLabel2.setBorder(BorderFactory.createEmptyBorder(2, 8, 0, 0));
|
||||
@ -97,12 +97,14 @@ class DataTypeComparePanel extends JPanel {
|
||||
final JViewport viewport1 = leftScrollPane.getViewport();
|
||||
final JViewport viewport2 = rightScrollPane.getViewport();
|
||||
viewport1.addChangeListener(new ChangeListener() {
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
int y = viewport1.getViewPosition().y;
|
||||
viewport2.setViewPosition(new Point(0, y));
|
||||
}
|
||||
});
|
||||
viewport2.addChangeListener(new ChangeListener() {
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
int y = viewport2.getViewPosition().y;
|
||||
viewport1.setViewPosition(new Point(0, y));
|
||||
|
@ -106,7 +106,7 @@ public class DataTypeManagerPlugin extends ProgramPlugin
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
recentlyOpenedArchiveMap = new LRUMap<String, DockingAction>(RECENTLY_USED_CACHE_SIZE) {
|
||||
recentlyOpenedArchiveMap = new LRUMap<>(RECENTLY_USED_CACHE_SIZE) {
|
||||
@Override
|
||||
protected void eldestEntryRemoved(Entry<String, DockingAction> eldest) {
|
||||
DockingAction action = eldest.getValue();
|
||||
@ -719,30 +719,6 @@ public class DataTypeManagerPlugin extends ProgramPlugin
|
||||
return currentSelection;
|
||||
}
|
||||
|
||||
// public DataOrganization promptToChangeDataOrganization(DataTypeManager dataTypeManagerToCheck)
|
||||
// throws CancelledException {
|
||||
// DataOrganization dataOrganization = promptUserForDataOrganization(dataTypeManagerToCheck);
|
||||
// dataTypeManagerToCheck.setDataOrganization(dataOrganization);
|
||||
// return dataOrganization;
|
||||
// }
|
||||
|
||||
// public DataOrganization promptUserForDataOrganization(DataTypeManager dataTypeManagerToAlign)
|
||||
// throws CancelledException {
|
||||
// DataOrganization currentDataOrganization = dataTypeManagerToAlign.getDataOrganization();
|
||||
// if (currentDataOrganization == null) {
|
||||
// currentDataOrganization = DataOrganizationImpl.getDefaultOrganization();
|
||||
// }
|
||||
// DataOrganizationDialog dataOrgDialog =
|
||||
// new DataOrganizationDialog(dataTypeManagerToAlign, currentDataOrganization);
|
||||
// dataOrgDialog.setHelpLocation(new HelpLocation(this.getName(),
|
||||
// "Align_Data_Types_In_Archive"));
|
||||
// tool.showDialog(dataOrgDialog);
|
||||
// if (dataOrgDialog.userCanceled()) {
|
||||
// throw new CancelledException();
|
||||
// }
|
||||
// return dataOrgDialog.getDataOrganization();
|
||||
// }
|
||||
|
||||
@Override
|
||||
public List<DockingActionIf> getPopupActions(ActionContext context) {
|
||||
if (!(context instanceof DataTypesActionContext)) {
|
||||
|
@ -23,6 +23,7 @@ import javax.swing.SwingUtilities;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import docking.widgets.label.GDHtmlLabel;
|
||||
import ghidra.app.plugin.core.datamgr.archive.DataTypeManagerHandler;
|
||||
import ghidra.app.plugin.core.datamgr.archive.SourceArchive;
|
||||
import ghidra.app.util.ToolTipUtils;
|
||||
@ -324,7 +325,7 @@ public class DataTypeSynchronizer {
|
||||
// this string allows us to force both tables to be the same width, which is
|
||||
// aesthetically pleasing
|
||||
String spacerString = createHTMLSpacerString(htmlContent, otherContent);
|
||||
StringBuffer buffy = new StringBuffer();
|
||||
StringBuilder buffy = new StringBuilder();
|
||||
buffy.append("<HTML>");
|
||||
|
||||
// -we use CELLPADDING here to allow us to create a narrow column within the table
|
||||
@ -333,7 +334,8 @@ public class DataTypeSynchronizer {
|
||||
|
||||
buffy.append("<TR BORDER=LEFT>");
|
||||
buffy.append("<TD VALIGN=\"TOP\">");
|
||||
buffy.append("<B>").append(dataTypeManager.getName()).append("</B><HR NOSHADE>");
|
||||
buffy.append("<B>").append(HTMLUtilities.escapeHTML(dataTypeManager.getName())).append(
|
||||
"</B><HR NOSHADE>");
|
||||
buffy.append(htmlContent);
|
||||
|
||||
// horizontal spacer below the inner table in order to force a minimum width
|
||||
@ -345,7 +347,8 @@ public class DataTypeSynchronizer {
|
||||
buffy.append("</TD>");
|
||||
|
||||
buffy.append("<TD VALIGN=\"TOP\">");
|
||||
buffy.append("<B>").append(sourceArchive.getName()).append("</B><HR NOSHADE>");
|
||||
buffy.append("<B>").append(HTMLUtilities.escapeHTML(sourceArchive.getName())).append(
|
||||
"</B><HR NOSHADE>");
|
||||
|
||||
buffy.append(otherContent);
|
||||
|
||||
@ -372,17 +375,15 @@ public class DataTypeSynchronizer {
|
||||
* an HTML string of spaces that is wide enough to represent that width.
|
||||
*/
|
||||
private static String createHTMLSpacerString(String htmlContent, String otherHTMLContent) {
|
||||
StringBuffer buffy = new StringBuffer();
|
||||
|
||||
// unfortunately, to get the displayed widths, we have to have rendered content, which
|
||||
// is what the JLabels below are doing for us
|
||||
JLabel label1 = new JLabel("<HTML>" + htmlContent);
|
||||
JLabel label2 = new JLabel("<HTML>" + otherHTMLContent);
|
||||
JLabel label1 = new GDHtmlLabel("<HTML>" + htmlContent);
|
||||
JLabel label2 = new GDHtmlLabel("<HTML>" + otherHTMLContent);
|
||||
|
||||
int maxPixelWidth =
|
||||
Math.max(label1.getPreferredSize().width, label2.getPreferredSize().width);
|
||||
FontMetrics fontMetrics = label1.getFontMetrics(label1.getFont());
|
||||
StringBuffer bigBuffy = new StringBuffer();
|
||||
StringBuilder bigBuffy = new StringBuilder();
|
||||
String HTMLSpace = " ";
|
||||
int invisibleCharCount = HTMLSpace.length();
|
||||
for (int i = 0; i < 150; i++) {
|
||||
@ -396,7 +397,7 @@ public class DataTypeSynchronizer {
|
||||
}
|
||||
}
|
||||
|
||||
return buffy.toString();
|
||||
return bigBuffy.toString();
|
||||
}
|
||||
|
||||
public String getClientName() {
|
||||
|
@ -197,7 +197,7 @@ class OpenDomainFileTask extends Task {
|
||||
if (dfile.isInWritableProject() && dfile.canRecover()) {
|
||||
Runnable r = () -> {
|
||||
int option = OptionDialog.showYesNoDialog(null, "Crash Recovery Data Found",
|
||||
dfile.getName() + " has crash data.\n" +
|
||||
"<html>" + HTMLUtilities.escapeHTML(dfile.getName()) + " has crash data.<br>" +
|
||||
"Would you like to recover unsaved changes?");
|
||||
recoverFile[0] = (option == OptionDialog.OPTION_ONE);
|
||||
};
|
||||
|
@ -62,7 +62,7 @@ public class CreatePointerAction extends DockingAction {
|
||||
Msg.showInfo(getClass(), gTree, "Pointers Filter Enabled",
|
||||
"<html>Newly created pointer is filtered out of view.<br><br>Toggle the " +
|
||||
"<b>Filter Pointers " + "Action</b> to view the pointer<br>Pointer: " +
|
||||
newManager.getName() + newPath);
|
||||
HTMLUtilities.escapeHTML(newManager.getName() + newPath));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -15,8 +15,6 @@
|
||||
*/
|
||||
package ghidra.app.plugin.core.datamgr.actions;
|
||||
|
||||
import java.awt.Component;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.CellEditorListener;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
@ -24,6 +22,8 @@ import javax.swing.tree.TreePath;
|
||||
|
||||
import docking.DialogComponentProvider;
|
||||
import docking.widgets.combobox.GhidraComboBox;
|
||||
import docking.widgets.label.GLabel;
|
||||
import docking.widgets.list.GListCellRenderer;
|
||||
import ghidra.app.plugin.core.datamgr.DataTypeManagerPlugin;
|
||||
import ghidra.app.plugin.core.datamgr.tree.ArchiveNode;
|
||||
import ghidra.app.plugin.core.datamgr.tree.DataTypeTreeNode;
|
||||
@ -59,18 +59,18 @@ public class CreateTypeDefDialog extends DialogComponentProvider {
|
||||
JPanel panel = new JPanel(new PairLayout());
|
||||
|
||||
// category info
|
||||
panel.add(new JLabel("Category:"));
|
||||
panel.add(new JLabel(category.getCategoryPath().getPath()));
|
||||
panel.add(new GLabel("Category:"));
|
||||
panel.add(new GLabel(category.getCategoryPath().getPath()));
|
||||
|
||||
// name info
|
||||
nameTextField = new JTextField(15);
|
||||
panel.add(new JLabel("Name:"));
|
||||
panel.add(new GLabel("Name:"));
|
||||
panel.add(nameTextField);
|
||||
|
||||
// data type info
|
||||
dataTypeEditor =
|
||||
new DataTypeSelectionEditor(plugin.getTool(), Integer.MAX_VALUE, AllowedDataTypes.ALL);
|
||||
panel.add(new JLabel("Data type:"));
|
||||
panel.add(new GLabel("Data type:"));
|
||||
panel.add(dataTypeEditor.getEditorComponent());
|
||||
|
||||
dataTypeEditor.addCellEditorListener(new CellEditorListener() {
|
||||
@ -88,21 +88,8 @@ public class CreateTypeDefDialog extends DialogComponentProvider {
|
||||
dataTypeEditor.setDefaultSelectedTreePath(selectedTreePath);
|
||||
|
||||
dataTypeManagerBox = new GhidraComboBox<>();
|
||||
dataTypeManagerBox.setRenderer(new DefaultListCellRenderer() {
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index,
|
||||
boolean isSelected, boolean cellHasFocus) {
|
||||
JLabel label =
|
||||
(JLabel) super.getListCellRendererComponent(list, value, index, isSelected,
|
||||
cellHasFocus);
|
||||
|
||||
if (value != null) {
|
||||
label.setText(((DataTypeManager) value).getName());
|
||||
}
|
||||
|
||||
return label;
|
||||
}
|
||||
});
|
||||
dataTypeManagerBox.setRenderer(
|
||||
GListCellRenderer.createDefaultCellTextRenderer(dtm -> dtm.getName()));
|
||||
|
||||
DataTypeManager[] dataTypeManagers = plugin.getDataTypeManagers();
|
||||
for (DataTypeManager manager : dataTypeManagers) {
|
||||
@ -127,7 +114,7 @@ public class CreateTypeDefDialog extends DialogComponentProvider {
|
||||
|
||||
dataTypeManagerBox.setSelectedItem(itemToSelect);
|
||||
|
||||
panel.add(new JLabel("Archive:"));
|
||||
panel.add(new GLabel("Archive:"));
|
||||
panel.add(dataTypeManagerBox);
|
||||
|
||||
panel.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* ###
|
||||
* 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.
|
||||
@ -16,12 +15,6 @@
|
||||
*/
|
||||
package ghidra.app.plugin.core.datamgr.actions;
|
||||
|
||||
import ghidra.app.plugin.core.datamgr.DataTypeManagerPlugin;
|
||||
import ghidra.app.plugin.core.datamgr.DataTypesActionContext;
|
||||
import ghidra.app.plugin.core.datamgr.archive.FileArchive;
|
||||
import ghidra.app.plugin.core.datamgr.tree.*;
|
||||
import ghidra.util.Msg;
|
||||
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.io.IOException;
|
||||
|
||||
@ -31,6 +24,12 @@ import docking.ActionContext;
|
||||
import docking.action.*;
|
||||
import docking.widgets.OptionDialog;
|
||||
import docking.widgets.tree.GTree;
|
||||
import ghidra.app.plugin.core.datamgr.DataTypeManagerPlugin;
|
||||
import ghidra.app.plugin.core.datamgr.DataTypesActionContext;
|
||||
import ghidra.app.plugin.core.datamgr.archive.FileArchive;
|
||||
import ghidra.app.plugin.core.datamgr.tree.*;
|
||||
import ghidra.util.HTMLUtilities;
|
||||
import ghidra.util.Msg;
|
||||
|
||||
public class DeleteArchiveAction extends DockingAction {
|
||||
|
||||
@ -92,10 +91,13 @@ public class DeleteArchiveAction extends DockingAction {
|
||||
TreePath[] selectionPaths = gTree.getSelectionPaths();
|
||||
FileArchiveNode node = (FileArchiveNode) selectionPaths[0].getLastPathComponent();
|
||||
|
||||
if (OptionDialog.showOptionDialogWithCancelAsDefaultButton(gTree, "Confirm Delete Operation",
|
||||
"<html><b>Are you sure you want to delete archive: " + node.getName() + "?<br><br>" +
|
||||
if (OptionDialog.showOptionDialogWithCancelAsDefaultButton(gTree,
|
||||
"Confirm Delete Operation",
|
||||
"<html><b>Are you sure you want to delete archive: " +
|
||||
HTMLUtilities.escapeHTML(node.getName()) + "?<br><br>" +
|
||||
"<font color=\"red\">(WARNING: This action will permanently " +
|
||||
"delete the file from disk.)</font></b>", "Yes", OptionDialog.QUESTION_MESSAGE) != OptionDialog.OPTION_ONE) {
|
||||
"delete the file from disk.)</font></b>",
|
||||
"Yes", OptionDialog.QUESTION_MESSAGE) != OptionDialog.OPTION_ONE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* ###
|
||||
* 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.
|
||||
@ -16,11 +15,6 @@
|
||||
*/
|
||||
package ghidra.app.plugin.core.datamgr.actions;
|
||||
|
||||
import ghidra.app.plugin.core.datamgr.DataTypeManagerPlugin;
|
||||
import ghidra.app.plugin.core.datamgr.DataTypesActionContext;
|
||||
import ghidra.app.plugin.core.datamgr.archive.*;
|
||||
import ghidra.app.plugin.core.datamgr.tree.InvalidArchiveNode;
|
||||
|
||||
import javax.swing.tree.TreePath;
|
||||
|
||||
import docking.ActionContext;
|
||||
@ -29,6 +23,11 @@ import docking.action.MenuData;
|
||||
import docking.widgets.OptionDialog;
|
||||
import docking.widgets.tree.GTree;
|
||||
import docking.widgets.tree.GTreeNode;
|
||||
import ghidra.app.plugin.core.datamgr.DataTypeManagerPlugin;
|
||||
import ghidra.app.plugin.core.datamgr.DataTypesActionContext;
|
||||
import ghidra.app.plugin.core.datamgr.archive.*;
|
||||
import ghidra.app.plugin.core.datamgr.tree.InvalidArchiveNode;
|
||||
import ghidra.util.HTMLUtilities;
|
||||
|
||||
public class RemoveInvalidArchiveFromProgramAction extends DockingAction {
|
||||
|
||||
@ -38,7 +37,8 @@ public class RemoveInvalidArchiveFromProgramAction extends DockingAction {
|
||||
super("Remove Invalid Archive", plugin.getName());
|
||||
this.plugin = plugin;
|
||||
|
||||
setPopupMenuData(new MenuData(new String[] { "Remove Archive From Program" }, null, "File"));
|
||||
setPopupMenuData(
|
||||
new MenuData(new String[] { "Remove Archive From Program" }, null, "File"));
|
||||
|
||||
setDescription("Removes the archive from program and tool");
|
||||
setEnabled(true);
|
||||
@ -76,11 +76,12 @@ public class RemoveInvalidArchiveFromProgramAction extends DockingAction {
|
||||
InvalidArchiveNode invalidArchiveNode = (InvalidArchiveNode) pathComponent;
|
||||
|
||||
if (OptionDialog.showOptionDialog(gtree, "Confirm Remove Invalid Archive(s)",
|
||||
"<html><b>Are you sure you want to delete archive: " + invalidArchiveNode.getName() +
|
||||
"<html><b>Are you sure you want to delete archive: " +
|
||||
HTMLUtilities.escapeHTML(invalidArchiveNode.getName()) +
|
||||
" from the program?<br><br>" +
|
||||
"<font color=\"red\">(WARNING: This action will disassociate " +
|
||||
"all datatypes in the program from this archive.)</font></b>", "Yes",
|
||||
OptionDialog.QUESTION_MESSAGE) != OptionDialog.OPTION_ONE) {
|
||||
"all datatypes in the program from this archive.)</font></b>",
|
||||
"Yes", OptionDialog.QUESTION_MESSAGE) != OptionDialog.OPTION_ONE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,296 +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.plugin.core.datamgr.archive;
|
||||
|
||||
import ghidra.framework.plugintool.Plugin;
|
||||
import ghidra.util.HelpLocation;
|
||||
import ghidra.util.UniversalID;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Component;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.*;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
import javax.swing.text.BadLocationException;
|
||||
import javax.swing.text.Document;
|
||||
|
||||
import docking.DialogComponentProvider;
|
||||
|
||||
public class ChooseArchiveDialog extends DialogComponentProvider {
|
||||
|
||||
private JPanel archiveListPanel;
|
||||
private JTextField filterField;
|
||||
private boolean removeWasCanceled;
|
||||
private Archive currentArchive;
|
||||
private List<Archive> archiveList;
|
||||
private JList list;
|
||||
private DefaultListModel listModel;
|
||||
|
||||
public ChooseArchiveDialog(Plugin plugin, String title, Archive currentArchive,
|
||||
List<Archive> archiveList) {
|
||||
super(title);
|
||||
this.currentArchive = currentArchive;
|
||||
this.archiveList = archiveList;
|
||||
createArchiveListPanel();
|
||||
filterField = getFilterField();
|
||||
addWorkPanel(archiveListPanel);
|
||||
addOKButton();
|
||||
setOkToolTip("Choose the archive file to synchronize.");
|
||||
addCancelButton();
|
||||
setHelpLocation(new HelpLocation(plugin.getName(), "Choose_Archive"));
|
||||
}
|
||||
|
||||
public boolean wasCanceled() {
|
||||
return removeWasCanceled;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void cancelCallback() {
|
||||
removeWasCanceled = true;
|
||||
clearStatusText();
|
||||
close();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void okCallback() {
|
||||
clearStatusText();
|
||||
Archive selectedArchive = getSelectedArchive();
|
||||
|
||||
if (selectedArchive == null) {
|
||||
setStatusText("Please select an archive to synchronize.");
|
||||
return;
|
||||
}
|
||||
close();
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the JList component.
|
||||
*/
|
||||
JList getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
JTextField getFilterField() {
|
||||
return filterField;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the selected data type archive in the JList.
|
||||
* @return null if no object is selected
|
||||
*/
|
||||
public Archive getSelectedArchive() {
|
||||
int index = list.getSelectedIndex();
|
||||
if (index >= 0) {
|
||||
return (Archive) listModel.get(index);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void selectArchive(Archive archive) {
|
||||
int index = listModel.indexOf(archive);
|
||||
list.setSelectedIndex(index);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void requestFocus() {
|
||||
// filterField.requestFocus();
|
||||
// filterField.selectAll();
|
||||
// filterList( filterField.getText() );
|
||||
// }
|
||||
|
||||
private void createArchiveListPanel() {
|
||||
|
||||
archiveListPanel = new JPanel(new BorderLayout());
|
||||
JPanel northPanel = new JPanel();
|
||||
String instructions =
|
||||
"<HTML>Choose the archive to synchronize with <B>" + currentArchive.getName() +
|
||||
"</B>.</HTML>";
|
||||
JLabel instructionLabel = new JLabel(instructions);
|
||||
northPanel.add(instructionLabel, BorderLayout.NORTH);
|
||||
northPanel.setBorder(BorderFactory.createEmptyBorder(3, 3, 8, 3));
|
||||
archiveListPanel.add(northPanel, BorderLayout.NORTH);
|
||||
|
||||
// Create the list
|
||||
listModel = new DefaultListModel();
|
||||
initListModel();
|
||||
list = new JList(listModel);
|
||||
list.setCellRenderer(new MyListCellRenderer());
|
||||
list.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
if ((e.getClickCount() == 2) && (e.getButton() == MouseEvent.BUTTON1)) {
|
||||
if (list.getSelectedValue() != null) {
|
||||
okCallback();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Set the preferred row count. This affects the preferredSize
|
||||
// of the JList when it's in a scrollpane.
|
||||
int size = listModel.getSize();
|
||||
list.setVisibleRowCount(size);
|
||||
|
||||
JScrollPane scrollPane = new JScrollPane(list);
|
||||
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
|
||||
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
||||
scrollPane.setBorder(BorderFactory.createEmptyBorder());
|
||||
|
||||
JPanel southPanel = new JPanel();
|
||||
southPanel.setLayout(new BoxLayout(southPanel, BoxLayout.X_AXIS));
|
||||
|
||||
filterField = createFilterField();
|
||||
southPanel.add(new JLabel("Filter: "));
|
||||
southPanel.add(filterField);
|
||||
southPanel.setBorder(BorderFactory.createEmptyBorder(8, 3, 8, 3));
|
||||
|
||||
archiveListPanel.add(southPanel, BorderLayout.SOUTH);
|
||||
|
||||
// Add list to a scrollpane
|
||||
JPanel listPanel = new JPanel(new BorderLayout());
|
||||
listPanel.add(scrollPane, BorderLayout.CENTER);
|
||||
listPanel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
|
||||
archiveListPanel.add(listPanel);
|
||||
}
|
||||
|
||||
private JTextField createFilterField() {
|
||||
JTextField newFilterField = new JTextField(20);
|
||||
// newFilterField.setBackground( BACKGROUND_COLOR );
|
||||
// newFilterField.setBorder( BorderFactory.createEmptyBorder( 0, 0, 5, 0 ) );
|
||||
|
||||
newFilterField.getDocument().addDocumentListener(new DocumentListener() {
|
||||
public void changedUpdate(DocumentEvent e) {
|
||||
filter(e.getDocument());
|
||||
}
|
||||
|
||||
public void insertUpdate(DocumentEvent e) {
|
||||
filter(e.getDocument());
|
||||
}
|
||||
|
||||
public void removeUpdate(DocumentEvent e) {
|
||||
filter(e.getDocument());
|
||||
}
|
||||
|
||||
private void filter(Document document) {
|
||||
try {
|
||||
String text = document.getText(0, document.getLength());
|
||||
filterList(text);
|
||||
}
|
||||
catch (BadLocationException e) {
|
||||
// shouldn't happen; don't care
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return newFilterField;
|
||||
}
|
||||
|
||||
private void filterList(String filterText) {
|
||||
List<Archive> allDataList = new ArrayList<Archive>();
|
||||
allDataList.addAll(archiveList);
|
||||
|
||||
boolean hasFilter = filterText.trim().length() != 0;
|
||||
if (hasFilter) {
|
||||
String lowerCaseFilterText = filterText.toLowerCase();
|
||||
for (Iterator<Archive> iterator = allDataList.iterator(); iterator.hasNext();) {
|
||||
Archive archive = iterator.next();
|
||||
String archiveString = getStringUsedInList(archive).toLowerCase();
|
||||
if (archiveString.indexOf(lowerCaseFilterText) < 0) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
listModel.clear();
|
||||
for (Archive archive : allDataList) {
|
||||
listModel.addElement(archive);
|
||||
}
|
||||
|
||||
// select something in the list so that the user can make a selection from the keyboard
|
||||
int totalListSize = archiveList.size();
|
||||
int shownListSize = listModel.getSize();
|
||||
if (shownListSize > 0) {
|
||||
int selectedIndex = list.getSelectedIndex();
|
||||
if (selectedIndex < 0) {
|
||||
list.setSelectedIndex(0);
|
||||
}
|
||||
if (shownListSize == totalListSize) {
|
||||
clearStatusText();
|
||||
}
|
||||
else {
|
||||
setStatusText("Filter is hiding " + (totalListSize - shownListSize) +
|
||||
" of the archive choices.");
|
||||
}
|
||||
}
|
||||
else {
|
||||
setStatusText("Filter is hiding all possible archive choices.");
|
||||
}
|
||||
}
|
||||
|
||||
private String getStringUsedInList(Archive archive) {
|
||||
return archive.getName();
|
||||
}
|
||||
|
||||
private void initListModel() {
|
||||
listModel.clear();
|
||||
for (int i = 0; i < archiveList.size(); i++) {
|
||||
Archive archive = archiveList.get(i);
|
||||
UniversalID sourceID = currentArchive.getDataTypeManager().getUniversalID();
|
||||
SourceArchive sourceArchive = archive.getDataTypeManager().getSourceArchive(sourceID);
|
||||
if (sourceArchive != null) {
|
||||
// This archive at least had a data type from the source archive at one time.
|
||||
listModel.addElement(archive);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class MyListCellRenderer extends JLabel implements ListCellRenderer {
|
||||
|
||||
MyListCellRenderer() {
|
||||
setOpaque(true);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see javax.swing.ListCellRenderer#getListCellRendererComponent(javax.swing.JList, java.lang.Object, int, boolean, boolean)
|
||||
*/
|
||||
public Component getListCellRendererComponent(JList localList, Object value, int index,
|
||||
boolean isSelected, boolean cellHasFocus) {
|
||||
|
||||
Archive archive = (Archive) value;
|
||||
setIcon(archive.getIcon(false));
|
||||
setIconTextGap(5);
|
||||
|
||||
String text = getStringUsedInList(archive);
|
||||
setText(text);
|
||||
if (isSelected) {
|
||||
setBackground(localList.getSelectionBackground());
|
||||
setForeground(localList.getSelectionForeground());
|
||||
}
|
||||
else {
|
||||
setBackground(localList.getBackground());
|
||||
setForeground(localList.getForeground());
|
||||
}
|
||||
setBorder(BorderFactory.createEmptyBorder(0, 3, 0, 10));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
@ -1316,7 +1316,7 @@ public class DataTypeManagerHandler {
|
||||
private boolean acquireSaveLock(UndoableDomainObject undoableDomainObject) {
|
||||
if (!undoableDomainObject.lock(null)) {
|
||||
String title = "Save " + CONTENT_NAME + " (Busy)";
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("The " + CONTENT_NAME + " is currently being modified by \n");
|
||||
buf.append("the following actions:\n ");
|
||||
Transaction t = undoableDomainObject.getCurrentTransaction();
|
||||
|
@ -18,10 +18,13 @@ package ghidra.app.plugin.core.datamgr.editor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.ComboBoxModel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import docking.ComponentProvider;
|
||||
import docking.widgets.checkbox.GCheckBox;
|
||||
import docking.widgets.combobox.GhidraComboBox;
|
||||
import docking.widgets.label.GLabel;
|
||||
import ghidra.app.plugin.core.compositeeditor.*;
|
||||
import ghidra.app.plugin.core.datamgr.DataTypeManagerPlugin;
|
||||
import ghidra.app.plugin.core.datamgr.archive.SourceArchive;
|
||||
@ -574,18 +577,18 @@ public class DataTypeEditorManager
|
||||
}
|
||||
|
||||
setCallingConventionChoices(choices);
|
||||
parentPanel.add(new JLabel("Calling Convention:"));
|
||||
parentPanel.add(new GLabel("Calling Convention:"));
|
||||
parentPanel.add(callingConventionComboBox);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installInlineWidget(JPanel parentPanel) {
|
||||
inlineCheckBox = new JCheckBox("Inline");
|
||||
inlineCheckBox = new GCheckBox("Inline");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installNoReturnWidget(JPanel parentPanel) {
|
||||
noReturnCheckBox = new JCheckBox("No Return");
|
||||
noReturnCheckBox = new GCheckBox("No Return");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,6 +26,8 @@ import javax.swing.table.TableModel;
|
||||
|
||||
import docking.widgets.OptionDialog;
|
||||
import docking.widgets.combobox.GhidraComboBox;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import docking.widgets.label.GLabel;
|
||||
import docking.widgets.table.GTableCellRenderer;
|
||||
import docking.widgets.table.GTableTextCellEditor;
|
||||
import docking.widgets.textfield.GValidatedTextField;
|
||||
@ -381,7 +383,7 @@ class EnumEditorPanel extends JPanel {
|
||||
JPanel panel = new JPanel();
|
||||
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
|
||||
|
||||
JLabel label = new JLabel("Name:", SwingConstants.RIGHT);
|
||||
JLabel label = new GLabel("Name:", SwingConstants.RIGHT);
|
||||
label.setPreferredSize(new Dimension(descLabel.getPreferredSize()));
|
||||
panel.add(label);
|
||||
panel.add(Box.createHorizontalStrut(2));
|
||||
@ -397,7 +399,7 @@ class EnumEditorPanel extends JPanel {
|
||||
JPanel panel = new JPanel();
|
||||
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
|
||||
|
||||
descLabel = new JLabel("Description:", SwingConstants.RIGHT);
|
||||
descLabel = new GDLabel("Description:", SwingConstants.RIGHT);
|
||||
|
||||
panel.add(descLabel);
|
||||
panel.add(Box.createHorizontalStrut(2));
|
||||
@ -430,13 +432,13 @@ class EnumEditorPanel extends JPanel {
|
||||
}
|
||||
});
|
||||
|
||||
JLabel label = new JLabel("Category:", SwingConstants.RIGHT);
|
||||
JLabel label = new GLabel("Category:", SwingConstants.RIGHT);
|
||||
label.setPreferredSize(new Dimension(descLabel.getPreferredSize()));
|
||||
panel.add(label);
|
||||
panel.add(Box.createHorizontalStrut(2));
|
||||
panel.add(categoryField);
|
||||
panel.add(Box.createHorizontalStrut(20));
|
||||
panel.add(new JLabel("Size:"));
|
||||
panel.add(new GLabel("Size:"));
|
||||
panel.add(Box.createHorizontalStrut(5));
|
||||
panel.add(sizeComboBox);
|
||||
|
||||
|
@ -398,7 +398,8 @@ public class EnumEditorProvider extends ComponentProviderAdapter
|
||||
newVal = "Missing";
|
||||
}
|
||||
msg.append(String.format("<li>%s: 0x%s \u2192 <font color=#ff0000>%s</font></li>",
|
||||
field, Long.toHexString(originalEnum.getValue(field)), newVal));
|
||||
HTMLUtilities.escapeHTML(field), Long.toHexString(originalEnum.getValue(field)),
|
||||
newVal));
|
||||
}
|
||||
msg.append("</ul>");
|
||||
msg.append(
|
||||
|
@ -23,8 +23,7 @@ import docking.widgets.tree.GTreeLazyNode;
|
||||
import docking.widgets.tree.GTreeNode;
|
||||
import ghidra.app.plugin.core.datamgr.util.DataTypeUtils;
|
||||
import ghidra.program.model.data.*;
|
||||
import ghidra.util.InvalidNameException;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.*;
|
||||
import ghidra.util.exception.AssertException;
|
||||
import ghidra.util.exception.DuplicateNameException;
|
||||
|
||||
@ -67,8 +66,7 @@ public class CategoryNode extends GTreeLazyNode implements DataTypeTreeNode {
|
||||
|
||||
Category[] subCategories = category.getCategories();
|
||||
DataType[] dataTypes = category.getDataTypes();
|
||||
List<GTreeNode> children =
|
||||
new ArrayList<>(subCategories.length + dataTypes.length);
|
||||
List<GTreeNode> children = new ArrayList<>(subCategories.length + dataTypes.length);
|
||||
for (Category subCategory : subCategories) {
|
||||
children.add(new CategoryNode(subCategory));
|
||||
}
|
||||
@ -142,7 +140,7 @@ public class CategoryNode extends GTreeLazyNode implements DataTypeTreeNode {
|
||||
|
||||
@Override
|
||||
public String getToolTip() {
|
||||
return category.getCategoryPathName();
|
||||
return "<html>" + HTMLUtilities.escapeHTML(category.getCategoryPathName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,6 +22,7 @@ import ghidra.app.plugin.core.datamgr.archive.DomainFileArchive;
|
||||
import ghidra.framework.model.DomainFile;
|
||||
import ghidra.framework.model.DomainObject;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.util.HTMLUtilities;
|
||||
import resources.MultiIcon;
|
||||
import resources.ResourceManager;
|
||||
import resources.icons.TranslateIcon;
|
||||
@ -102,7 +103,7 @@ public class DomainFileArchiveNode extends ArchiveNode {
|
||||
public String getToolTip() {
|
||||
DomainFile file = ((DomainFileArchive) archive).getDomainFile();
|
||||
if (file != null) {
|
||||
return file.getPathname();
|
||||
return "<html>" + HTMLUtilities.escapeHTML(file.getPathname());
|
||||
}
|
||||
return "[Unsaved New Domain File Archive]";
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ import javax.swing.ImageIcon;
|
||||
|
||||
import generic.jar.ResourceFile;
|
||||
import ghidra.app.plugin.core.datamgr.archive.FileArchive;
|
||||
import ghidra.util.HTMLUtilities;
|
||||
import resources.MultiIcon;
|
||||
import resources.ResourceManager;
|
||||
import resources.icons.TranslateIcon;
|
||||
@ -53,7 +54,7 @@ public class FileArchiveNode extends ArchiveNode {
|
||||
public String getToolTip() {
|
||||
ResourceFile file = fileArchive.getFile();
|
||||
if (file != null) {
|
||||
return file.getAbsolutePath();
|
||||
return "<html>" + HTMLUtilities.escapeHTML(file.getAbsolutePath());
|
||||
}
|
||||
return "[Unsaved New Archive]";
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* ###
|
||||
* 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.
|
||||
@ -16,13 +15,13 @@
|
||||
*/
|
||||
package ghidra.app.plugin.core.datamgr.tree;
|
||||
|
||||
import ghidra.app.plugin.core.datamgr.archive.Archive;
|
||||
import ghidra.app.plugin.core.datamgr.archive.InvalidFileArchive;
|
||||
import ghidra.program.model.data.ArchiveType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import docking.widgets.tree.GTreeNode;
|
||||
import ghidra.app.plugin.core.datamgr.archive.Archive;
|
||||
import ghidra.app.plugin.core.datamgr.archive.InvalidFileArchive;
|
||||
import ghidra.program.model.data.ArchiveType;
|
||||
import ghidra.util.HTMLUtilities;
|
||||
|
||||
public class InvalidArchiveNode extends ArchiveNode {
|
||||
|
||||
@ -44,7 +43,8 @@ public class InvalidArchiveNode extends ArchiveNode {
|
||||
public String getToolTip() {
|
||||
ArchiveType archiveType = ((InvalidFileArchive) archive).getArchiveType();
|
||||
String type = archiveType == ArchiveType.FILE ? "File" : "Project";
|
||||
return "Unable to locate " + type + " data type archive: " + archive.getName();
|
||||
return "<html>Unable to locate " + type + " data type archive: " +
|
||||
HTMLUtilities.escapeHTML(archive.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* ###
|
||||
* 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.
|
||||
@ -18,6 +17,7 @@ package ghidra.app.plugin.core.datamgr.tree;
|
||||
|
||||
import ghidra.app.plugin.core.datamgr.archive.ProgramArchive;
|
||||
import ghidra.framework.model.DomainFile;
|
||||
import ghidra.util.HTMLUtilities;
|
||||
|
||||
public class ProgramArchiveNode extends DomainFileArchiveNode {
|
||||
|
||||
@ -29,7 +29,7 @@ public class ProgramArchiveNode extends DomainFileArchiveNode {
|
||||
public String getToolTip() {
|
||||
DomainFile file = ((ProgramArchive) archive).getDomainFile();
|
||||
if (file != null) {
|
||||
return file.getPathname();
|
||||
return "<html>" + HTMLUtilities.escapeHTML(file.getPathname());
|
||||
}
|
||||
return "[Unsaved New Program Archive]";
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* ###
|
||||
* 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.
|
||||
@ -18,6 +17,7 @@ package ghidra.app.plugin.core.datamgr.tree;
|
||||
|
||||
import ghidra.app.plugin.core.datamgr.archive.ProjectArchive;
|
||||
import ghidra.framework.model.DomainFile;
|
||||
import ghidra.util.HTMLUtilities;
|
||||
|
||||
public class ProjectArchiveNode extends DomainFileArchiveNode {
|
||||
|
||||
@ -37,7 +37,7 @@ public class ProjectArchiveNode extends DomainFileArchiveNode {
|
||||
public String getToolTip() {
|
||||
DomainFile file = ((ProjectArchive) archive).getDomainFile();
|
||||
if (file != null) {
|
||||
return file.getPathname();
|
||||
return "<html>" + HTMLUtilities.escapeHTML(file.getPathname());
|
||||
}
|
||||
return "[Unsaved New Project Archive]";
|
||||
}
|
||||
|
@ -21,6 +21,9 @@ import java.awt.event.*;
|
||||
import javax.swing.*;
|
||||
|
||||
import docking.DialogComponentProvider;
|
||||
import docking.widgets.button.GRadioButton;
|
||||
import docking.widgets.label.GIconLabel;
|
||||
import docking.widgets.label.GLabel;
|
||||
import ghidra.util.HelpLocation;
|
||||
import resources.ResourceManager;
|
||||
|
||||
@ -117,9 +120,9 @@ public class ConflictDialog extends DialogComponentProvider {
|
||||
};
|
||||
|
||||
ButtonGroup bg = new ButtonGroup();
|
||||
renameRB = new JRadioButton("Rename new data type to " + newDTName, true);
|
||||
replaceRB = new JRadioButton("Replace existing data type");
|
||||
useExistingRB = new JRadioButton("Use existing data type");
|
||||
renameRB = new GRadioButton("Rename new data type to " + newDTName, true);
|
||||
replaceRB = new GRadioButton("Replace existing data type");
|
||||
useExistingRB = new GRadioButton("Use existing data type");
|
||||
|
||||
renameRB.addItemListener(listener);
|
||||
useExistingRB.addItemListener(listener);
|
||||
@ -140,18 +143,14 @@ public class ConflictDialog extends DialogComponentProvider {
|
||||
}
|
||||
|
||||
private JPanel createLabelPanel(String dtName, String categoryPath) {
|
||||
JLabel imageLabel = new JLabel(INFORM_ICON);
|
||||
|
||||
JLabel infoLabel = new JLabel("Conflict exists in " + categoryPath + " for " + dtName);
|
||||
|
||||
JPanel labelPanel = new JPanel();
|
||||
labelPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 20));
|
||||
BoxLayout bl = new BoxLayout(labelPanel, BoxLayout.X_AXIS);
|
||||
labelPanel.setLayout(bl);
|
||||
labelPanel.add(Box.createHorizontalStrut(5));
|
||||
labelPanel.add(imageLabel);
|
||||
labelPanel.add(new GIconLabel(INFORM_ICON));
|
||||
labelPanel.add(Box.createHorizontalStrut(5));
|
||||
labelPanel.add(infoLabel);
|
||||
labelPanel.add(new GLabel("Conflict exists in " + categoryPath + " for " + dtName));
|
||||
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
panel.add(labelPanel);
|
||||
|
@ -26,6 +26,7 @@ import javax.swing.tree.TreePath;
|
||||
import docking.DialogComponentProvider;
|
||||
import docking.widgets.filter.FilterOptions;
|
||||
import docking.widgets.filter.TextFilterStrategy;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import docking.widgets.tree.*;
|
||||
import ghidra.app.plugin.core.datamgr.DataTypeManagerPlugin;
|
||||
import ghidra.app.plugin.core.datamgr.tree.DataTypeArchiveGTree;
|
||||
@ -98,8 +99,7 @@ public class DataTypeChooserDialog extends DialogComponentProvider {
|
||||
|
||||
private JComponent createWorkPanel() {
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
String message = "Choose the data type you wish to use.";
|
||||
messageLabel = new JLabel(message);
|
||||
messageLabel = new GDLabel("Choose the data type you wish to use.");
|
||||
messageLabel.setBorder(BorderFactory.createEmptyBorder(2, 4, 2, 2));
|
||||
panel.add(messageLabel, BorderLayout.NORTH);
|
||||
panel.add(this.tree, BorderLayout.CENTER);
|
||||
|
@ -490,11 +490,11 @@ public class DataTypeUtils {
|
||||
// JFrame frame = new JFrame();
|
||||
// JPanel panel = new JPanel();
|
||||
//
|
||||
// JLabel label1 = new JLabel();
|
||||
// JLabel label1 = new GDLabel();
|
||||
// Icon icon = getOpenFolderIcon( false );
|
||||
// label1.setIcon( icon );
|
||||
//
|
||||
// JLabel label2 = new JLabel();
|
||||
// JLabel label2 = new GDLabel();
|
||||
// Icon icon2 = ResourceManager.getDisabledIcon( (ImageIcon) icon );
|
||||
// label2.setIcon( icon2 );
|
||||
//
|
||||
|
@ -26,9 +26,12 @@ import javax.swing.*;
|
||||
import docking.*;
|
||||
import docking.action.ToggleDockingAction;
|
||||
import docking.action.ToolBarData;
|
||||
import docking.widgets.button.GRadioButton;
|
||||
import docking.widgets.checkbox.GHtmlCheckBox;
|
||||
import docking.widgets.combobox.GhidraComboBox;
|
||||
import docking.widgets.filter.FilterListener;
|
||||
import docking.widgets.filter.FilterTextField;
|
||||
import docking.widgets.label.GLabel;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.util.HelpLocation;
|
||||
import ghidra.util.StringUtilities;
|
||||
@ -241,11 +244,11 @@ class FilterAction extends ToggleDockingAction {
|
||||
|
||||
JPanel enablePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||
ButtonGroup group = new ButtonGroup();
|
||||
enableButton = new JRadioButton("Enabled", true);
|
||||
enableButton = new GRadioButton("Enabled", true);
|
||||
enableButton.addKeyListener(listener);
|
||||
enablePanel.add(enableButton);
|
||||
group.add(enableButton);
|
||||
disableButton = new JRadioButton("Disabled", false);
|
||||
disableButton = new GRadioButton("Disabled", false);
|
||||
disableButton.addKeyListener(listener);
|
||||
enablePanel.add(disableButton);
|
||||
group.add(disableButton);
|
||||
@ -317,7 +320,7 @@ class FilterAction extends ToggleDockingAction {
|
||||
JPanel filterPanel = new JPanel(new BorderLayout());
|
||||
filterField = new FilterTextField(checkboxPanel);
|
||||
filterPanel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
|
||||
filterPanel.add(new JLabel("Filter:"), BorderLayout.WEST);
|
||||
filterPanel.add(new GLabel("Filter:"), BorderLayout.WEST);
|
||||
|
||||
filterPanel.add(filterField, BorderLayout.CENTER);
|
||||
filterField.addFilterListener(filterListener);
|
||||
@ -388,7 +391,7 @@ class FilterAction extends ToggleDockingAction {
|
||||
}
|
||||
|
||||
private void createCheckBox(String curTypeHtml, String curType, Boolean lEnabled) {
|
||||
JCheckBox newCheckbox = new JCheckBox(curTypeHtml, lEnabled.booleanValue());
|
||||
JCheckBox newCheckbox = new GHtmlCheckBox(curTypeHtml, lEnabled.booleanValue());
|
||||
newCheckbox.setName(curType);
|
||||
newCheckbox.addKeyListener(listener);
|
||||
newCheckbox.addItemListener(itemListener);
|
||||
|
@ -27,6 +27,9 @@ import docking.ActionContext;
|
||||
import docking.DialogComponentProvider;
|
||||
import docking.ToolTipManager;
|
||||
import docking.action.*;
|
||||
import docking.widgets.checkbox.GCheckBox;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import docking.widgets.label.GLabel;
|
||||
import ghidra.app.events.ProgramSelectionPluginEvent;
|
||||
import ghidra.app.services.GoToService;
|
||||
import ghidra.app.util.HelpTopics;
|
||||
@ -148,7 +151,7 @@ public class AddressTableDialog extends DialogComponentProvider {
|
||||
JPanel searchOptionsPanel = new JPanel(new BorderLayout());
|
||||
searchOptionsPanel.setBorder(BorderFactory.createTitledBorder("Search Options"));
|
||||
|
||||
JLabel minLengthLabel = new JLabel("Minimum Length: ");
|
||||
JLabel minLengthLabel = new GLabel("Minimum Length: ");
|
||||
ToolTipManager.setToolTipText(minLengthLabel,
|
||||
"The minimum number of consecutive addresses that will make an address table.");
|
||||
minLengthField = new JTextField(5);
|
||||
@ -159,7 +162,7 @@ public class AddressTableDialog extends DialogComponentProvider {
|
||||
minLengthPanel.add(minLengthLabel);
|
||||
minLengthPanel.add(minLengthField);
|
||||
|
||||
alignLabel = new JLabel("Alignment: ");
|
||||
alignLabel = new GDLabel("Alignment: ");
|
||||
alignField = new JTextField(5);
|
||||
alignField.setName("Alignment");
|
||||
ToolTipManager.setToolTipText(alignLabel,
|
||||
@ -170,7 +173,7 @@ public class AddressTableDialog extends DialogComponentProvider {
|
||||
}
|
||||
alignField.setText("" + align);
|
||||
|
||||
skipLabel = new JLabel("Skip Length: ");
|
||||
skipLabel = new GDLabel("Skip Length: ");
|
||||
skipField = new JTextField(5);
|
||||
skipField.setName("Skip");
|
||||
ToolTipManager.setToolTipText(skipLabel,
|
||||
@ -190,14 +193,14 @@ public class AddressTableDialog extends DialogComponentProvider {
|
||||
optPanel.add(alignPanel);
|
||||
optPanel.add(skipPanel);
|
||||
|
||||
selectionButton = new JCheckBox("Search Selection");
|
||||
selectionButton = new GCheckBox("Search Selection");
|
||||
selectionButton.setSelected(false);
|
||||
ToolTipManager.setToolTipText(selectionButton,
|
||||
"If checked, search only the current selection.");
|
||||
JPanel searchOptionsWestPanel = new JPanel(new GridLayout(2, 1));
|
||||
searchOptionsWestPanel.add(selectionButton);
|
||||
|
||||
shiftedAddressButton = new JCheckBox("Shifted Addresses");
|
||||
shiftedAddressButton = new GCheckBox("Shifted Addresses");
|
||||
|
||||
boolean allowShiftedAddresses =
|
||||
plugin.getProgram().getDataTypeManager().getDataOrganization().getPointerShift() != 0;
|
||||
@ -224,18 +227,18 @@ public class AddressTableDialog extends DialogComponentProvider {
|
||||
JPanel makeOptionsPanel = new JPanel(new BorderLayout());
|
||||
makeOptionsPanel.setBorder(BorderFactory.createTitledBorder("Make Table Options"));
|
||||
|
||||
autoLabelCB = new JCheckBox("Auto Label");
|
||||
autoLabelCB = new GCheckBox("Auto Label");
|
||||
autoLabelCB.setSelected(true);
|
||||
autoLabelCB.setEnabled(false);
|
||||
ToolTipManager.setToolTipText(autoLabelCB,
|
||||
"Label the top of the address table and all members of the table.");
|
||||
|
||||
offsetLabel = new JLabel("Offset: ");
|
||||
offsetLabel = new GDLabel("Offset: ");
|
||||
ToolTipManager.setToolTipText(offsetLabel,
|
||||
"Offset from the beginning of the selected table(s)");
|
||||
offsetLabel.setEnabled(false);
|
||||
|
||||
JLabel viewOffsetLabel = new JLabel(" ");
|
||||
JLabel viewOffsetLabel = new GDLabel(" ");
|
||||
viewOffsetLabel.setEnabled(false);
|
||||
|
||||
viewOffset = new HintTextField(20);
|
||||
|
@ -23,6 +23,7 @@ import javax.swing.*;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import docking.WindowPosition;
|
||||
import docking.widgets.list.GListCellRenderer;
|
||||
import ghidra.GhidraOptions;
|
||||
import ghidra.app.CorePluginPackage;
|
||||
import ghidra.app.plugin.PluginCategoryNames;
|
||||
@ -42,8 +43,7 @@ import ghidra.program.model.address.AddressOverflowException;
|
||||
import ghidra.program.model.listing.*;
|
||||
import ghidra.program.util.ProgramLocation;
|
||||
import ghidra.program.util.ProgramSelection;
|
||||
import ghidra.util.HelpLocation;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.*;
|
||||
import ghidra.util.exception.UsrException;
|
||||
|
||||
/**
|
||||
@ -421,23 +421,26 @@ public class DisassembledViewPlugin extends ProgramPlugin implements DomainObjec
|
||||
initializeDisplay();
|
||||
|
||||
// we need to do some custom rendering
|
||||
contentList.setCellRenderer(new DefaultListCellRenderer() {
|
||||
contentList.setCellRenderer(new GListCellRenderer<DisassembledAddressInfo>() {
|
||||
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList<?> list, Object value,
|
||||
int index, boolean isSelected, boolean cellHasFocus) {
|
||||
JLabel renderer = (JLabel) super.getListCellRendererComponent(list, value,
|
||||
index, isSelected, cellHasFocus);
|
||||
protected String getItemText(DisassembledAddressInfo value) {
|
||||
return value.getAddressPreview(addressPreviewFormat);
|
||||
}
|
||||
|
||||
renderer.setFont(font);
|
||||
@Override
|
||||
public Component getListCellRendererComponent(
|
||||
JList<? extends DisassembledAddressInfo> list,
|
||||
DisassembledAddressInfo value, int index, boolean isSelected,
|
||||
boolean cellHasFocus) {
|
||||
|
||||
renderer.setToolTipText(TOOLTIP_TEXT_PREPEND + currentLocation.getAddress());
|
||||
super.getListCellRendererComponent(list, value, index, isSelected,
|
||||
cellHasFocus);
|
||||
|
||||
// first let's set the text to the user-defined option, if
|
||||
// we have the correct type of class
|
||||
if (value instanceof DisassembledAddressInfo) {
|
||||
renderer.setText(((DisassembledAddressInfo) value).getAddressPreview(
|
||||
addressPreviewFormat));
|
||||
}
|
||||
setFont(font);
|
||||
|
||||
setToolTipText(TOOLTIP_TEXT_PREPEND +
|
||||
HTMLUtilities.escapeHTML(currentLocation.getAddress().toString()));
|
||||
|
||||
// make sure the first value is highlighted to indicate
|
||||
// that it is the selected program location
|
||||
@ -450,13 +453,12 @@ public class DisassembledViewPlugin extends ProgramPlugin implements DomainObjec
|
||||
background = background.darker();
|
||||
}
|
||||
|
||||
renderer.setForeground(foreground);
|
||||
renderer.setBackground(background);
|
||||
setForeground(foreground);
|
||||
setBackground(background);
|
||||
}
|
||||
|
||||
return renderer;
|
||||
return this;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* ###
|
||||
* 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.
|
||||
@ -16,13 +15,6 @@
|
||||
*/
|
||||
package ghidra.app.plugin.core.disassembler;
|
||||
|
||||
import ghidra.app.util.bean.FixedBitSizeValueField;
|
||||
import ghidra.program.model.lang.Register;
|
||||
import ghidra.program.model.lang.RegisterValue;
|
||||
import ghidra.program.model.listing.ProgramContext;
|
||||
import ghidra.util.HelpLocation;
|
||||
import ghidra.util.layout.PairLayout;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
@ -33,107 +25,115 @@ import java.util.ArrayList;
|
||||
import javax.swing.*;
|
||||
|
||||
import docking.DialogComponentProvider;
|
||||
import docking.widgets.button.GRadioButton;
|
||||
import docking.widgets.label.GLabel;
|
||||
import ghidra.app.util.bean.FixedBitSizeValueField;
|
||||
import ghidra.program.model.lang.Register;
|
||||
import ghidra.program.model.lang.RegisterValue;
|
||||
import ghidra.program.model.listing.ProgramContext;
|
||||
import ghidra.util.HelpLocation;
|
||||
import ghidra.util.layout.PairLayout;
|
||||
|
||||
public class ProcessorStateDialog extends DialogComponentProvider {
|
||||
|
||||
private JPanel mainPanel;
|
||||
private JPanel mainPanel;
|
||||
|
||||
private final static String TITLE = "Specify Processor Disassembly Options";
|
||||
private final static String TITLE = "Specify Processor Disassembly Options";
|
||||
|
||||
private FixedBitSizeValueField[] fields;
|
||||
private java.util.List<Register> registerList;
|
||||
private FixedBitSizeValueField[] fields;
|
||||
private java.util.List<Register> registerList;
|
||||
private ProgramContext programContext;
|
||||
|
||||
|
||||
public ProcessorStateDialog(ProgramContext programContext) {
|
||||
super(TITLE, true, false, true, false);
|
||||
super(TITLE, true, false, true, false);
|
||||
this.programContext = programContext;
|
||||
Register[] contextRegisters = programContext.getProcessorStateRegisters();
|
||||
registerList = new ArrayList<Register>();
|
||||
registerList = new ArrayList<>();
|
||||
for (Register register : contextRegisters) {
|
||||
if (!register.isBaseRegister()) {
|
||||
registerList.add(register);
|
||||
}
|
||||
}
|
||||
RegisterValue currentContext = programContext.getDefaultDisassemblyContext();
|
||||
addOKButton();
|
||||
addCancelButton();
|
||||
RegisterValue currentContext = programContext.getDefaultDisassemblyContext();
|
||||
addOKButton();
|
||||
addCancelButton();
|
||||
|
||||
JPanel workPanel = new JPanel(new PairLayout(4,4));
|
||||
workPanel.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
|
||||
fields = new FixedBitSizeValueField[registerList.size()];
|
||||
for (int i = 0; i < fields.length; i++) {
|
||||
Register register = registerList.get(i);
|
||||
int numbits = register.getBitLength();
|
||||
JLabel label = new JLabel(register.getName()+" [ "+register.getBitLength()
|
||||
+ " bit" + ((numbits == 1) ? "" : "s") + " ] :");
|
||||
label.setHorizontalAlignment(SwingConstants.TRAILING);
|
||||
label.setToolTipText(register.getDescription());
|
||||
workPanel.add(label);
|
||||
JPanel workPanel = new JPanel(new PairLayout(4, 4));
|
||||
workPanel.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
|
||||
fields = new FixedBitSizeValueField[registerList.size()];
|
||||
for (int i = 0; i < fields.length; i++) {
|
||||
Register register = registerList.get(i);
|
||||
int numbits = register.getBitLength();
|
||||
JLabel label = new GLabel(register.getName() + " [ " + register.getBitLength() +
|
||||
" bit" + ((numbits == 1) ? "" : "s") + " ] :");
|
||||
label.setHorizontalAlignment(SwingConstants.TRAILING);
|
||||
label.setToolTipText(register.getDescription());
|
||||
workPanel.add(label);
|
||||
fields[i] = new FixedBitSizeValueField(register.getBitLength(), false, false);
|
||||
fields[i].setValue( currentContext.getRegisterValue(register).getUnsignedValue() );
|
||||
fields[i].setValue(currentContext.getRegisterValue(register).getUnsignedValue());
|
||||
workPanel.add(fields[i]);
|
||||
}
|
||||
mainPanel = new JPanel(new BorderLayout());
|
||||
JScrollPane scrollPane = new JScrollPane(workPanel);
|
||||
mainPanel.add(scrollPane, BorderLayout.CENTER);
|
||||
JPanel radioPanel = new JPanel(new FlowLayout());
|
||||
mainPanel.add(radioPanel, BorderLayout.SOUTH);
|
||||
JRadioButton hexButton = new JRadioButton("Hex");
|
||||
JRadioButton decimalButton = new JRadioButton("Decimal");
|
||||
hexButton.setSelected(true);
|
||||
ButtonGroup group = new ButtonGroup();
|
||||
group.add(hexButton);
|
||||
group.add(decimalButton);
|
||||
radioPanel.add(hexButton);
|
||||
radioPanel.add(decimalButton);
|
||||
hexButton.addActionListener(new ActionListener() {
|
||||
mainPanel = new JPanel(new BorderLayout());
|
||||
JScrollPane scrollPane = new JScrollPane(workPanel);
|
||||
mainPanel.add(scrollPane, BorderLayout.CENTER);
|
||||
JPanel radioPanel = new JPanel(new FlowLayout());
|
||||
mainPanel.add(radioPanel, BorderLayout.SOUTH);
|
||||
GRadioButton hexButton = new GRadioButton("Hex");
|
||||
GRadioButton decimalButton = new GRadioButton("Decimal");
|
||||
hexButton.setSelected(true);
|
||||
ButtonGroup group = new ButtonGroup();
|
||||
group.add(hexButton);
|
||||
group.add(decimalButton);
|
||||
radioPanel.add(hexButton);
|
||||
radioPanel.add(decimalButton);
|
||||
hexButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
setRadix(16);
|
||||
}
|
||||
});
|
||||
decimalButton.addActionListener(new ActionListener() {
|
||||
decimalButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
setRadix(10);
|
||||
}
|
||||
});
|
||||
|
||||
addWorkPanel(mainPanel);
|
||||
setHelpLocation(new HelpLocation("DisassemblerPlugin","ProcessorOptions"));
|
||||
setRememberSize( false );
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void setRadix(int radix) {
|
||||
for (FixedBitSizeValueField field : fields) {
|
||||
addWorkPanel(mainPanel);
|
||||
setHelpLocation(new HelpLocation("DisassemblerPlugin", "ProcessorOptions"));
|
||||
setRememberSize(false);
|
||||
|
||||
}
|
||||
|
||||
protected void setRadix(int radix) {
|
||||
for (FixedBitSizeValueField field : fields) {
|
||||
field.setFormat(radix, false);
|
||||
}
|
||||
}
|
||||
|
||||
private RegisterValue setRegisterValue(RegisterValue registerValue, Register register, BigInteger value) {
|
||||
private RegisterValue setRegisterValue(RegisterValue registerValue, Register register,
|
||||
BigInteger value) {
|
||||
RegisterValue newValue = new RegisterValue(register, value);
|
||||
return registerValue.combineValues(newValue);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The callback method for when the "OK" button is pressed.
|
||||
*/
|
||||
@Override
|
||||
public void okCallback() {
|
||||
RegisterValue newValue = new RegisterValue(programContext.getBaseContextRegister());
|
||||
for (int i = 0; i < fields.length; i++) {
|
||||
BigInteger value = fields[i].getValue();
|
||||
if (value != null) {
|
||||
newValue = setRegisterValue(newValue, registerList.get(i), value);
|
||||
}
|
||||
* The callback method for when the "OK" button is pressed.
|
||||
*/
|
||||
@Override
|
||||
public void okCallback() {
|
||||
RegisterValue newValue = new RegisterValue(programContext.getBaseContextRegister());
|
||||
for (int i = 0; i < fields.length; i++) {
|
||||
BigInteger value = fields[i].getValue();
|
||||
if (value != null) {
|
||||
newValue = setRegisterValue(newValue, registerList.get(i), value);
|
||||
}
|
||||
}
|
||||
programContext.setDefaultDisassemblyContext(newValue);
|
||||
close();
|
||||
}
|
||||
|
||||
programContext.setDefaultDisassemblyContext(newValue);
|
||||
close();
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@ import javax.swing.*;
|
||||
|
||||
import docking.DialogComponentProvider;
|
||||
import docking.widgets.combobox.GhidraComboBox;
|
||||
import docking.widgets.label.GLabel;
|
||||
import ghidra.app.cmd.disassemble.SetFlowOverrideCmd;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.program.model.listing.*;
|
||||
@ -96,8 +97,8 @@ class SetFlowOverrideDialog extends DialogComponentProvider {
|
||||
|
||||
FlowType flowType = instruction.getFlowType();
|
||||
|
||||
panel.add(new JLabel("Current Flow: " + flowType.getName() +
|
||||
(flowType.isConditional() ? "*" : "")));
|
||||
panel.add(new GLabel(
|
||||
"Current Flow: " + flowType.getName() + (flowType.isConditional() ? "*" : "")));
|
||||
|
||||
panel.add(Box.createGlue());
|
||||
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
@ -110,7 +111,7 @@ class SetFlowOverrideDialog extends DialogComponentProvider {
|
||||
JPanel panel = new JPanel();
|
||||
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
|
||||
|
||||
panel.add(new JLabel(note));
|
||||
panel.add(new GLabel(note));
|
||||
|
||||
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
|
||||
@ -139,7 +140,7 @@ class SetFlowOverrideDialog extends DialogComponentProvider {
|
||||
flowOverrideComboBox.setSelectedItem(flowOverride);
|
||||
}
|
||||
|
||||
panel.add(new JLabel("Instruction Flow:"));
|
||||
panel.add(new GLabel("Instruction Flow:"));
|
||||
panel.add(flowOverrideComboBox);
|
||||
|
||||
panel.add(Box.createGlue());
|
||||
@ -191,8 +192,8 @@ class SetFlowOverrideDialog extends DialogComponentProvider {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
tool.executeBackgroundCommand(
|
||||
new SetFlowOverrideCmd(instruction.getMinAddress(), flow), program);
|
||||
tool.executeBackgroundCommand(new SetFlowOverrideCmd(instruction.getMinAddress(), flow),
|
||||
program);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import javax.swing.table.*;
|
||||
import docking.ActionContext;
|
||||
import docking.action.*;
|
||||
import docking.widgets.OptionDialog;
|
||||
import docking.widgets.label.GLabel;
|
||||
import ghidra.app.context.ProgramActionContext;
|
||||
import ghidra.app.services.DataTypeManagerService;
|
||||
import ghidra.app.services.GoToService;
|
||||
@ -218,7 +219,7 @@ public class EquateTableProvider extends ComponentProviderAdapter {
|
||||
setEquateTableRenderer();
|
||||
|
||||
JPanel equatesPanel = new JPanel(new BorderLayout());
|
||||
equatesPanel.add(new JLabel("Equates", SwingConstants.CENTER), BorderLayout.NORTH);
|
||||
equatesPanel.add(new GLabel("Equates", SwingConstants.CENTER), BorderLayout.NORTH);
|
||||
equatesPanel.add(equatesTablePane, BorderLayout.CENTER);
|
||||
equatesPanel.add(equatesFilterPanel, BorderLayout.SOUTH);
|
||||
|
||||
@ -245,7 +246,7 @@ public class EquateTableProvider extends ComponentProviderAdapter {
|
||||
setReferenceTableRenderer();
|
||||
|
||||
JPanel referencesPanel = new JPanel(new BorderLayout());
|
||||
referencesPanel.add(new JLabel("References", SwingConstants.CENTER), "North");
|
||||
referencesPanel.add(new GLabel("References", SwingConstants.CENTER), "North");
|
||||
referencesPanel.add(referencesTablePane, "Center");
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
@ -29,9 +29,11 @@ import javax.swing.event.DocumentListener;
|
||||
import docking.DialogComponentProvider;
|
||||
import docking.options.editor.ButtonPanelFactory;
|
||||
import docking.widgets.OptionDialog;
|
||||
import docking.widgets.checkbox.GCheckBox;
|
||||
import docking.widgets.combobox.GhidraComboBox;
|
||||
import docking.widgets.filechooser.GhidraFileChooser;
|
||||
import docking.widgets.filechooser.GhidraFileChooserMode;
|
||||
import docking.widgets.label.GLabel;
|
||||
import ghidra.app.plugin.core.help.AboutDomainObjectUtils;
|
||||
import ghidra.app.util.*;
|
||||
import ghidra.app.util.exporter.Exporter;
|
||||
@ -183,23 +185,23 @@ public class ExporterDialog extends DialogComponentProvider implements AddressFa
|
||||
private Component buildMainPanel() {
|
||||
JPanel panel = new JPanel(new PairLayout(5, 5));
|
||||
panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
|
||||
panel.add(new JLabel("Format: ", SwingConstants.RIGHT));
|
||||
panel.add(new GLabel("Format: ", SwingConstants.RIGHT));
|
||||
panel.add(buildFormatChooser());
|
||||
panel.add(new JLabel("Output File: ", SwingConstants.RIGHT));
|
||||
panel.add(new GLabel("Output File: ", SwingConstants.RIGHT));
|
||||
panel.add(buildFilePanel());
|
||||
return panel;
|
||||
}
|
||||
|
||||
private Component buildSelectionCheckboxPanel() {
|
||||
JPanel panel = new JPanel(new PairLayout(5, 5));
|
||||
selectionOnlyLabel = new JLabel("Selection Only:");
|
||||
selectionOnlyLabel = new GLabel("Selection Only:");
|
||||
panel.add(selectionOnlyLabel);
|
||||
panel.add(buildSelectionCheckbox());
|
||||
return panel;
|
||||
}
|
||||
|
||||
private Component buildSelectionCheckbox() {
|
||||
selectionCheckBox = new JCheckBox("");
|
||||
selectionCheckBox = new GCheckBox("");
|
||||
updateSelectionCheckbox();
|
||||
return selectionCheckBox;
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* ###
|
||||
* 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.
|
||||
@ -16,10 +15,6 @@
|
||||
*/
|
||||
package ghidra.app.plugin.core.fallthrough;
|
||||
|
||||
import ghidra.app.util.AddressInput;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.util.HelpLocation;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
@ -30,9 +25,14 @@ import javax.swing.border.TitledBorder;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import resources.ResourceManager;
|
||||
import docking.DialogComponentProvider;
|
||||
import docking.ToolTipManager;
|
||||
import docking.widgets.button.GRadioButton;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import ghidra.app.util.AddressInput;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.util.HelpLocation;
|
||||
import resources.ResourceManager;
|
||||
|
||||
/**
|
||||
* Dialog to prompt for overriding a fallthrough address on an
|
||||
@ -48,11 +48,11 @@ class FallThroughDialog extends DialogComponentProvider implements ChangeListene
|
||||
private JButton homeButton;
|
||||
private FallThroughPlugin plugin;
|
||||
private FallThroughModel model;
|
||||
private AddressInput addrField;
|
||||
private AddressInput addrField;
|
||||
private JRadioButton defaultRB;
|
||||
private JRadioButton userRB;
|
||||
private JRadioButton userRB;
|
||||
private boolean changing;
|
||||
|
||||
|
||||
FallThroughDialog(FallThroughPlugin plugin, FallThroughModel model) {
|
||||
super("Set Fallthrough Address", true);
|
||||
setHelpLocation(new HelpLocation(plugin.getName(), "Set Fallthrough"));
|
||||
@ -65,11 +65,12 @@ class FallThroughDialog extends DialogComponentProvider implements ChangeListene
|
||||
updateState();
|
||||
model.setChangeListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.util.bean.GhidraDialog#applyCallback()
|
||||
*/
|
||||
@Override
|
||||
protected void applyCallback() {
|
||||
protected void applyCallback() {
|
||||
model.execute();
|
||||
}
|
||||
|
||||
@ -77,14 +78,15 @@ class FallThroughDialog extends DialogComponentProvider implements ChangeListene
|
||||
* @see ghidra.util.bean.GhidraDialog#cancelCallback()
|
||||
*/
|
||||
@Override
|
||||
protected void cancelCallback() {
|
||||
protected void cancelCallback() {
|
||||
close();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.util.bean.GhidraDialog#okCallback()
|
||||
*/
|
||||
@Override
|
||||
protected void okCallback() {
|
||||
protected void okCallback() {
|
||||
if (model.execute()) {
|
||||
cancelCallback();
|
||||
}
|
||||
@ -99,18 +101,18 @@ class FallThroughDialog extends DialogComponentProvider implements ChangeListene
|
||||
cancelCallback();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
changing = true;
|
||||
addressLabel.setText(addr.toString());
|
||||
instLabel.setText(model.getInstructionRepresentation());
|
||||
|
||||
|
||||
if (model.isDefaultFallthrough()) {
|
||||
defaultRB.setSelected(true);
|
||||
}
|
||||
else if (model.isUserDefinedFallthrough()) {
|
||||
userRB.setSelected(true);
|
||||
}
|
||||
|
||||
|
||||
Address ftAddr = model.getCurrentFallthrough();
|
||||
if (ftAddr != null) {
|
||||
if (!ftAddr.equals(addrField.getAddress())) {
|
||||
@ -122,7 +124,7 @@ class FallThroughDialog extends DialogComponentProvider implements ChangeListene
|
||||
}
|
||||
boolean enabled = model.allowAddressEdits();
|
||||
addrField.setEnabled(enabled);
|
||||
|
||||
|
||||
changing = false;
|
||||
if (model.isValidInput()) {
|
||||
setOkEnabled(true);
|
||||
@ -133,12 +135,14 @@ class FallThroughDialog extends DialogComponentProvider implements ChangeListene
|
||||
setStatusText(msg);
|
||||
}
|
||||
}
|
||||
|
||||
private void addressChanged() {
|
||||
if (changing) {
|
||||
return;
|
||||
}
|
||||
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Address addr = addrField.getAddress();
|
||||
if (addr != null || addrField.getValue().length() == 0) {
|
||||
@ -153,20 +157,22 @@ class FallThroughDialog extends DialogComponentProvider implements ChangeListene
|
||||
};
|
||||
SwingUtilities.invokeLater(r);
|
||||
}
|
||||
|
||||
|
||||
private JPanel create() {
|
||||
JPanel panel = new JPanel(new BorderLayout(0, 10));
|
||||
panel.setBorder(BorderFactory.createEmptyBorder(5,0,0,0));
|
||||
panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
|
||||
addrField = new AddressInput();
|
||||
addrField.setAddressFactory(model.getProgram().getAddressFactory());
|
||||
addrField.addChangeListener(new ChangeListener() {
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
addressChanged();
|
||||
}
|
||||
});
|
||||
addrField.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
model.setCurrentFallthrough(addrField.getAddress());
|
||||
model.setCurrentFallthrough(addrField.getAddress());
|
||||
}
|
||||
});
|
||||
panel.add(createHomePanel(), BorderLayout.NORTH);
|
||||
@ -180,92 +186,98 @@ class FallThroughDialog extends DialogComponentProvider implements ChangeListene
|
||||
|
||||
panel.add(addrField, BorderLayout.NORTH);
|
||||
panel.add(createRadioButtonPanel(), BorderLayout.CENTER);
|
||||
return panel;
|
||||
}
|
||||
return panel;
|
||||
}
|
||||
|
||||
private JPanel createHomePanel() {
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
panel.setBorder(new TitledBorder("Home"));
|
||||
|
||||
addressLabel = new JLabel("01001000");
|
||||
|
||||
Font font = addressLabel.getFont();
|
||||
Font monoFont = new Font("monospaced", font.getStyle(),
|
||||
font.getSize());
|
||||
addressLabel.setFont(monoFont);
|
||||
|
||||
instLabel = new JLabel("jmp DAT_01001000");
|
||||
instLabel.setFont(monoFont);
|
||||
|
||||
homeButton = createButton("images/go-home.png", "Home");
|
||||
|
||||
addressLabel = new GDLabel("01001000");
|
||||
|
||||
Font font = addressLabel.getFont();
|
||||
Font monoFont = new Font("monospaced", font.getStyle(), font.getSize());
|
||||
addressLabel.setFont(monoFont);
|
||||
|
||||
instLabel = new GDLabel("jmp DAT_01001000");
|
||||
instLabel.setFont(monoFont);
|
||||
|
||||
homeButton = createButton("images/go-home.png", "Home");
|
||||
homeButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
plugin.goTo(model.getAddress());
|
||||
}
|
||||
});
|
||||
|
||||
JPanel innerPanel = new JPanel();
|
||||
BoxLayout bl = new BoxLayout(innerPanel,BoxLayout.X_AXIS);
|
||||
innerPanel.setLayout(bl);
|
||||
|
||||
innerPanel.add(Box.createHorizontalStrut(5));
|
||||
innerPanel.add(homeButton);
|
||||
innerPanel.add(Box.createHorizontalStrut(10));
|
||||
innerPanel.add(addressLabel);
|
||||
innerPanel.add(Box.createHorizontalStrut(20));
|
||||
innerPanel.add(instLabel);
|
||||
innerPanel.add(Box.createHorizontalStrut(10));
|
||||
panel.add(innerPanel, BorderLayout.CENTER);
|
||||
return panel;
|
||||
|
||||
JPanel innerPanel = new JPanel();
|
||||
BoxLayout bl = new BoxLayout(innerPanel, BoxLayout.X_AXIS);
|
||||
innerPanel.setLayout(bl);
|
||||
|
||||
innerPanel.add(Box.createHorizontalStrut(5));
|
||||
innerPanel.add(homeButton);
|
||||
innerPanel.add(Box.createHorizontalStrut(10));
|
||||
innerPanel.add(addressLabel);
|
||||
innerPanel.add(Box.createHorizontalStrut(20));
|
||||
innerPanel.add(instLabel);
|
||||
innerPanel.add(Box.createHorizontalStrut(10));
|
||||
panel.add(innerPanel, BorderLayout.CENTER);
|
||||
return panel;
|
||||
}
|
||||
|
||||
private JPanel createRadioButtonPanel() {
|
||||
|
||||
|
||||
JPanel panel = new JPanel();
|
||||
BoxLayout bl = new BoxLayout(panel, BoxLayout.X_AXIS);
|
||||
panel.setLayout(bl);
|
||||
|
||||
|
||||
ButtonGroup group = new ButtonGroup();
|
||||
defaultRB = new JRadioButton("Default", true);
|
||||
defaultRB = new GRadioButton("Default", true);
|
||||
defaultRB.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent ev) {
|
||||
model.defaultSelected();
|
||||
}
|
||||
});
|
||||
ToolTipManager.setToolTipText(defaultRB, "Use default fallthrough address");
|
||||
|
||||
userRB = new JRadioButton("User", false);
|
||||
|
||||
userRB = new GRadioButton("User", false);
|
||||
userRB.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent ev) {
|
||||
model.userSelected();
|
||||
}
|
||||
});
|
||||
ToolTipManager.setToolTipText(userRB, "Override default fallthrough address");
|
||||
|
||||
|
||||
group.add(defaultRB);
|
||||
group.add(userRB);
|
||||
|
||||
|
||||
panel.add(defaultRB);
|
||||
panel.add(userRB);
|
||||
|
||||
|
||||
JPanel outerPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
|
||||
outerPanel.add(panel);
|
||||
return outerPanel;
|
||||
}
|
||||
private JButton createButton(String filename, String altText) {
|
||||
JButton button = new JButton();
|
||||
URL imageURL = ResourceManager.getResource(filename);
|
||||
if (imageURL != null) {
|
||||
ImageIcon icon = new ImageIcon(imageURL);
|
||||
button = new JButton(icon);
|
||||
Insets noInsets = new Insets(0,0,0,0);
|
||||
button.setMargin(noInsets);
|
||||
}
|
||||
else {
|
||||
button = new JButton(altText);
|
||||
}
|
||||
}
|
||||
|
||||
private JButton createButton(String filename, String altText) {
|
||||
JButton button = new JButton();
|
||||
URL imageURL = ResourceManager.getResource(filename);
|
||||
if (imageURL != null) {
|
||||
ImageIcon icon = new ImageIcon(imageURL);
|
||||
button = new JButton(icon);
|
||||
Insets noInsets = new Insets(0, 0, 0, 0);
|
||||
button.setMargin(noInsets);
|
||||
}
|
||||
else {
|
||||
button = new JButton(altText);
|
||||
}
|
||||
ToolTipManager.setToolTipText(button, "Go back to home address");
|
||||
return button;
|
||||
}
|
||||
return button;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
updateState();
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* ###
|
||||
* 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.
|
||||
@ -16,16 +15,17 @@
|
||||
*/
|
||||
package ghidra.app.plugin.core.flowarrow;
|
||||
|
||||
import ghidra.program.model.address.*;
|
||||
import ghidra.program.model.symbol.RefType;
|
||||
import ghidra.util.exception.AssertException;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.geom.PathIterator;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import ghidra.program.model.address.*;
|
||||
import ghidra.program.model.symbol.RefType;
|
||||
import ghidra.util.HTMLUtilities;
|
||||
import ghidra.util.exception.AssertException;
|
||||
|
||||
abstract class FlowArrow {
|
||||
|
||||
private static final int MIN_LINE_SPACING = 9;
|
||||
@ -50,7 +50,7 @@ abstract class FlowArrow {
|
||||
protected Shape arrowHead;
|
||||
|
||||
/** The shape of the arrow body, but with added size */
|
||||
private List<Shape> clickableShapes = new ArrayList<Shape>();
|
||||
private List<Shape> clickableShapes = new ArrayList<>();
|
||||
|
||||
FlowArrow(FlowArrowPlugin plugin, Component canvas, Address start, Address end,
|
||||
RefType referenceType) {
|
||||
@ -153,7 +153,7 @@ abstract class FlowArrow {
|
||||
}
|
||||
|
||||
private void createClickableShapes() {
|
||||
List<Shape> shapes = new ArrayList<Shape>();
|
||||
List<Shape> shapes = new ArrayList<>();
|
||||
Rectangle r = null;
|
||||
PathIterator it = arrowBody.getPathIterator(null);
|
||||
float[] coords = new float[6];
|
||||
@ -242,13 +242,11 @@ abstract class FlowArrow {
|
||||
int displayWidth = canvas.getWidth();// - FlowArrowPlugin.LEFT_OFFSET;
|
||||
int lineWidth = calculateLineWidth(displayWidth);
|
||||
|
||||
arrowBody =
|
||||
FlowArrowShapeFactory.createArrowBody(plugin, this, displayWidth, displayHeight,
|
||||
lineWidth);
|
||||
arrowBody = FlowArrowShapeFactory.createArrowBody(plugin, this, displayWidth, displayHeight,
|
||||
lineWidth);
|
||||
|
||||
arrowHead =
|
||||
FlowArrowShapeFactory.createArrowHead(plugin, this, displayWidth, displayHeight,
|
||||
lineWidth);
|
||||
arrowHead = FlowArrowShapeFactory.createArrowHead(plugin, this, displayWidth, displayHeight,
|
||||
lineWidth);
|
||||
}
|
||||
|
||||
private int calculateLineWidth(int displayWidth) {
|
||||
@ -323,7 +321,8 @@ abstract class FlowArrow {
|
||||
}
|
||||
|
||||
public String getDisplayString() {
|
||||
return "<html><table><tr><td>start</td><td>" + start + "</td><tr><td>end</td><td>" + end +
|
||||
return "<html><table><tr><td>start</td><td>" + HTMLUtilities.escapeHTML(start.toString()) +
|
||||
"</td><tr><td>end</td><td>" + HTMLUtilities.escapeHTML(end.toString()) +
|
||||
"</td><tr><td>ref type</td><td>" + refType + "</td></tr></table>";
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,10 @@ import java.util.List;
|
||||
import javax.swing.*;
|
||||
|
||||
import docking.DialogComponentProvider;
|
||||
import docking.widgets.checkbox.GCheckBox;
|
||||
import docking.widgets.combobox.GhidraComboBox;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import docking.widgets.label.GLabel;
|
||||
import ghidra.app.cmd.function.ApplyFunctionSignatureCmd;
|
||||
import ghidra.app.services.DataTypeManagerService;
|
||||
import ghidra.app.util.cparser.C.ParseException;
|
||||
@ -127,7 +130,7 @@ public class EditFunctionSignatureDialog extends DialogComponentProvider {
|
||||
String signature = function.getPrototypeString(false, false);
|
||||
signatureField = new JTextField(signature.length()); // add some extra room to edit
|
||||
signatureField.setText(signature);
|
||||
signatureLabel = new JLabel("Signature:");
|
||||
signatureLabel = new GDLabel("Signature:");
|
||||
signaturePanel.add(signatureLabel);
|
||||
signaturePanel.add(signatureField);
|
||||
|
||||
@ -164,12 +167,12 @@ public class EditFunctionSignatureDialog extends DialogComponentProvider {
|
||||
function.getProgram().getFunctionManager().getCallingConventionNames();
|
||||
String[] choices = callingConventions.toArray(new String[callingConventions.size()]);
|
||||
setCallingConventionChoices(choices);
|
||||
parentPanel.add(new JLabel("Calling Convention:"));
|
||||
parentPanel.add(new GLabel("Calling Convention:"));
|
||||
parentPanel.add(callingConventionComboBox);
|
||||
}
|
||||
|
||||
protected void installInlineWidget(JPanel parentPanel) {
|
||||
inlineCheckBox = new JCheckBox("Inline");
|
||||
inlineCheckBox = new GCheckBox("Inline");
|
||||
inlineCheckBox.addChangeListener(e -> {
|
||||
if (inlineCheckBox.isSelected() && callFixupComboBox != null) {
|
||||
callFixupComboBox.setSelectedItem(NONE_CHOICE);
|
||||
@ -179,7 +182,7 @@ public class EditFunctionSignatureDialog extends DialogComponentProvider {
|
||||
}
|
||||
|
||||
protected void installNoReturnWidget(JPanel parentPanel) {
|
||||
noReturnCheckBox = new JCheckBox("No Return");
|
||||
noReturnCheckBox = new GCheckBox("No Return");
|
||||
parentPanel.add(noReturnCheckBox);
|
||||
}
|
||||
|
||||
@ -214,7 +217,7 @@ public class EditFunctionSignatureDialog extends DialogComponentProvider {
|
||||
callFixupComboBox.setSelectedItem(callFixupName);
|
||||
}
|
||||
|
||||
callFixupPanel.add(new JLabel("Call-Fixup:"));
|
||||
callFixupPanel.add(new GLabel("Call-Fixup:"));
|
||||
callFixupPanel.add(callFixupComboBox);
|
||||
|
||||
callFixupPanel.add(Box.createGlue());
|
||||
|
@ -388,23 +388,7 @@ public class FunctionPlugin extends Plugin implements DataService {
|
||||
Address loc = location.getAddress();
|
||||
return program.getFunctionManager().getFunctionsOverlapping(new AddressSet(loc, loc));
|
||||
}
|
||||
//return an empty iterator....
|
||||
return new Iterator<Function>() {
|
||||
@Override
|
||||
public void remove() {
|
||||
// not supported
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Function next() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
return Collections.emptyIterator();
|
||||
}
|
||||
|
||||
Function getFunction(ListingActionContext context) {
|
||||
@ -580,8 +564,8 @@ public class FunctionPlugin extends Plugin implements DataService {
|
||||
catch (VariableSizeException e) {
|
||||
tool.setStatusInfo(e.getMessage());
|
||||
if (e.canForce() && promptForConflictRemoval) {
|
||||
String msg = variable.getName() + " size change resulted in \n" + e.getMessage() +
|
||||
"\n \nDelete conflicting " + varType + "(s)";
|
||||
String msg = varType + " " + variable.getName() + " size change resulted in \n" +
|
||||
e.getMessage() + "\n \nDelete conflicting " + varType + "(s)";
|
||||
if (OptionDialog.YES_OPTION == OptionDialog.showYesNoDialog(tool.getActiveWindow(),
|
||||
varType + " Conflict", msg)) {
|
||||
tool.setStatusInfo("");
|
||||
|
@ -21,6 +21,7 @@ import java.util.List;
|
||||
import javax.swing.*;
|
||||
|
||||
import docking.DialogComponentProvider;
|
||||
import docking.widgets.label.GLabel;
|
||||
import ghidra.app.util.*;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.program.model.address.Address;
|
||||
@ -357,7 +358,7 @@ public class ThunkReferenceAddressDialog extends DialogComponentProvider {
|
||||
|
||||
JPanel mainPanel = new JPanel(new PairLayout(5, 5));
|
||||
refFunctionField = new JTextField(20);
|
||||
mainPanel.add(new JLabel("Destination Function/Address:"));
|
||||
mainPanel.add(new GLabel("Destination Function/Address:"));
|
||||
mainPanel.add(refFunctionField);
|
||||
|
||||
mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10));
|
||||
|
@ -30,6 +30,9 @@ import javax.swing.table.TableCellEditor;
|
||||
import docking.DialogComponentProvider;
|
||||
import docking.DockingUtils;
|
||||
import docking.widgets.OptionDialog;
|
||||
import docking.widgets.checkbox.GCheckBox;
|
||||
import docking.widgets.combobox.GComboBox;
|
||||
import docking.widgets.label.GLabel;
|
||||
import docking.widgets.table.*;
|
||||
import generic.util.WindowUtilities;
|
||||
import ghidra.app.services.DataTypeManagerService;
|
||||
@ -290,9 +293,9 @@ public class FunctionEditorDialog extends DialogComponentProvider implements Mod
|
||||
panel.setBorder(BorderFactory.createEmptyBorder(0, 5, 15, 15));
|
||||
|
||||
JPanel leftPanel = new JPanel(new PairLayout(4, 8));
|
||||
leftPanel.add(new JLabel("Function Name:"));
|
||||
leftPanel.add(new GLabel("Function Name:"));
|
||||
leftPanel.add(createNameField());
|
||||
leftPanel.add(new JLabel("Calling Convention"));
|
||||
leftPanel.add(new GLabel("Calling Convention"));
|
||||
leftPanel.add(createCallingConventionCombo());
|
||||
leftPanel.setBorder(BorderFactory.createEmptyBorder(14, 0, 0, 10));
|
||||
|
||||
@ -303,18 +306,18 @@ public class FunctionEditorDialog extends DialogComponentProvider implements Mod
|
||||
|
||||
private Component buildTogglePanel() {
|
||||
JPanel panel = new JPanel(new PairLayout());
|
||||
varArgsCheckBox = new JCheckBox("Varargs");
|
||||
varArgsCheckBox = new GCheckBox("Varargs");
|
||||
varArgsCheckBox.addItemListener(e -> model.setHasVarArgs(varArgsCheckBox.isSelected()));
|
||||
panel.add(varArgsCheckBox);
|
||||
|
||||
inLineCheckBox = new JCheckBox("In Line");
|
||||
inLineCheckBox = new GCheckBox("In Line");
|
||||
panel.add(inLineCheckBox);
|
||||
inLineCheckBox.addItemListener(e -> model.setIsInLine(inLineCheckBox.isSelected()));
|
||||
inLineCheckBox.setEnabled(model.isInlineAllowed());
|
||||
|
||||
noReturnCheckBox = new JCheckBox("No Return");
|
||||
noReturnCheckBox = new GCheckBox("No Return");
|
||||
noReturnCheckBox.addItemListener(e -> model.setNoReturn(noReturnCheckBox.isSelected()));
|
||||
storageCheckBox = new JCheckBox("Use Custom Storage");
|
||||
storageCheckBox = new GCheckBox("Use Custom Storage");
|
||||
storageCheckBox.addItemListener(
|
||||
e -> model.setUseCustomizeStorage(storageCheckBox.isSelected()));
|
||||
panel.add(noReturnCheckBox);
|
||||
@ -327,7 +330,7 @@ public class FunctionEditorDialog extends DialogComponentProvider implements Mod
|
||||
private JComponent createCallingConventionCombo() {
|
||||
List<String> callingConventionNames = model.getCallingConventionNames();
|
||||
String[] names = new String[callingConventionNames.size()];
|
||||
callingConventionComboBox = new JComboBox<>(callingConventionNames.toArray(names));
|
||||
callingConventionComboBox = new GComboBox<>(callingConventionNames.toArray(names));
|
||||
callingConventionComboBox.setSelectedItem(model.getCallingConventionName());
|
||||
callingConventionComboBox.addItemListener(e -> model.setCallingConventionName(
|
||||
(String) callingConventionComboBox.getSelectedItem()));
|
||||
@ -335,7 +338,7 @@ public class FunctionEditorDialog extends DialogComponentProvider implements Mod
|
||||
}
|
||||
|
||||
private JComponent createCallFixupComboPanel() {
|
||||
callFixupComboBox = new JComboBox<>();
|
||||
callFixupComboBox = new GComboBox<>();
|
||||
String[] callFixupNames = model.getCallFixupNames();
|
||||
|
||||
callFixupComboBox.addItem(FunctionEditorModel.NONE_CHOICE);
|
||||
@ -601,7 +604,8 @@ public class FunctionEditorDialog extends DialogComponentProvider implements Mod
|
||||
color = Color.red;
|
||||
}
|
||||
String toolTipText = ToolTipUtils.getToolTipText(dataType);
|
||||
String headerText = "<HTML><b>" + dataType.getPathName() + "</b><BR>";
|
||||
String headerText = "<HTML><b>" +
|
||||
HTMLUtilities.friendlyEncodeHTML(dataType.getPathName()) + "</b><BR>";
|
||||
toolTipText = toolTipText.replace("<HTML>", headerText);
|
||||
setToolTipText(toolTipText);
|
||||
}
|
||||
|
@ -20,7 +20,6 @@ import java.awt.event.*;
|
||||
import java.util.EventObject;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.BevelBorder;
|
||||
import javax.swing.event.CellEditorListener;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.table.TableCellEditor;
|
||||
@ -35,7 +34,6 @@ import ghidra.util.data.DataTypeParser;
|
||||
|
||||
class ParameterDataTypeCellEditor extends AbstractCellEditor implements TableCellEditor {
|
||||
private DataTypeSelectionEditor editor;
|
||||
private JLabel label = new JLabel();
|
||||
private DropDownSelectionTextField<DataType> textField;
|
||||
private JButton dataTypeChooserButton;
|
||||
private DataType dt;
|
||||
@ -44,8 +42,7 @@ class ParameterDataTypeCellEditor extends AbstractCellEditor implements TableCel
|
||||
private DataTypeManagerService service;
|
||||
private DialogComponentProvider dialog;
|
||||
|
||||
ParameterDataTypeCellEditor(DialogComponentProvider dialog,
|
||||
DataTypeManagerService service) {
|
||||
ParameterDataTypeCellEditor(DialogComponentProvider dialog, DataTypeManagerService service) {
|
||||
this.dialog = dialog;
|
||||
this.service = service;
|
||||
|
||||
@ -54,11 +51,6 @@ class ParameterDataTypeCellEditor extends AbstractCellEditor implements TableCel
|
||||
@Override
|
||||
public Component getTableCellEditorComponent(JTable table1, Object value, boolean isSelected,
|
||||
int row, int column) {
|
||||
if (label == null) {
|
||||
label = new JLabel();
|
||||
label.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
|
||||
}
|
||||
|
||||
init();
|
||||
|
||||
dt = (DataType) value;
|
||||
|
@ -26,6 +26,8 @@ import javax.swing.table.TableCellEditor;
|
||||
|
||||
import docking.DialogComponentProvider;
|
||||
import docking.widgets.DropDownSelectionTextField;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import docking.widgets.label.GLabel;
|
||||
import docking.widgets.table.GTable;
|
||||
import ghidra.app.services.DataTypeManagerService;
|
||||
import ghidra.program.model.address.Address;
|
||||
@ -37,8 +39,8 @@ import ghidra.util.Msg;
|
||||
import ghidra.util.layout.PairLayout;
|
||||
import ghidra.util.layout.VerticalLayout;
|
||||
|
||||
public class StorageAddressEditorDialog extends DialogComponentProvider implements
|
||||
ModelChangeListener {
|
||||
public class StorageAddressEditorDialog extends DialogComponentProvider
|
||||
implements ModelChangeListener {
|
||||
private FunctionVariableData variableData;
|
||||
private StorageAddressModel model;
|
||||
private VarnodeTableModel varnodeTableModel;
|
||||
@ -160,10 +162,9 @@ public class StorageAddressEditorDialog extends DialogComponentProvider implemen
|
||||
JPanel panel = new JPanel(new PairLayout(10, 4));
|
||||
panel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
|
||||
|
||||
panel.add(new JLabel("Datatype: "));
|
||||
panel.add(new GLabel("Datatype: "));
|
||||
|
||||
dataTypeEditor =
|
||||
new ParameterDataTypeCellEditor(this, service);
|
||||
dataTypeEditor = new ParameterDataTypeCellEditor(this, service);
|
||||
|
||||
dataTypeEditor.addCellEditorListener(new CellEditorListener() {
|
||||
|
||||
@ -211,11 +212,11 @@ public class StorageAddressEditorDialog extends DialogComponentProvider implemen
|
||||
});
|
||||
|
||||
panel.add(dataTypeEditComponent);
|
||||
panel.add(new JLabel("Datatype Size: "));
|
||||
sizeLabel = new JLabel("" + size);
|
||||
panel.add(new GLabel("Datatype Size: "));
|
||||
sizeLabel = new GDLabel("" + size);
|
||||
panel.add(sizeLabel);
|
||||
panel.add(new JLabel("Allocated Size:"));
|
||||
currentSizeLabel = new JLabel("");
|
||||
panel.add(new GLabel("Allocated Size:"));
|
||||
currentSizeLabel = new GDLabel("");
|
||||
panel.add(currentSizeLabel);
|
||||
|
||||
setFocusComponent(textField);
|
||||
|
@ -21,7 +21,9 @@ import java.awt.event.MouseEvent;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import docking.widgets.list.GListCellRenderer;
|
||||
import ghidra.program.model.listing.FunctionTag;
|
||||
import ghidra.util.HTMLUtilities;
|
||||
|
||||
/**
|
||||
* Simple list for displaying {@link FunctionTag} items. The only part of the tag
|
||||
@ -48,7 +50,7 @@ public class FunctionTagList extends JList<FunctionTag> {
|
||||
return "<no comment set>";
|
||||
}
|
||||
|
||||
return tag.getComment();
|
||||
return "<html>" + HTMLUtilities.escapeHTML(tag.getComment());
|
||||
}
|
||||
|
||||
return "";
|
||||
@ -62,25 +64,29 @@ public class FunctionTagList extends JList<FunctionTag> {
|
||||
*/
|
||||
@Override
|
||||
public ListCellRenderer<? super FunctionTag> getCellRenderer() {
|
||||
return new DefaultListCellRenderer() {
|
||||
return new GListCellRenderer<>() {
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList<?> list, Object value, int index,
|
||||
boolean isSelected, boolean cellHasFocus) {
|
||||
FunctionTag tag = (FunctionTag) value;
|
||||
Component listCellRendererComponent = super.getListCellRendererComponent(list,
|
||||
tag.getName(), index, isSelected, cellHasFocus);
|
||||
protected String getItemText(FunctionTag value) {
|
||||
return value.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList<? extends FunctionTag> list,
|
||||
FunctionTag value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
|
||||
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
|
||||
// If this tag is a temporary one (ie: read-in from a file), then it is
|
||||
// read-only and should be indicated to the user as a different color.
|
||||
if (value instanceof FunctionTagTemp) {
|
||||
if (cellHasFocus) {
|
||||
listCellRendererComponent.setForeground(Color.white);
|
||||
setForeground(Color.white);
|
||||
}
|
||||
else {
|
||||
listCellRendererComponent.setForeground(Color.blue);
|
||||
setForeground(Color.blue);
|
||||
}
|
||||
}
|
||||
return listCellRendererComponent;
|
||||
return this;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import java.util.List;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import docking.widgets.label.GLabel;
|
||||
import docking.widgets.textfield.HintTextField;
|
||||
import ghidra.app.cmd.function.CreateFunctionTagCmd;
|
||||
import ghidra.app.context.ProgramActionContext;
|
||||
@ -376,7 +377,6 @@ public class FunctionTagsComponentProvider extends ComponentProviderAdapter
|
||||
*/
|
||||
private JPanel createFilterPanel() {
|
||||
filterPanel = new JPanel(new BorderLayout());
|
||||
JLabel label = new JLabel(" Filter:");
|
||||
|
||||
filterInputTF = new HintTextField("");
|
||||
filterInputTF.setName("filterInputTF");
|
||||
@ -397,7 +397,7 @@ public class FunctionTagsComponentProvider extends ComponentProviderAdapter
|
||||
}
|
||||
});
|
||||
|
||||
filterPanel.add(label, BorderLayout.WEST);
|
||||
filterPanel.add(new GLabel(" Filter:"), BorderLayout.WEST);
|
||||
filterPanel.add(filterInputTF, BorderLayout.CENTER);
|
||||
|
||||
return filterPanel;
|
||||
@ -411,12 +411,11 @@ public class FunctionTagsComponentProvider extends ComponentProviderAdapter
|
||||
private JPanel createInputPanel() {
|
||||
|
||||
inputPanel = new JPanel(new BorderLayout());
|
||||
JLabel label = new JLabel(" Create new tag(s):");
|
||||
tagInputTF = new HintTextField("tag 1, tag 2, ...");
|
||||
tagInputTF.setName("tagInputTF");
|
||||
tagInputTF.addActionListener(e -> processCreates());
|
||||
|
||||
inputPanel.add(label, BorderLayout.WEST);
|
||||
inputPanel.add(new GLabel(" Create new tag(s):"), BorderLayout.WEST);
|
||||
inputPanel.add(tagInputTF, BorderLayout.CENTER);
|
||||
|
||||
return inputPanel;
|
||||
|
@ -20,11 +20,13 @@ import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.*;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.DefaultListModel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import docking.DockingWindowManager;
|
||||
import docking.widgets.OptionDialog;
|
||||
import docking.widgets.dialogs.InputDialog;
|
||||
import docking.widgets.label.GLabel;
|
||||
import ghidra.app.cmd.function.ChangeFunctionTagCmd;
|
||||
import ghidra.app.cmd.function.DeleteFunctionTagCmd;
|
||||
import ghidra.framework.cmd.Command;
|
||||
@ -64,8 +66,7 @@ public abstract class TagListPanel extends JPanel {
|
||||
* @param tool the plugin tool
|
||||
* @param title the title of the panel
|
||||
*/
|
||||
public TagListPanel(FunctionTagsComponentProvider provider, PluginTool tool,
|
||||
String title) {
|
||||
public TagListPanel(FunctionTagsComponentProvider provider, PluginTool tool, String title) {
|
||||
this.tool = tool;
|
||||
|
||||
setLayout(new BorderLayout());
|
||||
@ -97,18 +98,18 @@ public abstract class TagListPanel extends JPanel {
|
||||
|
||||
// If the tag is a temporary one, it's not editable. Show a message to the user.
|
||||
if (tag instanceof FunctionTagTemp) {
|
||||
Msg.showWarn(list, list, "Tag Not Editable",
|
||||
"Tag " + "\"" + tag.getName() + "\"" +
|
||||
" was loaded from an external source and cannot be edited or deleted");
|
||||
Msg.showWarn(list, list, "Tag Not Editable", "Tag " + "\"" + tag.getName() +
|
||||
"\"" +
|
||||
" was loaded from an external source and cannot be edited or deleted");
|
||||
return;
|
||||
}
|
||||
|
||||
String[] labels = new String[] { "Name:", "Comment:" };
|
||||
String[] init = new String[] { tag.getName(), tag.getComment() };
|
||||
|
||||
|
||||
InputDialog dialog = new InputDialog("Edit Tag", labels, init, true, d -> {
|
||||
String[] results = d.getValues();
|
||||
|
||||
|
||||
if (results == null || results.length != 2) {
|
||||
Msg.error(this, "Error retrieving data from edit dialog"); // shouldn't happen
|
||||
return false;
|
||||
@ -139,10 +140,10 @@ public abstract class TagListPanel extends JPanel {
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
|
||||
dialog.setPreferredSize(400, 150);
|
||||
DockingWindowManager.showDialog(list, dialog);
|
||||
|
||||
|
||||
if (dialog.isCanceled()) {
|
||||
return;
|
||||
}
|
||||
@ -150,9 +151,7 @@ public abstract class TagListPanel extends JPanel {
|
||||
}
|
||||
});
|
||||
|
||||
JLabel label = new JLabel(title);
|
||||
|
||||
add(label, BorderLayout.NORTH);
|
||||
add(new GLabel(title), BorderLayout.NORTH);
|
||||
add(list, BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
@ -245,8 +244,8 @@ public abstract class TagListPanel extends JPanel {
|
||||
// Show a confirmation message - users may not be aware that deleting a tag is more
|
||||
// than just removing it from a function.
|
||||
int option = OptionDialog.showOptionDialog(this, "Function Tag Delete",
|
||||
"Are you sure? \nThis will delete the tag from all functions in the program.",
|
||||
"OK", OptionDialog.WARNING_MESSAGE);
|
||||
"Are you sure? \nThis will delete the tag from all functions in the program.", "OK",
|
||||
OptionDialog.WARNING_MESSAGE);
|
||||
|
||||
switch (option) {
|
||||
case OptionDialog.OPTION_ONE:
|
||||
|
@ -26,6 +26,7 @@ import docking.ComponentProvider;
|
||||
import docking.action.*;
|
||||
import docking.help.Help;
|
||||
import docking.help.HelpService;
|
||||
import docking.widgets.combobox.GComboBox;
|
||||
import docking.widgets.fieldpanel.internal.FieldPanelCoordinator;
|
||||
import ghidra.app.util.viewer.util.CodeComparisonPanel;
|
||||
import ghidra.app.util.viewer.util.CodeComparisonPanelActionContext;
|
||||
@ -160,7 +161,7 @@ public abstract class FunctionChoiceComparisonPanel extends FunctionComparisonPa
|
||||
|
||||
private Component createLeftChoicePanel() {
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
leftComboBox = new JComboBox<>(leftWrappedFunctions);
|
||||
leftComboBox = new GComboBox<>(leftWrappedFunctions);
|
||||
adjustSelectedLeftFunction();
|
||||
leftComboBox.addItemListener(e -> {
|
||||
WrappedFunction wrappedFunction = (WrappedFunction) leftComboBox.getSelectedItem();
|
||||
@ -173,7 +174,7 @@ public abstract class FunctionChoiceComparisonPanel extends FunctionComparisonPa
|
||||
|
||||
private Component createRightChoicePanel() {
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
rightComboBox = new JComboBox<>(rightWrappedFunctions);
|
||||
rightComboBox = new GComboBox<>(rightWrappedFunctions);
|
||||
adjustSelectedRightFunction();
|
||||
rightComboBox.addItemListener(e -> {
|
||||
WrappedFunction wrappedFunction = (WrappedFunction) rightComboBox.getSelectedItem();
|
||||
|
@ -21,6 +21,8 @@ import java.awt.FlowLayout;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import docking.widgets.label.GDLabel;
|
||||
|
||||
/**
|
||||
* Simple panel containing a JLabel for displaying error messages.
|
||||
*
|
||||
@ -35,14 +37,14 @@ public class MessagePanel extends JPanel {
|
||||
*/
|
||||
public MessagePanel() {
|
||||
setLayout(new FlowLayout(FlowLayout.CENTER));
|
||||
msgLabel = new JLabel(NO_STATUS);
|
||||
msgLabel = new GDLabel(NO_STATUS);
|
||||
add(msgLabel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the text to be displayed.
|
||||
*
|
||||
* @param text the new text
|
||||
* @param text the new non-html text
|
||||
* @param foregroundColor the text color
|
||||
*/
|
||||
public void setMessageText(String text, Color foregroundColor) {
|
||||
|
@ -20,6 +20,8 @@ import java.awt.event.ActionEvent;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import docking.widgets.button.GRadioButton;
|
||||
|
||||
/**
|
||||
* Allows the user to define a custom search range for the {@link InstructionSearchDialog}.
|
||||
*
|
||||
@ -126,7 +128,7 @@ public class SearchDirectionWidget extends ControlPanelWidget {
|
||||
* @return
|
||||
*/
|
||||
private JRadioButton createSearchRB(AbstractAction action, String name, String tooltip) {
|
||||
JRadioButton button = new JRadioButton(action);
|
||||
GRadioButton button = new GRadioButton(action);
|
||||
button.setText(name);
|
||||
button.setToolTipText(tooltip);
|
||||
button.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||
|
@ -22,6 +22,7 @@ import java.util.List;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import docking.widgets.button.GRadioButton;
|
||||
import ghidra.app.plugin.core.instructionsearch.util.InstructionSearchUtils;
|
||||
|
||||
/**
|
||||
@ -59,8 +60,8 @@ public class SelectionModeWidget extends ControlPanelWidget {
|
||||
@Override
|
||||
protected JPanel createContent() {
|
||||
JPanel rbPanel = new JPanel();
|
||||
hexRB = new JRadioButton("hex");
|
||||
binaryRB = new JRadioButton("binary");
|
||||
hexRB = new GRadioButton("hex");
|
||||
binaryRB = new GRadioButton("binary");
|
||||
ButtonGroup inputGroup = new ButtonGroup();
|
||||
inputGroup.add(hexRB);
|
||||
inputGroup.add(binaryRB);
|
||||
@ -93,15 +94,17 @@ public class SelectionModeWidget extends ControlPanelWidget {
|
||||
// 1. Get the whitespace map so we can restore it after conversion.
|
||||
// 2. Get the group map so we can group bytes just as in the hex display.
|
||||
// 3. Convert and display.
|
||||
List<String> whitespaces = InstructionSearchUtils.getWhitespace(parent.getInputString().trim());
|
||||
List<String> whitespaces =
|
||||
InstructionSearchUtils.getWhitespace(parent.getInputString().trim());
|
||||
|
||||
List<Integer> groups;
|
||||
try {
|
||||
groups =
|
||||
InstructionSearchUtils.getGroupSizes(parent.getInputString().trim(), InputMode.BINARY);
|
||||
groups = InstructionSearchUtils.getGroupSizes(parent.getInputString().trim(),
|
||||
InputMode.BINARY);
|
||||
|
||||
// Now convert whatever is in the input box to binary.
|
||||
String hexStr = InstructionSearchUtils.toHex(parent.getInputString().trim(), true);
|
||||
String hexStr =
|
||||
InstructionSearchUtils.toHex(parent.getInputString().trim(), true);
|
||||
|
||||
// Restore grouping.
|
||||
hexStr =
|
||||
@ -139,15 +142,17 @@ public class SelectionModeWidget extends ControlPanelWidget {
|
||||
// 1. Get the whitespace map so we can restore it after conversion.
|
||||
// 2. Get the group map so we can group bytes just as in the hex display.
|
||||
// 3. Convert and display.
|
||||
List<String> whitespaces = InstructionSearchUtils.getWhitespace(parent.getInputString().trim());
|
||||
List<String> whitespaces =
|
||||
InstructionSearchUtils.getWhitespace(parent.getInputString().trim());
|
||||
|
||||
List<Integer> groups;
|
||||
try {
|
||||
groups =
|
||||
InstructionSearchUtils.getGroupSizes(parent.getInputString().trim(), InputMode.HEX);
|
||||
groups = InstructionSearchUtils.getGroupSizes(parent.getInputString().trim(),
|
||||
InputMode.HEX);
|
||||
|
||||
// Now convert whatever is in the input box to binary.
|
||||
String binaryStr = InstructionSearchUtils.toBinary(parent.getInputString().trim());
|
||||
String binaryStr =
|
||||
InstructionSearchUtils.toBinary(parent.getInputString().trim());
|
||||
|
||||
// Restore grouping.
|
||||
binaryStr = restoreGroupingAndWhitespace(binaryStr, groups, whitespaces,
|
||||
@ -176,9 +181,9 @@ public class SelectionModeWidget extends ControlPanelWidget {
|
||||
inputMode = InputMode.HEX;
|
||||
}
|
||||
else if (binaryRB.isSelected()) {
|
||||
inputMode = InputMode.BINARY;
|
||||
inputMode = InputMode.BINARY;
|
||||
}
|
||||
|
||||
|
||||
return inputMode;
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@ import java.util.*;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import docking.widgets.button.GRadioButton;
|
||||
import ghidra.app.plugin.core.instructionsearch.InstructionSearchPlugin;
|
||||
import ghidra.program.model.address.AddressRange;
|
||||
import ghidra.program.model.address.AddressRangeIterator;
|
||||
@ -36,7 +37,7 @@ public class SelectionScopeWidget extends ControlPanelWidget {
|
||||
private JRadioButton searchSelectionRB;
|
||||
|
||||
// Stores the current search range settings.
|
||||
private List<AddressRange> searchRanges = new ArrayList<AddressRange>();
|
||||
private List<AddressRange> searchRanges = new ArrayList<>();
|
||||
|
||||
private InstructionSearchDialog dialog;
|
||||
private InstructionSearchPlugin plugin;
|
||||
@ -183,7 +184,7 @@ public class SelectionScopeWidget extends ControlPanelWidget {
|
||||
* @return
|
||||
*/
|
||||
private JRadioButton createSearchRB(AbstractAction action, String name, String tooltip) {
|
||||
JRadioButton button = new JRadioButton(action);
|
||||
GRadioButton button = new GRadioButton(action);
|
||||
button.setName(name);
|
||||
button.setText(name);
|
||||
button.setToolTipText(tooltip);
|
||||
|
@ -24,6 +24,7 @@ import javax.swing.border.Border;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.event.ListDataListener;
|
||||
|
||||
import docking.widgets.list.GListCellRenderer;
|
||||
import generic.util.WindowUtilities;
|
||||
import ghidra.app.plugin.core.console.CodeCompletion;
|
||||
|
||||
@ -407,7 +408,12 @@ class CodeCompletionListSelectionModel extends DefaultListSelectionModel {
|
||||
*
|
||||
*
|
||||
*/
|
||||
class CodeCompletionListCellRenderer extends DefaultListCellRenderer {
|
||||
class CodeCompletionListCellRenderer extends GListCellRenderer<CodeCompletion> {
|
||||
|
||||
@Override
|
||||
protected String getItemText(CodeCompletion value) {
|
||||
return value.getDescription();
|
||||
}
|
||||
|
||||
/**
|
||||
* Render either a default list cell, or use the one provided.
|
||||
@ -416,12 +422,11 @@ class CodeCompletionListCellRenderer extends DefaultListCellRenderer {
|
||||
* Otherwise, we use the DefaultListCellRenderer routine.
|
||||
*/
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object completion, int index,
|
||||
boolean isSelected, boolean cellHasFocus) {
|
||||
CodeCompletion codeCompletion = (CodeCompletion) completion;
|
||||
public Component getListCellRendererComponent(JList<? extends CodeCompletion> list,
|
||||
CodeCompletion codeCompletion, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
if (null == codeCompletion.getComponent()) {
|
||||
return super.getListCellRendererComponent(list, codeCompletion.getDescription(), index,
|
||||
isSelected, cellHasFocus);
|
||||
return super.getListCellRendererComponent(list, codeCompletion, index, isSelected,
|
||||
cellHasFocus);
|
||||
}
|
||||
|
||||
/* ooh, we have a fancy component! */
|
||||
|
@ -19,6 +19,7 @@ import javax.swing.*;
|
||||
|
||||
import docking.DialogComponentProvider;
|
||||
import docking.widgets.combobox.GhidraComboBox;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import ghidra.app.cmd.label.AddLabelCmd;
|
||||
import ghidra.app.cmd.refs.AssociateSymbolCmd;
|
||||
import ghidra.app.context.ListingActionContext;
|
||||
@ -59,7 +60,7 @@ public class OperandLabelDialog extends DialogComponentProvider {
|
||||
JPanel mainPanel = new JPanel(new PairLayout(5, 5));
|
||||
mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
|
||||
label = new JLabel("Label: ");
|
||||
label = new GDLabel("Label: ");
|
||||
|
||||
myChoice = new GhidraComboBox<>();
|
||||
myChoice.setName("MYCHOICE");
|
||||
|
@ -22,7 +22,11 @@ import javax.swing.*;
|
||||
import javax.swing.event.*;
|
||||
|
||||
import docking.DialogComponentProvider;
|
||||
import docking.widgets.button.GRadioButton;
|
||||
import docking.widgets.checkbox.GCheckBox;
|
||||
import docking.widgets.combobox.GhidraComboBox;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import docking.widgets.label.GLabel;
|
||||
import ghidra.app.plugin.core.misc.RegisterField;
|
||||
import ghidra.app.util.*;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
@ -144,31 +148,27 @@ class AddBlockDialog extends DialogComponentProvider implements ChangeListener {
|
||||
lengthField.setChangeListener(e -> lengthChanged());
|
||||
addrField.addChangeListener(ev -> addrChanged());
|
||||
|
||||
JLabel readLabel = new JLabel("Read");
|
||||
readCB = new JCheckBox();
|
||||
readCB = new GCheckBox();
|
||||
readCB.setName("Read");
|
||||
|
||||
JLabel writeLabel = new JLabel("Write");
|
||||
writeCB = new JCheckBox();
|
||||
writeCB = new GCheckBox();
|
||||
writeCB.setName("Write");
|
||||
|
||||
JLabel executeLabel = new JLabel("Execute");
|
||||
executeCB = new JCheckBox();
|
||||
executeCB = new GCheckBox();
|
||||
executeCB.setName("Execute");
|
||||
|
||||
JLabel volatileLabel = new JLabel("Volatile");
|
||||
volatileCB = new JCheckBox();
|
||||
volatileCB = new GCheckBox();
|
||||
volatileCB.setName("Volatile");
|
||||
|
||||
JPanel topPanel = new JPanel(new PairLayout(4, 10, 150));
|
||||
topPanel.setBorder(BorderFactory.createEmptyBorder(5, 7, 4, 5));
|
||||
topPanel.add(new JLabel("Block Name:", SwingConstants.RIGHT));
|
||||
topPanel.add(new GLabel("Block Name:", SwingConstants.RIGHT));
|
||||
topPanel.add(nameField);
|
||||
topPanel.add(new JLabel("Start Addr:", SwingConstants.RIGHT));
|
||||
topPanel.add(new GLabel("Start Addr:", SwingConstants.RIGHT));
|
||||
topPanel.add(addrField);
|
||||
topPanel.add(new JLabel("Length:", SwingConstants.RIGHT));
|
||||
topPanel.add(new GLabel("Length:", SwingConstants.RIGHT));
|
||||
topPanel.add(lengthField);
|
||||
topPanel.add(new JLabel("Comment:", SwingConstants.RIGHT));
|
||||
topPanel.add(new GLabel("Comment:", SwingConstants.RIGHT));
|
||||
topPanel.add(commentField);
|
||||
|
||||
JPanel execPanel = new JPanel();
|
||||
@ -177,19 +177,19 @@ class AddBlockDialog extends DialogComponentProvider implements ChangeListener {
|
||||
|
||||
execPanel.setLayout(bl);
|
||||
execPanel.add(Box.createHorizontalStrut(10));
|
||||
execPanel.add(readLabel);
|
||||
execPanel.add(new GLabel("Read"));
|
||||
execPanel.add(readCB);
|
||||
execPanel.add(Box.createHorizontalStrut(10));
|
||||
|
||||
execPanel.add(writeLabel);
|
||||
execPanel.add(new GLabel("Write"));
|
||||
execPanel.add(writeCB);
|
||||
execPanel.add(Box.createHorizontalStrut(10));
|
||||
|
||||
execPanel.add(executeLabel);
|
||||
execPanel.add(new GLabel("Execute"));
|
||||
execPanel.add(executeCB);
|
||||
execPanel.add(Box.createHorizontalStrut(10));
|
||||
|
||||
execPanel.add(volatileLabel);
|
||||
execPanel.add(new GLabel("Volatile"));
|
||||
execPanel.add(volatileCB);
|
||||
|
||||
JPanel panel = new JPanel();
|
||||
@ -234,7 +234,7 @@ class AddBlockDialog extends DialogComponentProvider implements ChangeListener {
|
||||
nameField.setText("");
|
||||
addrField.setAddress(model.getStartAddress());
|
||||
|
||||
lengthField.setValue(new Long(0));
|
||||
lengthField.setValue(Long.valueOf(0));
|
||||
model.setLength(0);
|
||||
commentField.setText("");
|
||||
|
||||
@ -243,7 +243,7 @@ class AddBlockDialog extends DialogComponentProvider implements ChangeListener {
|
||||
executeCB.setSelected(false);
|
||||
volatileCB.setSelected(false);
|
||||
|
||||
initialValueField.setValue(new Long(0));
|
||||
initialValueField.setValue(Long.valueOf(0));
|
||||
model.setBlockType(MemoryBlockType.DEFAULT);
|
||||
model.setIsInitialized(initializedRB.isSelected());
|
||||
model.setInitialValue(0);
|
||||
@ -380,11 +380,11 @@ class AddBlockDialog extends DialogComponentProvider implements ChangeListener {
|
||||
panel.setLayout(bl);
|
||||
|
||||
ButtonGroup radioGroup = new ButtonGroup();
|
||||
initializedRB = new JRadioButton("Initialized", false);
|
||||
initializedRB = new GRadioButton("Initialized", false);
|
||||
initializedRB.setName(initializedRB.getText());
|
||||
initializedRB.addActionListener(ev -> initializeRBChanged());
|
||||
|
||||
uninitializedRB = new JRadioButton("Uninitialized", true);
|
||||
uninitializedRB = new GRadioButton("Uninitialized", true);
|
||||
uninitializedRB.setName(uninitializedRB.getText());
|
||||
uninitializedRB.addActionListener(ev -> uninitializedRBChanged());
|
||||
|
||||
@ -411,7 +411,7 @@ class AddBlockDialog extends DialogComponentProvider implements ChangeListener {
|
||||
}
|
||||
|
||||
private void createInitializedPanel() {
|
||||
initialValueLabel = new JLabel("Initial Value");
|
||||
initialValueLabel = new GDLabel("Initial Value");
|
||||
initialValueField = new RegisterField(8, null, false);
|
||||
initialValueField.setName("Initial Value");
|
||||
initialValueField.setEnabled(false);
|
||||
@ -427,7 +427,6 @@ class AddBlockDialog extends DialogComponentProvider implements ChangeListener {
|
||||
private JPanel createAddressPanel() {
|
||||
JPanel addressPanel = new JPanel(new PairLayout());
|
||||
|
||||
JLabel addrToAddLabel = new JLabel("Source Addr:");
|
||||
baseAddrField = new AddressInput();
|
||||
baseAddrField.setAddressFactory(addrFactory);
|
||||
baseAddrField.setName("Source Addr");
|
||||
@ -441,7 +440,7 @@ class AddBlockDialog extends DialogComponentProvider implements ChangeListener {
|
||||
}
|
||||
baseAddrField.setAddress(minAddr);
|
||||
model.setBaseAddress(minAddr);
|
||||
addressPanel.add(addrToAddLabel);
|
||||
addressPanel.add(new GLabel("Source Addr:"));
|
||||
addressPanel.add(baseAddrField);
|
||||
addressPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
|
||||
return addressPanel;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user