GT-2698 refactor UI elements to lock down HTML rendering

This commit is contained in:
dev747368 2019-04-11 15:55:56 -04:00
parent a03c96d37b
commit e0c25b0590
360 changed files with 3895 additions and 4563 deletions

View file

@ -26,6 +26,7 @@ import ghidra.feature.vt.gui.plugin.VTController;
import ghidra.feature.vt.gui.plugin.VTPlugin;
import ghidra.feature.vt.gui.provider.matchtable.VTMatchContext;
import ghidra.feature.vt.gui.task.ApplyBlockedMatchTask;
import ghidra.util.HTMLUtilities;
import ghidra.util.HelpLocation;
import resources.Icons;
@ -77,7 +78,7 @@ public class ApplyBlockedMatchAction extends DockingAction {
}
private List<VTAssociation> getConflictingMatches(VTMatch match) {
ArrayList<VTAssociation> list = new ArrayList<VTAssociation>();
ArrayList<VTAssociation> list = new ArrayList<>();
VTAssociation association = match.getAssociation();
Collection<VTAssociation> relatedAssociations = association.getRelatedAssociations();
for (VTAssociation relatedAssociation : relatedAssociations) {
@ -90,7 +91,7 @@ public class ApplyBlockedMatchAction extends DockingAction {
private String getConflictingMatchesDisplayString(VTMatch match,
List<VTAssociation> conflicts) {
StringBuffer buffer = new StringBuffer();
StringBuilder buffer = new StringBuilder();
buffer.append("<html>");
int count = 0;
for (VTAssociation conflictingAssociation : conflicts) {
@ -118,8 +119,10 @@ public class ApplyBlockedMatchAction extends DockingAction {
private String getAssociationDisplayString(VTAssociation association) {
return association.getType().toString() + " match with source of <b>" +
association.getSourceAddress().toString() + "</b> and destination of <b>" +
association.getDestinationAddress().toString() + "</b>";
HTMLUtilities.friendlyEncodeHTML(association.getSourceAddress().toString()) +
"</b> and destination of <b>" +
HTMLUtilities.friendlyEncodeHTML(association.getDestinationAddress().toString()) +
"</b>";
}
@Override

View file

@ -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.feature.vt.gui.editors;
import ghidra.feature.vt.api.main.VTMarkupItem;
import ghidra.feature.vt.api.main.VTMarkupItemDestinationAddressEditStatus;
import ghidra.feature.vt.gui.plugin.VTController;
import ghidra.program.model.address.Address;
import ghidra.util.Msg;
import ghidra.util.exception.InvalidInputException;
import java.awt.Component;
import java.awt.event.MouseEvent;
import java.util.EventObject;
@ -32,6 +24,13 @@ import javax.swing.border.BevelBorder;
import javax.swing.table.TableCellEditor;
import docking.DialogComponentProvider;
import docking.DockingUtils;
import ghidra.feature.vt.api.main.VTMarkupItem;
import ghidra.feature.vt.api.main.VTMarkupItemDestinationAddressEditStatus;
import ghidra.feature.vt.gui.plugin.VTController;
import ghidra.program.model.address.Address;
import ghidra.util.Msg;
import ghidra.util.exception.InvalidInputException;
public class AddressInputDialog extends AbstractCellEditor implements TableCellEditor {
@ -44,6 +43,7 @@ public class AddressInputDialog extends AbstractCellEditor implements TableCellE
this.controller = controller;
}
@Override
public Component getTableCellEditorComponent(JTable theTable, Object value, boolean isSelected,
int row, int column) {
@ -51,7 +51,7 @@ public class AddressInputDialog extends AbstractCellEditor implements TableCellE
EditableAddress editableAddress = (EditableAddress) value;
address = editableAddress.getAddress();
final JLabel label = new JLabel();
JLabel label = DockingUtils.createNonHtmlLabel();
label.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
label.setText(editableAddress.getDisplayString());
@ -61,10 +61,10 @@ public class AddressInputDialog extends AbstractCellEditor implements TableCellE
if (status != VTMarkupItemDestinationAddressEditStatus.EDITABLE) {
final String description = status.getDescription();
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
fireEditingCanceled();
Msg.showInfo(getClass(), table,
"Cannot Edit Destination Address", description);
Msg.showInfo(getClass(), table, "Cannot Edit Destination Address", description);
}
});
return label;
@ -73,6 +73,7 @@ public class AddressInputDialog extends AbstractCellEditor implements TableCellE
dialog = new DialogProvider(editableAddress);
dialog.setRememberSize(false);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
controller.getTool().showDialog(dialog, label);
stopCellEditing();
@ -89,6 +90,7 @@ public class AddressInputDialog extends AbstractCellEditor implements TableCellE
}
}
@Override
public Object getCellEditorValue() {
return ((DialogProvider) dialog).getAddress();
}
@ -140,8 +142,8 @@ public class AddressInputDialog extends AbstractCellEditor implements TableCellE
// Inner Classes
//==================================================================================================
private class DialogProvider extends DialogComponentProvider implements
AddressEditorPanelListener {
private class DialogProvider extends DialogComponentProvider
implements AddressEditorPanelListener {
private EditableAddress editableAddress;
private Address editedAddress;
@ -186,6 +188,7 @@ public class AddressInputDialog extends AbstractCellEditor implements TableCellE
/**
* An address edit action occurred in the panel so handle it as if ok button were pressed.
*/
@Override
public void addressEdited() {
okCallback();
}

View file

@ -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.
@ -17,9 +16,6 @@
package ghidra.feature.vt.gui.editors;
import static ghidra.feature.vt.gui.editors.TagEditorDialog.TagState.Action.ADD;
import ghidra.feature.vt.gui.editors.TagEditorDialog.TagState;
import ghidra.feature.vt.gui.editors.TagEditorDialog.TagStateListModel;
import ghidra.util.exception.AssertException;
import java.awt.*;
import java.awt.event.MouseAdapter;
@ -27,6 +23,10 @@ import java.awt.event.MouseEvent;
import javax.swing.*;
import docking.DockingUtils;
import ghidra.feature.vt.gui.editors.TagEditorDialog.TagState;
import ghidra.feature.vt.gui.editors.TagEditorDialog.TagStateListModel;
import ghidra.util.exception.AssertException;
import resources.ResourceManager;
public class TagEditorRenderer extends DefaultListCellRenderer {
@ -37,15 +37,15 @@ public class TagEditorRenderer extends DefaultListCellRenderer {
private static final Icon EXISTING_TAG_ICON = ResourceManager.loadImage("images/tag_blue.png");
private static final Icon UNDO_ICON = ResourceManager.loadImage("images/undo-apply.png");
private final JList list;
private final JList<TagState> list;
private final TagStateListModel listModel;
private JPanel panel;
private JLabel tagIconLabel = new JLabel();
private JLabel tagIconLabel = DockingUtils.createNonHtmlLabel();
private RemoveStateButton undoButton;
private MouseAdapter mouseForwarder;
TagEditorRenderer(final JList list, TagStateListModel listModel) {
TagEditorRenderer(JList<TagState> list, TagStateListModel listModel) {
this.list = list;
this.listModel = listModel;
@ -156,11 +156,10 @@ public class TagEditorRenderer extends DefaultListCellRenderer {
}
@Override
public Component getListCellRendererComponent(JList jList, Object value, int index,
public Component getListCellRendererComponent(JList<?> jList, Object value, int index,
boolean isSelected, boolean cellHasFocus) {
JLabel renderer =
(JLabel) super.getListCellRendererComponent(jList, value, index, isSelected,
cellHasFocus);
JLabel renderer = (JLabel) super.getListCellRendererComponent(jList, value, index,
isSelected, cellHasFocus);
initializePanel(renderer);

View file

@ -25,6 +25,7 @@ import javax.swing.event.EventListenerList;
import org.apache.commons.lang3.StringUtils;
import docking.DockingUtils;
import docking.widgets.combobox.GhidraComboBox;
import docking.widgets.textfield.HexIntegerFormatter;
import ghidra.feature.vt.api.main.VTAssociation;
@ -110,14 +111,15 @@ public abstract class AbstractAddressRangeFilter<T> extends AncillaryFilter<T>
upperRangeComboBox =
createComboBox(upperAddressRangeTextField, MAX_ADDRESS_VALUE, prototypeDisplay);
JLabel rangeLabel = new JLabel("<=");
JLabel rangeLabel = DockingUtils.createNonHtmlLabel("<=");
rangeLabel.setHorizontalAlignment(SwingConstants.CENTER);
//
// Lower Score Panel
//
lowerRangePanel = new JPanel(new GridLayout(2, 1));
JLabel lowLabel = new JLabel("<html><font size=\"2\" color=\"808080\">low</font>");
JLabel lowLabel =
DockingUtils.createHtmlLabel("<html><font size=\"2\" color=\"808080\">low</font>");
lowLabel.setHorizontalAlignment(SwingConstants.CENTER);
lowLabel.setVerticalAlignment(SwingConstants.BOTTOM);
lowerRangePanel.add(lowLabel);
@ -128,7 +130,7 @@ public abstract class AbstractAddressRangeFilter<T> extends AncillaryFilter<T>
//
JPanel labelPanel = new JPanel(new GridLayout(2, 1));
labelPanel.add(Box.createVerticalStrut(5)); // space filler
JLabel statusLabel = new JLabel("<=");
JLabel statusLabel = DockingUtils.createNonHtmlLabel("<=");
statusLabel.setHorizontalAlignment(SwingConstants.CENTER);
labelPanel.add(statusLabel);
@ -136,7 +138,8 @@ public abstract class AbstractAddressRangeFilter<T> extends AncillaryFilter<T>
// Upper Score Panel
//
upperRangePanel = new JPanel(new GridLayout(2, 1));
JLabel upperLabel = new JLabel("<html><font size=\"2\" color=\"808080\">high</font>");
JLabel upperLabel =
DockingUtils.createHtmlLabel("<html><font size=\"2\" color=\"808080\">high</font>");
upperLabel.setHorizontalAlignment(SwingConstants.CENTER);
upperLabel.setVerticalAlignment(SwingConstants.BOTTOM);
upperRangePanel.add(upperLabel);
@ -239,7 +242,7 @@ public abstract class AbstractAddressRangeFilter<T> extends AncillaryFilter<T>
private JComboBox<String> createComboBox(FilterFormattedTextField field, Long defaultValue,
String prototypeString) {
GhidraComboBox<String> comboBox =
new GhidraComboBox<String>(new LimitedHistoryComboBoxModel()) {
new GhidraComboBox<>(new LimitedHistoryComboBoxModel()) {
// overridden to paint seamlessly with out color changing text field
@Override
protected void paintComponent(Graphics g) {

View file

@ -23,6 +23,7 @@ import java.util.*;
import javax.swing.*;
import docking.DockingUtils;
import ghidra.feature.vt.api.impl.VTChangeManager;
import ghidra.feature.vt.api.impl.VersionTrackingChangeRecord;
import ghidra.feature.vt.api.main.*;
@ -40,8 +41,8 @@ public class TagFilter extends AncillaryFilter<VTMatch> {
private static final String ALL_TAGS_EXCLUDED = "<All Tags Excluded>";
static final String EXCLUDED_TAGS_KEY = "TagFilter.tags";
private static final String DELIMITER = ":";
private Map<String, VTMatchTag> excludedTags = new TreeMap<String, VTMatchTag>(); // ordered by String
private JLabel excludedTagsLabel = new JLabel();
private Map<String, VTMatchTag> excludedTags = new TreeMap<>(); // ordered by String
private JLabel excludedTagsLabel = DockingUtils.createNonHtmlLabel();
private JComponent component;
private final VTController controller;
@ -71,7 +72,7 @@ public class TagFilter extends AncillaryFilter<VTMatch> {
JPanel innerPanel = new JPanel();
innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.X_AXIS));
innerPanel.add(new JLabel("Excluded Tags: "));
innerPanel.add(DockingUtils.createNonHtmlLabel("Excluded Tags: "));
innerPanel.add(excludedTagsLabel);
innerPanel.add(Box.createHorizontalGlue());
innerPanel.add(editButton);
@ -82,14 +83,13 @@ public class TagFilter extends AncillaryFilter<VTMatch> {
private void chooseExcludedTags() {
Map<String, VTMatchTag> allTags = getAllTags();
excludedTags =
tagChooser.getExcludedTags(allTags, new TreeMap<String, VTMatchTag>(excludedTags));
excludedTags = tagChooser.getExcludedTags(allTags, new TreeMap<>(excludedTags));
updateTags(allTags);
}
private void initializeTags() {
// allow all tags by default
excludedTags = new TreeMap<String, VTMatchTag>();
excludedTags = new TreeMap<>();
updateTags();
}
@ -127,7 +127,7 @@ public class TagFilter extends AncillaryFilter<VTMatch> {
if (session == null) {
return Collections.emptyMap();
}
TreeMap<String, VTMatchTag> map = new TreeMap<String, VTMatchTag>();
TreeMap<String, VTMatchTag> map = new TreeMap<>();
Set<VTMatchTag> matchTags = session.getMatchTags();
for (VTMatchTag tag : matchTags) {
@ -151,7 +151,7 @@ public class TagFilter extends AncillaryFilter<VTMatch> {
@Override
public FilterState getFilterState() {
FilterState state = new FilterState(this);
state.put(EXCLUDED_TAGS_KEY, new TreeMap<String, VTMatchTag>(excludedTags));
state.put(EXCLUDED_TAGS_KEY, new TreeMap<>(excludedTags));
return state;
}
@ -193,7 +193,7 @@ public class TagFilter extends AncillaryFilter<VTMatch> {
private Map<String, VTMatchTag> getTagsFromText(String tagText) {
Map<String, VTMatchTag> allTags = getAllTags();
Map<String, VTMatchTag> tagFromStringMap = new TreeMap<String, VTMatchTag>();
Map<String, VTMatchTag> tagFromStringMap = new TreeMap<>();
String[] tags = tagText.split(DELIMITER);
for (String tagString : tags) {
VTMatchTag tag = allTags.get(tagString);

View file

@ -97,6 +97,7 @@ public class TagFilterEditorDialog extends DialogComponentProvider implements Ta
return mainPanel;
}
@Override
public Map<String, VTMatchTag> getExcludedTags(Map<String, VTMatchTag> allTagsMap,
Map<String, VTMatchTag> currentExcludedTagsMap) {
this.allTags = allTagsMap;
@ -108,7 +109,7 @@ public class TagFilterEditorDialog extends DialogComponentProvider implements Ta
tool.showDialog(this);
int size = listModel.getSize();
Map<String, VTMatchTag> newExcludedTags = new TreeMap<String, VTMatchTag>();
Map<String, VTMatchTag> newExcludedTags = new TreeMap<>();
for (int i = 0; i < size; i++) {
TagInfo info = (TagInfo) listModel.get(i);
if (!info.isIncluded()) {
@ -124,7 +125,7 @@ public class TagFilterEditorDialog extends DialogComponentProvider implements Ta
if (session == null) {
return Collections.emptyMap();
}
TreeMap<String, VTMatchTag> map = new TreeMap<String, VTMatchTag>();
TreeMap<String, VTMatchTag> map = new TreeMap<>();
Set<VTMatchTag> matchTags = session.getMatchTags();
for (VTMatchTag tag : matchTags) {
@ -196,11 +197,10 @@ public class TagFilterEditorDialog extends DialogComponentProvider implements Ta
private JCheckBox checkBox = new JCheckBox();
@Override
public Component getListCellRendererComponent(JList list, Object value, int index,
public Component getListCellRendererComponent(JList<?> list, Object value, int index,
boolean isSelected, boolean cellHasFocus) {
JLabel renderer =
(JLabel) super.getListCellRendererComponent(list, value, index, isSelected,
cellHasFocus);
JLabel renderer = (JLabel) super.getListCellRendererComponent(list, value, index,
isSelected, cellHasFocus);
TagInfo info = (TagInfo) value;
checkBox.setSelected(info.isIncluded);

View file

@ -28,9 +28,8 @@ import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.JTableHeader;
import docking.ActionContext;
import docking.*;
import docking.ToolTipManager;
import docking.WindowPosition;
import docking.action.*;
import docking.menu.ActionState;
import docking.menu.MultiStateDockingAction;
@ -143,8 +142,7 @@ public class VTFunctionAssociationProvider extends ComponentProviderAdapter
private void createFilterAction() {
MultiStateDockingAction<FilterSettings> filterAction =
new MultiStateDockingAction<FilterSettings>("Function Association Functions Filter",
VTPlugin.OWNER) {
new MultiStateDockingAction<>("Function Association Functions Filter", VTPlugin.OWNER) {
@Override
public void actionStateChanged(ActionState<FilterSettings> newActionState,
@ -357,7 +355,7 @@ public class VTFunctionAssociationProvider extends ComponentProviderAdapter
dualTablePanel.add(splitPane, BorderLayout.CENTER);
JPanel statusPanel = new JPanel(new BorderLayout());
statusLabel = new JLabel(NO_ERROR_MESSAGE);
statusLabel = DockingUtils.createNonHtmlLabel(NO_ERROR_MESSAGE);
statusLabel.setHorizontalAlignment(SwingConstants.CENTER);
statusLabel.setForeground(Color.RED.darker());
statusLabel.addComponentListener(new ComponentAdapter() {
@ -486,7 +484,7 @@ public class VTFunctionAssociationProvider extends ComponentProviderAdapter
String sourceString =
(sourceProgram != null) ? sourceProgram.getDomainFile().toString() : NO_SESSION;
String sourceTitle = SOURCE_TITLE + " = " + sourceString;
sourceSessionLabel = new JLabel(sourceTitle);
sourceSessionLabel = DockingUtils.createNonHtmlLabel(sourceTitle);
sourceSessionLabel.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0));
sourceFunctionPanel.add(sourceSessionLabel, BorderLayout.NORTH);
sourceFunctionPanel.add(sourceThreadedTablePanel, BorderLayout.CENTER);
@ -544,7 +542,7 @@ public class VTFunctionAssociationProvider extends ComponentProviderAdapter
(destinationProgram != null) ? destinationProgram.getDomainFile().toString()
: NO_SESSION;
String destinationTitle = DESTINATION_TITLE + " = " + destinationString;
destinationSessionLabel = new JLabel(destinationTitle);
destinationSessionLabel = DockingUtils.createNonHtmlLabel(destinationTitle);
destinationSessionLabel.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0));
destinationFunctionPanel.add(destinationSessionLabel, BorderLayout.NORTH);
destinationFunctionPanel.add(destinationThreadedTablePanel, BorderLayout.CENTER);

View file

@ -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,6 +15,11 @@
*/
package ghidra.feature.vt.gui.provider.markuptable;
import java.awt.event.ActionListener;
import javax.swing.JLabel;
import docking.DockingUtils;
import ghidra.app.util.AddressInput;
import ghidra.feature.vt.api.main.VTMarkupItem;
import ghidra.feature.vt.gui.editors.*;
@ -24,10 +28,6 @@ import ghidra.program.model.listing.Program;
import ghidra.util.exception.InvalidInputException;
import ghidra.util.layout.PairLayout;
import java.awt.event.ActionListener;
import javax.swing.JLabel;
public class EditableListingAddress extends DisplayableListingAddress implements EditableAddress {
private final VTMarkupItem markupItem;
@ -68,7 +68,7 @@ public class EditableListingAddress extends DisplayableListingAddress implements
}
}
});
JLabel label = new JLabel("Address: ");
JLabel label = DockingUtils.createNonHtmlLabel("Address: ");
add(label);
add(addressField);
}
@ -77,12 +77,12 @@ public class EditableListingAddress extends DisplayableListingAddress implements
public Address getAddress() throws InvalidInputException {
Address selectedAddress = addressField.getAddress();
if (selectedAddress == null) {
throw new InvalidInputException("\"" + addressField.getValue() +
"\" is not a valid address.");
throw new InvalidInputException(
"\"" + addressField.getValue() + "\" is not a valid address.");
}
if (!program.getMemory().contains(selectedAddress)) {
throw new InvalidInputException("\"" + selectedAddress.toString() +
"\" is not an address in the program.");
throw new InvalidInputException(
"\"" + selectedAddress.toString() + "\" is not an address in the program.");
}
address = selectedAddress;
return address;

View file

@ -24,6 +24,7 @@ import javax.swing.border.Border;
import org.apache.commons.lang3.StringUtils;
import docking.DockingUtils;
import docking.widgets.numberformat.BoundedRangeDecimalFormatterFactory;
import ghidra.feature.vt.gui.filters.*;
import ghidra.framework.options.SaveState;
@ -84,8 +85,8 @@ public abstract class AbstractDoubleRangeFilter<T> extends Filter<T>
Border outsideBorder = BorderFactory.createBevelBorder(BevelBorder.LOWERED);
panel.setBorder(BorderFactory.createCompoundBorder(outsideBorder, paddingBorder));
JLabel filterLabel = new JLabel(filterName + " Filter: ");
JLabel middleLabel = new JLabel("to");
JLabel filterLabel = DockingUtils.createNonHtmlLabel(filterName + " Filter: ");
JLabel middleLabel = DockingUtils.createNonHtmlLabel("to");
panel.add(filterLabel);
panel.add(lowerBoundField);

View file

@ -26,6 +26,7 @@ import java.beans.PropertyChangeListener;
import javax.swing.*;
import javax.swing.border.TitledBorder;
import docking.DockingUtils;
import docking.DockingWindowManager;
import docking.help.HelpService;
import ghidra.GhidraOptions;
@ -276,22 +277,23 @@ public class ApplyMarkupPropertyEditor implements OptionsEditor {
private void createFunctionSignatureDetailLabels() {
returnTypeLabel = new JLabel("Return Type", SwingConstants.RIGHT);
returnTypeLabel = DockingUtils.createNonHtmlLabel("Return Type", SwingConstants.RIGHT);
returnTypeLabel.setToolTipText(FUNCTION_RETURN_TYPE_TOOLTIP);
inlineLabel = new JLabel("Inline", SwingConstants.RIGHT);
inlineLabel = DockingUtils.createNonHtmlLabel("Inline", SwingConstants.RIGHT);
inlineLabel.setToolTipText(INLINE_TOOLTIP);
noReturnLabel = new JLabel("No Return", SwingConstants.RIGHT);
noReturnLabel = DockingUtils.createNonHtmlLabel("No Return", SwingConstants.RIGHT);
noReturnLabel.setToolTipText(NO_RETURN_TOOLTIP);
callingConventionLabel = new JLabel("Calling Convention", SwingConstants.RIGHT);
callingConventionLabel =
DockingUtils.createNonHtmlLabel("Calling Convention", SwingConstants.RIGHT);
callingConventionLabel.setToolTipText(CALLING_CONVENTION_TOOLTIP);
callFixupLabel = new JLabel("Call Fixup", SwingConstants.RIGHT);
callFixupLabel = DockingUtils.createNonHtmlLabel("Call Fixup", SwingConstants.RIGHT);
callFixupLabel.setToolTipText(CALL_FIXUP_TOOLTIP);
varArgsLabel = new JLabel("Var Args", SwingConstants.RIGHT);
varArgsLabel = DockingUtils.createNonHtmlLabel("Var Args", SwingConstants.RIGHT);
varArgsLabel.setToolTipText(VAR_ARGS_TOOLTIP);
}
@ -347,7 +349,7 @@ public class ApplyMarkupPropertyEditor implements OptionsEditor {
panel.add(parameterNamesLabel);
panel.add(parameterNamesComboBox);
panel.add(new JLabel(" "));
panel.add(DockingUtils.createNonHtmlLabel(" "));
panel.add(createPrioritySubPanel());
panel.add(parameterCommentsLabel);
@ -358,13 +360,16 @@ public class ApplyMarkupPropertyEditor implements OptionsEditor {
}
private void createParameterLabels() {
parameterDataTypesLabel = new JLabel("Parameter Data Types", SwingConstants.RIGHT);
parameterDataTypesLabel =
DockingUtils.createNonHtmlLabel("Parameter Data Types", SwingConstants.RIGHT);
parameterDataTypesLabel.setToolTipText(PARAMETER_DATA_TYPES_TOOLTIP);
parameterNamesLabel = new JLabel("Parameter Names", SwingConstants.RIGHT);
parameterNamesLabel =
DockingUtils.createNonHtmlLabel("Parameter Names", SwingConstants.RIGHT);
parameterNamesLabel.setToolTipText(PARAMETER_NAMES_TOOLTIP);
parameterCommentsLabel = new JLabel("Parameter Comments", SwingConstants.RIGHT);
parameterCommentsLabel =
DockingUtils.createNonHtmlLabel("Parameter Comments", SwingConstants.RIGHT);
parameterCommentsLabel.setToolTipText(PARAMETER_COMMENTS_TOOLTIP);
}
@ -415,7 +420,7 @@ public class ApplyMarkupPropertyEditor implements OptionsEditor {
panel.setToolTipText(PARAMETER_NAME_PRIORITY_TOOTIP);
Box buttonBox = new Box(BoxLayout.X_AXIS);
JLabel highestPriorityLabel = new JLabel(" Highest: ");
JLabel highestPriorityLabel = DockingUtils.createNonHtmlLabel(" Highest: ");
highestPriorityLabel.setToolTipText(HIGHEST_NAME_PRIORITY_TOOLTIP);
buttonBox.add(highestPriorityLabel);
buttonBox.add(userHighestPriorityRB);
@ -452,16 +457,18 @@ public class ApplyMarkupPropertyEditor implements OptionsEditor {
}
private void createNonCommentMarkupLabels() {
dataMatchDataTypeLabel = new JLabel("Data Match Data Type", SwingConstants.RIGHT);
dataMatchDataTypeLabel =
DockingUtils.createNonHtmlLabel("Data Match Data Type", SwingConstants.RIGHT);
dataMatchDataTypeLabel.setToolTipText(DATA_MATCH_DATA_TYPE_TOOLTIP);
labelsLabel = new JLabel("Labels", SwingConstants.RIGHT);
labelsLabel = DockingUtils.createNonHtmlLabel("Labels", SwingConstants.RIGHT);
labelsLabel.setToolTipText(LABELS_TOOLTIP);
functionNameLabel = new JLabel("Function Name", SwingConstants.RIGHT);
functionNameLabel = DockingUtils.createNonHtmlLabel("Function Name", SwingConstants.RIGHT);
functionNameLabel.setToolTipText(FUNCTION_NAME_TOOLTIP);
functionSignatureLabel = new JLabel("Function Signature", SwingConstants.RIGHT);
functionSignatureLabel =
DockingUtils.createNonHtmlLabel("Function Signature", SwingConstants.RIGHT);
functionSignatureLabel.setToolTipText(FUNCTION_SIGNATURE_TOOLTIP);
}
@ -519,19 +526,22 @@ public class ApplyMarkupPropertyEditor implements OptionsEditor {
}
private void createCommentLabels() {
plateCommentsLabel = new JLabel("Plate Comments", SwingConstants.RIGHT);
plateCommentsLabel =
DockingUtils.createNonHtmlLabel("Plate Comments", SwingConstants.RIGHT);
plateCommentsLabel.setToolTipText(PLATE_COMMENT_TOOLTIP);
preCommentsLabel = new JLabel("Pre-Comments", SwingConstants.RIGHT);
preCommentsLabel = DockingUtils.createNonHtmlLabel("Pre-Comments", SwingConstants.RIGHT);
preCommentsLabel.setToolTipText(PRE_COMMENT_TOOLTIP);
endOfLineCommentsLabel = new JLabel("End of Line Comments", SwingConstants.RIGHT);
endOfLineCommentsLabel =
DockingUtils.createNonHtmlLabel("End of Line Comments", SwingConstants.RIGHT);
endOfLineCommentsLabel.setToolTipText(END_OF_LINE_COMMENT_TOOLTIP);
repeatableCommentsLabel = new JLabel("Repeatable Comments", SwingConstants.RIGHT);
repeatableCommentsLabel =
DockingUtils.createNonHtmlLabel("Repeatable Comments", SwingConstants.RIGHT);
repeatableCommentsLabel.setToolTipText(REPEATABLE_COMMENT_TOOLTIP);
postCommentsLabel = new JLabel("Post Comments", SwingConstants.RIGHT);
postCommentsLabel = DockingUtils.createNonHtmlLabel("Post Comments", SwingConstants.RIGHT);
postCommentsLabel.setToolTipText(POST_COMMENT_TOOLTIP);
}

View file

@ -26,6 +26,7 @@ import javax.swing.border.Border;
import org.apache.commons.lang3.StringUtils;
import docking.DockingUtils;
import ghidra.feature.vt.api.main.VTMatch;
import ghidra.feature.vt.gui.filters.*;
import ghidra.framework.options.SaveState;
@ -45,7 +46,7 @@ public class LengthFilter extends Filter<VTMatch> {
}
private JComponent createComponent() {
final JLabel label = new JLabel("Length Filter: ");
final JLabel label = DockingUtils.createNonHtmlLabel("Length Filter: ");
Integer defaultValue = DEFAULT_FILTER_VALUE;
textField = new FilterFormattedTextField(new IntegerFormatterFactory(false), defaultValue);

View file

@ -26,6 +26,7 @@ import javax.swing.event.ListSelectionListener;
import javax.swing.table.*;
import docking.ActionContext;
import docking.DockingUtils;
import docking.widgets.table.GTable;
import docking.widgets.table.RowObjectTableModel;
import docking.widgets.table.threaded.ThreadedTableModel;
@ -323,27 +324,27 @@ public abstract class VTMatchOneToManyTableProvider extends ComponentProviderAda
// LABEL,
String labelText = (isSource ? "Source" : "Destination") + " Label: ";
label = new JLabel(labelText);
label = DockingUtils.createNonHtmlLabel(labelText);
// label.setForeground(LOCAL_INFO_FOREGROUND_COLOR);
labelValue = new JLabel(" ");
labelValue = DockingUtils.createNonHtmlLabel(" ");
labelValue.setForeground(LOCAL_INFO_FOREGROUND_COLOR);
labelPanel.add(label);
labelPanel.add(labelValue);
// LABEL_TYPE,
String labelTypeText = "Label Type: ";
labelType = new JLabel(labelTypeText);
labelType = DockingUtils.createNonHtmlLabel(labelTypeText);
// labelType.setForeground(LOCAL_INFO_FOREGROUND_COLOR);
labelTypeValue = new JLabel(" ");
labelTypeValue = DockingUtils.createNonHtmlLabel(" ");
labelTypeValue.setForeground(LOCAL_INFO_FOREGROUND_COLOR);
labelTypePanel.add(labelType);
labelTypePanel.add(labelTypeValue);
// ADDRESS
String addressText = (isSource ? "Source" : "Destination") + " Address: ";
address = new JLabel(addressText);
address = DockingUtils.createNonHtmlLabel(addressText);
// address.setForeground(LOCAL_INFO_FOREGROUND_COLOR);
addressValue = new JLabel(" ");
addressValue = DockingUtils.createNonHtmlLabel(" ");
addressValue.setForeground(LOCAL_INFO_FOREGROUND_COLOR);
addressPanel.add(address);
addressPanel.add(addressValue);

View file

@ -21,6 +21,7 @@ import java.util.Map;
import javax.swing.*;
import docking.DockingUtils;
import docking.widgets.table.GTableCellRenderingData;
import ghidra.feature.vt.api.main.VTAssociationStatus;
import ghidra.util.table.GhidraTableCellRenderer;
@ -52,22 +53,33 @@ public class RelatedMatchRenderer extends GhidraTableCellRenderer {
private static void initialize() {
if (sourceMap == null) {
sourceMap = new HashMap<VTRelatedMatchCorrelationType, JLabel>();
sourceMap.put(VTRelatedMatchCorrelationType.TARGET, new JLabel(TARGET_ICON));
sourceMap.put(VTRelatedMatchCorrelationType.CALLER, new JLabel(CALLER_ICON));
sourceMap.put(VTRelatedMatchCorrelationType.CALLEE, new JLabel(CALLEE_ICON));
sourceMap.put(VTRelatedMatchCorrelationType.UNRELATED, new JLabel(UNRELATED_ICON));
sourceMap = new HashMap<>();
sourceMap.put(VTRelatedMatchCorrelationType.TARGET,
DockingUtils.createNonHtmlLabel(TARGET_ICON));
sourceMap.put(VTRelatedMatchCorrelationType.CALLER,
DockingUtils.createNonHtmlLabel(CALLER_ICON));
sourceMap.put(VTRelatedMatchCorrelationType.CALLEE,
DockingUtils.createNonHtmlLabel(CALLEE_ICON));
sourceMap.put(VTRelatedMatchCorrelationType.UNRELATED,
DockingUtils.createNonHtmlLabel(UNRELATED_ICON));
destinationMap = new HashMap<VTRelatedMatchCorrelationType, JLabel>();
destinationMap.put(VTRelatedMatchCorrelationType.TARGET, new JLabel(TARGET_ICON));
destinationMap.put(VTRelatedMatchCorrelationType.CALLER, new JLabel(CALLER_ICON));
destinationMap.put(VTRelatedMatchCorrelationType.CALLEE, new JLabel(CALLEE_ICON));
destinationMap.put(VTRelatedMatchCorrelationType.UNRELATED, new JLabel(UNRELATED_ICON));
destinationMap = new HashMap<>();
destinationMap.put(VTRelatedMatchCorrelationType.TARGET,
DockingUtils.createNonHtmlLabel(TARGET_ICON));
destinationMap.put(VTRelatedMatchCorrelationType.CALLER,
DockingUtils.createNonHtmlLabel(CALLER_ICON));
destinationMap.put(VTRelatedMatchCorrelationType.CALLEE,
DockingUtils.createNonHtmlLabel(CALLEE_ICON));
destinationMap.put(VTRelatedMatchCorrelationType.UNRELATED,
DockingUtils.createNonHtmlLabel(UNRELATED_ICON));
statusMap = new HashMap<VTAssociationStatus, JLabel>();
statusMap.put(VTAssociationStatus.ACCEPTED, new JLabel(ACCEPTED_ICON));
statusMap.put(VTAssociationStatus.AVAILABLE, new JLabel(AVAILABLE_ICON));
statusMap.put(VTAssociationStatus.BLOCKED, new JLabel(LOCKED_OUT_ICON));
statusMap = new HashMap<>();
statusMap.put(VTAssociationStatus.ACCEPTED,
DockingUtils.createNonHtmlLabel(ACCEPTED_ICON));
statusMap.put(VTAssociationStatus.AVAILABLE,
DockingUtils.createNonHtmlLabel(AVAILABLE_ICON));
statusMap.put(VTAssociationStatus.BLOCKED,
DockingUtils.createNonHtmlLabel(LOCKED_OUT_ICON));
}
}
@ -80,7 +92,8 @@ public class RelatedMatchRenderer extends GhidraTableCellRenderer {
VTRelatedMatchType relatedMatchType = (VTRelatedMatchType) value;
relatedMatchColumnComponent.removeAll();
relatedMatchColumnComponent.add(sourceMap.get(relatedMatchType.getSourceType()));
relatedMatchColumnComponent.add(destinationMap.get(relatedMatchType.getDestinationType()));
relatedMatchColumnComponent.add(
destinationMap.get(relatedMatchType.getDestinationType()));
relatedMatchColumnComponent.add(statusMap.get(relatedMatchType.getAssociationStatus()));
Color bgColor = findBackgroundColor(relatedMatchType);
if (bgColor != null) {

View file

@ -26,6 +26,7 @@ import javax.swing.border.Border;
import javax.swing.text.DefaultFormatter;
import javax.swing.text.DefaultFormatterFactory;
import docking.DockingUtils;
import docking.widgets.table.GTable;
import ghidra.feature.vt.api.main.VTAssociation;
import ghidra.feature.vt.api.main.VTSession;
@ -69,7 +70,7 @@ public abstract class AbstractTextFilter<T> extends Filter<T> {
// we handle updates in real time, so ignore focus events, which trigger excess filtering
textField.disableFocusEventProcessing();
JLabel label = new JLabel(filterName + ": ");
JLabel label = DockingUtils.createNonHtmlLabel(filterName + ": ");
panel.add(label, BorderLayout.WEST);
panel.add(textField, BorderLayout.CENTER);

View file

@ -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,6 +15,12 @@
*/
package ghidra.feature.vt.gui.wizard;
import java.awt.Dimension;
import javax.swing.*;
import docking.DialogComponentProvider;
import docking.DockingUtils;
import ghidra.app.util.AddressInput;
import ghidra.app.util.HelpTopics;
import ghidra.program.model.address.Address;
@ -24,12 +29,6 @@ import ghidra.program.model.listing.Program;
import ghidra.util.HelpLocation;
import ghidra.util.layout.PairLayout;
import java.awt.Dimension;
import javax.swing.*;
import docking.DialogComponentProvider;
public class AddRemoveAddressRangeDialog extends DialogComponentProvider {
private Program program;
@ -65,7 +64,7 @@ public class AddRemoveAddressRangeDialog extends DialogComponentProvider {
addressRangePanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 0));
addressRangePanel.setLayout(new PairLayout(5, 5));
minLabel = new JLabel("Minimum:");
minLabel = DockingUtils.createNonHtmlLabel("Minimum:");
minLabel.setToolTipText("Enter minimum address to add or remove");
addressRangePanel.add(minLabel);
@ -76,7 +75,7 @@ public class AddRemoveAddressRangeDialog extends DialogComponentProvider {
minAddressField.setPreferredSize(minPreferredSize);
addressRangePanel.add(minAddressField);
maxLabel = new JLabel("Maximum:");
maxLabel = DockingUtils.createNonHtmlLabel("Maximum:");
maxLabel.setToolTipText("Enter maximum address to add or remove");
addressRangePanel.add(maxLabel);

View file

@ -15,22 +15,21 @@
*/
package ghidra.feature.vt.gui.wizard;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.*;
import javax.swing.*;
import javax.swing.event.*;
import docking.DockingUtils;
import ghidra.framework.plugintool.PluginTool;
import ghidra.program.model.address.*;
import ghidra.program.model.listing.Program;
import ghidra.util.layout.MiddleLayout;
import ghidra.util.layout.VerticalLayout;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.HashSet;
import java.util.List;
import javax.swing.*;
import javax.swing.event.*;
import resources.ResourceManager;
public class ChooseAddressSetEditorPanel extends JPanel {
@ -60,12 +59,13 @@ public class ChooseAddressSetEditorPanel extends JPanel {
private JButton removeRangeButton;
private JPanel bottomButtons;
private AddressSetListModel listModel;
private JList list;
private HashSet<ChangeListener> listeners = new HashSet<ChangeListener>();
private JList<AddressRange> list;
private Set<ChangeListener> listeners = new HashSet<>();
public ChooseAddressSetEditorPanel(final PluginTool tool, final String name,
final Program program, final AddressSetView selectionAddressSet,
final AddressSetView myInitialAddressSet, final AddressSetChoice initialAddressSetChoice) {
final AddressSetView myInitialAddressSet,
final AddressSetChoice initialAddressSetChoice) {
super(new BorderLayout());
// Establish the initial state from the parameters.
@ -78,9 +78,8 @@ public class ChooseAddressSetEditorPanel extends JPanel {
hasSelection = true;
}
this.myInitialAddressSet = new AddressSet(myInitialAddressSet);
this.initialAddressSetChoice =
(initialAddressSetChoice != null) ? initialAddressSetChoice
: (hasSelection ? AddressSetChoice.SELECTION : AddressSetChoice.ENTIRE_PROGRAM);
this.initialAddressSetChoice = (initialAddressSetChoice != null) ? initialAddressSetChoice
: (hasSelection ? AddressSetChoice.SELECTION : AddressSetChoice.ENTIRE_PROGRAM);
if (myInitialAddressSet != null && !myInitialAddressSet.isEmpty()) {
myCurrentAddressSet = new AddressSet(myInitialAddressSet);
@ -126,8 +125,8 @@ public class ChooseAddressSetEditorPanel extends JPanel {
originGroup.add(toolSelectionButton);
originGroup.add(myRangesButton);
entireProgramButton.setToolTipText("Don't limit the address ranges. Use all addresses in the " +
name + " program.");
entireProgramButton.setToolTipText(
"Don't limit the address ranges. Use all addresses in the " + name + " program.");
toolSelectionButton.setToolTipText("Limit the address ranges from the " + name +
" program to those that are selected in the " + name + " Tool.");
myRangesButton.setToolTipText("Limit the address ranges from the " + name +
@ -230,11 +229,12 @@ public class ChooseAddressSetEditorPanel extends JPanel {
buttonPanel.add(addRangeButton);
buttonPanel.add(subtractRangeButton);
JPanel headerPanel = new JPanel(new BorderLayout());
headerPanel.add(new JLabel("Address Ranges:"), BorderLayout.WEST);
headerPanel.add(DockingUtils.createNonHtmlLabel("Address Ranges:"), BorderLayout.WEST);
headerPanel.add(buttonPanel, BorderLayout.EAST);
listModel = new AddressSetListModel(myCurrentAddressSet.toList());
list = new JList(listModel);
list = new JList<>(listModel);
DockingUtils.turnOffHTMLRendering(list);
list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
list.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
@Override

View file

@ -23,6 +23,7 @@ import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import docking.DockingUtils;
import docking.options.editor.ButtonPanelFactory;
import docking.wizard.*;
import ghidra.app.util.task.OpenProgramTask;
@ -61,7 +62,7 @@ public class NewSessionPanel extends AbstractMageJPanel<VTWizardStateKey> {
this.tool = tool;
setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));
JLabel folderLabel = new JLabel("Project folder ");
JLabel folderLabel = DockingUtils.createNonHtmlLabel("Project folder ");
folderLabel.setHorizontalAlignment(SwingConstants.RIGHT);
folderLabel.setToolTipText("The folder to store the new Version Tracking Session");
folderNameField = new JTextField();
@ -79,7 +80,7 @@ public class NewSessionPanel extends AbstractMageJPanel<VTWizardStateKey> {
Font font = browseFolderButton.getFont();
browseFolderButton.setFont(new Font(font.getName(), Font.BOLD, font.getSize()));
JLabel newSessionLabel = new JLabel("New Session Name: ");
JLabel newSessionLabel = DockingUtils.createNonHtmlLabel("New Session Name: ");
newSessionLabel.setToolTipText("The name for the new Version Tracking Session");
newSessionLabel.setHorizontalAlignment(SwingConstants.RIGHT);
@ -101,12 +102,12 @@ public class NewSessionPanel extends AbstractMageJPanel<VTWizardStateKey> {
}
});
JLabel sourceLabel = new JLabel("Source Program: ");
JLabel sourceLabel = DockingUtils.createNonHtmlLabel("Source Program: ");
sourceLabel.setIcon(INFO_ICON);
sourceLabel.setToolTipText("Analyzed program with markup to transfer");
sourceLabel.setHorizontalAlignment(SwingConstants.RIGHT);
JLabel destinationLabel = new JLabel("Destination Program: ");
JLabel destinationLabel = DockingUtils.createNonHtmlLabel("Destination Program: ");
destinationLabel.setIcon(INFO_ICON);
destinationLabel.setToolTipText("New program that receives the transferred markup");
destinationLabel.setHorizontalAlignment(SwingConstants.RIGHT);
@ -427,24 +428,24 @@ public class NewSessionPanel extends AbstractMageJPanel<VTWizardStateKey> {
}
DomainFile file = folder.getFile(name);
if (file != null) {
notifyListenersOfStatusMessage("'" + file.getPathname() +
"' is the name of an existing domain file");
notifyListenersOfStatusMessage(
"'" + file.getPathname() + "' is the name of an existing domain file");
return false;
}
sourceProgram = updateProgram(sourceProgramFile, sourceProgram);
if (sourceProgram == null) {
notifyListenersOfStatusMessage("Can't open source program " +
sourceProgramFile.getName());
notifyListenersOfStatusMessage(
"Can't open source program " + sourceProgramFile.getName());
return false;
}
destinationProgram = updateProgram(destinationProgramFile, destinationProgram);
if (destinationProgram == null) {
notifyListenersOfStatusMessage("Can't open destination program " +
destinationProgramFile.getName());
notifyListenersOfStatusMessage(
"Can't open destination program " + destinationProgramFile.getName());
return false;
}
@ -463,9 +464,8 @@ public class NewSessionPanel extends AbstractMageJPanel<VTWizardStateKey> {
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
DomainFile programFile =
VTWizardUtils.chooseDomainFile(NewSessionPanel.this, "a source program",
VTWizardUtils.PROGRAM_FILTER, null);
DomainFile programFile = VTWizardUtils.chooseDomainFile(NewSessionPanel.this,
"a source program", VTWizardUtils.PROGRAM_FILTER, null);
if (programFile != null) {
setSourceProgram(programFile);
}
@ -480,9 +480,8 @@ public class NewSessionPanel extends AbstractMageJPanel<VTWizardStateKey> {
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
DomainFile programFile =
VTWizardUtils.chooseDomainFile(NewSessionPanel.this, "a destination program",
VTWizardUtils.PROGRAM_FILTER, null);
DomainFile programFile = VTWizardUtils.chooseDomainFile(NewSessionPanel.this,
"a destination program", VTWizardUtils.PROGRAM_FILTER, null);
if (programFile != null) {
setDestinationProgram(programFile);
}

View file

@ -15,19 +15,20 @@
*/
package ghidra.feature.vt.gui.wizard;
import ghidra.feature.vt.api.main.VTProgramCorrelatorFactory;
import ghidra.feature.vt.gui.wizard.ChooseAddressSetEditorPanel.AddressSetChoice;
import ghidra.framework.model.DomainFile;
import ghidra.util.HelpLocation;
import ghidra.util.layout.PairLayout;
import java.awt.BorderLayout;
import java.util.List;
import javax.swing.*;
import util.CollectionUtils;
import docking.DockingUtils;
import docking.wizard.*;
import ghidra.feature.vt.api.main.VTProgramCorrelatorFactory;
import ghidra.feature.vt.gui.wizard.ChooseAddressSetEditorPanel.AddressSetChoice;
import ghidra.framework.model.DomainFile;
import ghidra.util.HTMLUtilities;
import ghidra.util.HelpLocation;
import ghidra.util.layout.PairLayout;
import util.CollectionUtils;
public class SummaryPanel extends AbstractMageJPanel<VTWizardStateKey> {
private JLabel labelLabel;
@ -38,8 +39,8 @@ public class SummaryPanel extends AbstractMageJPanel<VTWizardStateKey> {
SummaryPanel() {
labelLabel = new JLabel();
summaryLabel = new JLabel();
labelLabel = DockingUtils.createHtmlLabel();
summaryLabel = DockingUtils.createHtmlLabel();
JPanel mainPanel = new JPanel(new PairLayout(5, 10));
mainPanel.add(labelLabel);
@ -72,9 +73,8 @@ public class SummaryPanel extends AbstractMageJPanel<VTWizardStateKey> {
label.append("Operation:");
String opDescription = (String) state.get(VTWizardStateKey.WIZARD_OP_DESCRIPTION);
helpName =
((opDescription != null) && opDescription.startsWith("New")) ? NEW_SUMMARY_PANEL
: ADD_SUMMARY_PANEL;
helpName = ((opDescription != null) && opDescription.startsWith("New")) ? NEW_SUMMARY_PANEL
: ADD_SUMMARY_PANEL;
summary.append(opDescription);
label.append("<br>");
summary.append("<br>");
@ -99,14 +99,16 @@ public class SummaryPanel extends AbstractMageJPanel<VTWizardStateKey> {
// source program
label.append("Source Program:");
summary.append(sourceProgramName == null ? "(null)" : sourceProgramName);
summary.append(sourceProgramName == null ? "(null)"
: HTMLUtilities.friendlyEncodeHTML(sourceProgramName));
label.append("<br>");
summary.append("<br>");
// destination program
label.append("Destination Program:");
summary.append(destinationProgramName == null ? "(null)" : destinationProgramName);
summary.append(destinationProgramName == null ? "(null)"
: HTMLUtilities.friendlyEncodeHTML(destinationProgramName));
label.append("<br>");
summary.append("<br>");
@ -145,11 +147,14 @@ public class SummaryPanel extends AbstractMageJPanel<VTWizardStateKey> {
(AddressSetChoice) state.get(VTWizardStateKey.DESTINATION_ADDRESS_SET_CHOICE);
String sourceAddressesInfo =
(sourceAddressSetChoice == AddressSetChoice.MANUALLY_DEFINED) ? "Manually Defined"
: ((sourceAddressSetChoice == AddressSetChoice.SELECTION)) ? "Source Tool Selection"
: ((sourceAddressSetChoice == AddressSetChoice.SELECTION))
? "Source Tool Selection"
: "Entire Source Program";
String destinationAddressesInfo =
(destinationAddressSetChoice == AddressSetChoice.MANUALLY_DEFINED) ? "Manually Defined"
: ((destinationAddressSetChoice == AddressSetChoice.SELECTION)) ? "Destination Tool Selection"
(destinationAddressSetChoice == AddressSetChoice.MANUALLY_DEFINED)
? "Manually Defined"
: ((destinationAddressSetChoice == AddressSetChoice.SELECTION))
? "Destination Tool Selection"
: "Entire Destination Program";
label.append("Source Address Set:");

View file

@ -15,20 +15,20 @@
*/
package ghidra.feature.vt.gui.wizard;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import docking.widgets.OptionDialog;
import ghidra.feature.vt.api.impl.VTSessionContentHandler;
import ghidra.feature.vt.gui.task.SaveTask;
import ghidra.framework.main.DataTreeDialog;
import ghidra.framework.model.DomainFile;
import ghidra.framework.model.DomainFileFilter;
import ghidra.program.database.ProgramDB;
import ghidra.util.HTMLUtilities;
import ghidra.util.task.TaskLauncher;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import docking.widgets.OptionDialog;
public class VTWizardUtils {
private static class DomainFileBox {
@ -57,10 +57,10 @@ public class VTWizardUtils {
static DomainFile chooseDomainFile(Component parent, String domainIdentifier,
DomainFileFilter filter, DomainFile fileToSelect) {
final DataTreeDialog dataTreeDialog =
filter == null ? new DataTreeDialog(parent, "Choose " + domainIdentifier,
DataTreeDialog.OPEN) : new DataTreeDialog(parent, "Choose " + domainIdentifier,
DataTreeDialog.OPEN, filter);
final DataTreeDialog dataTreeDialog = filter == null
? new DataTreeDialog(parent, "Choose " + domainIdentifier, DataTreeDialog.OPEN)
: new DataTreeDialog(parent, "Choose " + domainIdentifier, DataTreeDialog.OPEN,
filter);
final DomainFileBox box = new DomainFileBox();
dataTreeDialog.addOkActionListener(new ActionListener() {
@Override
@ -80,10 +80,10 @@ public class VTWizardUtils {
static public boolean askUserToSave(Component parent, DomainFile domainFile) {
String filename = domainFile.getName();
int result =
OptionDialog.showYesNoDialog(parent, "Save Version Tracking Changes?",
"<html>Unsaved Version Tracking changes found for session: " + filename +
". <br>" + "Would you like to save these changes?");
int result = OptionDialog.showYesNoDialog(parent, "Save Version Tracking Changes?",
"<html>Unsaved Version Tracking changes found for session: " +
HTMLUtilities.friendlyEncodeHTML(filename) + ". <br>" +
"Would you like to save these changes?");
boolean doSave = result == OptionDialog.YES_OPTION;
if (doSave) {
@ -98,10 +98,10 @@ public class VTWizardUtils {
static public boolean askUserToSaveBeforeClosing(Component parent, DomainFile domainFile) {
String filename = domainFile.getName();
int result =
OptionDialog.showYesNoCancelDialog(parent, "Save Version Tracking Changes?",
"<html>Unsaved Version Tracking changes found for session: " + filename +
". <br>" + "Would you like to save these changes?");
int result = OptionDialog.showYesNoCancelDialog(parent, "Save Version Tracking Changes?",
"<html>Unsaved Version Tracking changes found for session: " +
HTMLUtilities.friendlyEncodeHTML(filename) + ". <br>" +
"Would you like to save these changes?");
if (result == OptionDialog.CANCEL_OPTION) {
return false;