mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 17:59:46 +02:00
GP-9181 - Theming - Base Module
This commit is contained in:
parent
2dade60b3e
commit
4eb3d8fd86
113 changed files with 1092 additions and 1099 deletions
|
@ -15,13 +15,14 @@
|
|||
*/
|
||||
package ghidra.app.util.disassemble;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import docking.widgets.fieldpanel.field.*;
|
||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.app.util.HighlightProvider;
|
||||
import ghidra.app.util.viewer.field.*;
|
||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||
|
@ -130,7 +131,7 @@ public class ExternalDisassemblyFieldFactory extends FieldFactory {
|
|||
if (disassembly == null) {
|
||||
return null;
|
||||
}
|
||||
AttributedString text = new AttributedString(disassembly, Color.black, getMetrics());
|
||||
AttributedString text = new AttributedString(disassembly, Palette.BLACK, getMetrics());
|
||||
FieldElement fieldElement = new TextFieldElement(text, 0, 0);
|
||||
return ListingTextField.createSingleLineTextField(this, proxy, fieldElement,
|
||||
startX + varWidth, width, hlProvider);
|
||||
|
@ -162,7 +163,7 @@ public class ExternalDisassemblyFieldFactory extends FieldFactory {
|
|||
if (message == null) {
|
||||
message = e.toString();
|
||||
}
|
||||
AttributedString errorText = new AttributedString(message, Color.red, getMetrics());
|
||||
AttributedString errorText = new AttributedString(message, Messages.ERROR, getMetrics());
|
||||
FieldElement fieldElement = new TextFieldElement(errorText, 0, 0);
|
||||
return ListingTextField.createSingleLineTextField(this, proxy, fieldElement,
|
||||
startX + varWidth, width, hlProvider);
|
||||
|
|
|
@ -17,6 +17,7 @@ data/ExtensionPoint.manifest||GHIDRA||||END|
|
|||
data/MachOFunctionsThatDoNotReturn||GHIDRA||||END|
|
||||
data/PEFunctionsThatDoNotReturn||GHIDRA||||END|
|
||||
data/base.listing.theme.properties||GHIDRA||||END|
|
||||
data/base.programgraph.theme.properties||GHIDRA||||END|
|
||||
data/base.theme.properties||GHIDRA||||END|
|
||||
data/file_extension_icons.xml||GHIDRA||||END|
|
||||
data/functionTags.xml||GHIDRA||||END|
|
||||
|
|
|
@ -70,6 +70,13 @@ color.fg.listing.pcode.space = blue
|
|||
color.fg.listing.pcode.varnode = blue
|
||||
color.fg.listing.pcode.userop = blue
|
||||
|
||||
color.bg.listing.comparison.bytes = chartreuse
|
||||
color.bg.listing.comparison.mnemonic = chartreuse
|
||||
color.bg.listing.comparison.operand = chartreuse
|
||||
color.bg.listing.comparison.code.units.diff = silver
|
||||
color.bg.listing.comparison.code.units.unmatched = skyblue
|
||||
|
||||
|
||||
|
||||
|
||||
[Dark Defaults]
|
||||
|
|
56
Ghidra/Features/Base/data/base.programgraph.theme.properties
Normal file
56
Ghidra/Features/Base/data/base.programgraph.theme.properties
Normal file
|
@ -0,0 +1,56 @@
|
|||
|
||||
[Defaults]
|
||||
|
||||
|
||||
|
||||
color.bg.plugin.programgraph.edge.call.callother.override = red
|
||||
color.bg.plugin.programgraph.edge.call.computed = cyan
|
||||
color.bg.plugin.programgraph.edge.call.computed.terminator = purple
|
||||
color.bg.plugin.programgraph.edge.call.conditional.computed = cyan
|
||||
color.bg.plugin.programgraph.edge.call.conditional = darkorange
|
||||
color.bg.plugin.programgraph.edge.call.conditional.terminator = purple
|
||||
color.bg.plugin.programgraph.edge.call.unconditional = darkorange
|
||||
color.bg.plugin.programgraph.edge.call.unconditional.override = red
|
||||
color.bg.plugin.programgraph.edge.jump.callother.override = red
|
||||
color.bg.plugin.programgraph.edge.jump.conitional.computed = cyan
|
||||
color.bg.plugin.programgraph.edge.jump.computed = cyan
|
||||
color.bg.plugin.programgraph.edge.jump.conditional = darkgoldenrod
|
||||
color.bg.plugin.programgraph.edge.jump.terminator = purple
|
||||
color.bg.plugin.programgraph.edge.jump.unconditional = darkgreen
|
||||
color.bg.plugin.programgraph.edge.jump.unconditional.override = red
|
||||
|
||||
color.bg.plugin.programgraph.edge.default = red
|
||||
color.bg.plugin.programgraph.edge.conditional.terminator = purple
|
||||
color.bg.plugin.programgraph.edge.data.unknown = black
|
||||
color.bg.plugin.programgraph.edge.data.indirect = darkorange
|
||||
color.bg.plugin.programgraph.edge.entry = gray
|
||||
color.bg.plugin.programgraph.edge.external.ref = purple
|
||||
color.bg.plugin.programgraph.edge.fall.through = blue
|
||||
color.bg.plugin.programgraph.edge.indirection = pink
|
||||
color.bg.plugin.programgraph.edge.param = cyan
|
||||
color.bg.plugin.programgraph.edge.read = green
|
||||
color.bg.plugin.programgraph.edge.read.indirect = darkgreen
|
||||
color.bg.plugin.programgraph.edge.read.write = darkgoldenrod
|
||||
color.bg.plugin.programgraph.edge.read.write.indirect = brown
|
||||
color.bg.plugin.programgraph.edge.terminator = purple
|
||||
color.bg.plugin.programgraph.edge.thunk = blue
|
||||
color.bg.plugin.programgraph.edge.write = red
|
||||
color.bg.plugin.programgraph.edge.write.indirect = darkred
|
||||
|
||||
|
||||
color.bg.plugin.programgraph.vertex.default = red
|
||||
color.bg.plugin.programgraph.vertex.body = blue
|
||||
color.bg.plugin.programgraph.vertex.entry = darkorange
|
||||
color.bg.plugin.programgraph.vertex.exit = darkmagenta
|
||||
color.bg.plugin.programgraph.vertex.external = darkgreen
|
||||
color.bg.plugin.programgraph.vertex.switch = darkcyan
|
||||
color.bg.plugin.programgraph.vertex.bad = red
|
||||
color.bg.plugin.programgraph.vertex.data = pink
|
||||
color.bg.plugin.programgraph.vertex.entry.nexus = wheat
|
||||
color.bg.plugin.programgraph.vertex.instruction = blue
|
||||
color.bg.plugin.programgraph.vertex.stack = green
|
||||
|
||||
|
||||
|
||||
[Dark Defaults]
|
||||
|
|
@ -7,6 +7,8 @@ color.flowtype.jump.conditional = #007C00 // dark green
|
|||
color.flowtype.jump.unconditional = blue
|
||||
|
||||
color.function.thunk = color.palette.blue
|
||||
color.fg.function.name = color.palette.blue
|
||||
color.fg.function.params = color.palette.magenta
|
||||
|
||||
color.bg.table.selection.bundle = [color]textHighlight
|
||||
color.fg.table.selection.bundle = [color]textHighlightText
|
||||
|
@ -15,6 +17,9 @@ color.fg.table.bundle.busy = gray
|
|||
color.fg.table.bundle.inactive = black
|
||||
color.fg.table.bundle.active = green
|
||||
|
||||
color.fg.table.offcut.selected = pink
|
||||
color.fg.table.offcut.unselected = color.fg.error
|
||||
|
||||
color.bg.splash.infopanel = color.bg
|
||||
|
||||
color.bg.table.selected.ghidratable = color.bg
|
||||
|
@ -84,14 +89,7 @@ color.fg.plugin.function.editor.dialog.thunk = color.function.thunk
|
|||
color.fg.plugin.function.editor.dialog.textfield.default = color.fg
|
||||
color.fg.plugin.function.editor.dialog.textfield.error = color.fg.error
|
||||
color.fg.plugin.function.editor.dialog.textfield.function.name = color.palette.blue
|
||||
color.fg.plugin.function.editor.dialog.textfield.parameter = color.palette.magenta
|
||||
|
||||
color.bg.plugin.windowlocation = black
|
||||
color.bg.plugin.windowlocation.bounds.virtual = red
|
||||
color.bg.plugin.windowlocation.bounds.visible = green
|
||||
color.bg.plugin.windowlocation.screens = orange
|
||||
color.bg.plugin.windowlocation.window.selected = rgba(0, 255, 0, 200)
|
||||
color.fg.plugin.windowlocation.window.text = gray
|
||||
color.fg.plugin.function.editor.dialog.textfield.parameter = color.fg.function.params
|
||||
|
||||
color.bg.plugin.instructionsearch.table.masked.instruction = rgb(237, 243, 254) // faint blue
|
||||
color.bg.plugin.instructionsearch.table.masked.non.instruction = rgb(255, 242, 214) // tan
|
||||
|
@ -143,10 +141,22 @@ color.bg.plugin.overview.entropy.palette.base.low = black
|
|||
color.bg.plugin.overview.entropy.palette.base.high = white
|
||||
color.bg.plugin.overview.entropy.palette.text = color.fg
|
||||
|
||||
color.bg.plugin.programdiff.details.address = #009999
|
||||
color.bg.plugin.programdiff.details.comment = #009900
|
||||
color.bg.plugin.programdiff.details.danger = #FF0000
|
||||
color.bg.plugin.programdiff.details.emphasize = #009900
|
||||
color.bg.plugin.programdiff.details.program = #990099
|
||||
|
||||
color.bg.plugin.references.table.active.operand = rgb(205, 205, 205)
|
||||
|
||||
color.bg.plugin.register.marker = rgb(0, 153, 153)
|
||||
|
||||
color.bg.plugin.windowlocation = black
|
||||
color.bg.plugin.windowlocation.bounds.virtual = red
|
||||
color.bg.plugin.windowlocation.bounds.visible = green
|
||||
color.bg.plugin.windowlocation.screens = orange
|
||||
color.bg.plugin.windowlocation.window.selected = rgba(0, 255, 0, 200)
|
||||
color.fg.plugin.windowlocation.window.text = gray
|
||||
|
||||
|
||||
[Dark Defaults]
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
//NOTE: I do not de-duplicate, since the address of the instruction may affect the output.
|
||||
//@category Assembly
|
||||
|
||||
import java.awt.Color;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.util.HashSet;
|
||||
|
@ -27,6 +26,7 @@ import javax.swing.ImageIcon;
|
|||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.app.plugin.assembler.*;
|
||||
import ghidra.app.plugin.assembler.sleigh.sem.*;
|
||||
import ghidra.app.plugin.processors.sleigh.SleighDebugLogger;
|
||||
|
@ -105,7 +105,7 @@ public class AssemblyThrasherDevScript extends GhidraScript {
|
|||
|
||||
BookmarkManager bm = currentProgram.getBookmarkManager();
|
||||
ImageIcon myIcon = ResourceManager.loadImage("images/warning.png");
|
||||
bm.defineType(BOOKMARK_FAIL, myIcon, new Color(255, 255, 0), 0);
|
||||
bm.defineType(BOOKMARK_FAIL, myIcon, Palette.YELLOW, 0);
|
||||
bm.removeBookmarks(BOOKMARK_FAIL);
|
||||
|
||||
monitor.setMessage("Constructing Assembler");
|
||||
|
@ -157,7 +157,7 @@ public class AssemblyThrasherDevScript extends GhidraScript {
|
|||
}
|
||||
|
||||
println("Unique instructions by constructor: " + done.size());
|
||||
setBackgroundColor(uniques, new Color(255, 128, 128));
|
||||
setBackgroundColor(uniques, Palette.getColor("lightcoral"));
|
||||
}
|
||||
|
||||
protected PseudoInstruction disassemble(Instruction orig, byte[] ins) {
|
||||
|
|
|
@ -16,13 +16,14 @@
|
|||
// An example of how to color the listing background
|
||||
//@category Examples
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.app.plugin.core.colorizer.ColorizingService;
|
||||
import ghidra.app.script.GhidraScript;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.address.AddressSet;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
public class ExampleColorScript extends GhidraScript {
|
||||
|
||||
@Override
|
||||
|
@ -34,10 +35,10 @@ public class ExampleColorScript extends GhidraScript {
|
|||
}
|
||||
|
||||
if (currentSelection != null) {
|
||||
service.setBackgroundColor(currentSelection, new Color(255, 200, 200));
|
||||
service.setBackgroundColor(currentSelection, Palette.PINK);
|
||||
}
|
||||
else if (currentAddress != null) {
|
||||
service.setBackgroundColor(currentAddress, currentAddress, new Color(255, 200, 200));
|
||||
service.setBackgroundColor(currentAddress, currentAddress, Palette.PINK);
|
||||
}
|
||||
else {
|
||||
println("No selection or current address to color");
|
||||
|
|
|
@ -19,12 +19,12 @@
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.app.script.GhidraScript;
|
||||
import ghidra.app.services.GraphDisplayBroker;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.program.model.data.*;
|
||||
import ghidra.service.graph.*;
|
||||
import ghidra.util.WebColors;
|
||||
import ghidra.util.exception.CancelledException;
|
||||
import ghidra.util.task.TaskMonitor;
|
||||
|
||||
|
@ -36,7 +36,7 @@ public class GraphClassesScript extends GhidraScript {
|
|||
private static final String VIRTUAL_INHERITANCE = "Virtual Inheritance";
|
||||
private static final String NON_VIRTUAL_INHERITANCE = "Non-virtual Inheritance";
|
||||
|
||||
List<Structure> classStructures = new ArrayList<Structure>();
|
||||
List<Structure> classStructures = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
|
@ -107,9 +107,8 @@ public class GraphClassesScript extends GhidraScript {
|
|||
}
|
||||
|
||||
/**
|
||||
* Method to create a graph using preconfigured information found in class structure descriptions.
|
||||
* The structure descriptions are created using
|
||||
* {@link RecoveredClassUtils#createParentStringBuffer(RecoveredClass)}
|
||||
* Method to create a graph using pre-configured information found in class structure
|
||||
* descriptions.
|
||||
* @return the newly created graph
|
||||
*/
|
||||
private AttributedGraph createGraph() throws Exception {
|
||||
|
@ -290,7 +289,7 @@ public class GraphClassesScript extends GhidraScript {
|
|||
private Structure getParentStructureFromClassStructures(String parentName)
|
||||
throws CancelledException {
|
||||
|
||||
List<Structure> parentStructures = new ArrayList<Structure>();
|
||||
List<Structure> parentStructures = new ArrayList<>();
|
||||
for (Structure classStructure : classStructures) {
|
||||
monitor.checkCanceled();
|
||||
|
||||
|
@ -315,13 +314,13 @@ public class GraphClassesScript extends GhidraScript {
|
|||
display = service.getGraphDisplay(false, TaskMonitor.DUMMY);
|
||||
|
||||
GraphDisplayOptions graphOptions = new GraphDisplayOptionsBuilder(graph.getGraphType())
|
||||
.vertex(NO_INHERITANCE, VertexShape.RECTANGLE, WebColors.BLUE)
|
||||
.vertex(SINGLE_INHERITANCE, VertexShape.RECTANGLE, WebColors.GREEN)
|
||||
.vertex(MULTIPLE_INHERITANCE, VertexShape.RECTANGLE, WebColors.RED)
|
||||
.edge(NON_VIRTUAL_INHERITANCE, WebColors.LIME_GREEN)
|
||||
.edge(VIRTUAL_INHERITANCE, WebColors.ORANGE)
|
||||
.defaultVertexColor(WebColors.PURPLE)
|
||||
.defaultEdgeColor(WebColors.PURPLE)
|
||||
.vertex(NO_INHERITANCE, VertexShape.RECTANGLE, Palette.BLUE)
|
||||
.vertex(SINGLE_INHERITANCE, VertexShape.RECTANGLE, Palette.GREEN)
|
||||
.vertex(MULTIPLE_INHERITANCE, VertexShape.RECTANGLE, Palette.RED)
|
||||
.edge(NON_VIRTUAL_INHERITANCE, Palette.LIME)
|
||||
.edge(VIRTUAL_INHERITANCE, Palette.ORANGE)
|
||||
.defaultVertexColor(Palette.PURPLE)
|
||||
.defaultEdgeColor(Palette.PURPLE)
|
||||
.defaultLayoutAlgorithm("Compact Hierarchical")
|
||||
.maxNodeCount(1000)
|
||||
.build();
|
||||
|
@ -330,7 +329,6 @@ public class GraphClassesScript extends GhidraScript {
|
|||
"Recovered Classes Graph", false, TaskMonitor.DUMMY);
|
||||
}
|
||||
|
||||
|
||||
private String getClassName(String description) {
|
||||
|
||||
int indexOfColon = getIndexOfFirstSingleColon(description);
|
||||
|
|
|
@ -26,6 +26,9 @@ import javax.swing.*;
|
|||
import javax.swing.table.DefaultTableCellRenderer;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
|
||||
public class SearchGuiMulti extends SearchBaseExtended {
|
||||
|
||||
private JScrollPane jScrollPane1;
|
||||
|
@ -65,39 +68,19 @@ public class SearchGuiMulti extends SearchBaseExtended {
|
|||
frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||
|
||||
mnemonicButton.setText("Mnemonic");
|
||||
mnemonicButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
mnemonicButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
mnemonicButton.addActionListener(evt -> mnemonicButtonActionPerformed(evt));
|
||||
mnemonicButton.setVisible(false);
|
||||
|
||||
op1Button.setText("Operand 1");
|
||||
op1Button.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
op1ButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
op1Button.addActionListener(evt -> op1ButtonActionPerformed(evt));
|
||||
op1Button.setVisible(false);
|
||||
|
||||
op2Button.setText("Operand 2");
|
||||
op2Button.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
op2ButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
op2Button.addActionListener(evt -> op2ButtonActionPerformed(evt));
|
||||
op2Button.setVisible(false);
|
||||
|
||||
searchButton.setText("Search");
|
||||
searchButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
searchButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
searchButton.addActionListener(evt -> searchButtonActionPerformed(evt));
|
||||
|
||||
fillTable();
|
||||
tableModel = new DefaultTableModel(tableContentsDO, columnIdentifiers) {
|
||||
|
@ -122,13 +105,8 @@ public class SearchGuiMulti extends SearchBaseExtended {
|
|||
|
||||
Color backgroundColor = dataObject.getBackgroundColor();
|
||||
if (backgroundColor != null) {
|
||||
if (isSelected) {
|
||||
theRenderer.setBackground(backgroundColor.darker());
|
||||
}
|
||||
else {
|
||||
theRenderer.setBackground(backgroundColor);
|
||||
}
|
||||
}
|
||||
|
||||
return theRenderer;
|
||||
}
|
||||
|
@ -155,12 +133,14 @@ public class SearchGuiMulti extends SearchBaseExtended {
|
|||
.addGroup(layout.createSequentialGroup() //
|
||||
.addContainerGap(15, Short.MAX_VALUE) //
|
||||
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) //
|
||||
.addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() //
|
||||
.addGroup(GroupLayout.Alignment.TRAILING, layout
|
||||
.createSequentialGroup() //
|
||||
.addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE, 357,
|
||||
GroupLayout.PREFERRED_SIZE) //
|
||||
.addContainerGap() //
|
||||
) //
|
||||
.addGroup(GroupLayout.Alignment.CENTER, layout.createSequentialGroup() //
|
||||
.addGroup(GroupLayout.Alignment.CENTER,
|
||||
layout.createSequentialGroup() //
|
||||
.addComponent(mnemonicButton) //
|
||||
.addGap(39, 39, 39) //
|
||||
.addComponent(op1Button) //
|
||||
|
@ -205,7 +185,7 @@ public class SearchGuiMulti extends SearchBaseExtended {
|
|||
|
||||
if (column == 0) {
|
||||
tableContentsDO[mnemonic][column] =
|
||||
new DataObject(mnemonics.get(mnemonic).textRep, Color.green);
|
||||
new DataObject(mnemonics.get(mnemonic).textRep, Palette.GREEN);
|
||||
}
|
||||
else {
|
||||
OperandCase temp = null;
|
||||
|
@ -217,10 +197,10 @@ public class SearchGuiMulti extends SearchBaseExtended {
|
|||
}
|
||||
if (temp != null) {
|
||||
tableContentsDO[mnemonic][column] =
|
||||
new DataObject(temp.textRep, Color.red.brighter());
|
||||
new DataObject(temp.textRep, Palette.PINK);
|
||||
}
|
||||
else {
|
||||
tableContentsDO[mnemonic][column] = new DataObject("", Color.white);
|
||||
tableContentsDO[mnemonic][column] = new DataObject("", Palette.WHITE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -239,13 +219,13 @@ public class SearchGuiMulti extends SearchBaseExtended {
|
|||
throw new IndexOutOfBoundsException();
|
||||
}
|
||||
|
||||
if (tableContentsDO[rowSelection][columnSelection].getBackgroundColor().equals(
|
||||
Color.green)) {
|
||||
tableContentsDO[rowSelection][columnSelection].setBackgroundColor(Color.red);
|
||||
if (tableContentsDO[rowSelection][columnSelection].getBackgroundColor()
|
||||
.equals(Palette.GREEN)) {
|
||||
tableContentsDO[rowSelection][columnSelection].setBackgroundColor(Palette.RED);
|
||||
}
|
||||
else if (tableContentsDO[rowSelection][columnSelection].getBackgroundColor().equals(
|
||||
Color.red)) {
|
||||
tableContentsDO[rowSelection][columnSelection].setBackgroundColor(Color.green);
|
||||
else if (tableContentsDO[rowSelection][columnSelection].getBackgroundColor()
|
||||
.equals(Palette.RED)) {
|
||||
tableContentsDO[rowSelection][columnSelection].setBackgroundColor(Palette.GREEN);
|
||||
}
|
||||
else {
|
||||
//TODO Determine what to do if the cell is white when clicked on. White cell means that there isn't an operand or mnemonic in that position.
|
||||
|
@ -258,10 +238,10 @@ public class SearchGuiMulti extends SearchBaseExtended {
|
|||
int selectedRow = jTable1.getSelectedRow();
|
||||
|
||||
if (mnemonicButton.isSelected()) {
|
||||
tableContentsDO[selectedRow][0].setBackgroundColor(Color.red);
|
||||
tableContentsDO[selectedRow][0].setBackgroundColor(Palette.RED);
|
||||
}
|
||||
else {//off when clicked, turn on and update the table to reflect being enabled
|
||||
tableContentsDO[selectedRow][0].setBackgroundColor(Color.green);
|
||||
tableContentsDO[selectedRow][0].setBackgroundColor(Palette.GREEN);
|
||||
}
|
||||
jTable1.repaint();
|
||||
}
|
||||
|
@ -271,10 +251,10 @@ public class SearchGuiMulti extends SearchBaseExtended {
|
|||
int selectedRow = jTable1.getSelectedRow();
|
||||
|
||||
if (op1Button.isSelected()) {
|
||||
tableContentsDO[selectedRow][1].setBackgroundColor(Color.red);
|
||||
tableContentsDO[selectedRow][1].setBackgroundColor(Palette.RED);
|
||||
}
|
||||
else {//off when clicked, turn on and update the table to reflect being enabled
|
||||
tableContentsDO[selectedRow][1].setBackgroundColor(Color.green);
|
||||
tableContentsDO[selectedRow][1].setBackgroundColor(Palette.GREEN);
|
||||
}
|
||||
jTable1.repaint();
|
||||
}
|
||||
|
@ -284,10 +264,10 @@ public class SearchGuiMulti extends SearchBaseExtended {
|
|||
int selectedRow = jTable1.getSelectedRow();
|
||||
|
||||
if (op2Button.isSelected()) {
|
||||
tableContentsDO[selectedRow][2].setBackgroundColor(Color.red);
|
||||
tableContentsDO[selectedRow][2].setBackgroundColor(Palette.RED);
|
||||
}
|
||||
else {//off when clicked, turn on and update the table to reflect being enabled
|
||||
tableContentsDO[selectedRow][2].setBackgroundColor(Color.green);
|
||||
tableContentsDO[selectedRow][2].setBackgroundColor(Palette.GREEN);
|
||||
}
|
||||
jTable1.repaint();
|
||||
}
|
||||
|
@ -300,14 +280,14 @@ public class SearchGuiMulti extends SearchBaseExtended {
|
|||
for (int row = 0; row < mnemonics.size(); row++) {
|
||||
SLMaskControl temp = new SLMaskControl();
|
||||
|
||||
if (tableContentsDO[row][0].getBackgroundColor().equals(Color.green)) {
|
||||
if (tableContentsDO[row][0].getBackgroundColor().equals(Palette.GREEN)) {
|
||||
temp.useMnemonic = true;
|
||||
}
|
||||
else {
|
||||
temp.useMnemonic = false;
|
||||
}
|
||||
|
||||
if (tableContentsDO[row][1].getBackgroundColor().equals(Color.green)) {
|
||||
if (tableContentsDO[row][1].getBackgroundColor().equals(Palette.GREEN)) {
|
||||
temp.useOp1 = true;
|
||||
if (ops.get(0).get(mnemonics.get(row)).constant) {
|
||||
temp.useConst = true;
|
||||
|
@ -317,7 +297,7 @@ public class SearchGuiMulti extends SearchBaseExtended {
|
|||
temp.useOp1 = false;
|
||||
}
|
||||
|
||||
if (tableContentsDO[row][2].getBackgroundColor().equals(Color.green)) {
|
||||
if (tableContentsDO[row][2].getBackgroundColor().equals(Palette.GREEN)) {
|
||||
temp.useOp2 = true;
|
||||
if (ops.get(1).get(mnemonics.get(row)).constant) {
|
||||
temp.useConst = true;
|
||||
|
@ -336,7 +316,7 @@ public class SearchGuiMulti extends SearchBaseExtended {
|
|||
|
||||
private class DataObject {
|
||||
private String data;
|
||||
private Color background = Color.white;
|
||||
private Color background = Colors.BACKGROUND;
|
||||
|
||||
public DataObject(String data, Color color) {
|
||||
this.data = data;
|
||||
|
|
|
@ -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.merge;
|
|||
|
||||
import java.awt.Color;
|
||||
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
|
||||
public interface MergeConstants {
|
||||
public static final int RESULT = 0;
|
||||
|
@ -29,8 +29,8 @@ public interface MergeConstants {
|
|||
public static final String LATEST_TITLE = "Latest";
|
||||
public static final String MY_TITLE = "Checked Out";
|
||||
|
||||
public Color CONFLICT_COLOR = new Color(140, 0, 0);
|
||||
public static final Color HIGHLIGHT_COLOR = new Color(230,230,230);
|
||||
public Color CONFLICT_COLOR = Palette.MAROON;
|
||||
public static final Color HIGHLIGHT_COLOR = Palette.LIGHT_GRAY;
|
||||
|
||||
// The following are standardized names for use in passing resolve
|
||||
// information between individual merge managers.
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
package ghidra.app.merge;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.swing.*;
|
||||
|
@ -24,6 +23,7 @@ import javax.swing.border.Border;
|
|||
|
||||
import docking.widgets.label.GIconLabel;
|
||||
import docking.widgets.label.GLabel;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.layout.VerticalLayout;
|
||||
import resources.ResourceManager;
|
||||
|
@ -52,7 +52,7 @@ public class MergeProgressPanel extends JPanel {
|
|||
private JPanel getProgressTitlePanel() {
|
||||
JPanel phasesTitlePanel = new JPanel();
|
||||
Border insideBorder = BorderFactory.createEmptyBorder(0, 0, 2, 0);
|
||||
Border outsideBorder = BorderFactory.createMatteBorder(0, 0, 2, 0, Color.BLUE);
|
||||
Border outsideBorder = BorderFactory.createMatteBorder(0, 0, 2, 0, Palette.BLUE);
|
||||
Border compoundBorder = BorderFactory.createCompoundBorder(outsideBorder, insideBorder);
|
||||
phasesTitlePanel.setBorder(compoundBorder);
|
||||
BoxLayout bl = new BoxLayout(phasesTitlePanel, BoxLayout.X_AXIS);
|
||||
|
@ -139,9 +139,6 @@ public class MergeProgressPanel extends JPanel {
|
|||
return buf.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
MergeProgressPanel panel = new MergeProgressPanel();
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ import javax.swing.JPanel;
|
|||
import javax.swing.JTextPane;
|
||||
import javax.swing.text.*;
|
||||
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.app.merge.MergeConstants;
|
||||
import ghidra.docking.settings.Settings;
|
||||
import ghidra.docking.settings.SettingsDefinition;
|
||||
|
@ -39,8 +40,7 @@ import ghidra.util.UniversalID;
|
|||
*/
|
||||
class DataTypePanel extends JPanel {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
public Color SOURCE_COLOR = new Color(0, 140, 0);
|
||||
public Color SOURCE_COLOR = Palette.GREEN;
|
||||
private DataType dataType;
|
||||
private JTextPane textPane;
|
||||
private StyledDocument doc;
|
||||
|
@ -110,28 +110,28 @@ class DataTypePanel extends JPanel {
|
|||
offsetAttrSet = new SimpleAttributeSet();
|
||||
offsetAttrSet.addAttribute(StyleConstants.FontFamily, "Monospaced");
|
||||
offsetAttrSet.addAttribute(StyleConstants.FontSize, Integer.valueOf(12));
|
||||
offsetAttrSet.addAttribute(StyleConstants.Foreground, Color.BLACK);
|
||||
offsetAttrSet.addAttribute(StyleConstants.Foreground, Palette.BLACK);
|
||||
|
||||
contentAttrSet = new SimpleAttributeSet();
|
||||
contentAttrSet.addAttribute(StyleConstants.FontFamily, "Monospaced");
|
||||
contentAttrSet.addAttribute(StyleConstants.FontSize, Integer.valueOf(12));
|
||||
contentAttrSet.addAttribute(StyleConstants.Foreground, Color.BLUE);
|
||||
contentAttrSet.addAttribute(StyleConstants.Foreground, Palette.BLUE);
|
||||
|
||||
fieldNameAttrSet = new SimpleAttributeSet();
|
||||
fieldNameAttrSet.addAttribute(StyleConstants.FontFamily, "Monospaced");
|
||||
fieldNameAttrSet.addAttribute(StyleConstants.FontSize, Integer.valueOf(12));
|
||||
fieldNameAttrSet.addAttribute(StyleConstants.Foreground, new Color(204, 0, 204));
|
||||
fieldNameAttrSet.addAttribute(StyleConstants.Foreground, Palette.MAGENTA);
|
||||
|
||||
commentAttrSet = new SimpleAttributeSet();
|
||||
commentAttrSet.addAttribute(StyleConstants.FontFamily, "Monospaced");
|
||||
commentAttrSet.addAttribute(StyleConstants.FontSize, Integer.valueOf(12));
|
||||
commentAttrSet.addAttribute(StyleConstants.Foreground, new Color(0, 204, 51));
|
||||
commentAttrSet.addAttribute(StyleConstants.Foreground, Palette.LIME);
|
||||
|
||||
deletedAttrSet = new SimpleAttributeSet();
|
||||
deletedAttrSet.addAttribute(StyleConstants.FontFamily, "Tahoma");
|
||||
deletedAttrSet.addAttribute(StyleConstants.FontSize, Integer.valueOf(12));
|
||||
deletedAttrSet.addAttribute(StyleConstants.Bold, Boolean.TRUE);
|
||||
deletedAttrSet.addAttribute(StyleConstants.Foreground, Color.RED);
|
||||
deletedAttrSet.addAttribute(StyleConstants.Foreground, Palette.RED);
|
||||
|
||||
setDataType(dataType);
|
||||
}
|
||||
|
|
|
@ -15,17 +15,18 @@
|
|||
*/
|
||||
package ghidra.app.merge.datatypes;
|
||||
|
||||
import ghidra.program.model.data.ArchiveType;
|
||||
import ghidra.program.model.data.SourceArchive;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextPane;
|
||||
import javax.swing.text.*;
|
||||
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.program.model.data.ArchiveType;
|
||||
import ghidra.program.model.data.SourceArchive;
|
||||
import ghidra.util.Msg;
|
||||
|
||||
/**
|
||||
* Panel to show the contents of a Source Archive.
|
||||
*/
|
||||
|
@ -58,19 +59,19 @@ class SourceArchivePanel extends JPanel {
|
|||
|
||||
headingAttrSet = new SimpleAttributeSet();
|
||||
headingAttrSet.addAttribute(StyleConstants.FontFamily, "Monospaced");
|
||||
headingAttrSet.addAttribute(StyleConstants.FontSize, new Integer(12));
|
||||
headingAttrSet.addAttribute(StyleConstants.Foreground, Color.BLUE);
|
||||
headingAttrSet.addAttribute(StyleConstants.FontSize, 12);
|
||||
headingAttrSet.addAttribute(StyleConstants.Foreground, Palette.BLUE);
|
||||
|
||||
valueAttrSet = new SimpleAttributeSet();
|
||||
valueAttrSet.addAttribute(StyleConstants.FontFamily, "Tahoma");
|
||||
valueAttrSet.addAttribute(StyleConstants.FontSize, new Integer(11));
|
||||
valueAttrSet.addAttribute(StyleConstants.FontSize, 11);
|
||||
valueAttrSet.addAttribute(StyleConstants.Bold, Boolean.TRUE);
|
||||
|
||||
deletedAttrSet = new SimpleAttributeSet();
|
||||
deletedAttrSet.addAttribute(StyleConstants.FontFamily, "Tahoma");
|
||||
deletedAttrSet.addAttribute(StyleConstants.FontSize, new Integer(12));
|
||||
deletedAttrSet.addAttribute(StyleConstants.FontSize, 12);
|
||||
deletedAttrSet.addAttribute(StyleConstants.Bold, Boolean.TRUE);
|
||||
deletedAttrSet.addAttribute(StyleConstants.Foreground, Color.RED);
|
||||
deletedAttrSet.addAttribute(StyleConstants.Foreground, Palette.RED);
|
||||
|
||||
setSourceArchive(null);
|
||||
}
|
||||
|
@ -128,21 +129,14 @@ class SourceArchivePanel extends JPanel {
|
|||
insertString((sourceArchive.isDirty() ? "yes" : "no") + "\n", valueAttrSet);
|
||||
}
|
||||
|
||||
// private String pad(String str, int length) {
|
||||
// StringBuffer sb = new StringBuffer(str);
|
||||
// int len = length - str.length();
|
||||
// for (int i=0; i<len; i++) {
|
||||
// sb.append(" ");
|
||||
// }
|
||||
// return sb.toString();
|
||||
// }
|
||||
//
|
||||
private void insertString(String str, SimpleAttributeSet attributeSet) {
|
||||
int offset = doc.getLength();
|
||||
|
||||
try {
|
||||
doc.insertString(offset, str, attributeSet);
|
||||
} catch (BadLocationException e1) {
|
||||
}
|
||||
catch (BadLocationException e1) {
|
||||
Msg.debug(this, "Exception entering text", e1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import javax.swing.*;
|
|||
import javax.swing.border.TitledBorder;
|
||||
|
||||
import docking.widgets.label.GDHtmlLabel;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.app.merge.util.ConflictUtility;
|
||||
import ghidra.program.model.address.*;
|
||||
import ghidra.util.HTMLUtilities;
|
||||
|
@ -152,12 +153,13 @@ public class ConflictInfoPanel extends JPanel {
|
|||
}
|
||||
|
||||
private void addCount(StringBuffer buf, long value) {
|
||||
buf.append("<font color=\"#990000\">" + value + "</font>");
|
||||
buf.append("<font color=\"" + Palette.MAROON + "\">" + value + "</font>");
|
||||
}
|
||||
|
||||
private void addAddress(StringBuffer buf, Address addr) {
|
||||
buf.append(
|
||||
"<font color=\"#990000\">" + HTMLUtilities.escapeHTML(addr.toString()) + "</font>");
|
||||
"<font color=\"" + Palette.MAROON + "\">" + HTMLUtilities.escapeHTML(addr.toString()) +
|
||||
"</font>");
|
||||
}
|
||||
|
||||
private void updateWest() {
|
||||
|
|
|
@ -21,6 +21,7 @@ import javax.swing.*;
|
|||
import javax.swing.border.TitledBorder;
|
||||
|
||||
import docking.widgets.label.GDHtmlLabel;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.app.merge.util.ConflictUtility;
|
||||
|
||||
/**
|
||||
|
@ -103,11 +104,11 @@ public class ExternalConflictInfoPanel extends JPanel {
|
|||
}
|
||||
|
||||
private void addCount(StringBuffer buf, int value) {
|
||||
buf.append("<font color=\"#990000\">" + value + "</font>");
|
||||
buf.append("<font color=\"" + Palette.MAROON + "\">" + value + "</font>");
|
||||
}
|
||||
|
||||
private void addName(StringBuffer buf, String name) {
|
||||
buf.append("<font color=\"#990000\">" + name + "</font>");
|
||||
buf.append("<font color=\"" + Palette.MAROON + "\">" + name + "</font>");
|
||||
}
|
||||
|
||||
private void updateWest() {
|
||||
|
|
|
@ -15,15 +15,14 @@
|
|||
*/
|
||||
package ghidra.app.merge.listing;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.*;
|
||||
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||
import ghidra.app.merge.*;
|
||||
import ghidra.app.util.HelpTopics;
|
||||
import ghidra.program.database.function.FunctionManagerDB;
|
||||
|
@ -102,7 +101,6 @@ public class FunctionTagMerger implements MergeResolver, ListingMergeConstants {
|
|||
// the middle of resolving multiple conflicts.
|
||||
private long currentlyMergingTagID;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
@ -160,7 +158,6 @@ public class FunctionTagMerger implements MergeResolver, ListingMergeConstants {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void merge(TaskMonitor monitor) throws Exception {
|
||||
autoMerge();
|
||||
|
@ -270,7 +267,7 @@ public class FunctionTagMerger implements MergeResolver, ListingMergeConstants {
|
|||
// If the source program tag doesn't exist then the user has chosen to
|
||||
// keep a deleted tag, so make sure the corresponding tag in Result
|
||||
// is deleted as well.
|
||||
if (tag == null ) {
|
||||
if (tag == null) {
|
||||
if (resultTag != null) {
|
||||
resultTag.delete();
|
||||
}
|
||||
|
@ -279,7 +276,8 @@ public class FunctionTagMerger implements MergeResolver, ListingMergeConstants {
|
|||
// If the source tag exists, but the Result tag doesn't, we have to create a new
|
||||
// one in Result.
|
||||
else if (resultTag == null) {
|
||||
functionManagerDBResult.getFunctionTagManager().createFunctionTag(tag.getName(),
|
||||
functionManagerDBResult.getFunctionTagManager()
|
||||
.createFunctionTag(tag.getName(),
|
||||
tag.getComment());
|
||||
}
|
||||
|
||||
|
@ -574,9 +572,7 @@ public class FunctionTagMerger implements MergeResolver, ListingMergeConstants {
|
|||
private void showMergePanel(long id, TaskMonitor monitor) {
|
||||
|
||||
try {
|
||||
final ChangeListener changeListener = new ChangeListener() {
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
final ChangeListener changeListener = e -> {
|
||||
conflictOption = conflictPanel.getSelectedOptions();
|
||||
if (conflictOption == ASK_USER || conflictOption == CANCELED) {
|
||||
if (mergeManager != null) {
|
||||
|
@ -597,14 +593,8 @@ public class FunctionTagMerger implements MergeResolver, ListingMergeConstants {
|
|||
// user cancel - no need to log
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
SwingUtilities.invokeAndWait(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setupConflictPanel(id, changeListener, monitor);
|
||||
}
|
||||
});
|
||||
SwingUtilities.invokeAndWait(() -> setupConflictPanel(id, changeListener, monitor));
|
||||
}
|
||||
catch (InterruptedException | InvocationTargetException e) {
|
||||
Msg.error(this, "Unexpected error showing merge panel for tag " + id, e);
|
||||
|
@ -712,19 +702,20 @@ public class FunctionTagMerger implements MergeResolver, ListingMergeConstants {
|
|||
* @return
|
||||
*/
|
||||
private String getConflictInfo(TaskMonitor monitor) {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append(
|
||||
"<center><b>" + "Resolving conflict " + (monitor.getProgress() + 1) + " of " +
|
||||
tagConflicts.size() + "</b></center>");
|
||||
buf.append(HTMLUtilities.HTML_NEW_LINE);
|
||||
buf.append("Tag Id:");
|
||||
buf.append(HTMLUtilities.spaces(21));
|
||||
buf.append(HTMLUtilities.colorString(Color.BLUE, String.valueOf(currentlyMergingTagID)));
|
||||
buf.append(
|
||||
HTMLUtilities.colorString(Messages.NORMAL, String.valueOf(currentlyMergingTagID)));
|
||||
buf.append(HTMLUtilities.HTML_NEW_LINE);
|
||||
buf.append("Reason for Conflict:");
|
||||
buf.append(HTMLUtilities.spaces(1));
|
||||
buf.append(
|
||||
HTMLUtilities.colorString(Color.BLUE, tagConflicts.get(currentlyMergingTagID)));
|
||||
HTMLUtilities.colorString(Messages.NORMAL, tagConflicts.get(currentlyMergingTagID)));
|
||||
buf.append(HTMLUtilities.HTML_NEW_LINE);
|
||||
buf.append(HTMLUtilities.HTML_NEW_LINE);
|
||||
|
||||
|
|
|
@ -15,22 +15,12 @@
|
|||
*/
|
||||
package ghidra.app.merge.listing;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.FontMetrics;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.ComponentListener;
|
||||
import java.awt.event.ItemEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.ButtonGroup;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.TitledBorder;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
@ -39,6 +29,7 @@ import docking.widgets.button.GRadioButton;
|
|||
import docking.widgets.checkbox.GCheckBox;
|
||||
import docking.widgets.label.GDHtmlLabel;
|
||||
import docking.widgets.label.GLabel;
|
||||
import generic.theme.GThemeDefaults.Colors.Java;
|
||||
import ghidra.app.merge.util.ConflictUtility;
|
||||
import ghidra.util.HTMLUtilities;
|
||||
import ghidra.util.layout.MaximizeSpecificColumnGridLayout;
|
||||
|
@ -55,7 +46,7 @@ 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);
|
||||
BorderFactory.createMatteBorder(0, 0, 1, 0, Java.BORDER);
|
||||
|
||||
private JPanel rowPanel;
|
||||
private GDHtmlLabel headerLabel;
|
||||
|
@ -76,7 +67,7 @@ public class VariousChoicesPanel extends ConflictPanel {
|
|||
|
||||
/**
|
||||
* Constructor for a various choices panel.
|
||||
* @param isDoubleBuffered
|
||||
* @param isDoubleBuffered true if double buffered
|
||||
*/
|
||||
public VariousChoicesPanel(boolean isDoubleBuffered) {
|
||||
super(isDoubleBuffered);
|
||||
|
@ -199,9 +190,7 @@ public class VariousChoicesPanel extends ConflictPanel {
|
|||
MyRadioButton[] rb = new MyRadioButton[choices.length];
|
||||
final int row = rows.size();
|
||||
final ChoiceRow choiceRow = new ChoiceRow(titleComp, rb);
|
||||
ItemListener itemListener = new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
ItemListener itemListener = e -> {
|
||||
adjustUseForAllEnablement();
|
||||
if (listener != null) {
|
||||
Object source = e.getSource();
|
||||
|
@ -211,7 +200,6 @@ public class VariousChoicesPanel extends ConflictPanel {
|
|||
listener.stateChanged(re);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
ButtonGroup group = new ButtonGroup();
|
||||
for (int i = 0; i < choices.length; i++) {
|
||||
|
@ -246,16 +234,13 @@ public class VariousChoicesPanel extends ConflictPanel {
|
|||
MyCheckBox[] cb = new MyCheckBox[choices.length];
|
||||
final int row = rows.size();
|
||||
final ChoiceRow choiceRow = new ChoiceRow(titleComp, cb);
|
||||
ItemListener itemListener = new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
ItemListener itemListener = e -> {
|
||||
adjustUseForAllEnablement();
|
||||
if (listener != null) {
|
||||
ResolveConflictChangeEvent re =
|
||||
new ResolveConflictChangeEvent(e.getSource(), row, choiceRow.getChoice());
|
||||
listener.stateChanged(re);
|
||||
}
|
||||
}
|
||||
};
|
||||
for (int i = 0; i < choices.length; i++) {
|
||||
cb[i] = new MyCheckBox(choices[i]);
|
||||
|
@ -291,8 +276,8 @@ public class VariousChoicesPanel extends ConflictPanel {
|
|||
|
||||
rowPanel.add(choiceRow.titleLabel);
|
||||
|
||||
for (int i = 0; i < choiceRow.rb.length; i++) {
|
||||
rowPanel.add(choiceRow.rb[i]);
|
||||
for (JComponent element : choiceRow.rb) {
|
||||
rowPanel.add(element);
|
||||
}
|
||||
if (row == 0) {
|
||||
add(rowPanel, BorderLayout.CENTER);
|
||||
|
@ -303,8 +288,8 @@ public class VariousChoicesPanel extends ConflictPanel {
|
|||
ChoiceRow cr = rows.get(rowNum);
|
||||
rowPanel.remove(cr.titleLabel);
|
||||
JComponent[] comps = cr.rb;
|
||||
for (int i = 0; i < comps.length; i++) {
|
||||
rowPanel.remove(comps[i]);
|
||||
for (JComponent comp : comps) {
|
||||
rowPanel.remove(comp);
|
||||
}
|
||||
rows.remove(rowNum);
|
||||
}
|
||||
|
@ -404,8 +389,7 @@ public class VariousChoicesPanel extends ConflictPanel {
|
|||
}
|
||||
|
||||
private void removeListeners(ChoiceRow cr) {
|
||||
for (int i = 0; i < cr.rb.length; i++) {
|
||||
JComponent comp = cr.rb[i];
|
||||
for (JComponent comp : cr.rb) {
|
||||
if (comp instanceof MyRadioButton) {
|
||||
MyRadioButton rb = (MyRadioButton) comp;
|
||||
ItemListener[] listeners = rb.getItemListeners();
|
||||
|
@ -496,8 +480,8 @@ public class VariousChoicesPanel extends ConflictPanel {
|
|||
}
|
||||
|
||||
boolean hasChoices() {
|
||||
for (int i = 0; i < rb.length; i++) {
|
||||
if ((rb[i] instanceof MyRadioButton) || (rb[i] instanceof MyCheckBox)) {
|
||||
for (JComponent element : rb) {
|
||||
if ((element instanceof MyRadioButton) || (element instanceof MyCheckBox)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,27 +15,12 @@
|
|||
*/
|
||||
package ghidra.app.merge.listing;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Font;
|
||||
import java.awt.FontMetrics;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.ComponentListener;
|
||||
import java.awt.event.ItemEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.ListIterator;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.ButtonGroup;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JRadioButton;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.TitledBorder;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
@ -44,6 +29,7 @@ import docking.widgets.button.GRadioButton;
|
|||
import docking.widgets.checkbox.GCheckBox;
|
||||
import docking.widgets.label.GDHtmlLabel;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import generic.theme.GThemeDefaults.Colors.Java;
|
||||
import ghidra.app.merge.util.ConflictUtility;
|
||||
import ghidra.util.HTMLUtilities;
|
||||
import ghidra.util.datastruct.LongArrayList;
|
||||
|
@ -88,17 +74,11 @@ public class VerticalChoicesPanel extends ConflictPanel {
|
|||
private Insets textVsButtonInsets;
|
||||
private Insets textVsCheckBoxInsets;
|
||||
|
||||
/**
|
||||
* Creates an empty <CODE>VerticalChoicesPanel</CODE>
|
||||
*/
|
||||
public VerticalChoicesPanel() {
|
||||
super();
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param isDoubleBuffered
|
||||
*/
|
||||
public VerticalChoicesPanel(boolean isDoubleBuffered) {
|
||||
super(isDoubleBuffered);
|
||||
init();
|
||||
|
@ -179,8 +159,8 @@ public class VerticalChoicesPanel extends ConflictPanel {
|
|||
JComponent[] headerComps = getRowComponents(0);
|
||||
if (headerComps != null) {
|
||||
// remove the header
|
||||
for (int i = 0; i < headerComps.length; i++) {
|
||||
rowPanel.remove(headerComps[i]);
|
||||
for (JComponent headerComp : headerComps) {
|
||||
rowPanel.remove(headerComp);
|
||||
}
|
||||
headerComps = null;
|
||||
if (rowComps.isEmpty()) {
|
||||
|
@ -196,7 +176,8 @@ public class VerticalChoicesPanel extends ConflictPanel {
|
|||
else {
|
||||
rowTypes.set(0, (long) HEADER);
|
||||
}
|
||||
if ((items != null) && (items.length > 0)) {
|
||||
|
||||
if (items.length > 0) {
|
||||
if (rows.isEmpty()) {
|
||||
rows.add(0, items);
|
||||
}
|
||||
|
@ -209,7 +190,7 @@ public class VerticalChoicesPanel extends ConflictPanel {
|
|||
headerComps[i] = new MyLabel(items[i]);
|
||||
headerComps[i].setName(getComponentName(0, i));
|
||||
setRowComponent(headerComps[i], 0, i, defaultInsets);
|
||||
headerComps[i].setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.BLACK));
|
||||
headerComps[i].setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Java.BORDER));
|
||||
}
|
||||
}
|
||||
rowPanel.validate();
|
||||
|
@ -278,15 +259,12 @@ public class VerticalChoicesPanel extends ConflictPanel {
|
|||
final MyRadioButton firstComp = new MyRadioButton(items[0], conflictOption);
|
||||
group.add(firstComp);
|
||||
firstComp.setName(name);
|
||||
ItemListener itemListener = new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
ItemListener itemListener = e -> {
|
||||
if (listener != null && ((JRadioButton) e.getSource()).isSelected()) {
|
||||
ResolveConflictChangeEvent event =
|
||||
new ResolveConflictChangeEvent(firstComp, row, getSelectedOptions());
|
||||
listener.stateChanged(event);
|
||||
}
|
||||
}
|
||||
};
|
||||
firstComp.addItemListener(itemListener);
|
||||
setRowComponent(firstComp, row, 0, defaultInsets);
|
||||
|
@ -315,13 +293,10 @@ public class VerticalChoicesPanel extends ConflictPanel {
|
|||
rows.add(items);
|
||||
MyCheckBox firstComp = new MyCheckBox(items[0], conflictOption);
|
||||
firstComp.setName(name);
|
||||
ItemListener itemListener = new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
ItemListener itemListener = e -> {
|
||||
if (listener != null) {
|
||||
listener.stateChanged(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
firstComp.addItemListener(itemListener);
|
||||
setRowComponent(firstComp, row, 0, defaultInsets);
|
||||
|
@ -432,9 +407,6 @@ public class VerticalChoicesPanel extends ConflictPanel {
|
|||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
protected int getSelectedOptions() {
|
||||
int option = 0;
|
||||
for (int row = 0; row < rows.size(); row++) {
|
||||
|
@ -449,11 +421,6 @@ public class VerticalChoicesPanel extends ConflictPanel {
|
|||
return option;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param row
|
||||
* @param i
|
||||
* @return
|
||||
*/
|
||||
private JComponent getComponent(int row, int column) {
|
||||
JComponent[] comps = getRowComponents(row);
|
||||
if (column < comps.length) {
|
||||
|
@ -639,8 +606,7 @@ public class VerticalChoicesPanel extends ConflictPanel {
|
|||
int rowCount = rowComps.size();
|
||||
for (int row = 0; row < rowCount; row++) {
|
||||
JComponent[] comps = getRowComponents(row);
|
||||
for (int i = 0; i < comps.length; i++) {
|
||||
JComponent component = comps[i];
|
||||
for (JComponent component : comps) {
|
||||
if (component instanceof MyRadioButton &&
|
||||
((MyRadioButton) component).isSelected()) {
|
||||
conflictOption |= ((MyRadioButton) component).option;
|
||||
|
@ -666,8 +632,8 @@ public class VerticalChoicesPanel extends ConflictPanel {
|
|||
*/
|
||||
@Override
|
||||
public boolean hasChoice() {
|
||||
for (Iterator<Long> iterator = rowTypes.iterator(); iterator.hasNext();) {
|
||||
long rowType = iterator.next().longValue();
|
||||
for (Long rowType2 : rowTypes) {
|
||||
long rowType = rowType2.longValue();
|
||||
if (rowType == RADIO_BUTTON || rowType == CHECK_BOX) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@ import javax.swing.*;
|
|||
|
||||
import docking.widgets.label.GDLabel;
|
||||
import docking.widgets.label.GIconLabel;
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||
import ghidra.util.layout.PairLayout;
|
||||
import resources.ResourceManager;
|
||||
|
||||
|
@ -42,8 +44,8 @@ class TreeChangePanel extends JPanel {
|
|||
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;
|
||||
private final static Color CHANGED_COLOR = Colors.FOREGROUND;
|
||||
private final static Color NO_CHANGE_COLOR = Messages.HINT;
|
||||
|
||||
TreeChangePanel(String title) {
|
||||
super(new BorderLayout());
|
||||
|
|
|
@ -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,12 +16,13 @@
|
|||
package ghidra.app.merge.util;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.text.*;
|
||||
|
||||
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||
import ghidra.app.merge.MergeConstants;
|
||||
import ghidra.util.Msg;
|
||||
|
||||
/**
|
||||
* Panel that shows the current conflict number and the total number of
|
||||
|
@ -45,6 +45,7 @@ public class ConflictCountPanel extends JPanel {
|
|||
super(new BorderLayout());
|
||||
create();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the counts, e.g., Conflict # 1 of 3.
|
||||
* @param currentCount current
|
||||
|
@ -57,12 +58,14 @@ public class ConflictCountPanel extends JPanel {
|
|||
try {
|
||||
doc.insertString(offset, "Conflict # ", textAttrSet);
|
||||
offset = doc.getLength();
|
||||
doc.insertString(offset, " "+currentCount +" ", countAttrSet);
|
||||
doc.insertString(offset, " " + currentCount + " ", countAttrSet);
|
||||
offset = doc.getLength();
|
||||
doc.insertString(offset, " of ", textAttrSet);
|
||||
offset = doc.getLength();
|
||||
doc.insertString(offset, " "+totalCount +" ", countAttrSet);
|
||||
} catch (BadLocationException e) {
|
||||
doc.insertString(offset, " " + totalCount + " ", countAttrSet);
|
||||
}
|
||||
catch (BadLocationException e) {
|
||||
Msg.debug(this, "Exception updating text", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -81,10 +84,10 @@ public class ConflictCountPanel extends JPanel {
|
|||
|
||||
SimpleAttributeSet set = new SimpleAttributeSet();
|
||||
set.addAttribute(StyleConstants.Bold, Boolean.TRUE);
|
||||
set.addAttribute(StyleConstants.Foreground, Color.RED);
|
||||
set.addAttribute(StyleConstants.Foreground, Messages.ERROR);
|
||||
|
||||
textAttrSet = new SimpleAttributeSet();
|
||||
textAttrSet.addAttribute(StyleConstants.FontSize, new Integer(12));
|
||||
textAttrSet.addAttribute(StyleConstants.FontSize, 12);
|
||||
|
||||
countAttrSet = new SimpleAttributeSet();
|
||||
countAttrSet.addAttribute(StyleConstants.Bold, Boolean.TRUE);
|
||||
|
|
|
@ -20,24 +20,24 @@ import java.awt.Color;
|
|||
|
||||
import javax.swing.*;
|
||||
|
||||
import generic.theme.GColor;
|
||||
|
||||
public class DecoratorPanel extends JPanel {
|
||||
|
||||
private static final Color DISCONNECTED = new GColor("color.border.provider.disconnected");
|
||||
|
||||
public DecoratorPanel(JComponent component, boolean isConnected) {
|
||||
setLayout(new BorderLayout());
|
||||
add(component);
|
||||
setConnected( isConnected );
|
||||
setConnected(isConnected);
|
||||
}
|
||||
|
||||
public void setConnected( boolean isConnected ) {
|
||||
if ( !isConnected ) {
|
||||
setBorder( BorderFactory.createLineBorder( Color.ORANGE, 2 ) );
|
||||
public void setConnected(boolean isConnected) {
|
||||
if (!isConnected) {
|
||||
setBorder(BorderFactory.createLineBorder(DISCONNECTED, 2));
|
||||
}
|
||||
else {
|
||||
setBorder( BorderFactory.createEmptyBorder() );
|
||||
setBorder(BorderFactory.createEmptyBorder());
|
||||
}
|
||||
}
|
||||
|
||||
// public void setNorthPanel(JComponent comp) {
|
||||
// add(comp, BorderLayout.NORTH);
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -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,18 @@
|
|||
*/
|
||||
package ghidra.app.nav;
|
||||
|
||||
import ghidra.app.util.viewer.util.TitledPanel;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import generic.theme.GColor;
|
||||
import ghidra.app.util.viewer.util.TitledPanel;
|
||||
|
||||
public class ListingPanelContainer extends JPanel {
|
||||
|
||||
private static final Color DISCONNECTED = new GColor("color.border.provider.disconnected");
|
||||
|
||||
private JSplitPane splitPane;
|
||||
private TitledPanel leftTitlePanel;
|
||||
private TitledPanel rightTitlePanelPanel;
|
||||
|
@ -35,7 +37,7 @@ public class ListingPanelContainer extends JPanel {
|
|||
this.leftListingPanel = leftListingPanel;
|
||||
setLayout(new BorderLayout());
|
||||
add(leftListingPanel);
|
||||
setConnnected( isConnected );
|
||||
setConnnected(isConnected);
|
||||
}
|
||||
|
||||
public ListingPanelContainer(JComponent leftListingPanel, JComponent rightListingPanel,
|
||||
|
@ -46,12 +48,12 @@ public class ListingPanelContainer extends JPanel {
|
|||
setOtherPanel(rightListingPanel, leftTitle, rightTitle);
|
||||
}
|
||||
|
||||
public void setConnnected( boolean isConnected ) {
|
||||
if ( !isConnected ) {
|
||||
setBorder( BorderFactory.createLineBorder( Color.ORANGE, 2 ) );
|
||||
public void setConnnected(boolean isConnected) {
|
||||
if (!isConnected) {
|
||||
setBorder(BorderFactory.createLineBorder(DISCONNECTED, 2));
|
||||
}
|
||||
else {
|
||||
setBorder( BorderFactory.createEmptyBorder() );
|
||||
setBorder(BorderFactory.createEmptyBorder());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,7 +61,8 @@ public class ListingPanelContainer extends JPanel {
|
|||
removeAll();
|
||||
leftTitlePanel = new TitledPanel(leftTitle, leftListingPanel, 20);
|
||||
rightTitlePanelPanel = new TitledPanel(rightTitle, rightListingPanel, 20);
|
||||
splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftTitlePanel, rightTitlePanelPanel);
|
||||
splitPane =
|
||||
new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftTitlePanel, rightTitlePanelPanel);
|
||||
splitPane.setDividerLocation(0.5);
|
||||
splitPane.setResizeWeight(0.5);
|
||||
add(splitPane, BorderLayout.CENTER);
|
||||
|
@ -83,7 +86,8 @@ public class ListingPanelContainer extends JPanel {
|
|||
}
|
||||
|
||||
public void setOrientation(boolean isSideBySide) {
|
||||
splitPane.setOrientation(isSideBySide ? JSplitPane.HORIZONTAL_SPLIT : JSplitPane.VERTICAL_SPLIT);
|
||||
splitPane.setOrientation(
|
||||
isSideBySide ? JSplitPane.HORIZONTAL_SPLIT : JSplitPane.VERTICAL_SPLIT);
|
||||
splitPane.setDividerLocation(0.5);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ import java.awt.Point;
|
|||
import javax.swing.Icon;
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import resources.MultiIcon;
|
||||
import resources.ResourceManager;
|
||||
import resources.icons.OvalColorIcon;
|
||||
|
@ -50,7 +51,7 @@ public class NavigatableIconFactory {
|
|||
private static ImageIcon getHighlightIcon(Icon primaryIcon) {
|
||||
int primaryWidth = primaryIcon.getIconWidth();
|
||||
int primaryHeight = primaryIcon.getIconHeight();
|
||||
Color color = new Color(255, 255, 0, 255);
|
||||
Color color = Palette.YELLOW;
|
||||
return ResourceManager.getImageIcon(
|
||||
new OvalColorIcon(color, primaryWidth + 4, primaryHeight + 4));
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import docking.widgets.dialogs.MultiLineMessageDialog;
|
|||
import docking.widgets.filechooser.GhidraFileChooser;
|
||||
import docking.widgets.filechooser.GhidraFileChooserMode;
|
||||
import generic.jar.ResourceFile;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.app.plugin.core.analysis.AnalysisWorker;
|
||||
import ghidra.app.plugin.core.analysis.AutoAnalysisManager;
|
||||
import ghidra.app.plugin.core.colorizer.ColorizingService;
|
||||
|
@ -421,8 +422,8 @@ public abstract class GhidraScript extends FlatProgramAPI {
|
|||
null,
|
||||
"Keep Changes?",
|
||||
message,
|
||||
"<html>No (<font color=\"red\">discard</font> changes)",
|
||||
"<html>Yes (<font color=\"green\">keep</font> changes)",
|
||||
"<html>No (<font color=\""+Palette.RED+"\">discard</font> changes)",
|
||||
"<html>Yes (<font color=\""+Palette.GREEN+"\">keep</font> changes)",
|
||||
OptionDialog.QUESTION_MESSAGE);
|
||||
//@formatter:on
|
||||
|
||||
|
@ -3684,7 +3685,7 @@ public abstract class GhidraScript extends FlatProgramAPI {
|
|||
state.getTool(), currentProgram, addresses);
|
||||
TableComponentProvider<Address> tableProvider =
|
||||
table.showTableWithMarkers(title + " " + model.getName(), "GhidraScript", model,
|
||||
Color.GREEN, null, "Script Results", null);
|
||||
Palette.GREEN, null, "Script Results", null);
|
||||
tableProvider.installRemoveItemsAction();
|
||||
};
|
||||
Swing.runLater(runnable);
|
||||
|
@ -3701,7 +3702,7 @@ public abstract class GhidraScript extends FlatProgramAPI {
|
|||
AddressSetTableModel model =
|
||||
new AddressSetTableModel(title, state.getTool(), currentProgram, addresses, null);
|
||||
TableComponentProvider<Address> tableProvider = table.showTableWithMarkers(title,
|
||||
"GhidraScript", model, Color.GREEN, null, "Script Results", null);
|
||||
"GhidraScript", model, Palette.GREEN, null, "Script Results", null);
|
||||
tableProvider.installRemoveItemsAction();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -29,6 +29,8 @@ import docking.DialogComponentProvider;
|
|||
import docking.action.DockingAction;
|
||||
import docking.widgets.table.*;
|
||||
import docking.widgets.table.threaded.ThreadedTableModel;
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.app.nav.Navigatable;
|
||||
import ghidra.app.nav.NavigatableRemovalListener;
|
||||
import ghidra.app.services.GoToService;
|
||||
|
@ -418,7 +420,7 @@ public class TableChooserDialog extends DialogComponentProvider
|
|||
|
||||
private class WrappingCellRenderer extends GhidraTableCellRenderer {
|
||||
|
||||
private Color pendingColor = new Color(192, 192, 192, 75);
|
||||
private Color pendingColor = Palette.LIGHT_GRAY;
|
||||
private TableCellRenderer delegate;
|
||||
|
||||
@Override
|
||||
|
@ -443,7 +445,7 @@ public class TableChooserDialog extends DialogComponentProvider
|
|||
if (sharedPending.contains(ro)) {
|
||||
renderer.setBackground(pendingColor);
|
||||
renderer.setForeground(data.getTable().getSelectionForeground());
|
||||
renderer.setForeground(Color.BLACK);
|
||||
renderer.setForeground(Colors.FOREGROUND);
|
||||
}
|
||||
|
||||
return renderer;
|
||||
|
|
|
@ -22,6 +22,7 @@ import java.awt.event.ComponentListener;
|
|||
import javax.swing.*;
|
||||
|
||||
import docking.widgets.label.GDLabel;
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import ghidra.app.util.viewer.util.AddressPixelMap;
|
||||
import ghidra.program.model.mem.MemoryBlock;
|
||||
|
||||
|
@ -34,7 +35,7 @@ public class BlockPanel extends JPanel implements ComponentListener {
|
|||
|
||||
public BlockPanel() {
|
||||
super();
|
||||
setBackground(Color.WHITE);
|
||||
setBackground(Colors.BACKGROUND);
|
||||
addComponentListener(this);
|
||||
metrics = getFontMetrics(FONT);
|
||||
setPreferredSize(
|
||||
|
@ -44,7 +45,7 @@ public class BlockPanel extends JPanel implements ComponentListener {
|
|||
@Override
|
||||
public void paintComponent(Graphics g) {
|
||||
|
||||
g.setColor(Color.BLACK);
|
||||
g.setColor(Colors.FOREGROUND);
|
||||
g.setFont(FONT);
|
||||
int height = getHeight();
|
||||
|
||||
|
@ -53,8 +54,8 @@ public class BlockPanel extends JPanel implements ComponentListener {
|
|||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < blocks.length; i++) {
|
||||
Rectangle rect = map.getBlockPosition(blocks[i]);
|
||||
for (MemoryBlock block : blocks) {
|
||||
Rectangle rect = map.getBlockPosition(block);
|
||||
g.drawLine(rect.x, 0, rect.x, height - 1);
|
||||
}
|
||||
g.drawLine(getWidth() - 1, 0, getWidth() - 1, height - 1);
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.awt.Component;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import ghidra.GhidraOptions;
|
||||
import ghidra.app.util.viewer.options.OptionsGui;
|
||||
import ghidra.app.util.viewer.options.ScreenElement;
|
||||
|
@ -431,7 +432,7 @@ public class SymbolInspector implements OptionsChangeListener {
|
|||
|
||||
private Color getColor(ScreenElement se) {
|
||||
if (se == null) {
|
||||
return Color.BLACK;
|
||||
return Colors.BACKGROUND;
|
||||
}
|
||||
String optionName = se.getColorOptionName();
|
||||
Color color = (Color) cache.get(optionName);
|
||||
|
|
|
@ -23,6 +23,8 @@ import java.util.List;
|
|||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import generic.theme.GColor;
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import ghidra.app.util.html.*;
|
||||
import ghidra.app.util.viewer.options.OptionsGui;
|
||||
import ghidra.program.model.address.Address;
|
||||
|
@ -42,7 +44,8 @@ import ghidra.util.StringUtilities;
|
|||
*/
|
||||
public class ToolTipUtils {
|
||||
|
||||
private static final Color PARAM_NAME_COLOR = new Color(155, 50, 155);
|
||||
private static final Color FG_FUNCTION_NAME = new GColor("color.fg.function.name");
|
||||
private static final Color PARAM_NAME_COLOR = new GColor("color.fg.function.params");
|
||||
private static final Color PARAM_CUSTOM_STORAGE_COLOR =
|
||||
OptionsGui.PARAMETER_CUSTOM.getDefaultColor();
|
||||
private static final Color PARAM_DYNAMIC_STORAGE_COLOR =
|
||||
|
@ -162,7 +165,7 @@ public class ToolTipUtils {
|
|||
dt = DataType.DEFAULT;
|
||||
}
|
||||
|
||||
buf.append(colorString(Color.BLACK, friendlyEncodeHTML(dt.getName())));
|
||||
buf.append(colorString(Colors.FOREGROUND, friendlyEncodeHTML(dt.getName())));
|
||||
buf.append(HTML_SPACE);
|
||||
buf.append(friendlyEncodeHTML(s.getName()));
|
||||
|
||||
|
@ -256,7 +259,7 @@ public class ToolTipUtils {
|
|||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("<tr><td width=10> </td>"); // indent
|
||||
buf.append("<td width=\"1%\">");
|
||||
buf.append(colorString(Color.BLACK, friendlyEncodeHTML(type)));
|
||||
buf.append(colorString(Colors.FOREGROUND, friendlyEncodeHTML(type)));
|
||||
buf.append("</td><td width=\"1%\">");
|
||||
|
||||
boolean usesCustomStorage = false;
|
||||
|
@ -301,7 +304,7 @@ public class ToolTipUtils {
|
|||
}
|
||||
|
||||
String functionName = StringUtilities.trimMiddle(function.getName(), LINE_LENGTH);
|
||||
buffy.append(colorString(Color.BLUE, friendlyEncodeHTML(functionName)));
|
||||
buffy.append(colorString(FG_FUNCTION_NAME, friendlyEncodeHTML(functionName)));
|
||||
buffy.append(HTML_SPACE).append("(");
|
||||
|
||||
buildParameterPreview(function, buffy);
|
||||
|
@ -399,7 +402,7 @@ public class ToolTipUtils {
|
|||
}
|
||||
|
||||
StringBuilder pb = new StringBuilder();
|
||||
pb.append(colorString(Color.BLACK, friendlyEncodeHTML(type)));
|
||||
pb.append(colorString(Colors.FOREGROUND, friendlyEncodeHTML(type)));
|
||||
pb.append(HTML_SPACE);
|
||||
|
||||
pb.append(colorString(PARAM_NAME_COLOR, friendlyEncodeHTML(name)));
|
||||
|
|
|
@ -19,6 +19,8 @@ import java.io.*;
|
|||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||
import ghidra.app.services.DataTypeManagerService;
|
||||
import ghidra.app.util.cparser.CPP.PreProcessor;
|
||||
import ghidra.framework.plugintool.ServiceProvider;
|
||||
|
@ -652,16 +654,16 @@ public class CParserUtils {
|
|||
StringBuffer successFailureBuffer = new StringBuffer();
|
||||
successFailureBuffer.append("<blockquote>");
|
||||
if (errorIndex == 0) {
|
||||
successFailureBuffer.append("<font color=\"red\"><b>");
|
||||
successFailureBuffer.append("<font color=\"" + Messages.ERROR + "\"><b>");
|
||||
successFailureBuffer.append(HTMLUtilities.friendlyEncodeHTML(functionString));
|
||||
successFailureBuffer.append("</b></font>");
|
||||
}
|
||||
else {
|
||||
successFailureBuffer.append("<font color=\"black\">");
|
||||
successFailureBuffer.append("<font color=\"" + Colors.FOREGROUND + "\">");
|
||||
successFailureBuffer.append(
|
||||
HTMLUtilities.friendlyEncodeHTML(functionString.substring(0, errorIndex)));
|
||||
successFailureBuffer.append("</font>");
|
||||
successFailureBuffer.append("<font color=\"red\"><b>");
|
||||
successFailureBuffer.append("<font color=\"" + Messages.ERROR + "\"><b>");
|
||||
successFailureBuffer.append(
|
||||
HTMLUtilities.friendlyEncodeHTML(functionString.substring(errorIndex)));
|
||||
successFailureBuffer.append("</b></font>");
|
||||
|
|
|
@ -18,6 +18,7 @@ package ghidra.app.util.exporter;
|
|||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||
import ghidra.app.util.DisplayableEol;
|
||||
import ghidra.framework.plugintool.ServiceProvider;
|
||||
import ghidra.program.model.address.Address;
|
||||
|
@ -372,7 +373,7 @@ class ProgramTextWriter {
|
|||
|
||||
buffy = new StringBuilder();
|
||||
if (options.isHTML()) {
|
||||
writer.print("<FONT COLOR=#ff0000>");
|
||||
writer.print("<FONT COLOR=\"" + Messages.ERROR + "\">");
|
||||
}
|
||||
processAddress(bytesRemovedRangeStart, null);
|
||||
buffy.append(" -> ");
|
||||
|
|
|
@ -20,6 +20,8 @@ import static ghidra.util.HTMLUtilities.*;
|
|||
import java.awt.Color;
|
||||
import java.util.*;
|
||||
|
||||
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.app.util.ToolTipUtils;
|
||||
import ghidra.app.util.html.diff.*;
|
||||
import ghidra.program.model.data.*;
|
||||
|
@ -162,7 +164,7 @@ public class CompositeDataTypeHTMLRepresentation extends HTMLDataTypeRepresentat
|
|||
Iterator<String> warnings = warningLines.iterator();
|
||||
for (; warnings.hasNext();) {
|
||||
String warning = warnings.next();
|
||||
String warningLine = wrapStringInColor(warning, Color.RED);
|
||||
String warningLine = wrapStringInColor(warning, Messages.ERROR);
|
||||
|
||||
//@formatter:off
|
||||
append(fullHtml, truncatedHtml, lineCount++, warningLine, BR);
|
||||
|
@ -226,7 +228,7 @@ public class CompositeDataTypeHTMLRepresentation extends HTMLDataTypeRepresentat
|
|||
|
||||
if (!(line instanceof DataTypeLine)) {
|
||||
append(fullHtml, truncatedHtml, lineCount++, TR_OPEN,
|
||||
"<TD COLSPAN=3><FONT COLOR=\"gray\">", TAB, TAB,
|
||||
"<TD COLSPAN=3><FONT COLOR=\"" + Palette.GRAY + "\">", TAB, TAB,
|
||||
line.getText(), "</FONT>", TD_CLOSE, TR_CLOSE);
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
*/
|
||||
package ghidra.app.util.html;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.*;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||
import ghidra.app.util.ToolTipUtils;
|
||||
import ghidra.app.util.html.diff.DataTypeDiff;
|
||||
import ghidra.app.util.html.diff.DataTypeDiffBuilder;
|
||||
|
@ -220,7 +220,7 @@ public class TypeDefDataTypeHTMLRepresentation extends HTMLDataTypeRepresentatio
|
|||
Iterator<String> warnings = warningLines.iterator();
|
||||
for (; warnings.hasNext();) {
|
||||
String warning = warnings.next();
|
||||
String warningLine = wrapStringInColor(warning, Color.RED);
|
||||
String warningLine = wrapStringInColor(warning, Messages.ERROR);
|
||||
buffy.append(warningLine).append(BR);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@ package ghidra.app.util.html;
|
|||
|
||||
import java.awt.Color;
|
||||
|
||||
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||
|
||||
/**
|
||||
* A loose concept that represents a line of text, potentially with multiple parts, that can
|
||||
* be validated against other instances and can change the color of the text.
|
||||
|
@ -26,7 +28,7 @@ import java.awt.Color;
|
|||
*/
|
||||
public interface ValidatableLine {
|
||||
|
||||
public static final Color INVALID_COLOR = Color.RED;
|
||||
public static final Color INVALID_COLOR = Messages.ERROR;
|
||||
|
||||
public void updateColor(ValidatableLine otherLine, Color invalidColor);
|
||||
|
||||
|
|
|
@ -15,6 +15,10 @@
|
|||
*/
|
||||
package ghidra.app.util.viewer.field;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import docking.widgets.fieldpanel.field.AttributedString;
|
||||
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||
import ghidra.app.nav.Navigatable;
|
||||
import ghidra.app.services.GoToService;
|
||||
import ghidra.framework.plugintool.ServiceProvider;
|
||||
|
@ -22,18 +26,14 @@ import ghidra.program.model.address.Address;
|
|||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.util.Msg;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import docking.widgets.fieldpanel.field.AttributedString;
|
||||
|
||||
/**
|
||||
* An annotated string handler that allows handles annotations that begin with
|
||||
* {@link #SUPPORTED_ANNOTATIONS}. This class expects one string following the annotation
|
||||
* text that is an address string and will display that string as its display text.
|
||||
*/
|
||||
public class AddressAnnotatedStringHandler implements AnnotatedStringHandler {
|
||||
private static final String INVALID_SYMBOL_TEXT = "@address annotation must have an address"
|
||||
+ "string";
|
||||
private static final String INVALID_SYMBOL_TEXT =
|
||||
"@address annotation must have an address" + "string";
|
||||
private static final String[] SUPPORTED_ANNOTATIONS = { "address", "addr" };
|
||||
|
||||
@Override
|
||||
|
@ -51,7 +51,7 @@ public class AddressAnnotatedStringHandler implements AnnotatedStringHandler {
|
|||
Address address = program.getAddressFactory().getAddress(text[1]);
|
||||
|
||||
if (address == null) {
|
||||
return new AttributedString("No address: " + text[1], Color.RED,
|
||||
return new AttributedString("No address: " + text[1], Messages.ERROR,
|
||||
prototypeString.getFontMetrics(0), false, null);
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,8 @@ public class AddressAnnotatedStringHandler implements AnnotatedStringHandler {
|
|||
prototypeString.getFontMetrics(0), true, prototypeString.getColor(0));
|
||||
}
|
||||
|
||||
private AttributedString createUndecoratedString(AttributedString prototypeString, String[] text) {
|
||||
private AttributedString createUndecoratedString(AttributedString prototypeString,
|
||||
String[] text) {
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
for (String string : text) {
|
||||
buffer.append(string).append(" ");
|
||||
|
@ -78,6 +79,7 @@ public class AddressAnnotatedStringHandler implements AnnotatedStringHandler {
|
|||
return new AttributedString(buffer.toString(), Color.LIGHT_GRAY,
|
||||
prototypeString.getFontMetrics(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getSupportedAnnotations() {
|
||||
return SUPPORTED_ANNOTATIONS;
|
||||
|
|
|
@ -21,6 +21,7 @@ import java.math.BigInteger;
|
|||
|
||||
import docking.widgets.fieldpanel.field.*;
|
||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import ghidra.app.util.HighlightProvider;
|
||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||
|
@ -39,7 +40,7 @@ import ghidra.util.exception.AssertException;
|
|||
*/
|
||||
public class AddressFieldFactory extends FieldFactory {
|
||||
public static final String FIELD_NAME = "Address";
|
||||
public static final Color DEFAULT_COLOR = Color.BLACK;
|
||||
public static final Color DEFAULT_COLOR = Colors.FOREGROUND;
|
||||
private final static String GROUP_TITLE = "Address Field";
|
||||
public final static String DISPLAY_BLOCK_NAME =
|
||||
GROUP_TITLE + Options.DELIMITER + "Display Block Name";
|
||||
|
|
|
@ -21,6 +21,7 @@ import java.util.ArrayList;
|
|||
|
||||
import docking.widgets.fieldpanel.field.*;
|
||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.app.util.HighlightProvider;
|
||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||
|
@ -35,7 +36,7 @@ import ghidra.program.util.ProgramLocation;
|
|||
*/
|
||||
public class AssignedVariableFieldFactory extends FieldFactory {
|
||||
public static final String FIELD_NAME = "Var Assign";
|
||||
public static final Color DEFAULT_COLOR = new Color(128, 0, 128);
|
||||
public static final Color DEFAULT_COLOR = Palette.PURPLE;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
|
@ -59,15 +60,9 @@ public class AssignedVariableFieldFactory extends FieldFactory {
|
|||
@Override
|
||||
public void fieldOptionsChanged(Options options, String optionName, Object oldValue,
|
||||
Object newValue) {
|
||||
|
||||
// stub
|
||||
}
|
||||
|
||||
// private static String getOffsetString(int offset) {
|
||||
// String offString =
|
||||
// (offset >= 0 ? Integer.toHexString(offset) : "-" + Integer.toHexString(-offset));
|
||||
// return offString;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Returns the FactoryField for the given object at index index.
|
||||
* @param varWidth the amount of variable width spacing for any fields
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.math.BigInteger;
|
|||
import docking.widgets.fieldpanel.field.*;
|
||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||
import docking.widgets.fieldpanel.support.RowColLocation;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.app.util.HighlightProvider;
|
||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||
|
@ -46,8 +47,8 @@ import ghidra.util.HelpLocation;
|
|||
public class BytesFieldFactory extends FieldFactory {
|
||||
private static final int CHARS_IN_BYTE = 2;
|
||||
public static final String FIELD_NAME = "Bytes";
|
||||
public static final Color DEFAULT_COLOR = Color.BLUE;
|
||||
public static final Color ALIGNMENT_BYTES_COLOR = Color.gray;
|
||||
public static final Color DEFAULT_COLOR = Palette.BLUE;
|
||||
public static final Color ALIGNMENT_BYTES_COLOR = Palette.GRAY;
|
||||
public final static String GROUP_TITLE = "Bytes Field";
|
||||
public final static String MAX_DISPLAY_LINES_MSG =
|
||||
GROUP_TITLE + Options.DELIMITER + "Maximum Lines To Display";
|
||||
|
@ -79,7 +80,7 @@ public class BytesFieldFactory extends FieldFactory {
|
|||
/**
|
||||
* Constructor
|
||||
* @param model the model that the field belongs to.
|
||||
* @param hsProvider the HightLightStringProvider.
|
||||
* @param hlProvider the HightLightStringProvider.
|
||||
* @param displayOptions the Options for display properties.
|
||||
* @param fieldOptions the Options for field specific properties.
|
||||
*/
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.util.regex.Pattern;
|
|||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import docking.widgets.fieldpanel.field.*;
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.util.StringUtilities;
|
||||
import ghidra.util.WordLocation;
|
||||
|
@ -96,7 +97,7 @@ public class CommentUtils {
|
|||
Font dummyFont = new Font("monospaced", Font.PLAIN, 12);
|
||||
@SuppressWarnings("deprecation")
|
||||
FontMetrics fontMetrics = Toolkit.getDefaultToolkit().getFontMetrics(dummyFont);
|
||||
return new AttributedString("", Color.BLACK, fontMetrics);
|
||||
return new AttributedString("", Colors.FOREGROUND, fontMetrics);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||
|
||||
import docking.widgets.fieldpanel.field.*;
|
||||
import docking.widgets.fieldpanel.support.*;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.app.util.*;
|
||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||
import ghidra.app.util.viewer.options.OptionsGui;
|
||||
|
@ -62,7 +63,7 @@ public class EolCommentFieldFactory extends FieldFactory {
|
|||
GROUP_TITLE + Options.DELIMITER + "Show Function Reference Automatic Comments";
|
||||
public final static String ENABLE_PREPEND_REF_ADDRESS_MSG =
|
||||
GROUP_TITLE + Options.DELIMITER + "Prepend the Address to Each Referenced Comment";
|
||||
public static final Color DEFAULT_COLOR = Color.BLUE;
|
||||
public static final Color DEFAULT_COLOR = Palette.BLUE;
|
||||
|
||||
private boolean isWordWrap;
|
||||
private int maxDisplayLines;
|
||||
|
|
|
@ -19,6 +19,8 @@ import java.awt.*;
|
|||
import java.math.BigInteger;
|
||||
|
||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.app.util.HighlightProvider;
|
||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||
import ghidra.app.util.viewer.options.OptionsGui;
|
||||
|
@ -46,7 +48,7 @@ public abstract class FieldFactory implements ExtensionPoint {
|
|||
protected int startX;
|
||||
protected int width;
|
||||
protected Color color;
|
||||
protected Color underlineColor = Color.BLUE;
|
||||
protected Color underlineColor = Palette.BLUE;
|
||||
private FontMetrics defaultMetrics;
|
||||
private FontMetrics[] fontMetrics = new FontMetrics[4];
|
||||
protected Font baseFont;
|
||||
|
@ -89,7 +91,7 @@ public abstract class FieldFactory implements ExtensionPoint {
|
|||
// For most fields (defined in optionsGui) these will be set. But "ad hoc" fields won't,
|
||||
// so register something. A second registration won't change the original
|
||||
|
||||
displayOptions.registerOption(colorOptionName, Color.BLACK, null,
|
||||
displayOptions.registerOption(colorOptionName, Colors.FOREGROUND, null,
|
||||
"Sets the " + colorOptionName);
|
||||
displayOptions.registerOption(styleOptionName, -1, null, "Sets the " + style);
|
||||
|
||||
|
@ -197,7 +199,7 @@ public abstract class FieldFactory implements ExtensionPoint {
|
|||
* @return the color.
|
||||
*/
|
||||
public Color getDefaultColor() {
|
||||
return Color.BLACK;
|
||||
return Colors.FOREGROUND;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
*/
|
||||
package ghidra.app.util.viewer.field;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.math.BigInteger;
|
||||
|
||||
import docking.widgets.fieldpanel.field.*;
|
||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.app.util.HighlightProvider;
|
||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||
import ghidra.app.util.viewer.options.OptionsGui;
|
||||
|
@ -47,8 +47,8 @@ public class FunctionPurgeFieldFactory extends FieldFactory {
|
|||
|
||||
@Override
|
||||
public FieldFactory newInstance(FieldFormatModel newModel, HighlightProvider newHlProvider,
|
||||
ToolOptions displayOptions, ToolOptions fieldOptions) {
|
||||
return new FunctionPurgeFieldFactory(newModel, newHlProvider, displayOptions, fieldOptions);
|
||||
ToolOptions toolOptions, ToolOptions fieldOptions) {
|
||||
return new FunctionPurgeFieldFactory(newModel, newHlProvider, toolOptions, fieldOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -79,7 +79,7 @@ public class FunctionPurgeFieldFactory extends FieldFactory {
|
|||
stringDepth = Integer.toHexString(depth);
|
||||
}
|
||||
}
|
||||
AttributedString as = new AttributedString(stringDepth, Color.BLUE, getMetrics());
|
||||
AttributedString as = new AttributedString(stringDepth, Palette.BLUE, getMetrics());
|
||||
FieldElement text = new TextFieldElement(as, 0, 0);
|
||||
return ListingTextField.createSingleLineTextField(this, proxy, text, startX + varWidth,
|
||||
width, hlProvider);
|
||||
|
|
|
@ -23,6 +23,8 @@ import java.util.List;
|
|||
import docking.widgets.fieldpanel.field.*;
|
||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||
import docking.widgets.fieldpanel.support.RowColLocation;
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.GhidraOptions;
|
||||
import ghidra.app.util.HighlightProvider;
|
||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||
|
@ -99,18 +101,22 @@ public class FunctionSignatureFieldFactory extends FieldFactory {
|
|||
public void displayOptionsChanged(Options options, String optionName, Object oldValue,
|
||||
Object newValue) {
|
||||
super.displayOptionsChanged(options, optionName, oldValue, newValue);
|
||||
funRetColor = options.getColor(OptionsGui.FUN_RET_TYPE.getColorOptionName(), Color.BLACK);
|
||||
funNameColor = options.getColor(OptionsGui.FUN_NAME.getColorOptionName(), Color.BLACK);
|
||||
funRetColor =
|
||||
options.getColor(OptionsGui.FUN_RET_TYPE.getColorOptionName(), Colors.FOREGROUND);
|
||||
funNameColor =
|
||||
options.getColor(OptionsGui.FUN_NAME.getColorOptionName(), Colors.FOREGROUND);
|
||||
unresolvedThunkRefColor =
|
||||
displayOptions.getColor(OptionsGui.BAD_REF_ADDR.getColorOptionName(),
|
||||
OptionsGui.BAD_REF_ADDR.getDefaultColor());
|
||||
resolvedThunkRefColor =
|
||||
displayOptions.getColor(OptionsGui.EXT_REF_RESOLVED.getColorOptionName(),
|
||||
OptionsGui.EXT_REF_RESOLVED.getDefaultColor());
|
||||
funParamsColor = options.getColor(OptionsGui.FUN_PARAMS.getColorOptionName(), Color.BLACK);
|
||||
funParamsColor =
|
||||
options.getColor(OptionsGui.FUN_PARAMS.getColorOptionName(), Colors.FOREGROUND);
|
||||
autoParamColor =
|
||||
options.getColor(OptionsGui.FUN_AUTO_PARAMS.getColorOptionName(), Color.GRAY);
|
||||
literalColor = options.getColor(OptionsGui.SEPARATOR.getColorOptionName(), Color.BLACK);
|
||||
options.getColor(OptionsGui.FUN_AUTO_PARAMS.getColorOptionName(), Palette.GRAY);
|
||||
literalColor =
|
||||
options.getColor(OptionsGui.SEPARATOR.getColorOptionName(), Colors.FOREGROUND);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -413,8 +419,8 @@ public class FunctionSignatureFieldFactory extends FieldFactory {
|
|||
|
||||
@Override
|
||||
public FieldFactory newInstance(FieldFormatModel formatModel, HighlightProvider provider,
|
||||
ToolOptions displayOptions, ToolOptions fieldOptions) {
|
||||
return new FunctionSignatureFieldFactory(formatModel, provider, displayOptions,
|
||||
ToolOptions toolOptions, ToolOptions fieldOptions) {
|
||||
return new FunctionSignatureFieldFactory(formatModel, provider, toolOptions,
|
||||
fieldOptions);
|
||||
}
|
||||
|
||||
|
@ -445,6 +451,7 @@ public class FunctionSignatureFieldFactory extends FieldFactory {
|
|||
* @param as the attributed string used to display this element.
|
||||
* @param row the row of the function signature where this field element starts.
|
||||
* @param column the column where this field element starts within the row.
|
||||
* @param functionSigIndex the function signature index
|
||||
*/
|
||||
FunctionSignatureFieldElement(AttributedString as, int row, int column,
|
||||
int functionSigIndex) {
|
||||
|
|
|
@ -21,6 +21,7 @@ import java.math.BigInteger;
|
|||
import docking.widgets.fieldpanel.field.AttributedString;
|
||||
import docking.widgets.fieldpanel.field.TextFieldElement;
|
||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import ghidra.app.util.HighlightProvider;
|
||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||
import ghidra.app.util.viewer.options.OptionsGui;
|
||||
|
@ -70,7 +71,8 @@ public class FunctionSignatureSourceFieldFactory extends FieldFactory {
|
|||
public void displayOptionsChanged(Options options, String optionName, Object oldValue,
|
||||
Object newValue) {
|
||||
super.displayOptionsChanged(options, optionName, oldValue, newValue);
|
||||
literalColor = options.getColor(OptionsGui.SEPARATOR.getColorOptionName(), Color.BLACK);
|
||||
literalColor =
|
||||
options.getColor(OptionsGui.SEPARATOR.getColorOptionName(), Colors.FOREGROUND);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -125,8 +127,8 @@ public class FunctionSignatureSourceFieldFactory extends FieldFactory {
|
|||
|
||||
@Override
|
||||
public FieldFactory newInstance(FieldFormatModel formatModel, HighlightProvider provider,
|
||||
ToolOptions displayOptions, ToolOptions fieldOptions) {
|
||||
return new FunctionSignatureSourceFieldFactory(formatModel, provider, displayOptions,
|
||||
ToolOptions toolOptions, ToolOptions fieldOptions) {
|
||||
return new FunctionSignatureSourceFieldFactory(formatModel, provider, toolOptions,
|
||||
fieldOptions);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||
|
||||
import docking.widgets.fieldpanel.field.*;
|
||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.app.util.HighlightProvider;
|
||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||
import ghidra.app.util.viewer.options.OptionsGui;
|
||||
|
@ -44,7 +45,7 @@ import ghidra.program.util.ProgramLocation;
|
|||
public class FunctionTagFieldFactory extends FieldFactory {
|
||||
|
||||
public static final String FIELD_NAME = "Function Tags";
|
||||
public static final Color DEFAULT_COLOR = new Color(130, 0, 75);
|
||||
public static final Color DEFAULT_COLOR = Palette.MAROON;
|
||||
|
||||
private Color literalColor;
|
||||
|
||||
|
@ -59,10 +60,9 @@ public class FunctionTagFieldFactory extends FieldFactory {
|
|||
* Constructor
|
||||
*
|
||||
* @param model the model that the field belongs to.
|
||||
* @param hsProvider the HightLightStringProvider.
|
||||
* @param hlProvider the HightLightStringProvider.
|
||||
* @param displayOptions the Options for display properties.
|
||||
* @param fieldOptions the Options for field specific properties.
|
||||
* @param serviceProvider the provider for services.
|
||||
*/
|
||||
private FunctionTagFieldFactory(FieldFormatModel model, HighlightProvider hlProvider,
|
||||
Options displayOptions, Options fieldOptions) {
|
||||
|
@ -73,10 +73,6 @@ public class FunctionTagFieldFactory extends FieldFactory {
|
|||
OptionsGui.SEPARATOR.getDefaultColor());
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* PUBLIC METHODS
|
||||
******************************************************************************/
|
||||
|
||||
@Override
|
||||
public ListingField getField(ProxyObj<?> proxy, int varWidth) {
|
||||
|
||||
|
@ -139,8 +135,8 @@ public class FunctionTagFieldFactory extends FieldFactory {
|
|||
|
||||
@Override
|
||||
public FieldFactory newInstance(FieldFormatModel formatModel, HighlightProvider provider,
|
||||
ToolOptions displayOptions, ToolOptions fieldOptions) {
|
||||
return new FunctionTagFieldFactory(formatModel, provider, displayOptions, fieldOptions);
|
||||
ToolOptions toolOptions, ToolOptions fieldOptions) {
|
||||
return new FunctionTagFieldFactory(formatModel, provider, toolOptions, fieldOptions);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -155,15 +151,12 @@ public class FunctionTagFieldFactory extends FieldFactory {
|
|||
super.displayOptionsChanged(options, optionName, oldValue, newValue);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* PROTECTED METHODS
|
||||
******************************************************************************/
|
||||
|
||||
/**
|
||||
* Creates a tags list field to be show at the beginning of each function that shows the tags
|
||||
* assigned to that function.
|
||||
*
|
||||
* @param function the function to retrieve the tags from
|
||||
* @return the elements
|
||||
*/
|
||||
protected List<FieldElement> createFunctionTagElements(FunctionDB function) {
|
||||
|
||||
|
@ -186,10 +179,6 @@ public class FunctionTagFieldFactory extends FieldFactory {
|
|||
return textElements;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* PRIVATE METHODS
|
||||
******************************************************************************/
|
||||
|
||||
/**
|
||||
* Returns all function tags associated with the given function.
|
||||
*
|
||||
|
|
|
@ -20,6 +20,8 @@ import java.math.BigInteger;
|
|||
|
||||
import docking.widgets.fieldpanel.field.*;
|
||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.app.util.HighlightProvider;
|
||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||
|
@ -36,9 +38,9 @@ import ghidra.util.StringUtilities;
|
|||
public class InstructionMaskValueFieldFactory extends FieldFactory {
|
||||
|
||||
public static final String FIELD_NAME = "Instr Mask/Value";
|
||||
public static final Color MASK_COLOR = new Color(0, 0, 128);
|
||||
public static final Color VALUE_COLOR = new Color(0, 128, 0);
|
||||
public static final Color LABEL_COLOR = new Color(0, 0, 0);
|
||||
public static final Color MASK_COLOR = Palette.getColor("navy");
|
||||
public static final Color VALUE_COLOR = Palette.GREEN;
|
||||
public static final Color LABEL_COLOR = Colors.FOREGROUND;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
|
@ -141,9 +143,6 @@ public class InstructionMaskValueFieldFactory extends FieldFactory {
|
|||
return buf.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.app.util.viewer.field.FieldFactory#getProgramLocation(int, int, ghidra.app.util.viewer.field.ListingField)
|
||||
*/
|
||||
@Override
|
||||
public ProgramLocation getProgramLocation(int row, int col, ListingField bf) {
|
||||
Object obj = bf.getProxy().getObject();
|
||||
|
@ -156,9 +155,6 @@ public class InstructionMaskValueFieldFactory extends FieldFactory {
|
|||
col);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.app.util.viewer.field.FieldFactory#getFieldLocation(ghidra.app.util.viewer.field.ListingField, BigInteger, int, ghidra.program.util.ProgramLocation)
|
||||
*/
|
||||
@Override
|
||||
public FieldLocation getFieldLocation(ListingField bf, BigInteger index, int fieldNum,
|
||||
ProgramLocation programLoc) {
|
||||
|
@ -171,9 +167,6 @@ public class InstructionMaskValueFieldFactory extends FieldFactory {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.app.util.viewer.field.FieldFactory#acceptsType(int, java.lang.Class)
|
||||
*/
|
||||
@Override
|
||||
public boolean acceptsType(int category, Class<?> proxyObjectClass) {
|
||||
return category == FieldFormatModel.INSTRUCTION_OR_DATA;
|
||||
|
@ -181,16 +174,13 @@ public class InstructionMaskValueFieldFactory extends FieldFactory {
|
|||
|
||||
@Override
|
||||
public FieldFactory newInstance(FieldFormatModel formatModel, HighlightProvider hsProvider,
|
||||
ToolOptions displayOptions, ToolOptions fieldOptions) {
|
||||
return new InstructionMaskValueFieldFactory(formatModel, hsProvider, displayOptions,
|
||||
ToolOptions toolOptions, ToolOptions fieldOptions) {
|
||||
return new InstructionMaskValueFieldFactory(formatModel, hsProvider, toolOptions,
|
||||
fieldOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.app.util.viewer.field.FieldFactory#getDefaultColor()
|
||||
*/
|
||||
@Override
|
||||
public Color getDefaultColor() {
|
||||
return Color.black;
|
||||
return Colors.FOREGROUND;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,14 +15,12 @@
|
|||
*/
|
||||
package ghidra.app.util.viewer.field;
|
||||
|
||||
import docking.widgets.fieldpanel.field.AttributedString;
|
||||
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||
import ghidra.app.nav.Navigatable;
|
||||
import ghidra.framework.plugintool.ServiceProvider;
|
||||
import ghidra.program.model.listing.Program;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import docking.widgets.fieldpanel.field.AttributedString;
|
||||
|
||||
/**
|
||||
* An annotated string handler that is used to display an error message string when there is a
|
||||
* problem creating an annotated string.
|
||||
|
@ -42,7 +40,7 @@ public class InvalidAnnotatedStringHandler implements AnnotatedStringHandler {
|
|||
@Override
|
||||
public AttributedString createAnnotatedString(AttributedString prototypeString, String[] text,
|
||||
Program program) throws AnnotationException {
|
||||
return new AttributedString(errorText, Color.RED, prototypeString.getFontMetrics(0));
|
||||
return new AttributedString(errorText, Messages.ERROR, prototypeString.getFontMetrics(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.util.List;
|
|||
import docking.widgets.fieldpanel.field.*;
|
||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||
import docking.widgets.fieldpanel.support.RowColLocation;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.app.util.HighlightProvider;
|
||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||
|
@ -41,7 +42,7 @@ import ghidra.program.util.ProgramLocation;
|
|||
public class MemoryBlockStartFieldFactory extends FieldFactory {
|
||||
|
||||
private static final String FIELD_NAME = "Memory Block Start";
|
||||
private static final Color BLOCK_COLOR = new Color(75, 0, 130);
|
||||
private static final Color BLOCK_COLOR = Palette.getColor("indigo");
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
@ -54,7 +55,7 @@ public class MemoryBlockStartFieldFactory extends FieldFactory {
|
|||
/**
|
||||
* Constructor
|
||||
* @param model the model that the field belongs to.
|
||||
* @param hsProvider the HightLightStringProvider.
|
||||
* @param hlProvider the HightLightStringProvider.
|
||||
* @param displayOptions the Options for display properties.
|
||||
* @param fieldOptions the Options for field specific properties.
|
||||
*/
|
||||
|
|
|
@ -22,6 +22,8 @@ import javax.swing.event.ChangeListener;
|
|||
|
||||
import docking.widgets.fieldpanel.field.*;
|
||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.GhidraOptions;
|
||||
import ghidra.app.util.HighlightProvider;
|
||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||
|
@ -43,9 +45,9 @@ import ghidra.util.HelpLocation;
|
|||
*/
|
||||
public class MnemonicFieldFactory extends FieldFactory {
|
||||
public static final String FIELD_NAME = "Mnemonic";
|
||||
public static final Color OVERRIDE_COLOR = new Color(180, 0, 108);
|
||||
// TODO: Should BAD_PROTOTYPE_COLOR be an option?
|
||||
private final static Color BAD_PROTOTYPE_COLOR = new Color(196, 0, 0);
|
||||
public static final Color OVERRIDE_COLOR = Palette.PURPLE;
|
||||
|
||||
private final static Color BAD_PROTOTYPE_COLOR = Messages.ERROR;
|
||||
private final static String SHOW_UNDERLINE_FOR_REFERENCES =
|
||||
GhidraOptions.MNEMONIC_GROUP_TITLE + Options.DELIMITER + "Underline Fields With References";
|
||||
|
||||
|
@ -140,7 +142,7 @@ public class MnemonicFieldFactory extends FieldFactory {
|
|||
else {
|
||||
Data data = (Data) cu;
|
||||
if (data.isDefined() && data.getDataType().isNotYetDefined()) {
|
||||
c = Color.RED;
|
||||
c = Messages.ERROR;
|
||||
}
|
||||
}
|
||||
AttributedString as =
|
||||
|
|
|
@ -20,6 +20,8 @@ import java.math.BigInteger;
|
|||
|
||||
import docking.widgets.fieldpanel.field.*;
|
||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.app.util.HighlightProvider;
|
||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||
|
@ -38,7 +40,7 @@ import ghidra.program.util.ProgramLocation;
|
|||
public class ParallelInstructionFieldFactory extends FieldFactory {
|
||||
|
||||
public static final String FIELD_NAME = "Parallel ||";
|
||||
public static final Color DEFAULT_COLOR = new Color(0, 0, 128);
|
||||
public static final Color DEFAULT_COLOR = Palette.BLUE;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
|
@ -60,19 +62,18 @@ public class ParallelInstructionFieldFactory extends FieldFactory {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void fieldOptionsChanged(Options options, String name, Object oldValue,
|
||||
public void fieldOptionsChanged(Options options, String optionName, Object oldValue,
|
||||
Object newValue) {
|
||||
// don't care
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the FactoryField for the given object at index index.
|
||||
* @param varWidth the amount of variable width spacing for any fields
|
||||
* before this one.
|
||||
* @param proxy the object whose properties should be displayed.
|
||||
* @param varWidth the amount of variable width spacing for any fields before this one.
|
||||
*/
|
||||
@Override
|
||||
public ListingField getField(ProxyObj proxy, int varWidth) {
|
||||
public ListingField getField(ProxyObj<?> proxy, int varWidth) {
|
||||
Object obj = proxy.getObject();
|
||||
|
||||
if (!enabled || !(obj instanceof Instruction)) {
|
||||
|
@ -98,9 +99,6 @@ public class ParallelInstructionFieldFactory extends FieldFactory {
|
|||
width, hlProvider);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.app.util.viewer.field.FieldFactory#getProgramLocation(int, int, ghidra.app.util.viewer.field.ListingField)
|
||||
*/
|
||||
@Override
|
||||
public ProgramLocation getProgramLocation(int row, int col, ListingField bf) {
|
||||
Object obj = bf.getProxy().getObject();
|
||||
|
@ -112,9 +110,6 @@ public class ParallelInstructionFieldFactory extends FieldFactory {
|
|||
return new ParallelInstructionLocation(instr.getProgram(), instr.getMinAddress(), col);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.app.util.viewer.field.FieldFactory#getFieldLocation(ghidra.app.util.viewer.field.ListingField, BigInteger, int, ghidra.program.util.ProgramLocation)
|
||||
*/
|
||||
@Override
|
||||
public FieldLocation getFieldLocation(ListingField bf, BigInteger index, int fieldNum,
|
||||
ProgramLocation programLoc) {
|
||||
|
@ -126,25 +121,20 @@ public class ParallelInstructionFieldFactory extends FieldFactory {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.app.util.viewer.field.FieldFactory#acceptsType(int, java.lang.Class)
|
||||
*/
|
||||
@Override
|
||||
public boolean acceptsType(int category, Class<?> proxyObjectClass) {
|
||||
return category == FieldFormatModel.INSTRUCTION_OR_DATA;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FieldFactory newInstance(FieldFormatModel model, HighlightProvider hsProvider,
|
||||
ToolOptions displayOptions, ToolOptions fieldOptions) {
|
||||
return new ParallelInstructionFieldFactory(model, hsProvider, displayOptions, fieldOptions);
|
||||
public FieldFactory newInstance(FieldFormatModel formatModel, HighlightProvider hsProvider,
|
||||
ToolOptions toolOptinos, ToolOptions fieldOptions) {
|
||||
return new ParallelInstructionFieldFactory(formatModel, hsProvider, toolOptinos,
|
||||
fieldOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.app.util.viewer.field.FieldFactory#getDefaultColor()
|
||||
*/
|
||||
@Override
|
||||
public Color getDefaultColor() {
|
||||
return Color.black;
|
||||
return Colors.FOREGROUND;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||
|
||||
import docking.widgets.fieldpanel.field.*;
|
||||
import docking.widgets.fieldpanel.support.*;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.app.util.HelpTopics;
|
||||
import ghidra.app.util.HighlightProvider;
|
||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||
|
@ -47,7 +48,7 @@ public class PlateFieldFactory extends FieldFactory {
|
|||
|
||||
private static final String EMPTY_STRING = "";
|
||||
public static final String FIELD_NAME = "Plate Comment";
|
||||
public static final Color DEFAULT_COLOR = Color.BLUE;
|
||||
public static final Color DEFAULT_COLOR = Palette.BLUE;
|
||||
private final static String FIELD_GROUP_TITLE = "Plate Comments Field";
|
||||
public final static String ENABLE_WORD_WRAP_MSG =
|
||||
FIELD_GROUP_TITLE + Options.DELIMITER + "Enable Word Wrapping";
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
*/
|
||||
package ghidra.app.util.viewer.field;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.math.BigInteger;
|
||||
|
||||
import docking.widgets.fieldpanel.field.*;
|
||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import ghidra.app.util.HighlightProvider;
|
||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||
|
@ -67,12 +67,10 @@ public class SpaceFieldFactory extends FieldFactory {
|
|||
if (!enabled || !(obj instanceof CodeUnit)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
CodeUnit cu = (CodeUnit) obj;
|
||||
|
||||
if (cu.hasProperty(CodeUnit.SPACE_PROPERTY)) {
|
||||
|
||||
try {
|
||||
int n = cu.getIntProperty(CodeUnit.SPACE_PROPERTY);
|
||||
Integer n = getSpaces(cu);
|
||||
if (n != null) {
|
||||
if (n == 0) {
|
||||
cu.removeProperty(CodeUnit.SPACE_PROPERTY);
|
||||
return null;
|
||||
|
@ -81,24 +79,30 @@ public class SpaceFieldFactory extends FieldFactory {
|
|||
n = -n;
|
||||
}
|
||||
FieldElement[] fes = new FieldElement[n];
|
||||
AttributedString as = new AttributedString("", Color.BLACK, getMetrics());
|
||||
AttributedString as = new AttributedString("", Colors.FOREGROUND, getMetrics());
|
||||
for (int i = 0; i < n; i++) {
|
||||
fes[i] = new TextFieldElement(as, 0, 0);
|
||||
}
|
||||
|
||||
return ListingTextField.createMultilineTextField(this, proxy, fes,
|
||||
startX + varWidth, width, n + 1, hlProvider);
|
||||
}
|
||||
catch (NoValueException e) {
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.app.util.viewer.field.FieldFactory#getProgramLocation(int, int, ghidra.app.util.viewer.field.ListingField)
|
||||
*/
|
||||
private Integer getSpaces(CodeUnit cu) {
|
||||
if (cu.hasProperty(CodeUnit.SPACE_PROPERTY)) {
|
||||
try {
|
||||
return cu.getIntProperty(CodeUnit.SPACE_PROPERTY);
|
||||
}
|
||||
catch (NoValueException e) {
|
||||
// can't happen
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProgramLocation getProgramLocation(int row, int col, ListingField bf) {
|
||||
Object obj = bf.getProxy().getObject();
|
||||
|
|
|
@ -15,11 +15,12 @@
|
|||
*/
|
||||
package ghidra.app.util.viewer.field;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import docking.widgets.fieldpanel.field.AttributedString;
|
||||
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.app.nav.Navigatable;
|
||||
import ghidra.app.services.GoToService;
|
||||
import ghidra.app.util.NamespaceUtils;
|
||||
|
@ -90,7 +91,7 @@ public class SymbolAnnotatedStringHandler implements AnnotatedStringHandler {
|
|||
prototypeString.getFontMetrics(0), true, prototypeString.getColor(0));
|
||||
}
|
||||
|
||||
return new AttributedString("No symbol: " + text[1], Color.RED,
|
||||
return new AttributedString("No symbol: " + text[1], Messages.ERROR,
|
||||
prototypeString.getFontMetrics(0), false, null);
|
||||
}
|
||||
|
||||
|
@ -101,7 +102,7 @@ public class SymbolAnnotatedStringHandler implements AnnotatedStringHandler {
|
|||
buffer.append(string).append(" ");
|
||||
}
|
||||
|
||||
return new AttributedString(buffer.toString(), Color.LIGHT_GRAY,
|
||||
return new AttributedString(buffer.toString(), Palette.LIGHT_GRAY,
|
||||
prototypeString.getFontMetrics(0));
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,11 @@
|
|||
*/
|
||||
package ghidra.app.util.viewer.field;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
import docking.widgets.fieldpanel.field.AttributedString;
|
||||
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||
import ghidra.app.nav.Navigatable;
|
||||
import ghidra.app.services.ProgramManager;
|
||||
import ghidra.framework.plugintool.ServiceProvider;
|
||||
|
@ -23,12 +28,6 @@ import ghidra.program.model.listing.Program;
|
|||
import ghidra.util.BrowserLoader;
|
||||
import ghidra.util.Msg;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
import docking.widgets.fieldpanel.field.AttributedString;
|
||||
|
||||
/**
|
||||
* An annotated string handler that allows handles annotations that begin with
|
||||
* {@link #SUPPORTED_ANNOTATIONS}. This class expects one or two strings following the annotation.
|
||||
|
@ -37,8 +36,8 @@ import docking.widgets.fieldpanel.field.AttributedString;
|
|||
* displayed.
|
||||
*/
|
||||
public class URLAnnotatedStringHandler implements AnnotatedStringHandler {
|
||||
private static final String INVALID_SYMBOL_TEXT = "@url annotation must have a URL string "
|
||||
+ "optionally followed by a display string";
|
||||
private static final String INVALID_SYMBOL_TEXT =
|
||||
"@url annotation must have a URL string " + "optionally followed by a display string";
|
||||
private static final String[] SUPPORTED_ANNOTATIONS = { "url", "hyperlink", "href", "link" };
|
||||
|
||||
@Override
|
||||
|
@ -54,7 +53,7 @@ public class URLAnnotatedStringHandler implements AnnotatedStringHandler {
|
|||
|
||||
if (url == null) {
|
||||
return new AttributedString("Invalid URL annotations - not a URL: " + text[1],
|
||||
Color.RED, prototypeString.getFontMetrics(0), false, Color.RED);
|
||||
Messages.ERROR, prototypeString.getFontMetrics(0), false, Messages.ERROR);
|
||||
}
|
||||
|
||||
String displayText = url.toExternalForm();
|
||||
|
@ -88,6 +87,7 @@ public class URLAnnotatedStringHandler implements AnnotatedStringHandler {
|
|||
return url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleMouseClick(String[] annotationParts, Navigatable navigatable,
|
||||
ServiceProvider serviceProvider) {
|
||||
String urlString = annotationParts[1];
|
||||
|
|
|
@ -23,6 +23,7 @@ import javax.swing.Icon;
|
|||
|
||||
import docking.widgets.fieldpanel.field.*;
|
||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||
import ghidra.app.util.HighlightProvider;
|
||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||
import ghidra.app.util.viewer.options.OptionsGui;
|
||||
|
@ -59,7 +60,7 @@ public class VariableLocFieldFactory extends AbstractVariableFieldFactory {
|
|||
/**
|
||||
* Constructor
|
||||
* @param model the model that the field belongs to.
|
||||
* @param hsProvider the HightLightStringProvider.
|
||||
* @param hlProvider the HightLightStringProvider.
|
||||
* @param displayOptions the Options for display properties.
|
||||
* @param fieldOptions the Options for field specific properties.
|
||||
*/
|
||||
|
@ -78,9 +79,6 @@ public class VariableLocFieldFactory extends AbstractVariableFieldFactory {
|
|||
return icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.app.util.viewer.field.FieldFactory#getField(ProxyObj, int)
|
||||
*/
|
||||
@Override
|
||||
public ListingField getField(ProxyObj<?> proxy, int varWidth) {
|
||||
Object obj = proxy.getObject();
|
||||
|
@ -93,7 +91,7 @@ public class VariableLocFieldFactory extends AbstractVariableFieldFactory {
|
|||
boolean hasInvalidStorage = !var.isValid();
|
||||
String loc = var.getVariableStorage().toString();
|
||||
AttributedString as = new AttributedString(getStorageIcon(fontMetrics, hasInvalidStorage),
|
||||
loc, hasInvalidStorage ? Color.RED : getColor(var), fontMetrics, false, null);
|
||||
loc, hasInvalidStorage ? Messages.ERROR : getColor(var), fontMetrics, false, null);
|
||||
FieldElement field = new TextFieldElement(as, 0, 0);
|
||||
return ListingTextField.createSingleLineTextField(this, proxy, field, startX + varWidth,
|
||||
width, hlProvider);
|
||||
|
@ -102,6 +100,7 @@ public class VariableLocFieldFactory extends AbstractVariableFieldFactory {
|
|||
/**
|
||||
* Returns the string representing the offset.
|
||||
* @param offset the offset to get a string for
|
||||
* @return the offset string
|
||||
*/
|
||||
public String getOffsetString(int offset) {
|
||||
String offString =
|
||||
|
@ -109,10 +108,6 @@ public class VariableLocFieldFactory extends AbstractVariableFieldFactory {
|
|||
return offString;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see ghidra.app.util.viewer.field.FieldFactory#getProgramLocation(int, int, ghidra.app.util.viewer.field.ListingField)
|
||||
*/
|
||||
@Override
|
||||
public ProgramLocation getProgramLocation(int row, int col, ListingField bf) {
|
||||
ProxyObj<?> proxy = bf.getProxy();
|
||||
|
@ -126,9 +121,6 @@ public class VariableLocFieldFactory extends AbstractVariableFieldFactory {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.app.util.viewer.field.FieldFactory#getFieldLocation(ghidra.app.util.viewer.field.ListingField, BigInteger, int, ghidra.program.util.ProgramLocation)
|
||||
*/
|
||||
@Override
|
||||
public FieldLocation getFieldLocation(ListingField bf, BigInteger index, int fieldNum,
|
||||
ProgramLocation loc) {
|
||||
|
@ -149,9 +141,6 @@ public class VariableLocFieldFactory extends AbstractVariableFieldFactory {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.app.util.viewer.field.FieldFactory#acceptsType(int, java.lang.Class)
|
||||
*/
|
||||
@Override
|
||||
public boolean acceptsType(int category, Class<?> proxyObjectClass) {
|
||||
if (!Variable.class.isAssignableFrom(proxyObjectClass)) {
|
||||
|
@ -162,13 +151,10 @@ public class VariableLocFieldFactory extends AbstractVariableFieldFactory {
|
|||
|
||||
@Override
|
||||
public FieldFactory newInstance(FieldFormatModel formatModel, HighlightProvider provider,
|
||||
ToolOptions displayOptions, ToolOptions fieldOptions) {
|
||||
return new VariableLocFieldFactory(formatModel, provider, displayOptions, fieldOptions);
|
||||
ToolOptions toolOptions, ToolOptions fieldOptions) {
|
||||
return new VariableLocFieldFactory(formatModel, provider, toolOptions, fieldOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.app.util.viewer.field.FieldFactory#getDefaultColor()
|
||||
*/
|
||||
@Override
|
||||
public Color getDefaultColor() {
|
||||
return OptionsGui.VARIABLE.getDefaultColor();
|
||||
|
|
|
@ -15,13 +15,13 @@
|
|||
*/
|
||||
package ghidra.app.util.viewer.field;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.math.BigInteger;
|
||||
import java.util.*;
|
||||
|
||||
import docking.widgets.fieldpanel.field.*;
|
||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||
import docking.widgets.fieldpanel.support.RowColLocation;
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import ghidra.app.util.HighlightProvider;
|
||||
import ghidra.app.util.XReferenceUtils;
|
||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||
|
@ -101,7 +101,7 @@ public class VariableXRefFieldFactory extends XRefFieldFactory {
|
|||
int totalXrefs = xrefs.size() + offcuts.size();
|
||||
boolean tooMany = totalXrefs > maxXRefs;
|
||||
|
||||
AttributedString delimiter = new AttributedString(delim, Color.BLACK, getMetrics());
|
||||
AttributedString delimiter = new AttributedString(delim, Colors.FOREGROUND, getMetrics());
|
||||
|
||||
FieldElement[] elements = new FieldElement[tooMany ? maxXRefs : totalXrefs];
|
||||
int count = 0;
|
||||
|
|
|
@ -27,6 +27,7 @@ import javax.swing.event.ChangeListener;
|
|||
|
||||
import docking.widgets.fieldpanel.field.*;
|
||||
import docking.widgets.fieldpanel.support.*;
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import ghidra.app.util.HighlightProvider;
|
||||
import ghidra.app.util.XReferenceUtils;
|
||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||
|
@ -428,7 +429,7 @@ public class XRefFieldFactory extends FieldFactory {
|
|||
HighlightFactory hlFactory) {
|
||||
|
||||
FontMetrics metrics = getMetrics();
|
||||
AttributedString delimiter = new AttributedString(delim, Color.BLACK, metrics);
|
||||
AttributedString delimiter = new AttributedString(delim, Colors.FOREGROUND, metrics);
|
||||
|
||||
int row = 0;
|
||||
List<FieldElement> elements = new ArrayList<>();
|
||||
|
@ -490,7 +491,7 @@ public class XRefFieldFactory extends FieldFactory {
|
|||
HighlightFactory hlFactory) {
|
||||
|
||||
FontMetrics metrics = getMetrics();
|
||||
AttributedString delimiter = new AttributedString(delim, Color.BLACK, metrics);
|
||||
AttributedString delimiter = new AttributedString(delim, Colors.FOREGROUND, metrics);
|
||||
int row = startRow;
|
||||
List<XrefFieldElement> elements = new ArrayList<>();
|
||||
for (Reference ref : xrefs) {
|
||||
|
@ -542,7 +543,7 @@ public class XRefFieldFactory extends FieldFactory {
|
|||
CodeUnit cu = (CodeUnit) obj;
|
||||
Program program = cu.getProgram();
|
||||
FontMetrics metrics = getMetrics();
|
||||
AttributedString delimiter = new AttributedString(delim, Color.BLACK, metrics);
|
||||
AttributedString delimiter = new AttributedString(delim, Colors.FOREGROUND, metrics);
|
||||
|
||||
Set<Reference> offcutSet = new HashSet<>(offcuts);
|
||||
Predicate<Reference> isOffcut = r -> offcutSet.contains(r);
|
||||
|
|
|
@ -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,33 +15,29 @@
|
|||
*/
|
||||
package ghidra.app.util.viewer.format;
|
||||
|
||||
import docking.widgets.fieldpanel.field.*;
|
||||
import docking.widgets.fieldpanel.support.*;
|
||||
import generic.theme.GColor;
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import ghidra.app.util.HighlightProvider;
|
||||
import ghidra.app.util.viewer.field.*;
|
||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import docking.widgets.fieldpanel.field.*;
|
||||
import docking.widgets.fieldpanel.support.*;
|
||||
|
||||
public class ErrorListingField extends ListingTextField {
|
||||
|
||||
private Throwable t;
|
||||
|
||||
private static HighlightProvider myProvider = new HighlightProvider() {
|
||||
private static HighlightProvider myProvider =
|
||||
(text, obj, fieldFactoryClass, cursorTextOffset) -> new Highlight[] {
|
||||
new Highlight(0, text.length() - 1, new GColor("color.bg.error")) };
|
||||
|
||||
public Highlight[] getHighlights(String text, Object obj,
|
||||
Class<? extends FieldFactory> fieldFactoryClass, int cursorTextOffset) {
|
||||
return new Highlight[] { new Highlight(0, text.length() - 1, new Color(245, 158, 158)) };
|
||||
}
|
||||
};
|
||||
|
||||
public ErrorListingField(FieldFactory ff, ProxyObj proxy, int varWidth, Throwable t) {
|
||||
public ErrorListingField(FieldFactory ff, ProxyObj<?> proxy, int varWidth, Throwable t) {
|
||||
super(ff, proxy, createField(ff, proxy, varWidth, t));
|
||||
this.t = t;
|
||||
}
|
||||
|
||||
private static TextField createField(FieldFactory ff, ProxyObj proxy, int varWidth, Throwable t) {
|
||||
private static TextField createField(FieldFactory ff, ProxyObj<?> proxy, int varWidth,
|
||||
Throwable t) {
|
||||
HighlightFactory hlFactory =
|
||||
new FieldHighlightFactory(myProvider, ff.getClass(), proxy.getObject());
|
||||
return new ClippingTextField(ff.getStartX() + varWidth, ff.getWidth(),
|
||||
|
@ -53,7 +48,7 @@ public class ErrorListingField extends ListingTextField {
|
|||
String message = t.getMessage() == null ? t.toString() : t.getMessage();
|
||||
AttributedString as =
|
||||
new AttributedString("*Error*: " + message + ". Double click for Details.",
|
||||
Color.BLACK, ff.getMetrics());
|
||||
Colors.FOREGROUND, ff.getMetrics());
|
||||
return new TextFieldElement(as, 0, 0);
|
||||
}
|
||||
|
||||
|
@ -61,9 +56,6 @@ public class ErrorListingField extends ListingTextField {
|
|||
return t;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ListingTextField#getClickedObject(FieldLocation)
|
||||
*/
|
||||
@Override
|
||||
public Object getClickedObject(FieldLocation fieldLocation) {
|
||||
// overridden to return this object, rather than the lower-level text field
|
||||
|
|
|
@ -43,9 +43,9 @@ public class FieldHeaderComp extends JPanel {
|
|||
private static final int DEFAULT_SNAP_SIZE = 10;
|
||||
|
||||
private static final Color ACTIVE_FIELD_BG_COLOR =
|
||||
new GColor("color.bg.listing.header.active.field"); // new Color(244, 221, 183);
|
||||
new GColor("color.bg.listing.header.active.field");
|
||||
private static final Color ACTIVE_FIELD_FG_COLOR =
|
||||
new GColor("color.fg.listing.header.active.field"); // new Color(244, 221, 183);
|
||||
new GColor("color.fg.listing.header.active.field");
|
||||
|
||||
private FieldFormatModel model;
|
||||
private JLabel label;
|
||||
|
|
|
@ -17,6 +17,7 @@ package ghidra.app.util.viewer.listingpanel;
|
|||
|
||||
import java.awt.Color;
|
||||
|
||||
import generic.theme.GColor;
|
||||
import ghidra.framework.options.ToolOptions;
|
||||
import ghidra.util.HelpLocation;
|
||||
|
||||
|
@ -42,15 +43,16 @@ public class ListingCodeComparisonOptions {
|
|||
private static final String DEFAULT_UNMATCHED_CODE_UNITS_BACKGROUND_COLOR_DESCRIPTION =
|
||||
"The default background color applied to code units that are unmatched within the listing code comparison window by the address correlator.";
|
||||
|
||||
public static final Color MEDIUM_SKY_BLUE_COLOR = new Color(0x69, 0xcd, 0xe1);
|
||||
public static final Color MEDIUM_GRAY_COLOR = new Color(0xb9, 0xb9, 0xb9);
|
||||
public static final Color SPRING_GREEN_COLOR = new Color(0xaf, 0xff, 0x69);
|
||||
|
||||
private static final Color DEFAULT_BYTE_DIFFS_COLOR = SPRING_GREEN_COLOR;
|
||||
private static final Color DEFAULT_MNEMONIC_DIFFS_COLOR = SPRING_GREEN_COLOR;
|
||||
private static final Color DEFAULT_OPERAND_DIFFS_COLOR = SPRING_GREEN_COLOR;
|
||||
private static final Color DEFAULT_DIFF_CODE_UNITS_COLOR = MEDIUM_GRAY_COLOR;
|
||||
private static final Color DEFAULT_UNMATCHED_CODE_UNITS_COLOR = MEDIUM_SKY_BLUE_COLOR;
|
||||
private static final Color DEFAULT_BYTE_DIFFS_COLOR =
|
||||
new GColor("color.bg.listing.comparison.bytes");
|
||||
private static final Color DEFAULT_MNEMONIC_DIFFS_COLOR =
|
||||
new GColor("color.bg.listing.comparison.mnemonic");
|
||||
private static final Color DEFAULT_OPERAND_DIFFS_COLOR =
|
||||
new GColor("color.bg.listing.comparison.operand");
|
||||
private static final Color DEFAULT_DIFF_CODE_UNITS_COLOR =
|
||||
new GColor("color.bg.listing.comparison.code.units.diff");
|
||||
private static final Color DEFAULT_UNMATCHED_CODE_UNITS_COLOR =
|
||||
new GColor("color.bg.listing.comparison.code.units.unmatched");
|
||||
|
||||
private Color byteDiffsColor = DEFAULT_BYTE_DIFFS_COLOR;
|
||||
private Color mnemonicDiffsColor = DEFAULT_MNEMONIC_DIFFS_COLOR;
|
||||
|
|
|
@ -149,7 +149,7 @@ public class ListingCodeComparisonPanel
|
|||
FunctionNameListingHover functionNameHoverService;
|
||||
private String leftTitle;
|
||||
private String rightTitle;
|
||||
private ListingCodeComparisonOptions comparisonOptions = new ListingCodeComparisonOptions();
|
||||
private ListingCodeComparisonOptions comparisonOptions;
|
||||
private Address[] coordinatorLockedAddresses;
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,6 +22,7 @@ import java.util.Map;
|
|||
|
||||
import docking.widgets.fieldpanel.support.BackgroundColorModel;
|
||||
import generic.theme.GColor;
|
||||
import generic.theme.TempColorUtils;
|
||||
import ghidra.app.util.viewer.util.AddressIndexMap;
|
||||
import ghidra.framework.model.DomainObjectChangedEvent;
|
||||
import ghidra.framework.model.DomainObjectListener;
|
||||
|
@ -94,7 +95,7 @@ public class PropertyBasedBackgroundColorModel
|
|||
}
|
||||
Color c = colorCache.get(value);
|
||||
if (c == null) {
|
||||
c = new Color(value, true);
|
||||
c = TempColorUtils.fromRgba(value);
|
||||
colorCache.put(value, c);
|
||||
}
|
||||
return c;
|
||||
|
|
|
@ -36,6 +36,9 @@ import docking.widgets.fieldpanel.support.*;
|
|||
import docking.widgets.indexedscrollpane.IndexedScrollPane;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import generic.theme.GColor;
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import generic.theme.GThemeDefaults.Colors.Tables;
|
||||
import ghidra.GhidraOptions;
|
||||
import ghidra.util.SystemUtilities;
|
||||
|
||||
|
@ -331,18 +334,12 @@ public class OptionsGui extends JPanel {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the base font to be used by the fields.
|
||||
*/
|
||||
public void setBaseFont(Font font) {
|
||||
baseFont = font;
|
||||
baseMetrics = getFontMetrics(font);
|
||||
metricsMap.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current base font.
|
||||
*/
|
||||
public Font getBaseFont() {
|
||||
return baseFont;
|
||||
}
|
||||
|
@ -410,13 +407,13 @@ public class OptionsGui extends JPanel {
|
|||
GraphicsEnvironment gEnv = GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||
String envfonts[] = gEnv.getAvailableFontFamilyNames();
|
||||
fontNameField = new GComboBox<>(envfonts);
|
||||
fontNameField.setBackground(Color.white);
|
||||
fontNameField.setBackground(Colors.BACKGROUND);
|
||||
fontNameField.setRenderer(new FontRenderer());
|
||||
panel1.add(fontNameField);
|
||||
|
||||
fontSizeField =
|
||||
new GComboBox<>(IntStream.rangeClosed(6, 32).boxed().toArray(Integer[]::new));
|
||||
fontSizeField.setBackground(Color.white);
|
||||
fontSizeField.setBackground(Colors.BACKGROUND);
|
||||
panel1.add(fontSizeField);
|
||||
panel.add(panel1, BorderLayout.NORTH);
|
||||
|
||||
|
@ -434,8 +431,8 @@ public class OptionsGui extends JPanel {
|
|||
|
||||
//Displays the font field with the actual fonts for easier selection
|
||||
class FontRenderer extends GDLabel implements ListCellRenderer<String> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final Color SELECTED_COLOR = new Color(10, 36, 106);
|
||||
|
||||
private final Color SELECTED_COLOR = Palette.getColor("darkslategray");
|
||||
|
||||
public FontRenderer() {
|
||||
setOpaque(true);
|
||||
|
@ -448,8 +445,8 @@ public class OptionsGui extends JPanel {
|
|||
Font origFont = fontNameField.getFont();
|
||||
setFont(new Font(value.toString(), origFont.getStyle(), origFont.getSize()));
|
||||
|
||||
setBackground(isSelected ? SELECTED_COLOR : Color.white);
|
||||
setForeground(isSelected ? Color.white : Color.black);
|
||||
setBackground(isSelected ? SELECTED_COLOR : Colors.BACKGROUND);
|
||||
setForeground(isSelected ? Tables.FG_SELECTED : Tables.FG_UNSELECTED);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
@ -477,7 +474,7 @@ public class OptionsGui extends JPanel {
|
|||
subPanel = new JPanel(new BorderLayout());
|
||||
subPanel.setBorder(BorderFactory.createTitledBorder(border, "Color"));
|
||||
colorPanel = new JPanel();
|
||||
colorPanel.setBackground(Color.white);
|
||||
colorPanel.setBackground(Colors.BACKGROUND);
|
||||
subPanel.add(colorPanel, BorderLayout.CENTER);
|
||||
panel.add(subPanel, BorderLayout.NORTH);
|
||||
return panel;
|
||||
|
@ -847,6 +844,7 @@ public class OptionsGui extends JPanel {
|
|||
size = (Integer) fontSizeField.getSelectedItem();
|
||||
}
|
||||
catch (Exception e) {
|
||||
// handled below
|
||||
}
|
||||
|
||||
if (size < 6) {
|
||||
|
@ -881,9 +879,6 @@ public class OptionsGui extends JPanel {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a layout for the given index.
|
||||
*/
|
||||
public Layout getLayout(int index) {
|
||||
return layouts[index];
|
||||
}
|
||||
|
@ -900,6 +895,7 @@ public class OptionsGui extends JPanel {
|
|||
|
||||
@Override
|
||||
public void flushChanges() {
|
||||
// stub
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -958,9 +954,6 @@ public class OptionsGui extends JPanel {
|
|||
add(text, element, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the string and adorns it based on the given type (display index)
|
||||
*/
|
||||
void add(String text, ScreenElement element, boolean underline) {
|
||||
|
||||
// add some padding to push off of the edge
|
||||
|
@ -985,9 +978,6 @@ public class OptionsGui extends JPanel {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a layout consisting of all the added text fields.
|
||||
*/
|
||||
Layout getLayout() {
|
||||
return new SingleRowLayout(fields);
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import docking.ComponentProvider;
|
|||
import docking.action.DockingAction;
|
||||
import docking.widgets.fieldpanel.FieldPanel;
|
||||
import docking.widgets.fieldpanel.internal.FieldPanelCoordinator;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.app.plugin.core.functioncompare.FunctionComparisonPanel;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.program.model.address.AddressSet;
|
||||
|
@ -40,8 +41,8 @@ import ghidra.util.classfinder.ExtensionPoint;
|
|||
* form of comparing two sections of code within the same or different programs
|
||||
* <p>
|
||||
* NOTE: ALL CodeComparisonPanel CLASSES MUST END IN
|
||||
* <code>CodeComparisonPanel</code> so they are discoverable by the
|
||||
* {@link ClassSearcher}
|
||||
* <code>CodeComparisonPanel</code> so they are discoverable by the {@link ClassSearcher}
|
||||
* @param <T> the type
|
||||
*/
|
||||
public abstract class CodeComparisonPanel<T extends FieldPanelCoordinator> extends JPanel
|
||||
implements ExtensionPoint, FocusListener {
|
||||
|
@ -52,9 +53,9 @@ public abstract class CodeComparisonPanel<T extends FieldPanelCoordinator> exten
|
|||
|
||||
protected static final int LEFT = 0;
|
||||
protected static final int RIGHT = 1;
|
||||
private static final Color BUBBLE_GUM_PINK_COLOR = new Color(0xff, 0xa5, 0xa5);
|
||||
private static final Color FOCUS_BORDER_COLOR = Palette.getColor("lightpink");
|
||||
protected static final Border FOCUS_BORDER =
|
||||
BorderFactory.createMatteBorder(3, 3, 3, 3, BUBBLE_GUM_PINK_COLOR);
|
||||
BorderFactory.createMatteBorder(3, 3, 3, 3, FOCUS_BORDER_COLOR);
|
||||
protected static final Border NON_FOCUS_BORDER = BorderFactory.createEmptyBorder(3, 3, 3, 3);
|
||||
protected static final AddressSetView EMPTY_ADDRESS_SET = new AddressSet();
|
||||
|
||||
|
|
|
@ -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,16 @@
|
|||
*/
|
||||
package ghidra.app.util.xml;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import org.xml.sax.SAXParseException;
|
||||
|
||||
import generic.theme.TempColorUtils;
|
||||
import ghidra.app.util.importer.MessageLog;
|
||||
import ghidra.framework.options.*;
|
||||
import ghidra.program.model.address.*;
|
||||
|
@ -28,15 +37,6 @@ import ghidra.util.xml.*;
|
|||
import ghidra.xml.XmlElement;
|
||||
import ghidra.xml.XmlPullParser;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import org.xml.sax.SAXParseException;
|
||||
|
||||
class PropertiesXmlMgr {
|
||||
|
||||
private final static String PROPERTY_LIST_CATEGORY_DELIMITER = Options.DELIMITER_STRING;
|
||||
|
@ -209,7 +209,8 @@ class PropertiesXmlMgr {
|
|||
String listName = getPropertyList(pathname);
|
||||
String name = getPropertyName(pathname);
|
||||
if (listName == null || name == null) {
|
||||
log.appendMsg("Property NAME attribute must contain both category prefix and property name");
|
||||
log.appendMsg(
|
||||
"Property NAME attribute must contain both category prefix and property name");
|
||||
return;
|
||||
}
|
||||
Options list = program.getOptions(listName);
|
||||
|
@ -253,7 +254,8 @@ class PropertiesXmlMgr {
|
|||
list.setDate(name, new Date(value));
|
||||
}
|
||||
else if ("color".equals(type)) {
|
||||
Color color = new Color(XmlUtilities.parseInt(element.getAttribute("VALUE")));
|
||||
Color color =
|
||||
TempColorUtils.fromRgb(XmlUtilities.parseInt(element.getAttribute("VALUE")));
|
||||
list.setColor(name, color);
|
||||
}
|
||||
else if ("file".equals(type)) {
|
||||
|
@ -311,7 +313,8 @@ class PropertiesXmlMgr {
|
|||
// XML WRITE CURRENT DTD //
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void write(XmlWriter writer, AddressSetView set, TaskMonitor monitor) throws CancelledException {
|
||||
void write(XmlWriter writer, AddressSetView set, TaskMonitor monitor)
|
||||
throws CancelledException {
|
||||
monitor.setMessage("Writing PROPERTIES ...");
|
||||
writer.startElement("PROPERTIES");
|
||||
writePropertyMaps(writer, set, monitor);
|
||||
|
@ -323,11 +326,11 @@ class PropertiesXmlMgr {
|
|||
throws CancelledException {
|
||||
List<String> listNames = program.getOptionsNames();
|
||||
Collections.sort(listNames);
|
||||
for (int i = 0; i < listNames.size(); i++) {
|
||||
Options propList = program.getOptions(listNames.get(i));
|
||||
for (String listName : listNames) {
|
||||
Options propList = program.getOptions(listName);
|
||||
List<String> propNames = propList.getOptionNames();
|
||||
Collections.sort(propNames);
|
||||
String prefix = listNames.get(i) + PROPERTY_LIST_CATEGORY_DELIMITER;
|
||||
String prefix = listName + PROPERTY_LIST_CATEGORY_DELIMITER;
|
||||
for (String name : propNames) {
|
||||
if (monitor.isCancelled()) {
|
||||
throw new CancelledException();
|
||||
|
|
|
@ -18,6 +18,7 @@ package ghidra.base.actions;
|
|||
import docking.ActionContext;
|
||||
import docking.action.DockingAction;
|
||||
import docking.action.MenuData;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.util.HTMLUtilities;
|
||||
|
||||
/**
|
||||
|
@ -41,7 +42,8 @@ public class HorizontalRuleAction extends DockingAction {
|
|||
markHelpUnnecessary();
|
||||
|
||||
// The menu name is both names, one over the other, in a small, light grayish font.
|
||||
setMenuBarData(new MenuData(new String[] { "<HTML><CENTER><FONT SIZE=2 COLOR=SILVER>" +
|
||||
setMenuBarData(new MenuData(new String[] { "<HTML><CENTER><FONT SIZE=2 COLOR=\"" +
|
||||
Palette.SILVER + "\">" +
|
||||
fixupFirstAmp(
|
||||
HTMLUtilities.escapeHTML(topName) + "<BR>" + HTMLUtilities.escapeHTML(bottomName)) +
|
||||
"</FONT></CENTER>" }));
|
||||
|
|
|
@ -28,6 +28,7 @@ import docking.DockingUtils;
|
|||
import docking.widgets.*;
|
||||
import docking.widgets.label.*;
|
||||
import generic.theme.GColor;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import generic.util.WindowUtilities;
|
||||
import ghidra.framework.Application;
|
||||
import ghidra.framework.ApplicationProperties;
|
||||
|
@ -37,13 +38,10 @@ import resources.ResourceManager;
|
|||
import utilities.util.FileUtilities;
|
||||
|
||||
/**
|
||||
* Window to display version information about the current release of
|
||||
* the ghidra application.
|
||||
* Window to display version information about the current release of the application.
|
||||
*/
|
||||
class InfoPanel extends JPanel {
|
||||
|
||||
private final static Color RED = new Color(199, 0, 0);
|
||||
|
||||
private final static int MARGIN = 10;
|
||||
|
||||
private String version;
|
||||
|
@ -130,7 +128,7 @@ class InfoPanel extends JPanel {
|
|||
|
||||
private Component buildMarkingLabel() {
|
||||
MultiLineLabel markingLabel = new MultiLineLabel(marking, 0, 3, MultiLineLabel.CENTER);
|
||||
markingLabel.setForeground(RED);
|
||||
markingLabel.setForeground(Palette.RED);
|
||||
return markingLabel;
|
||||
}
|
||||
|
||||
|
@ -145,7 +143,7 @@ class InfoPanel extends JPanel {
|
|||
private Component buildTestBuildLabel() {
|
||||
MultiLineLabel testLabel =
|
||||
new MultiLineLabel("-- UNSUPPORTED TEST BUILD --", 0, 3, MultiLineLabel.CENTER);
|
||||
testLabel.setForeground(RED);
|
||||
testLabel.setForeground(Palette.RED);
|
||||
return testLabel;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,10 +18,10 @@ package ghidra.graph;
|
|||
import static ghidra.graph.ProgramGraphType.*;
|
||||
import static ghidra.service.graph.VertexShape.*;
|
||||
|
||||
import generic.theme.GColor;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.service.graph.GraphDisplayOptions;
|
||||
import ghidra.service.graph.VertexShape;
|
||||
import ghidra.util.WebColors;
|
||||
|
||||
/**
|
||||
* {@link GraphDisplayOptions} for {@link ProgramGraphType}
|
||||
|
@ -40,59 +40,60 @@ public class ProgramGraphDisplayOptions extends GraphDisplayOptions {
|
|||
@Override
|
||||
protected void initializeDefaults() {
|
||||
setDefaultVertexShape(ELLIPSE);
|
||||
setDefaultVertexColor(WebColors.RED);
|
||||
setDefaultEdgeColor(WebColors.RED);
|
||||
setDefaultVertexColor(new GColor("color.bg.plugin.programgraph.vertex.default"));
|
||||
setDefaultEdgeColor(new GColor("color.bg.plugin.programgraph.edge.default"));
|
||||
setFavoredEdgeType(FALL_THROUGH);
|
||||
|
||||
configureVertexType(BODY, RECTANGLE, WebColors.BLUE);
|
||||
configureVertexType(ENTRY, TRIANGLE_DOWN, WebColors.DARK_ORANGE);
|
||||
configureVertexType(EXIT, TRIANGLE_UP, WebColors.DARK_MAGENTA);
|
||||
configureVertexType(SWITCH, DIAMOND, WebColors.DARK_CYAN);
|
||||
configureVertexType(EXTERNAL, RECTANGLE, WebColors.DARK_GREEN);
|
||||
configureVertexType(BAD, ELLIPSE, WebColors.RED);
|
||||
configureVertexType(DATA, ELLIPSE, WebColors.PINK);
|
||||
configureVertexType(ENTRY_NEXUS, ELLIPSE, WebColors.WHEAT);
|
||||
configureVertexType(INSTRUCTION, VertexShape.HEXAGON, WebColors.BLUE);
|
||||
configureVertexType(STACK, RECTANGLE, WebColors.GREEN);
|
||||
//@formatter:off
|
||||
configureVertexType(BODY, RECTANGLE, new GColor("color.bg.plugin.programgraph.vertex.body"));
|
||||
configureVertexType(ENTRY, TRIANGLE_DOWN, new GColor("color.bg.plugin.programgraph.vertex.entry"));
|
||||
configureVertexType(EXIT, TRIANGLE_UP, new GColor("color.bg.plugin.programgraph.vertex.exit"));
|
||||
configureVertexType(SWITCH, DIAMOND, new GColor("color.bg.plugin.programgraph.vertex.switch"));
|
||||
configureVertexType(EXTERNAL, RECTANGLE, new GColor("color.bg.plugin.programgraph.vertex.external"));
|
||||
configureVertexType(BAD, ELLIPSE, new GColor("color.bg.plugin.programgraph.vertex.bad"));
|
||||
configureVertexType(DATA, ELLIPSE, new GColor("color.bg.plugin.programgraph.vertex.data"));
|
||||
configureVertexType(ENTRY_NEXUS, ELLIPSE, new GColor("color.bg.plugin.programgraph.vertex.entry.nexus"));
|
||||
configureVertexType(INSTRUCTION, VertexShape.HEXAGON, new GColor("color.bg.plugin.programgraph.vertex.instruction"));
|
||||
configureVertexType(STACK, RECTANGLE, new GColor("color.bg.plugin.programgraph.vertex.stack"));
|
||||
|
||||
configureEdgeType(ENTRY_EDGE, WebColors.GRAY);
|
||||
configureEdgeType(FALL_THROUGH, WebColors.BLUE);
|
||||
configureEdgeType(UNCONDITIONAL_JUMP, WebColors.DARK_GREEN);
|
||||
configureEdgeType(UNCONDITIONAL_CALL, WebColors.DARK_ORANGE);
|
||||
configureEdgeType(TERMINATOR, WebColors.PURPLE);
|
||||
configureEdgeType(JUMP_TERMINATOR, WebColors.PURPLE);
|
||||
configureEdgeType(INDIRECTION, WebColors.PINK);
|
||||
configureEdgeType(ENTRY_EDGE, new GColor("color.bg.plugin.programgraph.edge.entry"));
|
||||
configureEdgeType(FALL_THROUGH, new GColor("color.bg.plugin.programgraph.edge.fall.through"));
|
||||
configureEdgeType(UNCONDITIONAL_JUMP, new GColor("color.bg.plugin.programgraph.edge.jump.unconditional"));
|
||||
configureEdgeType(UNCONDITIONAL_CALL, new GColor("color.bg.plugin.programgraph.edge.call.unconditional"));
|
||||
configureEdgeType(TERMINATOR, new GColor("color.bg.plugin.programgraph.edge.terminator"));
|
||||
configureEdgeType(JUMP_TERMINATOR, new GColor("color.bg.plugin.programgraph.edge.jump.terminator"));
|
||||
configureEdgeType(INDIRECTION, new GColor("color.bg.plugin.programgraph.edge.indirection"));
|
||||
|
||||
configureEdgeType(CONDITIONAL_JUMP, WebColors.DARK_GOLDENROD);
|
||||
configureEdgeType(CONDITIONAL_CALL, WebColors.DARK_ORANGE);
|
||||
configureEdgeType(CONDITIONAL_TERMINATOR, WebColors.PURPLE);
|
||||
configureEdgeType(CONDITIONAL_CALL_TERMINATOR, WebColors.PURPLE);
|
||||
configureEdgeType(CONDITIONAL_JUMP, new GColor("color.bg.plugin.programgraph.edge.jump.conditional"));
|
||||
configureEdgeType(CONDITIONAL_CALL, new GColor("color.bg.plugin.programgraph.edge.call.conditional"));
|
||||
configureEdgeType(CONDITIONAL_TERMINATOR, new GColor("color.bg.plugin.programgraph.edge.conditional.terminator"));
|
||||
configureEdgeType(CONDITIONAL_CALL_TERMINATOR, new GColor("color.bg.plugin.programgraph.edge.call.conditional.terminator"));
|
||||
|
||||
configureEdgeType(COMPUTED_JUMP, WebColors.CYAN);
|
||||
configureEdgeType(COMPUTED_CALL, WebColors.CYAN);
|
||||
configureEdgeType(COMPUTED_CALL_TERMINATOR, WebColors.PURPLE);
|
||||
configureEdgeType(COMPUTED_JUMP, new GColor("color.bg.plugin.programgraph.edge.jump.computed"));
|
||||
configureEdgeType(COMPUTED_CALL, new GColor("color.bg.plugin.programgraph.edge.call.computed"));
|
||||
configureEdgeType(COMPUTED_CALL_TERMINATOR, new GColor("color.bg.plugin.programgraph.edge.call.computed.terminator"));
|
||||
|
||||
configureEdgeType(CONDITIONAL_COMPUTED_CALL, WebColors.CYAN);
|
||||
configureEdgeType(CONDITIONAL_COMPUTED_JUMP, WebColors.CYAN);
|
||||
configureEdgeType(CONDITIONAL_COMPUTED_CALL, new GColor("color.bg.plugin.programgraph.edge.call.conditional.computed"));
|
||||
configureEdgeType(CONDITIONAL_COMPUTED_JUMP, new GColor("color.bg.plugin.programgraph.edge.jump.conitional.computed"));
|
||||
|
||||
configureEdgeType(CALL_OVERRIDE_UNCONDITIONAL, WebColors.RED);
|
||||
configureEdgeType(JUMP_OVERRIDE_UNCONDITIONAL, WebColors.RED);
|
||||
configureEdgeType(CALLOTHER_OVERRIDE_CALL, WebColors.RED);
|
||||
configureEdgeType(CALLOTHER_OVERRIDE_JUMP, WebColors.RED);
|
||||
configureEdgeType(CALL_OVERRIDE_UNCONDITIONAL, new GColor("color.bg.plugin.programgraph.edge.call.unconditional.override"));
|
||||
configureEdgeType(JUMP_OVERRIDE_UNCONDITIONAL, new GColor("color.bg.plugin.programgraph.edge.jump.unconditional.override"));
|
||||
configureEdgeType(CALLOTHER_OVERRIDE_CALL, new GColor("color.bg.plugin.programgraph.edge.call.callother.override"));
|
||||
configureEdgeType(CALLOTHER_OVERRIDE_JUMP, new GColor("color.bg.plugin.programgraph.edge.jump.callother.override"));
|
||||
|
||||
configureEdgeType(READ, WebColors.GREEN);
|
||||
configureEdgeType(WRITE, WebColors.RED);
|
||||
configureEdgeType(READ_WRITE, WebColors.DARK_GOLDENROD);
|
||||
configureEdgeType(UNKNOWN_DATA, WebColors.BLACK);
|
||||
configureEdgeType(EXTERNAL_REF, WebColors.PURPLE);
|
||||
configureEdgeType(READ, new GColor("color.bg.plugin.programgraph.edge.read"));
|
||||
configureEdgeType(WRITE, new GColor("color.bg.plugin.programgraph.edge.write"));
|
||||
configureEdgeType(READ_WRITE, new GColor("color.bg.plugin.programgraph.edge.read.write"));
|
||||
configureEdgeType(UNKNOWN_DATA, new GColor("color.bg.plugin.programgraph.edge.data.unknown"));
|
||||
configureEdgeType(EXTERNAL_REF, new GColor("color.bg.plugin.programgraph.edge.external.ref"));
|
||||
|
||||
configureEdgeType(READ_INDIRECT, WebColors.DARK_GREEN);
|
||||
configureEdgeType(WRITE_INDIRECT, WebColors.DARK_RED);
|
||||
configureEdgeType(READ_WRITE_INDIRECT, WebColors.BROWN);
|
||||
configureEdgeType(DATA_INDIRECT, WebColors.DARK_ORANGE);
|
||||
|
||||
configureEdgeType(PARAM, WebColors.CYAN);
|
||||
configureEdgeType(THUNK, WebColors.BLUE);
|
||||
configureEdgeType(READ_INDIRECT, new GColor("color.bg.plugin.programgraph.edge.read.indirect"));
|
||||
configureEdgeType(WRITE_INDIRECT, new GColor("color.bg.plugin.programgraph.edge.write.indirect"));
|
||||
configureEdgeType(READ_WRITE_INDIRECT, new GColor("color.bg.plugin.programgraph.edge.read.write.indirect"));
|
||||
configureEdgeType(DATA_INDIRECT, new GColor("color.bg.plugin.programgraph.edge.data.indirect"));
|
||||
|
||||
configureEdgeType(PARAM, new GColor("color.bg.plugin.programgraph.edge.param"));
|
||||
configureEdgeType(THUNK, new GColor("color.bg.plugin.programgraph.edge.thunk"));
|
||||
//@formatter:on
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import javax.swing.border.Border;
|
|||
|
||||
import docking.widgets.checkbox.GCheckBox;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||
import ghidra.program.model.lang.*;
|
||||
import ghidra.program.util.DefaultLanguageService;
|
||||
import ghidra.util.table.*;
|
||||
|
@ -84,7 +85,7 @@ public class NewLanguagePanel extends JPanel {
|
|||
|
||||
formatLabel = new GDLabel();
|
||||
formatLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
formatLabel.setForeground(Color.BLUE);
|
||||
formatLabel.setForeground(Messages.NORMAL);
|
||||
}
|
||||
|
||||
private void layoutEverything() {
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
*/
|
||||
package ghidra.plugins.fsbrowser;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.ArrayList;
|
||||
|
@ -30,6 +29,7 @@ import docking.event.mouse.GMouseListenerAdapter;
|
|||
import docking.widgets.tree.GTree;
|
||||
import docking.widgets.tree.GTreeNode;
|
||||
import docking.widgets.tree.support.GTreeRenderer;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.app.services.ProgramManager;
|
||||
import ghidra.app.services.TextEditorService;
|
||||
import ghidra.formats.gfilesystem.*;
|
||||
|
@ -87,6 +87,7 @@ class FileSystemBrowserComponentProvider extends ComponentProviderAdapter
|
|||
handleDoubleClick(gTree.getNodeForLocation(e.getX(), e.getY()));
|
||||
e.consume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
super.mouseClicked(e);
|
||||
|
@ -127,7 +128,8 @@ class FileSystemBrowserComponentProvider extends ComponentProviderAdapter
|
|||
FSRLRoot fsFSRL = nodeFSRef.getFilesystem().getFSRL();
|
||||
String containerFilename =
|
||||
fsFSRL.hasContainer() ? fsFSRL.getContainer().getName() : "unknown";
|
||||
Icon image = FileIconService.getInstance().getImage(containerFilename,
|
||||
Icon image = FileIconService.getInstance()
|
||||
.getImage(containerFilename,
|
||||
FileIconService.OVERLAY_FILESYSTEM);
|
||||
setIcon(image);
|
||||
}
|
||||
|
@ -153,7 +155,7 @@ class FileSystemBrowserComponentProvider extends ComponentProviderAdapter
|
|||
|
||||
if (ProgramMappingService.isFileOpen(fsrl)) {
|
||||
// TODO: change this to a OVERLAY_OPEN option when fetching icon
|
||||
setForeground(selected ? Color.CYAN : Color.MAGENTA);
|
||||
setForeground(selected ? Palette.CYAN : Palette.MAGENTA);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ import docking.widgets.filechooser.GhidraFileChooser;
|
|||
import docking.widgets.filechooser.GhidraFileChooserMode;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import docking.widgets.table.*;
|
||||
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||
import ghidra.app.services.ProgramManager;
|
||||
import ghidra.formats.gfilesystem.FSRL;
|
||||
import ghidra.formats.gfilesystem.FileSystemService;
|
||||
|
@ -537,7 +538,8 @@ public class BatchImportDialog extends DialogComponentProvider {
|
|||
protected String getText(Object value) {
|
||||
BatchGroupLoadSpec bgls = (BatchGroupLoadSpec) value;
|
||||
return (bgls != null) ? bgls.toString()
|
||||
: "<html><font size=\"-2\" color=\"gray\">Click to set language</font>";
|
||||
: "<html><font size=\"-2\" color=\"" + Messages.HINT +
|
||||
"\">Click to set language</font>";
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ import java.util.*;
|
|||
|
||||
import javax.swing.text.*;
|
||||
|
||||
import generic.theme.GColor;
|
||||
import ghidra.program.database.properties.UnsupportedMapDB;
|
||||
import ghidra.program.model.address.*;
|
||||
import ghidra.program.model.data.*;
|
||||
|
@ -43,20 +44,17 @@ public class ProgramDiffDetails {
|
|||
private static final int INDENT_SIZE = 4;
|
||||
private static final String STANDARD_NEW_LINE = "\n";
|
||||
|
||||
public static Color RED = new Color(0xff, 0x00, 0x00);
|
||||
public static Color MAROON = new Color(0x99, 0x00, 0x00);
|
||||
public static Color GREEN = new Color(0x00, 0x99, 0x00);
|
||||
public static Color BLUE = new Color(0x00, 0x00, 0x99);
|
||||
public static Color PURPLE = new Color(0x99, 0x00, 0x99);
|
||||
public static Color DARK_CYAN = new Color(0x00, 0x99, 0x99);
|
||||
public static Color OLIVE = new Color(0x99, 0x99, 0x00);
|
||||
public static Color ORANGE = new Color(0xff, 0x99, 0x00);
|
||||
public static Color PINK = new Color(0xff, 0x99, 0x99);
|
||||
public static Color YELLOW = new Color(0xff, 0xff, 0x00);
|
||||
public static Color GRAY = new Color(0x88, 0x88, 0x88);
|
||||
private static final Color EMPHASIZE_COLOR = GREEN;
|
||||
private static final Color ADDRESS_COLOR = DARK_CYAN;
|
||||
private static final Color COMMENT_COLOR = GREEN;
|
||||
//@formatter:off
|
||||
private static Color FG_COLOR_ADDRESS = new GColor("color.bg.plugin.programdiff.details.address");
|
||||
private static Color FG_COLOR_COMMENT = new GColor("color.bg.plugin.programdiff.details.comment");
|
||||
private static Color FG_COLOR_DANGER = new GColor("color.bg.plugin.programdiff.details.danger");
|
||||
private static Color FG_COLOR_EMPHASIZE = new GColor("color.bg.plugin.programdiff.details.emphasize");
|
||||
private static Color FG_COLOR_PROGRAM = new GColor("color.bg.plugin.programdiff.details.emphasize");
|
||||
//@formatter:on
|
||||
|
||||
private static final Color EMPHASIZE_COLOR = FG_COLOR_EMPHASIZE;
|
||||
private static final Color ADDRESS_COLOR = FG_COLOR_ADDRESS;
|
||||
private static final Color COMMENT_COLOR = FG_COLOR_COMMENT;
|
||||
|
||||
private static final BookmarkComparator BOOKMARK_COMPARATOR = new BookmarkComparator();
|
||||
|
||||
|
@ -123,12 +121,9 @@ public class ProgramDiffDetails {
|
|||
return buf.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void initAttributes() {
|
||||
textAttrSet = new SimpleAttributeSet();
|
||||
textAttrSet.addAttribute(StyleConstants.FontSize, new Integer(12));
|
||||
textAttrSet.addAttribute(StyleConstants.FontSize, 12);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -690,9 +685,6 @@ public class ProgramDiffDetails {
|
|||
return list.toArray(new Symbol[list.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param addr
|
||||
*/
|
||||
private void addEntryPtLine(Address addr) {
|
||||
addText(indent2);
|
||||
addColorAddress(addr);
|
||||
|
@ -744,7 +736,6 @@ public class ProgramDiffDetails {
|
|||
* @param nameLength the length of the name field.
|
||||
* @param typeLength the length of the type field.
|
||||
* @param sourceLength the length of the source field.
|
||||
* @return the string with the label name and attributes.
|
||||
*/
|
||||
private void addDisplayLabel(Symbol symbol, int nameLength, int typeLength, int sourceLength) {
|
||||
String name = "";
|
||||
|
@ -1191,9 +1182,6 @@ public class ProgramDiffDetails {
|
|||
return hasAddrDiffs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param opIndex
|
||||
*/
|
||||
private void addOperandText(int opIndex) {
|
||||
addText(indent2);
|
||||
addText("Operand: ");
|
||||
|
@ -1445,8 +1433,8 @@ public class ProgramDiffDetails {
|
|||
* tags passed-in. If a comment is present in the tag object, it will be shown
|
||||
* in parenthesis.
|
||||
*
|
||||
* @param tags
|
||||
* @return
|
||||
* @param tags the tags
|
||||
* @return the info
|
||||
*/
|
||||
private String getTagInfo(Collection<FunctionTag> tags) {
|
||||
if (tags == null || tags.size() == 0) {
|
||||
|
@ -2179,7 +2167,9 @@ public class ProgramDiffDetails {
|
|||
for (String propertyName : names1) {
|
||||
if (cu.hasProperty(propertyName)) {
|
||||
// Handle case where the class for a Saveable property is missing (unsupported).
|
||||
if (cu.getProgram().getListing().getPropertyMap(
|
||||
if (cu.getProgram()
|
||||
.getListing()
|
||||
.getPropertyMap(
|
||||
propertyName) instanceof UnsupportedMapDB) {
|
||||
buf.append(
|
||||
indent2 + propertyName + " is an unsupported property." + newLine);
|
||||
|
@ -2551,7 +2541,7 @@ public class ProgramDiffDetails {
|
|||
}
|
||||
|
||||
private void addColorProgram(StyledDocument doc, String text) {
|
||||
color(PURPLE);
|
||||
color(FG_COLOR_PROGRAM);
|
||||
try {
|
||||
doc.insertString(doc.getLength(), text, textAttrSet);
|
||||
}
|
||||
|
@ -2575,7 +2565,7 @@ public class ProgramDiffDetails {
|
|||
}
|
||||
|
||||
private void addDangerColorText(String text) {
|
||||
addColorText(RED, detailsDoc, text);
|
||||
addColorText(FG_COLOR_DANGER, detailsDoc, text);
|
||||
}
|
||||
|
||||
private void addColorText(Color color, StyledDocument doc, String text) {
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
package ghidra.test.processors.support;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
|
@ -23,6 +24,7 @@ import org.jdom.Element;
|
|||
import org.jdom.input.SAXBuilder;
|
||||
import org.jdom.output.XMLOutputter;
|
||||
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.test.processors.support.PCodeTestResults.TestResults;
|
||||
import ghidra.util.HTMLUtilities;
|
||||
import ghidra.util.Msg;
|
||||
|
@ -383,9 +385,9 @@ public class PCodeTestCombinedTestResults {
|
|||
w.println("</tr>");
|
||||
}
|
||||
|
||||
private void writeResultCount(PrintWriter w, int count, String color) {
|
||||
private void writeResultCount(PrintWriter w, int count, Color color) {
|
||||
if (count == 0) {
|
||||
w.print("<font color=\"gray\">-</font>");
|
||||
w.print("<font color=\"" + Palette.GRAY + "\">-</font>");
|
||||
}
|
||||
else {
|
||||
w.print("<font color=\"" + color + "\">" + Integer.toString(count) + "</font>");
|
||||
|
@ -417,25 +419,26 @@ public class PCodeTestCombinedTestResults {
|
|||
// analyzed program has relocation or disassembly errors
|
||||
w.print("<td align=\"center\" class=\"ResultSummary bad\">");
|
||||
if (testResults.summaryHasIngestErrors) {
|
||||
w.print("<font color=\"red\">Ingest-Err</font><br>");
|
||||
w.print("<font color=\"" + Palette.RED + "\">Ingest-Err</font><br>");
|
||||
}
|
||||
if (testResults.summaryHasRelocationErrors) {
|
||||
w.print("<font color=\"red\">Reloc-Err</font><br>");
|
||||
w.print("<font color=\"" + Palette.RED + "\">Reloc-Err</font><br>");
|
||||
}
|
||||
if (testResults.summaryHasDisassemblyErrors) {
|
||||
w.print("<font color=\"red\">Dis-Err</font>");
|
||||
w.print("<font color=\"" + Palette.RED + "\">Dis-Err</font>");
|
||||
}
|
||||
}
|
||||
else {
|
||||
w.print("<td align=\"center\" class=\"ResultSummary " +
|
||||
getSummaryHighlightColorClass(testResults) + "\">");
|
||||
writeResultCount(w, testResults.summaryPassCount, "green");
|
||||
writeResultCount(w, testResults.summaryPassCount, Palette.GREEN);
|
||||
w.print("/");
|
||||
writeResultCount(w, testResults.summaryFailCount, "red");
|
||||
writeResultCount(w, testResults.summaryFailCount, Palette.RED);
|
||||
w.print("/");
|
||||
writeResultCount(w, testResults.summaryCallOtherCount, "orange");
|
||||
writeResultCount(w, testResults.summaryCallOtherCount, Palette.ORANGE);
|
||||
if (testResults.summarySevereFailures != 0) {
|
||||
w.print("<br><font color=\"red\">ERR: " + testResults.summarySevereFailures +
|
||||
w.print("<br><font color=\"" + Palette.RED + "\">ERR: " +
|
||||
testResults.summarySevereFailures +
|
||||
"</font>");
|
||||
}
|
||||
}
|
||||
|
@ -498,25 +501,26 @@ public class PCodeTestCombinedTestResults {
|
|||
namedTestColumn.getColumnWidth() + "><br>");
|
||||
}
|
||||
if (severeFailure) {
|
||||
w.print("<font color=\"red\">ERR</font>");
|
||||
w.print("<font color=\"" + Palette.RED + "\">ERR</font>");
|
||||
}
|
||||
else {
|
||||
if (total == 0) {
|
||||
if (totalAsserts == 0) {
|
||||
w.print("<font color=\"gray\">-</font>");
|
||||
w.print("<font color=\"" + Palette.GRAY + "\">-</font>");
|
||||
}
|
||||
else {
|
||||
w.print("<font color=\"red\">x</font>");
|
||||
w.print("<font color=\"" + Palette.RED + "\">x</font>");
|
||||
}
|
||||
}
|
||||
else {
|
||||
writeResultCount(w, pass, "green");
|
||||
writeResultCount(w, pass, Palette.GREEN);
|
||||
w.print("/");
|
||||
writeResultCount(w, fail, "red");
|
||||
writeResultCount(w, fail, Palette.RED);
|
||||
w.print("/");
|
||||
writeResultCount(w, callother, "orange");
|
||||
writeResultCount(w, callother, Palette.ORANGE);
|
||||
if (total != totalAsserts) {
|
||||
w.print("<br><font color=\"red\">(!=" + totalAsserts + ")</font>");
|
||||
w.print("<br><font color=\"" + Palette.RED + "\">(!=" + totalAsserts +
|
||||
")</font>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import javax.swing.JLabel;
|
|||
import javax.swing.JTable;
|
||||
|
||||
import docking.widgets.table.GTableCellRenderingData;
|
||||
import generic.theme.GColor;
|
||||
import ghidra.docking.settings.Settings;
|
||||
import ghidra.program.util.ProgramLocation;
|
||||
import ghidra.util.Msg;
|
||||
|
@ -33,8 +34,10 @@ import ghidra.util.table.column.AbstractGColumnRenderer;
|
|||
* used directly with {@link PreviewTableCellData} column data.
|
||||
*/
|
||||
public class PreviewDataTableCellRenderer extends AbstractGColumnRenderer<PreviewTableCellData> {
|
||||
private static final Color DEFAULT_OFFCUT_FOREGROUND_COLOR = Color.RED;
|
||||
private static final Color DEFAULT_SELECTED_OFFCUT_FOREGROUND_COLOR = Color.PINK;
|
||||
private static final Color DEFAULT_OFFCUT_FOREGROUND_COLOR =
|
||||
new GColor("color.fg.table.offcut.unselected");
|
||||
private static final Color DEFAULT_SELECTED_OFFCUT_FOREGROUND_COLOR =
|
||||
new GColor("color.fg.table.offcut.selected");
|
||||
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(GTableCellRenderingData data) {
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.util.stream.Collectors;
|
|||
import javax.swing.JLabel;
|
||||
|
||||
import docking.widgets.table.GTableCellRenderingData;
|
||||
import generic.theme.GColor;
|
||||
import ghidra.app.plugin.core.navigation.locationreferences.ReferenceUtils;
|
||||
import ghidra.docking.settings.Settings;
|
||||
import ghidra.framework.plugintool.ServiceProvider;
|
||||
|
@ -98,6 +99,7 @@ public class ReferencesFromTableModel extends AddressBasedTableModel<ReferenceEn
|
|||
// " << OFFCUT >>"
|
||||
private static final String PLAIN_OFFCUT_TEXT = "<< OFFCUT >>";
|
||||
private static final String HTML_OFFCUT_TEXT = " << OFFCUT >>";
|
||||
private static final Color OFFCUT_COLOR = new GColor("color.fg.table.offcut.unselected");
|
||||
|
||||
ReferenceTypeTableCellRenderer() {
|
||||
setHTMLRenderingEnabled(true);
|
||||
|
@ -120,7 +122,7 @@ public class ReferencesFromTableModel extends AddressBasedTableModel<ReferenceEn
|
|||
RefType refType = t.getReferenceType();
|
||||
String text = refType.getName();
|
||||
if (t.isOffcut()) {
|
||||
text = "<html>" + HTMLUtilities.colorString(Color.RED, text + HTML_OFFCUT_TEXT);
|
||||
text = "<html>" + HTMLUtilities.colorString(OFFCUT_COLOR, text + HTML_OFFCUT_TEXT);
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
|
|
@ -47,6 +47,10 @@ import docking.widgets.table.threaded.ThreadedTableModel;
|
|||
import docking.widgets.tree.GTree;
|
||||
import generic.jar.ResourceFile;
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import generic.theme.GThemeDefaults.Colors.Java;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import generic.theme.TempColorUtils;
|
||||
import generic.util.image.ImageUtils;
|
||||
import ghidra.app.events.ProgramSelectionPluginEvent;
|
||||
import ghidra.app.plugin.core.analysis.AnalysisOptionsDialog;
|
||||
|
@ -420,7 +424,7 @@ public abstract class AbstractScreenShotGenerator extends AbstractGhidraHeadedIn
|
|||
captureComponent(window);
|
||||
}
|
||||
}
|
||||
drawBorder(Color.BLACK);
|
||||
drawBorder(Java.BORDER);
|
||||
}
|
||||
|
||||
public JPopupMenu getPopupMenu() {
|
||||
|
@ -784,20 +788,20 @@ public abstract class AbstractScreenShotGenerator extends AbstractGhidraHeadedIn
|
|||
BufferedImage combinedImage =
|
||||
new BufferedImage(rect.width, rect.height, BufferedImage.TYPE_INT_ARGB);
|
||||
Graphics g = combinedImage.getGraphics();
|
||||
g.setColor(Color.WHITE);
|
||||
g.setColor(Palette.WHITE);
|
||||
g.fillRect(0, 0, rect.width, rect.height);
|
||||
|
||||
for (Component component : comps) {
|
||||
int pad = 6;
|
||||
Point p = component.getLocationOnScreen();
|
||||
g.setColor(new Color(250, 250, 250));
|
||||
g.setColor(TempColorUtils.fromRgb(250, 250, 250)); // just slightly not white
|
||||
g.fillRoundRect(p.x - rect.x - pad, p.y - rect.y - pad, component.getWidth() + pad * 2,
|
||||
component.getHeight() + pad * 2, pad * 2, pad * 2);
|
||||
}
|
||||
for (Component component : comps) {
|
||||
int pad = 3;
|
||||
Point p = component.getLocationOnScreen();
|
||||
g.setColor(new Color(240, 240, 240));
|
||||
g.setColor(TempColorUtils.fromRgb(240, 240, 240)); // faint gray
|
||||
g.fillRoundRect(p.x - rect.x - pad, p.y - rect.y - pad, component.getWidth() + pad * 2,
|
||||
component.getHeight() + pad * 2, pad * 2, pad * 2);
|
||||
}
|
||||
|
@ -1372,7 +1376,7 @@ public abstract class AbstractScreenShotGenerator extends AbstractGhidraHeadedIn
|
|||
}
|
||||
|
||||
public void drawRectangleWithDropShadowAround(JComponent component, Color color, int padding) {
|
||||
Rectangle r = drawRectangleAround(component, Color.BLACK, padding);
|
||||
Rectangle r = drawRectangleAround(component, Java.BORDER, padding);
|
||||
|
||||
// move it back a bit to create the drop-shadow effect
|
||||
r.x -= padding;
|
||||
|
@ -1594,7 +1598,7 @@ public abstract class AbstractScreenShotGenerator extends AbstractGhidraHeadedIn
|
|||
public Image takeSnippet(Rectangle bounds) {
|
||||
int margin = 20;
|
||||
int topMargin = 4;
|
||||
padImage(Color.WHITE, 0, margin, 0, margin);
|
||||
padImage(Colors.BACKGROUND, 0, margin, 0, margin);
|
||||
int rise = 8;
|
||||
bounds.width += 2 * margin;
|
||||
|
||||
|
@ -1625,7 +1629,7 @@ public abstract class AbstractScreenShotGenerator extends AbstractGhidraHeadedIn
|
|||
|
||||
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
|
||||
g2.setColor(Color.BLACK);
|
||||
g2.setColor(Java.BORDER);
|
||||
g2.setStroke(new BasicStroke(3f));
|
||||
g2.draw(topPath);
|
||||
g2.draw(bottomPath);
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
package help.screenshot;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
@ -31,6 +31,7 @@ import org.junit.Assert;
|
|||
import docking.*;
|
||||
import docking.action.DockingActionIf;
|
||||
import generic.jar.ResourceFile;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import generic.util.WindowUtilities;
|
||||
import ghidra.framework.Application;
|
||||
import ghidra.framework.main.FrontEndTool;
|
||||
|
@ -39,6 +40,7 @@ import ghidra.util.exception.AssertException;
|
|||
|
||||
public abstract class GhidraScreenShotGenerator extends AbstractScreenShotGenerator {
|
||||
|
||||
private static final Color FG_COLOR_TEXT = Palette.getColor("color.palate.cornflowerblue");
|
||||
private static final String CAPTURE = "Capture";
|
||||
|
||||
protected GhidraScreenShotGenerator() {
|
||||
|
@ -256,7 +258,7 @@ public abstract class GhidraScreenShotGenerator extends AbstractScreenShotGenera
|
|||
|
||||
int x = (width / 2) - (stringWidth / 2);
|
||||
int y = (height / 2) + (stringHeight / 2);
|
||||
g.setColor(new Color(0, 0, 200, 100));
|
||||
g.setColor(FG_COLOR_TEXT);
|
||||
g.drawString(text, x, y);
|
||||
|
||||
return gifImage;
|
||||
|
@ -280,7 +282,7 @@ public abstract class GhidraScreenShotGenerator extends AbstractScreenShotGenera
|
|||
|
||||
int x = (width / 2) - (stringWidth / 2);
|
||||
int y = (height / 2) + (stringHeight / 2);
|
||||
g.setColor(new Color(0, 0, 200, 100));
|
||||
g.setColor(FG_COLOR_TEXT);
|
||||
g.drawString(text, x, y);
|
||||
|
||||
return gifImage;
|
||||
|
|
|
@ -33,6 +33,8 @@ import docking.action.DockingAction;
|
|||
import docking.action.ToolBarData;
|
||||
import docking.widgets.combobox.GComboBox;
|
||||
import docking.widgets.label.*;
|
||||
import generic.theme.GThemeDefaults.Colors.Java;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.bean.GGlassPane;
|
||||
import ghidra.util.bean.GGlassPanePainter;
|
||||
|
@ -85,7 +87,7 @@ public class ImageDialogProvider extends DialogComponentProvider {
|
|||
@Override
|
||||
public void actionPerformed(ActionContext context) {
|
||||
if (dragShape != null) {
|
||||
dragShape.setColor(Color.green.brighter());
|
||||
dragShape.setColor(Palette.GREEN);
|
||||
shapeList.add(dragShape);
|
||||
dragShape = null;
|
||||
glassPane.repaint();
|
||||
|
@ -143,12 +145,12 @@ public class ImageDialogProvider extends DialogComponentProvider {
|
|||
String selectedItem = (String) shapeCombo.getSelectedItem();
|
||||
if ("Rectangle".equals(selectedItem)) {
|
||||
Rectangle r = new Rectangle(startPoint, new Dimension(width, height));
|
||||
dragShape = new ShapePainter(r, Color.RED);
|
||||
dragShape = new ShapePainter(r, Palette.RED);
|
||||
}
|
||||
else if ("Oval".equals(selectedItem)) {
|
||||
Ellipse2D ellipse =
|
||||
new Ellipse2D.Double(startPoint.x, startPoint.y, width, height);
|
||||
dragShape = new ShapePainter(ellipse, Color.RED);
|
||||
dragShape = new ShapePainter(ellipse, Palette.RED);
|
||||
}
|
||||
else if ("Arrow".equals(selectedItem)) {
|
||||
// TODO
|
||||
|
@ -174,25 +176,25 @@ public class ImageDialogProvider extends DialogComponentProvider {
|
|||
|
||||
newImageLabel = new GIconLabel(new ImageIcon(newImage));
|
||||
newImageLabel.setOpaque(true);
|
||||
newImageLabel.setBackground(Color.BLACK);
|
||||
newImageLabel.setBackground(Palette.BLACK);
|
||||
JPanel newLabelPanel = new JPanel(new BorderLayout());
|
||||
|
||||
if (oldImage != null) {
|
||||
oldImageLabel = new GIconLabel(new ImageIcon(oldImage));
|
||||
oldImageLabel.setOpaque(true);
|
||||
oldImageLabel.setBackground(Color.BLACK);
|
||||
oldImageLabel.setBackground(Palette.BLACK);
|
||||
}
|
||||
else {
|
||||
oldImageLabel = new GLabel(" Old image not found ");
|
||||
}
|
||||
|
||||
newLabelPanel.add(createImageLabelComponent("New Image"), BorderLayout.NORTH);
|
||||
newLabelPanel.setBorder(BorderFactory.createLineBorder(Color.black, 20));
|
||||
newLabelPanel.setBorder(BorderFactory.createLineBorder(Java.BORDER, 20));
|
||||
newLabelPanel.add(newImageLabel, BorderLayout.CENTER);
|
||||
|
||||
JPanel oldLabelPanel = new JPanel(new BorderLayout());
|
||||
oldLabelPanel.add(createImageLabelComponent("Old Image"), BorderLayout.NORTH);
|
||||
oldLabelPanel.setBorder(BorderFactory.createLineBorder(Color.black, 20));
|
||||
oldLabelPanel.setBorder(BorderFactory.createLineBorder(Java.BORDER, 20));
|
||||
oldLabelPanel.add(oldImageLabel, BorderLayout.CENTER);
|
||||
|
||||
imagePanel.add(oldLabelPanel, BorderLayout.WEST);
|
||||
|
@ -215,10 +217,10 @@ public class ImageDialogProvider extends DialogComponentProvider {
|
|||
}
|
||||
|
||||
private JLabel createNameLabel(String name) {
|
||||
JLabel label = new GDHtmlLabel("<html><b><font color='yellow' size='8'>" + name);
|
||||
JLabel label =
|
||||
new GDHtmlLabel("<html><b><font color='" + Palette.YELLOW + "' size='8'>" + name);
|
||||
label.setOpaque(true);
|
||||
// label.setForeground(Color.YELLOW);
|
||||
label.setBackground(Color.BLACK);
|
||||
label.setBackground(Palette.BLACK);
|
||||
label.setHorizontalTextPosition(SwingConstants.CENTER);
|
||||
return label;
|
||||
}
|
||||
|
|
|
@ -31,6 +31,8 @@ import docking.ActionContext;
|
|||
import docking.action.DockingActionIf;
|
||||
import docking.options.editor.DefaultOptionComponent;
|
||||
import docking.widgets.table.GTable;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import generic.theme.TempColorUtils;
|
||||
import ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin;
|
||||
import ghidra.app.plugin.core.codebrowser.CodeViewerProvider;
|
||||
import ghidra.app.services.*;
|
||||
|
@ -59,7 +61,7 @@ public class AnalysisOptions2Test extends AbstractGhidraHeadedIntegrationTest {
|
|||
private static final String OLD_OPTION_DEFAULT_VALUE = "Old Default Value";
|
||||
private static final String UNCHANGING_OPTION_DEFAULT_VALUE = "Unchanging Default Value";
|
||||
|
||||
private static final Color NEW_OPTION_DEFAULT_VALUE_AS_COLOR = Color.GREEN;
|
||||
private static final Color NEW_OPTION_DEFAULT_VALUE_AS_COLOR = Palette.GREEN;
|
||||
|
||||
private TestEnv env;
|
||||
private PluginTool tool;
|
||||
|
@ -349,7 +351,7 @@ public class AnalysisOptions2Test extends AbstractGhidraHeadedIntegrationTest {
|
|||
int r = Integer.parseInt(parts[0]);
|
||||
int g = Integer.parseInt(parts[1]);
|
||||
int b = Integer.parseInt(parts[2]);
|
||||
return new Color(r, g, b);
|
||||
return TempColorUtils.fromRgb(r, g, b);
|
||||
}
|
||||
|
||||
private void selectAnalyzer(String name) {
|
||||
|
|
|
@ -33,6 +33,8 @@ import docking.widgets.EventTrigger;
|
|||
import docking.widgets.fieldpanel.FieldPanel;
|
||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||
import docking.widgets.fieldpanel.support.FieldSelection;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import generic.theme.TempColorUtils;
|
||||
import ghidra.GhidraOptions;
|
||||
import ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin;
|
||||
import ghidra.app.plugin.core.marker.MarkerManagerPlugin;
|
||||
|
@ -119,7 +121,7 @@ public class ColorizingPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
assertNavigationActionsEnabled(false);
|
||||
assertSetColorActionEnabled(true);
|
||||
|
||||
Color color = Color.RED;
|
||||
Color color = Palette.RED;
|
||||
setColor(color);
|
||||
assertColorForAddress(color);
|
||||
|
||||
|
@ -133,7 +135,7 @@ public class ColorizingPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
|
||||
assertSetColorActionEnabled(true);
|
||||
|
||||
Color selectionColor = Color.BLUE;
|
||||
Color selectionColor = Palette.BLUE;
|
||||
setColor(selectionColor);
|
||||
assertColorForSelection(selectionColor);
|
||||
|
||||
|
@ -150,7 +152,7 @@ public class ColorizingPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
|
||||
Address address1 = cb.getCurrentAddress();
|
||||
Address address2 = address1.add(8);
|
||||
Color color = Color.RED;
|
||||
Color color = Palette.RED;
|
||||
setColor(color, address1, address2);
|
||||
assertColorForAddress(color, address1, address2);
|
||||
|
||||
|
@ -160,7 +162,7 @@ public class ColorizingPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
|
||||
createSelection();
|
||||
|
||||
Color selectionColor = Color.BLUE;
|
||||
Color selectionColor = Palette.BLUE;
|
||||
setColor(selectionColor);
|
||||
assertColorForSelection(selectionColor);
|
||||
|
||||
|
@ -178,7 +180,7 @@ public class ColorizingPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
Address address2 = address1.add(8);
|
||||
Address address3 = address2.add(16);
|
||||
|
||||
Color color = new Color(100, 100, 100, 100);
|
||||
Color color = TempColorUtils.fromRgba(100, 100, 100, 100);
|
||||
setColor(color, address1, address2, address3);
|
||||
assertColorForAddress(color, address1, address2, address3);
|
||||
|
||||
|
@ -198,7 +200,7 @@ public class ColorizingPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
|
||||
// change the location so that the current line marker does not affect our color check below
|
||||
address = address.add(400);
|
||||
Color color = new Color(100, 100, 100);
|
||||
Color color = TempColorUtils.fromRgb(100, 100, 100);
|
||||
setBackgroundFromAPI(address, color);
|
||||
|
||||
assertMarkerColorAtAddress(address, color);
|
||||
|
@ -218,7 +220,7 @@ public class ColorizingPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
Address address2 = address1.add(8);
|
||||
Address address3 = address2.add(8);
|
||||
|
||||
Color color = new Color(100, 100, 100, 100);
|
||||
Color color = TempColorUtils.fromRgba(100, 100, 100, 100);
|
||||
setColor(color, address1, address2, address3);
|
||||
|
||||
// start before the first address to test that the next range action is enabled and the
|
||||
|
@ -254,7 +256,7 @@ public class ColorizingPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
assertPreviousButtonEnabled(true);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Tests navigation of offcut ranges when coloring is set from a GUI/API point-of-view.
|
||||
*
|
||||
* @throws Exception
|
||||
|
@ -266,7 +268,7 @@ public class ColorizingPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
assertNavigationActionsEnabled(false);
|
||||
|
||||
Address initialAddress = cb.getCurrentAddress(); // 0x1001000
|
||||
Color selectionColor = Color.YELLOW;
|
||||
Color selectionColor = Palette.YELLOW;
|
||||
|
||||
createSelectionBytes("0x10036c0", 0, 0, "0x10036c6", 1, 2); // Sets offcut at end of range
|
||||
setColor(selectionColor);
|
||||
|
@ -320,7 +322,7 @@ public class ColorizingPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Tests navigation of offcut ranges when coloring is set from a plugin point-of-view.
|
||||
*
|
||||
* @throws Exception
|
||||
|
@ -333,7 +335,7 @@ public class ColorizingPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
//
|
||||
// Set some color ranges
|
||||
//
|
||||
Color selectionColor = Color.GRAY;
|
||||
Color selectionColor = Palette.GRAY;
|
||||
setColorOverRange(selectionColor, addr("0x10036c0"), addr("0x10036c9"));
|
||||
setColorOverRange(selectionColor, addr("0x10036d3"), addr("0x10036d6"));
|
||||
setColorOverRange(selectionColor, addr("0x10036e1"), addr("0x10036e6"));
|
||||
|
|
|
@ -15,10 +15,8 @@
|
|||
*/
|
||||
package ghidra.app.plugin.core.disassembler;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -30,6 +28,7 @@ import org.junit.*;
|
|||
|
||||
import docking.ComponentProvider;
|
||||
import docking.widgets.fieldpanel.FieldPanel;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.GhidraOptions;
|
||||
import ghidra.app.events.ProgramSelectionPluginEvent;
|
||||
import ghidra.app.plugin.ProgramPlugin;
|
||||
|
@ -92,7 +91,7 @@ public class DisassembledViewPluginTest extends AbstractGhidraHeadedIntegrationT
|
|||
openProgram("notepad");
|
||||
|
||||
// get the list hiding inside of the component provider
|
||||
JList list = (JList) getInstanceField("contentList", componentProvider);
|
||||
JList<?> list = (JList<?>) getInstanceField("contentList", componentProvider);
|
||||
|
||||
// sanity check
|
||||
assertEquals("The component provider has data when it is not visible.", 0,
|
||||
|
@ -100,9 +99,9 @@ public class DisassembledViewPluginTest extends AbstractGhidraHeadedIntegrationT
|
|||
|
||||
// show the plugin and make sure it is visible before we continue
|
||||
tool.showComponentProvider(componentProvider, true);
|
||||
waitForPostedSwingRunnables();
|
||||
waitForSwing();
|
||||
|
||||
ListModel modelOne = list.getModel();
|
||||
ListModel<?> modelOne = list.getModel();
|
||||
|
||||
// now the list should have data, as it will populate itself off of the
|
||||
// current program location of the plugin
|
||||
|
@ -116,10 +115,10 @@ public class DisassembledViewPluginTest extends AbstractGhidraHeadedIntegrationT
|
|||
// scroll the display and force a new selection
|
||||
pageDown(cbPlugin.getFieldPanel());
|
||||
simulateButtonPress(cbPlugin);
|
||||
waitForPostedSwingRunnables();
|
||||
waitForSwing();
|
||||
|
||||
// get the data
|
||||
ListModel modelTwo = list.getModel();
|
||||
ListModel<?> modelTwo = list.getModel();
|
||||
|
||||
boolean sameData = compareListData(modelOne, modelTwo);
|
||||
assertTrue("The contents of the two lists are the same when they " + "should not be.",
|
||||
|
@ -127,7 +126,7 @@ public class DisassembledViewPluginTest extends AbstractGhidraHeadedIntegrationT
|
|||
|
||||
// make sure no work is done when we are not visible
|
||||
tool.showComponentProvider(componentProvider, false);
|
||||
waitForPostedSwingRunnables();
|
||||
waitForSwing();
|
||||
|
||||
assertEquals("The component provider has data when it is not visible.", 0,
|
||||
list.getModel().getSize());
|
||||
|
@ -135,7 +134,7 @@ public class DisassembledViewPluginTest extends AbstractGhidraHeadedIntegrationT
|
|||
// show the plugin so that it will get the program location change
|
||||
// data
|
||||
tool.showComponentProvider(componentProvider, true);
|
||||
waitForPostedSwingRunnables();
|
||||
waitForSwing();
|
||||
|
||||
// test that sending a bad address will not return any results or
|
||||
// throw any exceptions
|
||||
|
@ -178,11 +177,11 @@ public class DisassembledViewPluginTest extends AbstractGhidraHeadedIntegrationT
|
|||
openProgram("notepad");
|
||||
|
||||
tool.showComponentProvider(componentProvider, true);
|
||||
waitForPostedSwingRunnables();
|
||||
waitForSwing();
|
||||
|
||||
// the Java component that is our display for the plugin
|
||||
JList list = (JList) getInstanceField("contentList", componentProvider);
|
||||
ListModel listContents = list.getModel();
|
||||
JList<?> list = (JList<?>) getInstanceField("contentList", componentProvider);
|
||||
ListModel<?> listContents = list.getModel();
|
||||
|
||||
// make sure that nothing happens on a single-selection
|
||||
plugin.processEvent(createProgramSelectionEvent(false));
|
||||
|
@ -213,7 +212,7 @@ public class DisassembledViewPluginTest extends AbstractGhidraHeadedIntegrationT
|
|||
openProgram("notepad");
|
||||
|
||||
tool.showComponentProvider(componentProvider, true);
|
||||
waitForPostedSwingRunnables();
|
||||
waitForSwing();
|
||||
|
||||
String[] fieldNames =
|
||||
{ "selectedAddressColor", "addressForegroundColor", "backgroundColor", "font" };
|
||||
|
@ -230,35 +229,30 @@ public class DisassembledViewPluginTest extends AbstractGhidraHeadedIntegrationT
|
|||
|
||||
// get and change each options of interest
|
||||
String optionToChange = GhidraOptions.OPTION_SELECTION_COLOR;
|
||||
Color currentColor =
|
||||
opt.getColor(optionToChange, (Color) optionsMap.get("selectedAddressColor"));
|
||||
opt.setColor(optionToChange, deriveNewColor(currentColor));
|
||||
opt.setColor(optionToChange, Palette.LIME);
|
||||
|
||||
// the rest of the options to change are stored under a different
|
||||
// options node
|
||||
opt = tool.getOptions(GhidraOptions.CATEGORY_BROWSER_DISPLAY);
|
||||
|
||||
optionToChange = (String) getInstanceField("ADDRESS_COLOR_OPTION", componentProvider);
|
||||
currentColor =
|
||||
opt.getColor(optionToChange, (Color) optionsMap.get("addressForegroundColor"));
|
||||
opt.setColor(optionToChange, deriveNewColor(currentColor));
|
||||
opt.setColor(optionToChange, Palette.GOLD);
|
||||
|
||||
optionToChange = (String) getInstanceField("BACKGROUND_COLOR_OPTION", componentProvider);
|
||||
currentColor = opt.getColor(optionToChange, (Color) optionsMap.get("backgroundColor"));
|
||||
opt.setColor(optionToChange, deriveNewColor(currentColor));
|
||||
opt.setColor(optionToChange, Palette.LAVENDER);
|
||||
|
||||
optionToChange = (String) getInstanceField("ADDRESS_FONT_OPTION", componentProvider);
|
||||
Font currentFont = opt.getFont(optionToChange, (Font) optionsMap.get("font"));
|
||||
opt.setFont(optionToChange, currentFont.deriveFont((float) currentFont.getSize() + 1));
|
||||
|
||||
// now make sure that the changes have been propogated
|
||||
for (int i = 0; i < fieldNames.length; i++) {
|
||||
// now make sure that the changes have been propagated
|
||||
for (String fieldName : fieldNames) {
|
||||
|
||||
Object newValue = getInstanceField(fieldNames[i], componentProvider);
|
||||
Object newValue = getInstanceField(fieldName, componentProvider);
|
||||
|
||||
assertTrue("The old value has not changed in response to " +
|
||||
"changing the options. Value: " + fieldNames[i],
|
||||
!(newValue.equals(optionsMap.get(fieldNames[i]))));
|
||||
"changing the options. Value: " + fieldName,
|
||||
!(newValue.equals(optionsMap.get(fieldName))));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -282,26 +276,6 @@ public class DisassembledViewPluginTest extends AbstractGhidraHeadedIntegrationT
|
|||
return new ProgramSelectionPluginEvent("CodeBrowserPlugin", selection, program);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Color object that is different than the one provided.
|
||||
*
|
||||
* @param originalColor The color from which the new Color will be
|
||||
* derived.
|
||||
* @return A new color that is different than the one given.
|
||||
*/
|
||||
public Color deriveNewColor(Color originalColor) {
|
||||
Color newColor = null;
|
||||
|
||||
if (originalColor == Color.BLACK) {
|
||||
newColor = originalColor.brighter();
|
||||
}
|
||||
else {
|
||||
newColor = originalColor.darker();
|
||||
}
|
||||
|
||||
return newColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simulates a user click in the code browser plugin.
|
||||
*
|
||||
|
@ -330,7 +304,7 @@ public class DisassembledViewPluginTest extends AbstractGhidraHeadedIntegrationT
|
|||
* @param modelTwo The second list contents to compare
|
||||
* @return True if both lists hold the equal contents in the same order.
|
||||
*/
|
||||
private boolean compareListData(ListModel modelOne, ListModel modelTwo) {
|
||||
private boolean compareListData(ListModel<?> modelOne, ListModel<?> modelTwo) {
|
||||
boolean isSame = false;
|
||||
|
||||
if (modelOne.getSize() == modelTwo.getSize()) {
|
||||
|
@ -350,19 +324,12 @@ public class DisassembledViewPluginTest extends AbstractGhidraHeadedIntegrationT
|
|||
return isSame;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the program of the given name and shows the tool with that
|
||||
* program.
|
||||
*
|
||||
* @param name
|
||||
* @throws Exception
|
||||
*/
|
||||
private void openProgram(String name) throws Exception {
|
||||
|
||||
ClassicSampleX86ProgramBuilder builder = new ClassicSampleX86ProgramBuilder();
|
||||
program = builder.getProgram();
|
||||
|
||||
env.showTool(program);
|
||||
waitForPostedSwingRunnables();
|
||||
waitForSwing();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ import docking.widgets.EventTrigger;
|
|||
import docking.widgets.fieldpanel.FieldPanel;
|
||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||
import docking.widgets.fieldpanel.support.FieldSelection;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.app.cmd.data.CreateStructureCmd;
|
||||
import ghidra.app.events.ProgramActivatedPluginEvent;
|
||||
import ghidra.app.events.ProgramSelectionPluginEvent;
|
||||
|
@ -342,7 +343,7 @@ public class MarkerTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
|
||||
Program program2 = loadSecondProgram();
|
||||
|
||||
Color startColor = Color.PINK;
|
||||
Color startColor = Palette.PINK;
|
||||
MarkerSet markersP1 = markerService.createPointMarker("Awesome Markers", "Description",
|
||||
program, 0, true, true,
|
||||
true, startColor, null, true);
|
||||
|
@ -358,8 +359,8 @@ public class MarkerTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
assertMarkerColor(program, addressP1, startColor);
|
||||
assertMarkerColor(program2, addressP2, startColor);
|
||||
|
||||
Color c1 = Color.ORANGE;
|
||||
Color c2 = Color.BLUE;
|
||||
Color c1 = Palette.ORANGE;
|
||||
Color c2 = Palette.BLUE;
|
||||
|
||||
setMarkerColor(markersP1, c1);
|
||||
setMarkerColor(markersP2, c2);
|
||||
|
@ -367,8 +368,8 @@ public class MarkerTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
assertMarkerColor(program, addressP1, c1);
|
||||
assertMarkerColor(program2, addressP2, c2);
|
||||
|
||||
Color c3 = Color.RED;
|
||||
Color c4 = Color.GREEN;
|
||||
Color c3 = Palette.RED;
|
||||
Color c4 = Palette.GREEN;
|
||||
|
||||
// change markers for current program
|
||||
setMarkerColor(markersP1, c3);
|
||||
|
|
|
@ -17,8 +17,6 @@ package ghidra.app.plugin.core.navigation;
|
|||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
|
@ -27,6 +25,7 @@ import org.junit.*;
|
|||
import docking.action.DockingActionIf;
|
||||
import docking.menu.ActionState;
|
||||
import docking.menu.MultiStateDockingAction;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.app.cmd.data.CreateDataCmd;
|
||||
import ghidra.app.cmd.disassemble.DisassembleCommand;
|
||||
import ghidra.app.plugin.core.bookmark.BookmarkEditCmd;
|
||||
|
@ -799,7 +798,7 @@ public class NextPrevCodeUnitPluginTest extends AbstractGhidraHeadedIntegrationT
|
|||
ImageIcon bookmarkBobIcon =
|
||||
ResourceManager.loadImage("images/applications-engineering.png");
|
||||
|
||||
BookmarkType bob = bookmarkManager.defineType("BOB", bookmarkBobIcon, Color.YELLOW, 0);
|
||||
BookmarkType bob = bookmarkManager.defineType("BOB", bookmarkBobIcon, Palette.YELLOW, 0);
|
||||
|
||||
String typeString = bob.getTypeString();
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.junit.*;
|
|||
import docking.action.DockingAction;
|
||||
import docking.widgets.fieldpanel.FieldPanel;
|
||||
import generic.test.TestUtils;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin;
|
||||
import ghidra.app.plugin.core.marker.MarkerManagerPlugin;
|
||||
import ghidra.app.services.*;
|
||||
|
@ -338,20 +339,12 @@ public class MultiTabPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
fp.setCursorPosition(BigInteger.valueOf(4), 0, 0, 0);
|
||||
});
|
||||
|
||||
assertEquals(Color.BLUE, getFieldPanelBackgroundColor(fp, BigInteger.ZERO));
|
||||
assertEquals(Color.WHITE, getFieldPanelBackgroundColor(fp, BigInteger.ONE));
|
||||
assertEquals(BigInteger.valueOf(4), fp.getCursorLocation().getIndex());
|
||||
|
||||
Color lineColor = (Color) getInstanceField("CURSOR_LINE_COLOR", CodeBrowserPlugin.class);
|
||||
|
||||
programManager.setCurrentProgram(p2);
|
||||
assertEquals(lineColor, getFieldPanelBackgroundColor(fp, BigInteger.ZERO));
|
||||
assertEquals(Color.WHITE, getFieldPanelBackgroundColor(fp, BigInteger.ONE));
|
||||
assertEquals(BigInteger.ZERO, fp.getCursorLocation().getIndex());
|
||||
|
||||
programManager.setCurrentProgram(p1);
|
||||
assertEquals(Color.BLUE, getFieldPanelBackgroundColor(fp, BigInteger.ZERO));
|
||||
assertEquals(Color.WHITE, getFieldPanelBackgroundColor(fp, BigInteger.ONE));
|
||||
assertEquals(BigInteger.valueOf(4), fp.getCursorLocation().getIndex());
|
||||
}
|
||||
|
||||
|
@ -548,7 +541,7 @@ public class MultiTabPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
private MarkerSet createMarkers(final Program p) {
|
||||
final AtomicReference<MarkerSet> ref = new AtomicReference<>();
|
||||
runSwing(() -> ref.set(markerService.createPointMarker("Test", "Test", p, 40, false, false,
|
||||
true, Color.BLUE, null)));
|
||||
true, Palette.BLUE, null)));
|
||||
return ref.get();
|
||||
}
|
||||
|
||||
|
@ -558,10 +551,6 @@ public class MultiTabPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
return windowForComponent(listPanel);
|
||||
}
|
||||
|
||||
private Color getFieldPanelBackgroundColor(FieldPanel fp, BigInteger index) {
|
||||
return runSwing(() -> fp.getBackgroundColor(index));
|
||||
}
|
||||
|
||||
private void performPreviousAction() throws Exception {
|
||||
MultiTabPlugin plugin = env.getPlugin(MultiTabPlugin.class);
|
||||
DockingAction goToPreviousProgramAction =
|
||||
|
@ -613,7 +602,8 @@ public class MultiTabPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
private void addComment(Program p) {
|
||||
int transactionID = p.startTransaction("test");
|
||||
try {
|
||||
p.getListing().setComment(p.getAddressFactory().getAddress("01000000"),
|
||||
p.getListing()
|
||||
.setComment(p.getAddressFactory().getAddress("01000000"),
|
||||
CodeUnit.REPEATABLE_COMMENT, "This is a simple comment change.");
|
||||
}
|
||||
finally {
|
||||
|
|
|
@ -43,6 +43,7 @@ import docking.widgets.DropDownTextFieldDataModel;
|
|||
import docking.widgets.tree.GTree;
|
||||
import docking.widgets.tree.GTreeNode;
|
||||
import generic.test.AbstractGTest;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import generic.util.WindowUtilities;
|
||||
import generic.util.image.ImageUtils;
|
||||
import ghidra.app.plugin.core.datamgr.DataTypeManagerPlugin;
|
||||
|
@ -1195,7 +1196,7 @@ public class DataTypeSelectionDialogTest extends AbstractGhidraHeadedIntegration
|
|||
final JTextField panelUpdateField = new JTextField("Hey Mom");
|
||||
Highlighter highlighter = panelUpdateField.getHighlighter();
|
||||
highlighter.addHighlight(0, 2,
|
||||
new DefaultHighlighter.DefaultHighlightPainter(Color.YELLOW));
|
||||
new DefaultHighlighter.DefaultHighlightPainter(Palette.YELLOW));
|
||||
|
||||
JPanel editorPanel = new JPanel(new BorderLayout());
|
||||
DataTypeSelectionEditor editor = new DataTypeSelectionEditor(tool, AllowedDataTypes.ALL);
|
||||
|
|
|
@ -28,6 +28,8 @@ import org.junit.Before;
|
|||
import org.junit.Test;
|
||||
|
||||
import docking.widgets.fieldpanel.field.*;
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||
import ghidra.app.nav.Navigatable;
|
||||
import ghidra.app.nav.TestDummyNavigatable;
|
||||
import ghidra.app.services.*;
|
||||
|
@ -670,7 +672,7 @@ public class AnnotationTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
FieldElement[] strings = getNumberOfSubFieldElements(fieldElement);
|
||||
assertEquals("Unexpected number of AttributedStrings from comment text.", 2,
|
||||
strings.length);
|
||||
assertEquals("Did not get the expected error annotation string color.", Color.RED,
|
||||
assertEquals("Did not get the expected error annotation string color.", Messages.ERROR,
|
||||
strings[1].getColor(0));
|
||||
}
|
||||
|
||||
|
@ -703,7 +705,7 @@ public class AnnotationTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
FieldElement[] strings = getNumberOfSubFieldElements(fieldElement);
|
||||
assertEquals("Unexpected number of AttributedStrings from comment text.", 2,
|
||||
strings.length);
|
||||
assertEquals("Did not get the expected error annotation string color.", Color.RED,
|
||||
assertEquals("Did not get the expected error annotation string color.", Messages.ERROR,
|
||||
strings[1].getColor(0));
|
||||
}
|
||||
|
||||
|
@ -757,7 +759,7 @@ public class AnnotationTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
|
||||
private AttributedString prototype() {
|
||||
FontMetrics fontMetrics = getFontMetrics();
|
||||
AttributedString prototypeString = new AttributedString("", Color.BLACK, fontMetrics);
|
||||
AttributedString prototypeString = new AttributedString("", Colors.FOREGROUND, fontMetrics);
|
||||
return prototypeString;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ import javax.swing.KeyStroke;
|
|||
import org.junit.*;
|
||||
|
||||
import generic.stl.Pair;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin;
|
||||
import ghidra.app.plugin.core.gotoquery.GoToServicePlugin;
|
||||
import ghidra.app.plugin.core.progmgr.ProgramManagerPlugin;
|
||||
|
@ -91,7 +92,7 @@ public class ToolPluginOptionsTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
String optionName = " Highlight Color";
|
||||
Color highlightColor = options.getColor(optionName, null);
|
||||
assertNotNull("Existing option has been removed--update test", highlightColor);
|
||||
options.setColor(optionName, Color.RED);
|
||||
options.setColor(optionName, Palette.RED);
|
||||
|
||||
optionName = "Highlight Search Results";
|
||||
boolean highlightResults = options.getBoolean(optionName, true);
|
||||
|
|
|
@ -17,10 +17,9 @@ package ghidra.program.database.data;
|
|||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import org.junit.*;
|
||||
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.docking.settings.*;
|
||||
import ghidra.program.database.ProgramBuilder;
|
||||
import ghidra.program.database.ProgramDB;
|
||||
|
@ -154,7 +153,7 @@ public class SettingsTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
defaultSettings.getLong("padded").longValue());
|
||||
|
||||
try {
|
||||
defaultSettings.setValue("format", Color.RED);
|
||||
defaultSettings.setValue("format", Palette.RED);
|
||||
Assert.fail("Should not be able to set arbitrary objects");
|
||||
}
|
||||
catch (IllegalArgumentException e) {
|
||||
|
|
|
@ -44,6 +44,8 @@ import docking.widgets.table.RowObjectFilterModel;
|
|||
import docking.widgets.tree.GTree;
|
||||
import docking.widgets.tree.GTreeNode;
|
||||
import generic.test.TestUtils;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import generic.theme.TempColorUtils;
|
||||
import ghidra.GhidraOptions;
|
||||
import ghidra.app.plugin.core.console.ConsolePlugin;
|
||||
import ghidra.app.util.viewer.options.OptionsGui;
|
||||
|
@ -123,7 +125,8 @@ public class OptionsDialogTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
|
||||
selectAddressEntryInScreenElementOptionsList(optionsGui);
|
||||
|
||||
Color newColor = new Color(255, addressFieldColor.getGreen(), addressFieldColor.getBlue());
|
||||
Color newColor =
|
||||
TempColorUtils.fromRgb(255, addressFieldColor.getGreen(), addressFieldColor.getBlue());
|
||||
setAddressColorValueInOptionsGUI(optionsGui, newColor);
|
||||
|
||||
// close the options
|
||||
|
@ -349,13 +352,13 @@ public class OptionsDialogTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
|
||||
JColorChooser chooser = findComponent(window, JColorChooser.class);
|
||||
assertNotNull(chooser);
|
||||
chooser.setColor(Color.BLUE);
|
||||
chooser.setColor(Palette.BLUE);
|
||||
PropertyEditor editor = getPropertyEditorForProperty(simpleOptionsPanel, "Favorite Color");
|
||||
|
||||
JButton okButton = findButtonByText(window, "OK");
|
||||
assertNotNull(okButton);
|
||||
pressButton(okButton);
|
||||
assertEquals(Color.BLUE, editor.getValue());
|
||||
assertColorsEqual(Palette.BLUE, (Color) editor.getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -640,7 +643,7 @@ public class OptionsDialogTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
|
||||
JColorChooser chooser = findComponent(window, JColorChooser.class);
|
||||
assertNotNull(chooser);
|
||||
chooser.setColor(Color.BLUE);
|
||||
chooser.setColor(Palette.BLUE);
|
||||
|
||||
JButton okButton = findButtonByText(window, "OK");
|
||||
assertNotNull(okButton);
|
||||
|
@ -654,9 +657,9 @@ public class OptionsDialogTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
|
||||
Options options = tool.getOptions(ToolConstants.TOOL_OPTIONS);
|
||||
|
||||
Color c = options.getColor("Favorite Color", Color.RED);
|
||||
Color c = options.getColor("Favorite Color", Palette.RED);
|
||||
|
||||
assertEquals(Color.BLUE, c);
|
||||
assertColorsEqual(Palette.BLUE, c);
|
||||
|
||||
assertTrue(tool.hasConfigChanged());
|
||||
}
|
||||
|
@ -686,7 +689,7 @@ public class OptionsDialogTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
|
||||
JColorChooser chooser = findComponent(window, JColorChooser.class);
|
||||
assertNotNull(chooser);
|
||||
chooser.setColor(Color.BLUE);
|
||||
chooser.setColor(Palette.BLUE);
|
||||
|
||||
JButton okButton = findButtonByText(window, "OK");
|
||||
assertNotNull(okButton);
|
||||
|
@ -700,17 +703,25 @@ public class OptionsDialogTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
|
||||
Options options = tool.getOptions(ToolConstants.TOOL_OPTIONS);
|
||||
|
||||
Color c = options.getColor("Favorite Color", Color.RED);
|
||||
Color c = options.getColor("Favorite Color", Palette.RED);
|
||||
|
||||
assertEquals(Color.BLUE, c);
|
||||
assertColorsEqual(Palette.BLUE, c);
|
||||
|
||||
env.saveRestoreToolState();
|
||||
|
||||
tool = env.getTool();
|
||||
assertEquals(Color.BLUE, options.getColor("Favorite Color", null));
|
||||
assertColorsEqual(Palette.BLUE, options.getColor("Favorite Color", null));
|
||||
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
// Inner Classes
|
||||
//=================================================================================================
|
||||
|
||||
private void assertColorsEqual(Color c1, Color c2) {
|
||||
assertEquals(c1.getRGB(), c2.getRGB());
|
||||
}
|
||||
|
||||
private KeyStroke getKeyBinding(String actionName) throws Exception {
|
||||
OptionsEditor editor = seleNodeWithCustomEditor("Key Bindings");
|
||||
KeyBindingsPanel panel = (KeyBindingsPanel) getInstanceField("panel", editor);
|
||||
|
@ -1106,8 +1117,8 @@ public class OptionsDialogTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
options.setInt(name, 300);
|
||||
|
||||
name = "Favorite Color";
|
||||
options.registerOption(name, Color.RED, null, "description");
|
||||
options.setColor(name, Color.RED);
|
||||
options.registerOption(name, Palette.RED, null, "description");
|
||||
options.setColor(name, Palette.RED);
|
||||
|
||||
// select the middle button
|
||||
name = "Mouse Buttons" + Options.DELIMITER + "Mouse Button To Activate";
|
||||
|
|
|
@ -15,19 +15,16 @@
|
|||
*/
|
||||
package ghidra.app.util.cparser.C;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
|
||||
public class CParserUtilsTest extends AbstractGenericTest {
|
||||
|
||||
public CParserUtilsTest() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUserMessage_OnTokenMgrError() {
|
||||
String function = "void bob@12(int a)";
|
||||
|
@ -35,7 +32,7 @@ public class CParserUtilsTest extends AbstractGenericTest {
|
|||
String message = CParserUtils.handleParseProblem(t, function);
|
||||
|
||||
String characterInfo = "near character 8";
|
||||
String invalidInfo = "<font color=\"red\"><b>@";
|
||||
String invalidInfo = "<font color=\"" + Palette.RED + "\"><b>@";
|
||||
assertTrue(message.contains(characterInfo));
|
||||
assertTrue(message.contains(invalidInfo));
|
||||
}
|
||||
|
|
|
@ -27,6 +27,8 @@ import org.junit.Assert;
|
|||
import org.junit.Test;
|
||||
|
||||
import docking.widgets.label.GHtmlLabel;
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||
import ghidra.app.util.html.diff.*;
|
||||
|
||||
public class DataTypeDifferTest {
|
||||
|
@ -471,7 +473,7 @@ public class DataTypeDifferTest {
|
|||
|
||||
for (ValidatableLine line : lines) {
|
||||
if (line.isDiffColored()) {
|
||||
buffy.append("<font color=\"red\">");
|
||||
buffy.append("<font color=\"" + Messages.ERROR + "\">");
|
||||
}
|
||||
|
||||
buffy.append(line.getText());
|
||||
|
@ -492,14 +494,14 @@ public class DataTypeDifferTest {
|
|||
JPanel rightPanel = new JPanel(new BorderLayout());
|
||||
JLabel rightLabel = new GHtmlLabel(htmlLeft);
|
||||
rightLabel.setOpaque(true);
|
||||
rightLabel.setBackground(Color.WHITE);
|
||||
rightLabel.setBackground(Colors.BACKGROUND);
|
||||
rightLabel.setVerticalAlignment(SwingConstants.TOP);
|
||||
rightPanel.add(rightLabel);
|
||||
|
||||
JPanel leftPanel = new JPanel(new BorderLayout());
|
||||
JLabel leftLabel = new GHtmlLabel(htmlRight);
|
||||
leftLabel.setOpaque(true);
|
||||
leftLabel.setBackground(Color.WHITE);
|
||||
leftLabel.setBackground(Colors.BACKGROUND);
|
||||
leftLabel.setVerticalAlignment(SwingConstants.TOP);
|
||||
leftPanel.add(leftLabel);
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.junit.*;
|
|||
|
||||
import docking.widgets.label.GDHtmlLabel;
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import ghidra.app.util.ToolTipUtils;
|
||||
import ghidra.program.model.data.*;
|
||||
import ghidra.program.model.data.Composite;
|
||||
|
@ -1474,7 +1475,7 @@ public class HTMLDataTypeRepresentationTest extends AbstractGenericTest {
|
|||
StringBuffer buffy1 = new StringBuffer(rightHtml);
|
||||
JLabel rightLabel = new GDHtmlLabel();
|
||||
rightLabel.setOpaque(true);
|
||||
rightLabel.setBackground(Color.WHITE);
|
||||
rightLabel.setBackground(Colors.BACKGROUND);
|
||||
rightLabel.setVerticalAlignment(SwingConstants.TOP);
|
||||
rightPanel.add(rightLabel);
|
||||
|
||||
|
@ -1484,7 +1485,7 @@ public class HTMLDataTypeRepresentationTest extends AbstractGenericTest {
|
|||
StringBuffer buffy2 = new StringBuffer(leftHtml);
|
||||
JLabel leftLabel = new GDHtmlLabel();
|
||||
leftLabel.setOpaque(true);
|
||||
leftLabel.setBackground(Color.WHITE);
|
||||
leftLabel.setBackground(Colors.BACKGROUND);
|
||||
leftLabel.setVerticalAlignment(SwingConstants.TOP);
|
||||
leftPanel.add(leftLabel);
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ package ghidra.framework.data;
|
|||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyEditorSupport;
|
||||
|
@ -30,6 +29,7 @@ import javax.swing.KeyStroke;
|
|||
import org.junit.*;
|
||||
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.framework.options.*;
|
||||
import ghidra.framework.options.OptionsTest.FRUIT;
|
||||
import ghidra.program.database.ProgramBuilder;
|
||||
|
@ -194,9 +194,9 @@ public class OptionsDBTest extends AbstractGenericTest {
|
|||
|
||||
@Test
|
||||
public void testSaveColorOption() {
|
||||
options.setColor("Foo", Color.RED);
|
||||
options.setColor("Foo", Palette.RED);
|
||||
saveAndRestoreOptions();
|
||||
assertEquals(Color.RED, options.getColor("Foo", Color.BLUE));
|
||||
assertEquals(Palette.RED.getRGB(), options.getColor("Foo", Palette.BLUE).getRGB());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -262,7 +262,7 @@ public class OptionsDBTest extends AbstractGenericTest {
|
|||
|
||||
@Test
|
||||
public void testRemove() {
|
||||
options.setColor("COLOR", Color.RED);
|
||||
options.setColor("COLOR", Palette.RED);
|
||||
assertTrue(options.contains("COLOR"));
|
||||
options.removeOption("COLOR");
|
||||
assertTrue(!options.contains("COLOR"));
|
||||
|
@ -271,7 +271,7 @@ public class OptionsDBTest extends AbstractGenericTest {
|
|||
|
||||
@Test
|
||||
public void testGetOptionNames() {
|
||||
options.setColor("COLOR", Color.red);
|
||||
options.setColor("COLOR", Palette.RED);
|
||||
options.setInt("INT", 3);
|
||||
List<String> optionNames = options.getOptionNames();
|
||||
assertTrue(optionNames.contains("COLOR"));
|
||||
|
@ -280,16 +280,16 @@ public class OptionsDBTest extends AbstractGenericTest {
|
|||
|
||||
@Test
|
||||
public void testGetDefaultValue() {
|
||||
options.registerOption("Foo", Color.RED, null, "description");
|
||||
options.setColor("Foo", Color.BLUE);
|
||||
assertEquals(Color.BLUE, options.getColor("Foo", null));
|
||||
assertEquals(Color.RED, options.getDefaultValue("Foo"));
|
||||
options.registerOption("Foo", Palette.RED, null, "description");
|
||||
options.setColor("Foo", Palette.BLUE);
|
||||
assertEquals(Palette.BLUE, options.getColor("Foo", null));
|
||||
assertEquals(Palette.RED, options.getDefaultValue("Foo"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRegisterPropertyEditor() {
|
||||
MyPropertyEditor editor = new MyPropertyEditor();
|
||||
options.registerOption("color", OptionType.COLOR_TYPE, Color.RED, null, "description",
|
||||
options.registerOption("color", OptionType.COLOR_TYPE, Palette.RED, null, "description",
|
||||
editor);
|
||||
assertEquals(editor, options.getRegisteredPropertyEditor("color"));
|
||||
|
||||
|
@ -304,11 +304,11 @@ public class OptionsDBTest extends AbstractGenericTest {
|
|||
|
||||
@Test
|
||||
public void testRestoreOptionValue() {
|
||||
options.registerOption("Foo", Color.RED, null, "description");
|
||||
options.setColor("Foo", Color.BLUE);
|
||||
assertEquals(Color.BLUE, options.getColor("Foo", null));
|
||||
options.registerOption("Foo", Palette.RED, null, "description");
|
||||
options.setColor("Foo", Palette.BLUE);
|
||||
assertEquals(Palette.BLUE, options.getColor("Foo", null));
|
||||
options.restoreDefaultValue("Foo");
|
||||
assertEquals(Color.RED, options.getColor("Foo", null));
|
||||
assertEquals(Palette.RED, options.getColor("Foo", null));
|
||||
|
||||
}
|
||||
|
||||
|
@ -403,11 +403,11 @@ public class OptionsDBTest extends AbstractGenericTest {
|
|||
@Test
|
||||
public void testCopyOptions() {
|
||||
options.setInt("INT", 3);
|
||||
options.setColor("COLOR", Color.RED);
|
||||
options.setColor("COLOR", Palette.RED);
|
||||
ToolOptions options2 = new ToolOptions("aaa");
|
||||
options2.copyOptions(options);
|
||||
assertEquals(3, options.getInt("INT", 3));
|
||||
assertEquals(Color.RED, options.getColor("COLOR", null));
|
||||
assertEquals(Palette.RED, options.getColor("COLOR", null));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -550,17 +550,17 @@ public class OptionsDBTest extends AbstractGenericTest {
|
|||
|
||||
@Test
|
||||
public void testSettingValueToNull() {
|
||||
options.registerOption("Bar", Color.BLUE, null, "description");
|
||||
options.setColor("Bar", Color.red);
|
||||
options.registerOption("Bar", Palette.BLUE, null, "description");
|
||||
options.setColor("Bar", Palette.RED);
|
||||
options.setColor("Bar", null);
|
||||
assertEquals(null, options.getColor("Bar", null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNullValueWillUsedPassedInDefault() {
|
||||
options.setColor("Bar", Color.red);
|
||||
options.setColor("Bar", Palette.RED);
|
||||
options.setColor("Bar", null);
|
||||
assertEquals(Color.BLUE, options.getColor("Bar", Color.BLUE));
|
||||
assertEquals(Palette.BLUE, options.getColor("Bar", Palette.BLUE));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -17,13 +17,13 @@ package ghidra.framework.options;
|
|||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
|
||||
public class FileOptionsTest extends AbstractGenericTest {
|
||||
|
||||
|
@ -33,17 +33,17 @@ public class FileOptionsTest extends AbstractGenericTest {
|
|||
|
||||
options.registerOption("aaa", Integer.valueOf(5), null, "aaa description");
|
||||
options.registerOption("bbb", Integer.valueOf(5), null, "bbb description");
|
||||
options.registerOption("ccc", Color.RED, null, "ccc description");
|
||||
options.registerOption("ccc", Palette.RED, null, "ccc description");
|
||||
|
||||
TestCustomOption custom = new TestCustomOption("bob", 23, true);
|
||||
|
||||
options.setInt("aaa", 10);
|
||||
options.setColor("ccc", Color.BLUE);
|
||||
options.setColor("ccc", Palette.BLUE);
|
||||
options.setCustomOption("ddd", custom);
|
||||
|
||||
assertEquals(10, options.getInt("aaa", 0));
|
||||
assertEquals(5, options.getInt("bbb", 0));
|
||||
assertEquals(Color.BLUE, options.getColor("ccc", null));
|
||||
assertEquals(Palette.BLUE, options.getColor("ccc", null));
|
||||
assertEquals(custom, options.getCustomOption("ddd", null));
|
||||
|
||||
File file = createTempFile("optionsFile", "options");
|
||||
|
@ -54,7 +54,7 @@ public class FileOptionsTest extends AbstractGenericTest {
|
|||
|
||||
assertEquals(10, restored.getInt("aaa", 0));
|
||||
assertFalse(restored.contains("bbb")); // default value should not have been saved
|
||||
assertEquals(Color.BLUE, restored.getColor("ccc", null));
|
||||
assertEquals(Palette.BLUE.getRGB(), restored.getColor("ccc", null).getRGB());
|
||||
assertEquals(custom, restored.getCustomOption("ddd", null));
|
||||
}
|
||||
|
||||
|
|
|
@ -15,8 +15,7 @@
|
|||
*/
|
||||
package ghidra.framework.options;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
|
@ -28,6 +27,7 @@ import javax.swing.KeyStroke;
|
|||
import org.junit.Test;
|
||||
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
|
||||
public class OptionTypeTest extends AbstractGenericTest {
|
||||
static public enum FOO {
|
||||
|
@ -117,9 +117,10 @@ public class OptionTypeTest extends AbstractGenericTest {
|
|||
|
||||
@Test
|
||||
public void testColorConversion() {
|
||||
Color c = new Color(100, 150, 200);
|
||||
Color c = Palette.BLUE;
|
||||
String string = OptionType.COLOR_TYPE.convertObjectToString(c);
|
||||
assertEquals(c, OptionType.COLOR_TYPE.convertStringToObject(string));
|
||||
assertEquals(c.getRGB(),
|
||||
((Color) OptionType.COLOR_TYPE.convertStringToObject(string)).getRGB());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -160,21 +161,27 @@ public class OptionTypeTest extends AbstractGenericTest {
|
|||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
if (this == obj) {
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
MyCustomOption other = (MyCustomOption) obj;
|
||||
if (a != other.a)
|
||||
return false;
|
||||
if (b == null) {
|
||||
if (other.b != null)
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
else if (!b.equals(other.b))
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
MyCustomOption other = (MyCustomOption) obj;
|
||||
if (a != other.a) {
|
||||
return false;
|
||||
}
|
||||
if (b == null) {
|
||||
if (other.b != null) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (!b.equals(other.b)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.jdom.Element;
|
|||
import org.junit.*;
|
||||
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.util.HelpLocation;
|
||||
import ghidra.util.bean.opteditor.OptionsVetoException;
|
||||
import ghidra.util.exception.InvalidInputException;
|
||||
|
@ -137,9 +138,9 @@ public class OptionsTest extends AbstractGenericTest {
|
|||
|
||||
@Test
|
||||
public void testSaveColorOption() {
|
||||
options.setColor("Foo", Color.RED);
|
||||
options.setColor("Foo", Palette.RED);
|
||||
saveAndRestoreOptions();
|
||||
assertEquals(Color.RED, options.getColor("Foo", Color.BLUE));
|
||||
assertColorsEqual(Palette.RED, options.getColor("Foo", Palette.BLUE));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -195,7 +196,7 @@ public class OptionsTest extends AbstractGenericTest {
|
|||
@Test
|
||||
public void testCopy() {
|
||||
options.setInt("Foo", 3);
|
||||
options.setColor("COLOR", Color.RED);
|
||||
options.setColor("COLOR", Palette.RED);
|
||||
options.getLong("LONG", 10);
|
||||
options.registerOption("Bar", true, null, null);
|
||||
Options optionsCopy = options.copy();
|
||||
|
@ -238,39 +239,39 @@ public class OptionsTest extends AbstractGenericTest {
|
|||
|
||||
@Test
|
||||
public void testVeto() {
|
||||
options.setColor("COLOR", Color.RED);
|
||||
options.setColor("COLOR", Palette.RED);
|
||||
|
||||
OptionsChangeListenerForTestVeto listener1 = new OptionsChangeListenerForTestVeto();
|
||||
OptionsChangeListenerForTestVeto listener2 = new OptionsChangeListenerForTestVeto();
|
||||
options.addOptionsChangeListener(listener1);
|
||||
options.addOptionsChangeListener(listener2);
|
||||
|
||||
options.setColor("COLOR", Color.BLUE);
|
||||
options.setColor("COLOR", Palette.BLUE);
|
||||
|
||||
assertEquals(Color.RED, options.getColor("COLOR", Color.RED));
|
||||
assertEquals(Palette.RED, options.getColor("COLOR", Palette.RED));
|
||||
|
||||
if (listener1.callOrder == 1) {
|
||||
assertEquals(Color.RED, listener1.value);
|
||||
assertEquals(Palette.RED, listener1.value);
|
||||
assertEquals(null, listener2.value);
|
||||
}
|
||||
if (listener2.callOrder == 1) {
|
||||
assertEquals(Color.RED, listener2.value);
|
||||
assertEquals(Palette.RED, listener2.value);
|
||||
assertEquals(null, listener1.value);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemove() {
|
||||
options.setColor("COLOR", Color.RED);
|
||||
options.setColor("COLOR", Palette.RED);
|
||||
assertTrue(options.contains("COLOR"));
|
||||
options.removeOption("COLOR");
|
||||
assertTrue(!options.contains("COLOR"));
|
||||
assertFalse(options.contains("COLOR"));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetOptionNames() {
|
||||
options.setColor("COLOR", Color.red);
|
||||
options.setColor("COLOR", Palette.RED);
|
||||
options.setInt("INT", 3);
|
||||
List<String> optionNames = options.getOptionNames();
|
||||
assertEquals(2, optionNames.size());
|
||||
|
@ -280,16 +281,16 @@ public class OptionsTest extends AbstractGenericTest {
|
|||
|
||||
@Test
|
||||
public void testGetDefaultValue() {
|
||||
options.registerOption("Foo", Color.RED, null, null);
|
||||
options.setColor("Foo", Color.BLUE);
|
||||
assertEquals(Color.BLUE, options.getColor("Foo", null));
|
||||
assertEquals(Color.RED, options.getDefaultValue("Foo"));
|
||||
options.registerOption("Foo", Palette.RED, null, null);
|
||||
options.setColor("Foo", Palette.BLUE);
|
||||
assertColorsEqual(Palette.BLUE, options.getColor("Foo", null));
|
||||
assertColorsEqual(Palette.RED, (Color) options.getDefaultValue("Foo"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRegisterPropertyEditor() {
|
||||
MyPropertyEditor editor = new MyPropertyEditor();
|
||||
options.registerOption("color", OptionType.COLOR_TYPE, Color.RED, null, null, editor);
|
||||
options.registerOption("color", OptionType.COLOR_TYPE, Palette.RED, null, null, editor);
|
||||
assertEquals(editor, options.getRegisteredPropertyEditor("color"));
|
||||
}
|
||||
|
||||
|
@ -303,12 +304,12 @@ public class OptionsTest extends AbstractGenericTest {
|
|||
@Test
|
||||
public void testRestoreOptionValue() {
|
||||
|
||||
options.registerOption("Foo", Color.RED, null, null);
|
||||
options.setColor("Foo", Color.BLUE);
|
||||
assertEquals(Color.BLUE, options.getColor("Foo", null));
|
||||
options.registerOption("Foo", Palette.RED, null, null);
|
||||
options.setColor("Foo", Palette.BLUE);
|
||||
assertColorsEqual(Palette.BLUE, options.getColor("Foo", null));
|
||||
|
||||
options.restoreDefaultValue("Foo");
|
||||
assertEquals(Color.RED, options.getColor("Foo", null));
|
||||
assertColorsEqual(Palette.RED, options.getColor("Foo", null));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -427,11 +428,11 @@ public class OptionsTest extends AbstractGenericTest {
|
|||
@Test
|
||||
public void testCopyOptions() {
|
||||
options.setInt("INT", 3);
|
||||
options.setColor("COLOR", Color.RED);
|
||||
options.setColor("COLOR", Palette.RED);
|
||||
ToolOptions options2 = new ToolOptions("aaa");
|
||||
options2.copyOptions(options);
|
||||
assertEquals(3, options.getInt("INT", 3));
|
||||
assertEquals(Color.RED, options.getColor("COLOR", null));
|
||||
assertColorsEqual(Palette.RED, options.getColor("COLOR", null));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -573,16 +574,16 @@ public class OptionsTest extends AbstractGenericTest {
|
|||
|
||||
@Test
|
||||
public void testSettingValueToNull() {
|
||||
options.setColor("Bar", Color.red);
|
||||
options.setColor("Bar", Palette.RED);
|
||||
options.setColor("Bar", null);
|
||||
assertEquals(null, options.getColor("Bar", null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNullValueWillUsedPassedInDefault() {
|
||||
options.setColor("Bar", Color.red);
|
||||
public void testNullValueWillUsePassedInDefault() {
|
||||
options.setColor("Bar", Palette.RED);
|
||||
options.setColor("Bar", null);
|
||||
assertEquals(Color.BLUE, options.getColor("Bar", Color.BLUE));
|
||||
assertColorsEqual(Palette.BLUE, options.getColor("Bar", Palette.BLUE));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -592,6 +593,10 @@ public class OptionsTest extends AbstractGenericTest {
|
|||
assertEquals(OptionType.NO_TYPE, options.getType("bar"));// there is no bar
|
||||
}
|
||||
|
||||
private void assertColorsEqual(Color c1, Color c2) {
|
||||
assertEquals(c1.getRGB(), c2.getRGB());
|
||||
}
|
||||
|
||||
private void saveAndRestoreOptions() {
|
||||
Element root = options.getXmlRoot(false);
|
||||
options = new ToolOptions(root);
|
||||
|
|
|
@ -35,6 +35,7 @@ import org.junit.Test;
|
|||
import com.google.gson.JsonObject;
|
||||
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.app.plugin.core.overview.addresstype.AddressType;
|
||||
import ghidra.program.model.lang.Endian;
|
||||
import ghidra.util.xml.GenericXMLOutputter;
|
||||
|
@ -68,15 +69,15 @@ public class SaveStateTest extends AbstractGenericTest {
|
|||
|
||||
@Test
|
||||
public void testColor() throws Exception {
|
||||
ss.putColor("TEST", Color.RED);
|
||||
ss.putColor("TEST", Palette.RED);
|
||||
Color c = ss.getColor("TEST", null);
|
||||
assertEquals(Color.RED, c);
|
||||
assertEquals(Palette.RED.getRGB(), c.getRGB());
|
||||
|
||||
SaveState restoredState = saveAndRestoreToXml();
|
||||
|
||||
// make sure our value is inside
|
||||
c = restoredState.getColor("TEST", null);
|
||||
assertEquals(Color.RED, c);
|
||||
assertEquals(Palette.RED.getRGB(), c.getRGB());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -421,9 +422,9 @@ public class SaveStateTest extends AbstractGenericTest {
|
|||
|
||||
@Test
|
||||
public void testJsonColorRoundTrip() {
|
||||
ss.putColor("foo", Color.BLUE);
|
||||
ss.putColor("foo", Palette.BLUE);
|
||||
SaveState restored = jsonRoundTrip(ss);
|
||||
assertEquals(Color.BLUE, restored.getColor("foo", null));
|
||||
assertEquals(Palette.BLUE.getRGB(), restored.getColor("foo", null).getRGB());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -15,10 +15,10 @@
|
|||
*/
|
||||
package ghidra.program.database;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.Date;
|
||||
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.program.model.data.*;
|
||||
import ghidra.program.model.lang.Register;
|
||||
import ghidra.program.model.listing.*;
|
||||
|
@ -133,10 +133,10 @@ class MergeProgramGenerator_DiffTestPrograms implements MergeProgramGenerator {
|
|||
builder.setIntProperty("10018ff", "Space", 1);
|
||||
builder.setIntProperty("100248c", "Space", 1);
|
||||
|
||||
builder.setObjectProperty("100248c", "testColor", new SaveableColor(Color.CYAN));
|
||||
builder.setObjectProperty("10039dd", "testColor", new SaveableColor(Color.BLACK));
|
||||
builder.setObjectProperty("10039f8", "testColor", new SaveableColor(Color.BLACK));
|
||||
builder.setObjectProperty("10039fe", "testColor", new SaveableColor(Color.RED));
|
||||
builder.setObjectProperty("100248c", "testColor", new SaveableColor(Palette.CYAN));
|
||||
builder.setObjectProperty("10039dd", "testColor", new SaveableColor(Palette.BLACK));
|
||||
builder.setObjectProperty("10039f8", "testColor", new SaveableColor(Palette.BLACK));
|
||||
builder.setObjectProperty("10039fe", "testColor", new SaveableColor(Palette.RED));
|
||||
|
||||
AbstractGenericTest.setInstanceField("recordChanges", program, Boolean.TRUE);
|
||||
|
||||
|
@ -145,8 +145,8 @@ class MergeProgramGenerator_DiffTestPrograms implements MergeProgramGenerator {
|
|||
if (lastGeneratedUniversalID != null) {
|
||||
if (!lastGeneratedUniversalID.equals(ID)) {
|
||||
// if this happens, update initializeStaticUniversalIDUsage()
|
||||
throw new AssertException("Expected Test UniversalID has changed. "
|
||||
+ "This is probably due to an new static usage of the UniversalIDGenerator.");
|
||||
throw new AssertException("Expected Test UniversalID has changed. " +
|
||||
"This is probably due to an new static usage of the UniversalIDGenerator.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -173,10 +173,10 @@ class MergeProgramGenerator_DiffTestPrograms implements MergeProgramGenerator {
|
|||
builder.setIntProperty("1002428", "Space", 1);
|
||||
builder.setIntProperty("100248c", "Space", 1);
|
||||
|
||||
builder.setObjectProperty("100248c", "testColor", new SaveableColor(Color.WHITE));
|
||||
builder.setObjectProperty("10039f1", "testColor", new SaveableColor(Color.BLACK));
|
||||
builder.setObjectProperty("10039f8", "testColor", new SaveableColor(Color.BLACK));
|
||||
builder.setObjectProperty("10039fe", "testColor", new SaveableColor(Color.GREEN));
|
||||
builder.setObjectProperty("100248c", "testColor", new SaveableColor(Palette.WHITE));
|
||||
builder.setObjectProperty("10039f1", "testColor", new SaveableColor(Palette.BLACK));
|
||||
builder.setObjectProperty("10039f8", "testColor", new SaveableColor(Palette.BLACK));
|
||||
builder.setObjectProperty("10039fe", "testColor", new SaveableColor(Palette.GREEN));
|
||||
|
||||
AbstractGenericTest.setInstanceField("recordChanges", program, Boolean.TRUE);
|
||||
|
||||
|
@ -185,8 +185,8 @@ class MergeProgramGenerator_DiffTestPrograms implements MergeProgramGenerator {
|
|||
if (lastGeneratedUniversalID != null) {
|
||||
if (!lastGeneratedUniversalID.equals(ID)) {
|
||||
// if this happens, update initializeStaticUniversalIDUsage()
|
||||
throw new AssertException("Expected Test UniversalID has changed. "
|
||||
+ "This is probably due to an new static usage of the UniversalIDGenerator.");
|
||||
throw new AssertException("Expected Test UniversalID has changed. " +
|
||||
"This is probably due to an new static usage of the UniversalIDGenerator.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -228,7 +228,8 @@ class MergeProgramGenerator_DiffTestPrograms implements MergeProgramGenerator {
|
|||
Parameter p_dh = new ParameterImpl(null, dt, dh, builder.getProgram());
|
||||
Parameter p_ecx = new ParameterImpl(null, dt, ecx, builder.getProgram());
|
||||
builder.createEmptyFunction(null, null, null, true, "10018cf", 10, null, p_al);
|
||||
builder.createEmptyFunction(null, null, null, true, "100299e", 10, null, p_fee, p_ah, p_dr1);
|
||||
builder.createEmptyFunction(null, null, null, true, "100299e", 10, null, p_fee, p_ah,
|
||||
p_dr1);
|
||||
builder.createEmptyFunction(null, null, null, true, "1002cf5", 10, null, p1, p_cs, p3, p4,
|
||||
p5);
|
||||
builder.createEmptyFunction(null, null, null, true, "1002c93", 10, null, p_ecx, p1, p2);
|
||||
|
@ -250,8 +251,8 @@ class MergeProgramGenerator_DiffTestPrograms implements MergeProgramGenerator {
|
|||
if (lastGeneratedUniversalID != null) {
|
||||
if (!lastGeneratedUniversalID.equals(ID)) {
|
||||
// if this happens, update initializeStaticUniversalIDUsage()
|
||||
throw new AssertException("Expected Test UniversalID has changed. "
|
||||
+ "This is probably due to an new static usage of the UniversalIDGenerator.");
|
||||
throw new AssertException("Expected Test UniversalID has changed. " +
|
||||
"This is probably due to an new static usage of the UniversalIDGenerator.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -276,8 +277,8 @@ class MergeProgramGenerator_DiffTestPrograms implements MergeProgramGenerator {
|
|||
if (lastGeneratedUniversalID != null) {
|
||||
if (!lastGeneratedUniversalID.equals(ID)) {
|
||||
// if this happens, update initializeStaticUniversalIDUsage()
|
||||
throw new AssertException("Expected Test UniversalID has changed. "
|
||||
+ "This is probably due to an new static usage of the UniversalIDGenerator.");
|
||||
throw new AssertException("Expected Test UniversalID has changed. " +
|
||||
"This is probably due to an new static usage of the UniversalIDGenerator.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,13 +17,13 @@ package ghidra.program.database.code;
|
|||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.math.BigInteger;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.junit.*;
|
||||
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.program.database.ProgramDB;
|
||||
import ghidra.program.model.address.*;
|
||||
import ghidra.program.model.data.*;
|
||||
|
@ -473,7 +473,7 @@ public class CodeManagerTest extends AbstractGenericTest {
|
|||
PropertyMap map = listing.getPropertyMap("Numbers");
|
||||
assertNotNull(map);
|
||||
|
||||
inst.setProperty("FavoriteColor", new SaveableColor(Color.RED));
|
||||
inst.setProperty("FavoriteColor", new SaveableColor(Palette.RED));
|
||||
|
||||
map = listing.getPropertyMap("FavoriteColor");
|
||||
assertNotNull(map);
|
||||
|
@ -487,10 +487,10 @@ public class CodeManagerTest extends AbstractGenericTest {
|
|||
inst.setProperty("Numbers", 12);
|
||||
assertEquals(12, inst.getIntProperty("Numbers"));
|
||||
|
||||
inst.setProperty("FavoriteColor", new SaveableColor(Color.RED));
|
||||
inst.setProperty("FavoriteColor", new SaveableColor(Palette.RED));
|
||||
SaveableColor c = (SaveableColor) inst.getObjectProperty("FavoriteColor");
|
||||
assertNotNull(c);
|
||||
assertEquals(Color.RED, c.getColor());
|
||||
assertEquals(Palette.RED.getRGB(), c.getColor().getRGB());
|
||||
|
||||
Iterator<String> iter = listing.getUserDefinedProperties();
|
||||
String name1 = iter.next();
|
||||
|
@ -516,7 +516,7 @@ public class CodeManagerTest extends AbstractGenericTest {
|
|||
// expected
|
||||
}
|
||||
|
||||
inst.setProperty("FavoriteColor", new SaveableColor(Color.RED));
|
||||
inst.setProperty("FavoriteColor", new SaveableColor(Palette.RED));
|
||||
SaveableColor c = (SaveableColor) inst.getObjectProperty("FavoriteColor");
|
||||
assertNotNull(c);
|
||||
listing.removeUserDefinedProperty("FavoriteColor");
|
||||
|
@ -543,7 +543,7 @@ public class CodeManagerTest extends AbstractGenericTest {
|
|||
cu.setProperty("Numbers", 12);
|
||||
assertEquals(12, cu.getIntProperty("Numbers"));
|
||||
|
||||
cu.setProperty("FavoriteColor", new SaveableColor(Color.RED));
|
||||
cu.setProperty("FavoriteColor", new SaveableColor(Palette.RED));
|
||||
SaveableColor c = (SaveableColor) cu.getObjectProperty("FavoriteColor");
|
||||
|
||||
mem.moveBlock(block, addr(0x8000), new TaskMonitorAdapter());
|
||||
|
|
|
@ -31,12 +31,12 @@ import docking.widgets.label.GDLabel;
|
|||
import docking.widgets.label.GHtmlLabel;
|
||||
import docking.widgets.textfield.HexIntegerFormatter;
|
||||
import generic.theme.GColor;
|
||||
import generic.theme.TempColorUtils;
|
||||
import ghidra.feature.vt.api.main.VTAssociation;
|
||||
import ghidra.feature.vt.gui.provider.matchtable.NumberRangeProducer;
|
||||
import ghidra.feature.vt.gui.provider.matchtable.NumberRangeSubFilterChecker;
|
||||
import ghidra.framework.options.SaveState;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.util.WebColors;
|
||||
|
||||
public abstract class AbstractAddressRangeFilter<T> extends AncillaryFilter<T>
|
||||
implements NumberRangeSubFilterChecker, NumberRangeProducer {
|
||||
|
@ -122,7 +122,7 @@ public abstract class AbstractAddressRangeFilter<T> extends AncillaryFilter<T>
|
|||
//
|
||||
// Lower Score Panel
|
||||
//
|
||||
String fgColor = WebColors.toString(FG_TOOLTIP_DEFAULT, false);
|
||||
String fgColor = TempColorUtils.toString(FG_TOOLTIP_DEFAULT);
|
||||
lowerRangePanel = new JPanel(new GridLayout(2, 1));
|
||||
JLabel lowLabel =
|
||||
new GHtmlLabel("<html><font size=\"2\" color=\"" + fgColor + "\">low</font>");
|
||||
|
@ -208,7 +208,7 @@ public abstract class AbstractAddressRangeFilter<T> extends AncillaryFilter<T>
|
|||
@Override
|
||||
protected void paintComponent(Graphics g) {
|
||||
Color bg = getBackground();
|
||||
Color disabledColor = new Color(bg.getRed(), bg.getGreen(), bg.getBlue(), 100);
|
||||
Color disabledColor = TempColorUtils.withAlpha(bg, 100);
|
||||
g.setColor(disabledColor);
|
||||
g.fillRect(0, 0, getWidth(), getHeight());
|
||||
}
|
||||
|
|
|
@ -5,26 +5,33 @@ color.palette.disabled = rgba(255,255,255,0)
|
|||
|
||||
color.palette.black = black
|
||||
color.palette.blue = blue
|
||||
color.palate.cornflowerblue = cornflowerblue
|
||||
color.palette.crimson = crimson
|
||||
color.palette.cyan = cyan
|
||||
color.palette.darkblue = DarkBlue
|
||||
color.palette.darkgray = DarkGray
|
||||
color.palette.darkkhaki = DarkKhaki
|
||||
color.palette.darkred = DarkRed
|
||||
color.palette.darkslategray = darkslategray
|
||||
color.palette.dodgerblue = DodgerBlue
|
||||
color.palette.gold = gold
|
||||
color.palette.gray = gray
|
||||
color.palette.green = green
|
||||
color.palette.indigo = indigo
|
||||
color.palette.khaki = khaki
|
||||
color.palette.lavender = lavender
|
||||
color.palette.lime = lime
|
||||
color.palette.lightcoral = lightcoral
|
||||
color.palette.lightgray = rgb(192, 192, 192)
|
||||
color.palette.lightgreen = rgb(127, 255, 127)
|
||||
color.palette.lightpink = lightpink
|
||||
color.palette.lightred = rgb(255, 127, 127)
|
||||
color.palette.lightskyblue = lightskyblue
|
||||
color.palette.lightsteelblue = lightsteelblue
|
||||
color.palette.magenta = magenta
|
||||
color.palette.maroon = maroon
|
||||
color.palette.mistyrose = mistyrose
|
||||
color.palette.navy = navy
|
||||
color.palette.olive = olive
|
||||
color.palette.orange = orange
|
||||
color.palette.palegreen = palegreen
|
||||
|
@ -32,6 +39,7 @@ color.palette.palevioletred = PaleVioletRed
|
|||
color.palette.pink = pink
|
||||
color.palette.purple = purple
|
||||
color.palette.red = red
|
||||
color.palette.silver = silver
|
||||
color.palette.yellow = yellow
|
||||
color.palette.yellowgreen = yellowgreen
|
||||
color.palette.white = white
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue