mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-30 16:47:43 +08:00
GP-9181 - Theming - Base Module
This commit is contained in:
+4
-3
@@ -15,13 +15,14 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.util.disassemble;
|
package ghidra.app.util.disassemble;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import docking.widgets.fieldpanel.field.*;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
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.HighlightProvider;
|
||||||
import ghidra.app.util.viewer.field.*;
|
import ghidra.app.util.viewer.field.*;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
@@ -130,7 +131,7 @@ public class ExternalDisassemblyFieldFactory extends FieldFactory {
|
|||||||
if (disassembly == null) {
|
if (disassembly == null) {
|
||||||
return 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);
|
FieldElement fieldElement = new TextFieldElement(text, 0, 0);
|
||||||
return ListingTextField.createSingleLineTextField(this, proxy, fieldElement,
|
return ListingTextField.createSingleLineTextField(this, proxy, fieldElement,
|
||||||
startX + varWidth, width, hlProvider);
|
startX + varWidth, width, hlProvider);
|
||||||
@@ -162,7 +163,7 @@ public class ExternalDisassemblyFieldFactory extends FieldFactory {
|
|||||||
if (message == null) {
|
if (message == null) {
|
||||||
message = e.toString();
|
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);
|
FieldElement fieldElement = new TextFieldElement(errorText, 0, 0);
|
||||||
return ListingTextField.createSingleLineTextField(this, proxy, fieldElement,
|
return ListingTextField.createSingleLineTextField(this, proxy, fieldElement,
|
||||||
startX + varWidth, width, hlProvider);
|
startX + varWidth, width, hlProvider);
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ data/ExtensionPoint.manifest||GHIDRA||||END|
|
|||||||
data/MachOFunctionsThatDoNotReturn||GHIDRA||||END|
|
data/MachOFunctionsThatDoNotReturn||GHIDRA||||END|
|
||||||
data/PEFunctionsThatDoNotReturn||GHIDRA||||END|
|
data/PEFunctionsThatDoNotReturn||GHIDRA||||END|
|
||||||
data/base.listing.theme.properties||GHIDRA||||END|
|
data/base.listing.theme.properties||GHIDRA||||END|
|
||||||
|
data/base.programgraph.theme.properties||GHIDRA||||END|
|
||||||
data/base.theme.properties||GHIDRA||||END|
|
data/base.theme.properties||GHIDRA||||END|
|
||||||
data/file_extension_icons.xml||GHIDRA||||END|
|
data/file_extension_icons.xml||GHIDRA||||END|
|
||||||
data/functionTags.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.varnode = blue
|
||||||
color.fg.listing.pcode.userop = 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]
|
[Dark Defaults]
|
||||||
|
|||||||
@@ -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.flowtype.jump.unconditional = blue
|
||||||
|
|
||||||
color.function.thunk = color.palette.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.bg.table.selection.bundle = [color]textHighlight
|
||||||
color.fg.table.selection.bundle = [color]textHighlightText
|
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.inactive = black
|
||||||
color.fg.table.bundle.active = green
|
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.splash.infopanel = color.bg
|
||||||
|
|
||||||
color.bg.table.selected.ghidratable = 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.default = color.fg
|
||||||
color.fg.plugin.function.editor.dialog.textfield.error = color.fg.error
|
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.function.name = color.palette.blue
|
||||||
color.fg.plugin.function.editor.dialog.textfield.parameter = color.palette.magenta
|
color.fg.plugin.function.editor.dialog.textfield.parameter = color.fg.function.params
|
||||||
|
|
||||||
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.bg.plugin.instructionsearch.table.masked.instruction = rgb(237, 243, 254) // faint blue
|
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
|
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.base.high = white
|
||||||
color.bg.plugin.overview.entropy.palette.text = color.fg
|
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.references.table.active.operand = rgb(205, 205, 205)
|
||||||
|
|
||||||
color.bg.plugin.register.marker = rgb(0, 153, 153)
|
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]
|
[Dark Defaults]
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
//NOTE: I do not de-duplicate, since the address of the instruction may affect the output.
|
//NOTE: I do not de-duplicate, since the address of the instruction may affect the output.
|
||||||
//@category Assembly
|
//@category Assembly
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@@ -27,6 +26,7 @@ import javax.swing.ImageIcon;
|
|||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
import ghidra.app.plugin.assembler.*;
|
import ghidra.app.plugin.assembler.*;
|
||||||
import ghidra.app.plugin.assembler.sleigh.sem.*;
|
import ghidra.app.plugin.assembler.sleigh.sem.*;
|
||||||
import ghidra.app.plugin.processors.sleigh.SleighDebugLogger;
|
import ghidra.app.plugin.processors.sleigh.SleighDebugLogger;
|
||||||
@@ -105,7 +105,7 @@ public class AssemblyThrasherDevScript extends GhidraScript {
|
|||||||
|
|
||||||
BookmarkManager bm = currentProgram.getBookmarkManager();
|
BookmarkManager bm = currentProgram.getBookmarkManager();
|
||||||
ImageIcon myIcon = ResourceManager.loadImage("images/warning.png");
|
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);
|
bm.removeBookmarks(BOOKMARK_FAIL);
|
||||||
|
|
||||||
monitor.setMessage("Constructing Assembler");
|
monitor.setMessage("Constructing Assembler");
|
||||||
@@ -157,7 +157,7 @@ public class AssemblyThrasherDevScript extends GhidraScript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
println("Unique instructions by constructor: " + done.size());
|
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) {
|
protected PseudoInstruction disassemble(Instruction orig, byte[] ins) {
|
||||||
|
|||||||
@@ -16,13 +16,14 @@
|
|||||||
// An example of how to color the listing background
|
// An example of how to color the listing background
|
||||||
//@category Examples
|
//@category Examples
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
import ghidra.app.plugin.core.colorizer.ColorizingService;
|
import ghidra.app.plugin.core.colorizer.ColorizingService;
|
||||||
import ghidra.app.script.GhidraScript;
|
import ghidra.app.script.GhidraScript;
|
||||||
import ghidra.program.model.address.Address;
|
import ghidra.program.model.address.Address;
|
||||||
import ghidra.program.model.address.AddressSet;
|
import ghidra.program.model.address.AddressSet;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
|
|
||||||
public class ExampleColorScript extends GhidraScript {
|
public class ExampleColorScript extends GhidraScript {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -34,10 +35,10 @@ public class ExampleColorScript extends GhidraScript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (currentSelection != null) {
|
if (currentSelection != null) {
|
||||||
service.setBackgroundColor(currentSelection, new Color(255, 200, 200));
|
service.setBackgroundColor(currentSelection, Palette.PINK);
|
||||||
}
|
}
|
||||||
else if (currentAddress != null) {
|
else if (currentAddress != null) {
|
||||||
service.setBackgroundColor(currentAddress, currentAddress, new Color(255, 200, 200));
|
service.setBackgroundColor(currentAddress, currentAddress, Palette.PINK);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
println("No selection or current address to color");
|
println("No selection or current address to color");
|
||||||
|
|||||||
@@ -19,12 +19,12 @@
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
import ghidra.app.script.GhidraScript;
|
import ghidra.app.script.GhidraScript;
|
||||||
import ghidra.app.services.GraphDisplayBroker;
|
import ghidra.app.services.GraphDisplayBroker;
|
||||||
import ghidra.framework.plugintool.PluginTool;
|
import ghidra.framework.plugintool.PluginTool;
|
||||||
import ghidra.program.model.data.*;
|
import ghidra.program.model.data.*;
|
||||||
import ghidra.service.graph.*;
|
import ghidra.service.graph.*;
|
||||||
import ghidra.util.WebColors;
|
|
||||||
import ghidra.util.exception.CancelledException;
|
import ghidra.util.exception.CancelledException;
|
||||||
import ghidra.util.task.TaskMonitor;
|
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 VIRTUAL_INHERITANCE = "Virtual Inheritance";
|
||||||
private static final String NON_VIRTUAL_INHERITANCE = "Non-virtual Inheritance";
|
private static final String NON_VIRTUAL_INHERITANCE = "Non-virtual Inheritance";
|
||||||
|
|
||||||
List<Structure> classStructures = new ArrayList<Structure>();
|
List<Structure> classStructures = new ArrayList<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() throws Exception {
|
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.
|
* Method to create a graph using pre-configured information found in class structure
|
||||||
* The structure descriptions are created using
|
* descriptions.
|
||||||
* {@link RecoveredClassUtils#createParentStringBuffer(RecoveredClass)}
|
|
||||||
* @return the newly created graph
|
* @return the newly created graph
|
||||||
*/
|
*/
|
||||||
private AttributedGraph createGraph() throws Exception {
|
private AttributedGraph createGraph() throws Exception {
|
||||||
@@ -290,7 +289,7 @@ public class GraphClassesScript extends GhidraScript {
|
|||||||
private Structure getParentStructureFromClassStructures(String parentName)
|
private Structure getParentStructureFromClassStructures(String parentName)
|
||||||
throws CancelledException {
|
throws CancelledException {
|
||||||
|
|
||||||
List<Structure> parentStructures = new ArrayList<Structure>();
|
List<Structure> parentStructures = new ArrayList<>();
|
||||||
for (Structure classStructure : classStructures) {
|
for (Structure classStructure : classStructures) {
|
||||||
monitor.checkCanceled();
|
monitor.checkCanceled();
|
||||||
|
|
||||||
@@ -315,13 +314,13 @@ public class GraphClassesScript extends GhidraScript {
|
|||||||
display = service.getGraphDisplay(false, TaskMonitor.DUMMY);
|
display = service.getGraphDisplay(false, TaskMonitor.DUMMY);
|
||||||
|
|
||||||
GraphDisplayOptions graphOptions = new GraphDisplayOptionsBuilder(graph.getGraphType())
|
GraphDisplayOptions graphOptions = new GraphDisplayOptionsBuilder(graph.getGraphType())
|
||||||
.vertex(NO_INHERITANCE, VertexShape.RECTANGLE, WebColors.BLUE)
|
.vertex(NO_INHERITANCE, VertexShape.RECTANGLE, Palette.BLUE)
|
||||||
.vertex(SINGLE_INHERITANCE, VertexShape.RECTANGLE, WebColors.GREEN)
|
.vertex(SINGLE_INHERITANCE, VertexShape.RECTANGLE, Palette.GREEN)
|
||||||
.vertex(MULTIPLE_INHERITANCE, VertexShape.RECTANGLE, WebColors.RED)
|
.vertex(MULTIPLE_INHERITANCE, VertexShape.RECTANGLE, Palette.RED)
|
||||||
.edge(NON_VIRTUAL_INHERITANCE, WebColors.LIME_GREEN)
|
.edge(NON_VIRTUAL_INHERITANCE, Palette.LIME)
|
||||||
.edge(VIRTUAL_INHERITANCE, WebColors.ORANGE)
|
.edge(VIRTUAL_INHERITANCE, Palette.ORANGE)
|
||||||
.defaultVertexColor(WebColors.PURPLE)
|
.defaultVertexColor(Palette.PURPLE)
|
||||||
.defaultEdgeColor(WebColors.PURPLE)
|
.defaultEdgeColor(Palette.PURPLE)
|
||||||
.defaultLayoutAlgorithm("Compact Hierarchical")
|
.defaultLayoutAlgorithm("Compact Hierarchical")
|
||||||
.maxNodeCount(1000)
|
.maxNodeCount(1000)
|
||||||
.build();
|
.build();
|
||||||
@@ -330,7 +329,6 @@ public class GraphClassesScript extends GhidraScript {
|
|||||||
"Recovered Classes Graph", false, TaskMonitor.DUMMY);
|
"Recovered Classes Graph", false, TaskMonitor.DUMMY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private String getClassName(String description) {
|
private String getClassName(String description) {
|
||||||
|
|
||||||
int indexOfColon = getIndexOfFirstSingleColon(description);
|
int indexOfColon = getIndexOfFirstSingleColon(description);
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ import javax.swing.*;
|
|||||||
import javax.swing.table.DefaultTableCellRenderer;
|
import javax.swing.table.DefaultTableCellRenderer;
|
||||||
import javax.swing.table.DefaultTableModel;
|
import javax.swing.table.DefaultTableModel;
|
||||||
|
|
||||||
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
|
|
||||||
public class SearchGuiMulti extends SearchBaseExtended {
|
public class SearchGuiMulti extends SearchBaseExtended {
|
||||||
|
|
||||||
private JScrollPane jScrollPane1;
|
private JScrollPane jScrollPane1;
|
||||||
@@ -65,39 +68,19 @@ public class SearchGuiMulti extends SearchBaseExtended {
|
|||||||
frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||||
|
|
||||||
mnemonicButton.setText("Mnemonic");
|
mnemonicButton.setText("Mnemonic");
|
||||||
mnemonicButton.addActionListener(new ActionListener() {
|
mnemonicButton.addActionListener(evt -> mnemonicButtonActionPerformed(evt));
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent evt) {
|
|
||||||
mnemonicButtonActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
mnemonicButton.setVisible(false);
|
mnemonicButton.setVisible(false);
|
||||||
|
|
||||||
op1Button.setText("Operand 1");
|
op1Button.setText("Operand 1");
|
||||||
op1Button.addActionListener(new ActionListener() {
|
op1Button.addActionListener(evt -> op1ButtonActionPerformed(evt));
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent evt) {
|
|
||||||
op1ButtonActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
op1Button.setVisible(false);
|
op1Button.setVisible(false);
|
||||||
|
|
||||||
op2Button.setText("Operand 2");
|
op2Button.setText("Operand 2");
|
||||||
op2Button.addActionListener(new ActionListener() {
|
op2Button.addActionListener(evt -> op2ButtonActionPerformed(evt));
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent evt) {
|
|
||||||
op2ButtonActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
op2Button.setVisible(false);
|
op2Button.setVisible(false);
|
||||||
|
|
||||||
searchButton.setText("Search");
|
searchButton.setText("Search");
|
||||||
searchButton.addActionListener(new ActionListener() {
|
searchButton.addActionListener(evt -> searchButtonActionPerformed(evt));
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent evt) {
|
|
||||||
searchButtonActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
fillTable();
|
fillTable();
|
||||||
tableModel = new DefaultTableModel(tableContentsDO, columnIdentifiers) {
|
tableModel = new DefaultTableModel(tableContentsDO, columnIdentifiers) {
|
||||||
@@ -122,12 +105,7 @@ public class SearchGuiMulti extends SearchBaseExtended {
|
|||||||
|
|
||||||
Color backgroundColor = dataObject.getBackgroundColor();
|
Color backgroundColor = dataObject.getBackgroundColor();
|
||||||
if (backgroundColor != null) {
|
if (backgroundColor != null) {
|
||||||
if (isSelected) {
|
theRenderer.setBackground(backgroundColor);
|
||||||
theRenderer.setBackground(backgroundColor.darker());
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
theRenderer.setBackground(backgroundColor);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return theRenderer;
|
return theRenderer;
|
||||||
@@ -152,45 +130,47 @@ public class SearchGuiMulti extends SearchBaseExtended {
|
|||||||
GroupLayout layout = new GroupLayout(frame.getContentPane());
|
GroupLayout layout = new GroupLayout(frame.getContentPane());
|
||||||
frame.getContentPane().setLayout(layout);
|
frame.getContentPane().setLayout(layout);
|
||||||
layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) //
|
layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) //
|
||||||
.addGroup(layout.createSequentialGroup() //
|
.addGroup(layout.createSequentialGroup() //
|
||||||
.addContainerGap(15, Short.MAX_VALUE) //
|
.addContainerGap(15, Short.MAX_VALUE) //
|
||||||
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) //
|
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) //
|
||||||
.addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() //
|
.addGroup(GroupLayout.Alignment.TRAILING, layout
|
||||||
.addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE, 357,
|
.createSequentialGroup() //
|
||||||
GroupLayout.PREFERRED_SIZE) //
|
.addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE, 357,
|
||||||
.addContainerGap() //
|
GroupLayout.PREFERRED_SIZE) //
|
||||||
) //
|
.addContainerGap() //
|
||||||
.addGroup(GroupLayout.Alignment.CENTER, layout.createSequentialGroup() //
|
) //
|
||||||
.addComponent(mnemonicButton) //
|
.addGroup(GroupLayout.Alignment.CENTER,
|
||||||
.addGap(39, 39, 39) //
|
layout.createSequentialGroup() //
|
||||||
.addComponent(op1Button) //
|
.addComponent(mnemonicButton) //
|
||||||
.addGap(42, 42, 42) //
|
.addGap(39, 39, 39) //
|
||||||
.addComponent(op2Button) //
|
.addComponent(op1Button) //
|
||||||
.addGap(40, 40, 40) //
|
.addGap(42, 42, 42) //
|
||||||
) //
|
.addComponent(op2Button) //
|
||||||
|
.addGap(40, 40, 40) //
|
||||||
|
) //
|
||||||
|
) //
|
||||||
|
) //
|
||||||
|
.addGroup(layout.createSequentialGroup() //
|
||||||
|
.addGap(153, 153, 153) //
|
||||||
|
.addComponent(searchButton) //
|
||||||
|
.addContainerGap(164, Short.MAX_VALUE) //
|
||||||
) //
|
) //
|
||||||
) //
|
|
||||||
.addGroup(layout.createSequentialGroup() //
|
|
||||||
.addGap(153, 153, 153) //
|
|
||||||
.addComponent(searchButton) //
|
|
||||||
.addContainerGap(164, Short.MAX_VALUE) //
|
|
||||||
) //
|
|
||||||
);
|
);
|
||||||
layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) //
|
layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) //
|
||||||
.addGroup(layout.createSequentialGroup() //
|
.addGroup(layout.createSequentialGroup() //
|
||||||
.addGap(23, 23, 23) //
|
.addGap(23, 23, 23) //
|
||||||
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) //
|
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) //
|
||||||
.addComponent(op1Button) //
|
.addComponent(op1Button) //
|
||||||
.addComponent(op2Button) //
|
.addComponent(op2Button) //
|
||||||
.addComponent(mnemonicButton) //
|
.addComponent(mnemonicButton) //
|
||||||
|
) //
|
||||||
|
.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) //
|
||||||
|
.addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE, 402,
|
||||||
|
GroupLayout.PREFERRED_SIZE) //
|
||||||
|
.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) //
|
||||||
|
.addComponent(searchButton) //
|
||||||
|
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) //
|
||||||
) //
|
) //
|
||||||
.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) //
|
|
||||||
.addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE, 402,
|
|
||||||
GroupLayout.PREFERRED_SIZE) //
|
|
||||||
.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) //
|
|
||||||
.addComponent(searchButton) //
|
|
||||||
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) //
|
|
||||||
) //
|
|
||||||
);
|
);
|
||||||
|
|
||||||
frame.pack();
|
frame.pack();
|
||||||
@@ -205,7 +185,7 @@ public class SearchGuiMulti extends SearchBaseExtended {
|
|||||||
|
|
||||||
if (column == 0) {
|
if (column == 0) {
|
||||||
tableContentsDO[mnemonic][column] =
|
tableContentsDO[mnemonic][column] =
|
||||||
new DataObject(mnemonics.get(mnemonic).textRep, Color.green);
|
new DataObject(mnemonics.get(mnemonic).textRep, Palette.GREEN);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
OperandCase temp = null;
|
OperandCase temp = null;
|
||||||
@@ -217,10 +197,10 @@ public class SearchGuiMulti extends SearchBaseExtended {
|
|||||||
}
|
}
|
||||||
if (temp != null) {
|
if (temp != null) {
|
||||||
tableContentsDO[mnemonic][column] =
|
tableContentsDO[mnemonic][column] =
|
||||||
new DataObject(temp.textRep, Color.red.brighter());
|
new DataObject(temp.textRep, Palette.PINK);
|
||||||
}
|
}
|
||||||
else {
|
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();
|
throw new IndexOutOfBoundsException();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tableContentsDO[rowSelection][columnSelection].getBackgroundColor().equals(
|
if (tableContentsDO[rowSelection][columnSelection].getBackgroundColor()
|
||||||
Color.green)) {
|
.equals(Palette.GREEN)) {
|
||||||
tableContentsDO[rowSelection][columnSelection].setBackgroundColor(Color.red);
|
tableContentsDO[rowSelection][columnSelection].setBackgroundColor(Palette.RED);
|
||||||
}
|
}
|
||||||
else if (tableContentsDO[rowSelection][columnSelection].getBackgroundColor().equals(
|
else if (tableContentsDO[rowSelection][columnSelection].getBackgroundColor()
|
||||||
Color.red)) {
|
.equals(Palette.RED)) {
|
||||||
tableContentsDO[rowSelection][columnSelection].setBackgroundColor(Color.green);
|
tableContentsDO[rowSelection][columnSelection].setBackgroundColor(Palette.GREEN);
|
||||||
}
|
}
|
||||||
else {
|
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.
|
//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();
|
int selectedRow = jTable1.getSelectedRow();
|
||||||
|
|
||||||
if (mnemonicButton.isSelected()) {
|
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
|
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();
|
jTable1.repaint();
|
||||||
}
|
}
|
||||||
@@ -271,10 +251,10 @@ public class SearchGuiMulti extends SearchBaseExtended {
|
|||||||
int selectedRow = jTable1.getSelectedRow();
|
int selectedRow = jTable1.getSelectedRow();
|
||||||
|
|
||||||
if (op1Button.isSelected()) {
|
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
|
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();
|
jTable1.repaint();
|
||||||
}
|
}
|
||||||
@@ -284,10 +264,10 @@ public class SearchGuiMulti extends SearchBaseExtended {
|
|||||||
int selectedRow = jTable1.getSelectedRow();
|
int selectedRow = jTable1.getSelectedRow();
|
||||||
|
|
||||||
if (op2Button.isSelected()) {
|
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
|
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();
|
jTable1.repaint();
|
||||||
}
|
}
|
||||||
@@ -300,14 +280,14 @@ public class SearchGuiMulti extends SearchBaseExtended {
|
|||||||
for (int row = 0; row < mnemonics.size(); row++) {
|
for (int row = 0; row < mnemonics.size(); row++) {
|
||||||
SLMaskControl temp = new SLMaskControl();
|
SLMaskControl temp = new SLMaskControl();
|
||||||
|
|
||||||
if (tableContentsDO[row][0].getBackgroundColor().equals(Color.green)) {
|
if (tableContentsDO[row][0].getBackgroundColor().equals(Palette.GREEN)) {
|
||||||
temp.useMnemonic = true;
|
temp.useMnemonic = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
temp.useMnemonic = false;
|
temp.useMnemonic = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tableContentsDO[row][1].getBackgroundColor().equals(Color.green)) {
|
if (tableContentsDO[row][1].getBackgroundColor().equals(Palette.GREEN)) {
|
||||||
temp.useOp1 = true;
|
temp.useOp1 = true;
|
||||||
if (ops.get(0).get(mnemonics.get(row)).constant) {
|
if (ops.get(0).get(mnemonics.get(row)).constant) {
|
||||||
temp.useConst = true;
|
temp.useConst = true;
|
||||||
@@ -317,7 +297,7 @@ public class SearchGuiMulti extends SearchBaseExtended {
|
|||||||
temp.useOp1 = false;
|
temp.useOp1 = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tableContentsDO[row][2].getBackgroundColor().equals(Color.green)) {
|
if (tableContentsDO[row][2].getBackgroundColor().equals(Palette.GREEN)) {
|
||||||
temp.useOp2 = true;
|
temp.useOp2 = true;
|
||||||
if (ops.get(1).get(mnemonics.get(row)).constant) {
|
if (ops.get(1).get(mnemonics.get(row)).constant) {
|
||||||
temp.useConst = true;
|
temp.useConst = true;
|
||||||
@@ -336,7 +316,7 @@ public class SearchGuiMulti extends SearchBaseExtended {
|
|||||||
|
|
||||||
private class DataObject {
|
private class DataObject {
|
||||||
private String data;
|
private String data;
|
||||||
private Color background = Color.white;
|
private Color background = Colors.BACKGROUND;
|
||||||
|
|
||||||
public DataObject(String data, Color color) {
|
public DataObject(String data, Color color) {
|
||||||
this.data = data;
|
this.data = data;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
/* ###
|
/* ###
|
||||||
* IP: GHIDRA
|
* IP: GHIDRA
|
||||||
* REVIEWED: YES
|
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -18,36 +17,37 @@ package ghidra.app.merge;
|
|||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
|
|
||||||
public interface MergeConstants {
|
public interface MergeConstants {
|
||||||
public static final int RESULT = 0;
|
public static final int RESULT = 0;
|
||||||
public static final int LATEST = 1;
|
public static final int LATEST = 1;
|
||||||
public static final int MY = 2;
|
public static final int MY = 2;
|
||||||
public static final int ORIGINAL = 3;
|
public static final int ORIGINAL = 3;
|
||||||
public static final String RESULT_TITLE = "Result";
|
public static final String RESULT_TITLE = "Result";
|
||||||
public static final String ORIGINAL_TITLE = "Original";
|
public static final String ORIGINAL_TITLE = "Original";
|
||||||
public static final String LATEST_TITLE = "Latest";
|
public static final String LATEST_TITLE = "Latest";
|
||||||
public static final String MY_TITLE = "Checked Out";
|
public static final String MY_TITLE = "Checked Out";
|
||||||
|
|
||||||
public Color CONFLICT_COLOR = new Color(140, 0, 0);
|
public Color CONFLICT_COLOR = Palette.MAROON;
|
||||||
public static final Color HIGHLIGHT_COLOR = new Color(230,230,230);
|
public static final Color HIGHLIGHT_COLOR = Palette.LIGHT_GRAY;
|
||||||
|
|
||||||
// The following are standardized names for use in passing resolve
|
// The following are standardized names for use in passing resolve
|
||||||
// information between individual merge managers.
|
// information between individual merge managers.
|
||||||
// For example:
|
// For example:
|
||||||
// the data type merger knows what data type in the result is equivalent
|
// the data type merger knows what data type in the result is equivalent
|
||||||
// to a given data type from my checked out program. The code unit and
|
// to a given data type from my checked out program. The code unit and
|
||||||
// function mergers need to be able to get this information so they
|
// function mergers need to be able to get this information so they
|
||||||
// don't unknowingly re-introduce a data type that was already eliminated
|
// don't unknowingly re-introduce a data type that was already eliminated
|
||||||
// by a data type conflict.
|
// by a data type conflict.
|
||||||
public static final String RESOLVED_LATEST_DTS = "ResolvedLatestDataTypes";
|
public static final String RESOLVED_LATEST_DTS = "ResolvedLatestDataTypes";
|
||||||
public static final String RESOLVED_MY_DTS = "ResolvedMyDataTypes";
|
public static final String RESOLVED_MY_DTS = "ResolvedMyDataTypes";
|
||||||
public static final String RESOLVED_ORIGINAL_DTS = "ResolvedOriginalDataTypes";
|
public static final String RESOLVED_ORIGINAL_DTS = "ResolvedOriginalDataTypes";
|
||||||
public static final String RESOLVED_CODE_UNITS = "ResolvedCodeUnits";
|
public static final String RESOLVED_CODE_UNITS = "ResolvedCodeUnits";
|
||||||
public static final String PICKED_LATEST_CODE_UNITS = "PickedLatestCodeUnits";
|
public static final String PICKED_LATEST_CODE_UNITS = "PickedLatestCodeUnits";
|
||||||
public static final String PICKED_MY_CODE_UNITS = "PickedMyCodeUnits";
|
public static final String PICKED_MY_CODE_UNITS = "PickedMyCodeUnits";
|
||||||
public static final String PICKED_ORIGINAL_CODE_UNITS = "PickedOriginalCodeUnits";
|
public static final String PICKED_ORIGINAL_CODE_UNITS = "PickedOriginalCodeUnits";
|
||||||
public static final String RESOLVED_LATEST_SYMBOLS = "ResolvedLatestSymbols";
|
public static final String RESOLVED_LATEST_SYMBOLS = "ResolvedLatestSymbols";
|
||||||
public static final String RESOLVED_MY_SYMBOLS = "ResolvedMySymbols";
|
public static final String RESOLVED_MY_SYMBOLS = "ResolvedMySymbols";
|
||||||
public static final String RESOLVED_ORIGINAL_SYMBOLS = "ResolvedOriginalSymbols";
|
public static final String RESOLVED_ORIGINAL_SYMBOLS = "ResolvedOriginalSymbols";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
package ghidra.app.merge;
|
package ghidra.app.merge;
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Color;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
@@ -24,6 +23,7 @@ import javax.swing.border.Border;
|
|||||||
|
|
||||||
import docking.widgets.label.GIconLabel;
|
import docking.widgets.label.GIconLabel;
|
||||||
import docking.widgets.label.GLabel;
|
import docking.widgets.label.GLabel;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
import ghidra.util.Msg;
|
import ghidra.util.Msg;
|
||||||
import ghidra.util.layout.VerticalLayout;
|
import ghidra.util.layout.VerticalLayout;
|
||||||
import resources.ResourceManager;
|
import resources.ResourceManager;
|
||||||
@@ -52,7 +52,7 @@ public class MergeProgressPanel extends JPanel {
|
|||||||
private JPanel getProgressTitlePanel() {
|
private JPanel getProgressTitlePanel() {
|
||||||
JPanel phasesTitlePanel = new JPanel();
|
JPanel phasesTitlePanel = new JPanel();
|
||||||
Border insideBorder = BorderFactory.createEmptyBorder(0, 0, 2, 0);
|
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);
|
Border compoundBorder = BorderFactory.createCompoundBorder(outsideBorder, insideBorder);
|
||||||
phasesTitlePanel.setBorder(compoundBorder);
|
phasesTitlePanel.setBorder(compoundBorder);
|
||||||
BoxLayout bl = new BoxLayout(phasesTitlePanel, BoxLayout.X_AXIS);
|
BoxLayout bl = new BoxLayout(phasesTitlePanel, BoxLayout.X_AXIS);
|
||||||
@@ -139,9 +139,6 @@ public class MergeProgressPanel extends JPanel {
|
|||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param args
|
|
||||||
*/
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
MergeProgressPanel panel = new MergeProgressPanel();
|
MergeProgressPanel panel = new MergeProgressPanel();
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import javax.swing.JPanel;
|
|||||||
import javax.swing.JTextPane;
|
import javax.swing.JTextPane;
|
||||||
import javax.swing.text.*;
|
import javax.swing.text.*;
|
||||||
|
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
import ghidra.app.merge.MergeConstants;
|
import ghidra.app.merge.MergeConstants;
|
||||||
import ghidra.docking.settings.Settings;
|
import ghidra.docking.settings.Settings;
|
||||||
import ghidra.docking.settings.SettingsDefinition;
|
import ghidra.docking.settings.SettingsDefinition;
|
||||||
@@ -39,8 +40,7 @@ import ghidra.util.UniversalID;
|
|||||||
*/
|
*/
|
||||||
class DataTypePanel extends JPanel {
|
class DataTypePanel extends JPanel {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
public Color SOURCE_COLOR = Palette.GREEN;
|
||||||
public Color SOURCE_COLOR = new Color(0, 140, 0);
|
|
||||||
private DataType dataType;
|
private DataType dataType;
|
||||||
private JTextPane textPane;
|
private JTextPane textPane;
|
||||||
private StyledDocument doc;
|
private StyledDocument doc;
|
||||||
@@ -110,28 +110,28 @@ class DataTypePanel extends JPanel {
|
|||||||
offsetAttrSet = new SimpleAttributeSet();
|
offsetAttrSet = new SimpleAttributeSet();
|
||||||
offsetAttrSet.addAttribute(StyleConstants.FontFamily, "Monospaced");
|
offsetAttrSet.addAttribute(StyleConstants.FontFamily, "Monospaced");
|
||||||
offsetAttrSet.addAttribute(StyleConstants.FontSize, Integer.valueOf(12));
|
offsetAttrSet.addAttribute(StyleConstants.FontSize, Integer.valueOf(12));
|
||||||
offsetAttrSet.addAttribute(StyleConstants.Foreground, Color.BLACK);
|
offsetAttrSet.addAttribute(StyleConstants.Foreground, Palette.BLACK);
|
||||||
|
|
||||||
contentAttrSet = new SimpleAttributeSet();
|
contentAttrSet = new SimpleAttributeSet();
|
||||||
contentAttrSet.addAttribute(StyleConstants.FontFamily, "Monospaced");
|
contentAttrSet.addAttribute(StyleConstants.FontFamily, "Monospaced");
|
||||||
contentAttrSet.addAttribute(StyleConstants.FontSize, Integer.valueOf(12));
|
contentAttrSet.addAttribute(StyleConstants.FontSize, Integer.valueOf(12));
|
||||||
contentAttrSet.addAttribute(StyleConstants.Foreground, Color.BLUE);
|
contentAttrSet.addAttribute(StyleConstants.Foreground, Palette.BLUE);
|
||||||
|
|
||||||
fieldNameAttrSet = new SimpleAttributeSet();
|
fieldNameAttrSet = new SimpleAttributeSet();
|
||||||
fieldNameAttrSet.addAttribute(StyleConstants.FontFamily, "Monospaced");
|
fieldNameAttrSet.addAttribute(StyleConstants.FontFamily, "Monospaced");
|
||||||
fieldNameAttrSet.addAttribute(StyleConstants.FontSize, Integer.valueOf(12));
|
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 = new SimpleAttributeSet();
|
||||||
commentAttrSet.addAttribute(StyleConstants.FontFamily, "Monospaced");
|
commentAttrSet.addAttribute(StyleConstants.FontFamily, "Monospaced");
|
||||||
commentAttrSet.addAttribute(StyleConstants.FontSize, Integer.valueOf(12));
|
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 = new SimpleAttributeSet();
|
||||||
deletedAttrSet.addAttribute(StyleConstants.FontFamily, "Tahoma");
|
deletedAttrSet.addAttribute(StyleConstants.FontFamily, "Tahoma");
|
||||||
deletedAttrSet.addAttribute(StyleConstants.FontSize, Integer.valueOf(12));
|
deletedAttrSet.addAttribute(StyleConstants.FontSize, Integer.valueOf(12));
|
||||||
deletedAttrSet.addAttribute(StyleConstants.Bold, Boolean.TRUE);
|
deletedAttrSet.addAttribute(StyleConstants.Bold, Boolean.TRUE);
|
||||||
deletedAttrSet.addAttribute(StyleConstants.Foreground, Color.RED);
|
deletedAttrSet.addAttribute(StyleConstants.Foreground, Palette.RED);
|
||||||
|
|
||||||
setDataType(dataType);
|
setDataType(dataType);
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-22
@@ -15,17 +15,18 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.merge.datatypes;
|
package ghidra.app.merge.datatypes;
|
||||||
|
|
||||||
import ghidra.program.model.data.ArchiveType;
|
|
||||||
import ghidra.program.model.data.SourceArchive;
|
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Color;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JTextPane;
|
import javax.swing.JTextPane;
|
||||||
import javax.swing.text.*;
|
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.
|
* Panel to show the contents of a Source Archive.
|
||||||
*/
|
*/
|
||||||
@@ -58,19 +59,19 @@ class SourceArchivePanel extends JPanel {
|
|||||||
|
|
||||||
headingAttrSet = new SimpleAttributeSet();
|
headingAttrSet = new SimpleAttributeSet();
|
||||||
headingAttrSet.addAttribute(StyleConstants.FontFamily, "Monospaced");
|
headingAttrSet.addAttribute(StyleConstants.FontFamily, "Monospaced");
|
||||||
headingAttrSet.addAttribute(StyleConstants.FontSize, new Integer(12));
|
headingAttrSet.addAttribute(StyleConstants.FontSize, 12);
|
||||||
headingAttrSet.addAttribute(StyleConstants.Foreground, Color.BLUE);
|
headingAttrSet.addAttribute(StyleConstants.Foreground, Palette.BLUE);
|
||||||
|
|
||||||
valueAttrSet = new SimpleAttributeSet();
|
valueAttrSet = new SimpleAttributeSet();
|
||||||
valueAttrSet.addAttribute(StyleConstants.FontFamily, "Tahoma");
|
valueAttrSet.addAttribute(StyleConstants.FontFamily, "Tahoma");
|
||||||
valueAttrSet.addAttribute(StyleConstants.FontSize, new Integer(11));
|
valueAttrSet.addAttribute(StyleConstants.FontSize, 11);
|
||||||
valueAttrSet.addAttribute(StyleConstants.Bold, Boolean.TRUE);
|
valueAttrSet.addAttribute(StyleConstants.Bold, Boolean.TRUE);
|
||||||
|
|
||||||
deletedAttrSet = new SimpleAttributeSet();
|
deletedAttrSet = new SimpleAttributeSet();
|
||||||
deletedAttrSet.addAttribute(StyleConstants.FontFamily, "Tahoma");
|
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.Bold, Boolean.TRUE);
|
||||||
deletedAttrSet.addAttribute(StyleConstants.Foreground, Color.RED);
|
deletedAttrSet.addAttribute(StyleConstants.Foreground, Palette.RED);
|
||||||
|
|
||||||
setSourceArchive(null);
|
setSourceArchive(null);
|
||||||
}
|
}
|
||||||
@@ -110,9 +111,9 @@ class SourceArchivePanel extends JPanel {
|
|||||||
ArchiveType archiveType = sourceArchive.getArchiveType();
|
ArchiveType archiveType = sourceArchive.getArchiveType();
|
||||||
String typeString = (archiveType == ArchiveType.FILE) ? "File Archive"
|
String typeString = (archiveType == ArchiveType.FILE) ? "File Archive"
|
||||||
: (archiveType == ArchiveType.PROGRAM) ? "Program"
|
: (archiveType == ArchiveType.PROGRAM) ? "Program"
|
||||||
: (archiveType == ArchiveType.PROJECT) ? "Project Archive"
|
: (archiveType == ArchiveType.PROJECT) ? "Project Archive"
|
||||||
: (archiveType == ArchiveType.BUILT_IN) ? "Built-In"
|
: (archiveType == ArchiveType.BUILT_IN) ? "Built-In"
|
||||||
: "Invalid";
|
: "Invalid";
|
||||||
insertString(" Type: ", headingAttrSet);
|
insertString(" Type: ", headingAttrSet);
|
||||||
insertString(typeString + "\n", valueAttrSet);
|
insertString(typeString + "\n", valueAttrSet);
|
||||||
}
|
}
|
||||||
@@ -128,21 +129,14 @@ class SourceArchivePanel extends JPanel {
|
|||||||
insertString((sourceArchive.isDirty() ? "yes" : "no") + "\n", valueAttrSet);
|
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) {
|
private void insertString(String str, SimpleAttributeSet attributeSet) {
|
||||||
int offset = doc.getLength();
|
int offset = doc.getLength();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
doc.insertString(offset, str, attributeSet);
|
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 javax.swing.border.TitledBorder;
|
||||||
|
|
||||||
import docking.widgets.label.GDHtmlLabel;
|
import docking.widgets.label.GDHtmlLabel;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
import ghidra.app.merge.util.ConflictUtility;
|
import ghidra.app.merge.util.ConflictUtility;
|
||||||
import ghidra.program.model.address.*;
|
import ghidra.program.model.address.*;
|
||||||
import ghidra.util.HTMLUtilities;
|
import ghidra.util.HTMLUtilities;
|
||||||
@@ -152,12 +153,13 @@ public class ConflictInfoPanel extends JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addCount(StringBuffer buf, long value) {
|
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) {
|
private void addAddress(StringBuffer buf, Address addr) {
|
||||||
buf.append(
|
buf.append(
|
||||||
"<font color=\"#990000\">" + HTMLUtilities.escapeHTML(addr.toString()) + "</font>");
|
"<font color=\"" + Palette.MAROON + "\">" + HTMLUtilities.escapeHTML(addr.toString()) +
|
||||||
|
"</font>");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateWest() {
|
private void updateWest() {
|
||||||
|
|||||||
+3
-2
@@ -21,6 +21,7 @@ import javax.swing.*;
|
|||||||
import javax.swing.border.TitledBorder;
|
import javax.swing.border.TitledBorder;
|
||||||
|
|
||||||
import docking.widgets.label.GDHtmlLabel;
|
import docking.widgets.label.GDHtmlLabel;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
import ghidra.app.merge.util.ConflictUtility;
|
import ghidra.app.merge.util.ConflictUtility;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -103,11 +104,11 @@ public class ExternalConflictInfoPanel extends JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addCount(StringBuffer buf, int value) {
|
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) {
|
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() {
|
private void updateWest() {
|
||||||
|
|||||||
+27
-36
@@ -15,15 +15,14 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.merge.listing;
|
package ghidra.app.merge.listing;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import javax.swing.event.ChangeEvent;
|
|
||||||
import javax.swing.event.ChangeListener;
|
import javax.swing.event.ChangeListener;
|
||||||
|
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||||
import ghidra.app.merge.*;
|
import ghidra.app.merge.*;
|
||||||
import ghidra.app.util.HelpTopics;
|
import ghidra.app.util.HelpTopics;
|
||||||
import ghidra.program.database.function.FunctionManagerDB;
|
import ghidra.program.database.function.FunctionManagerDB;
|
||||||
@@ -102,7 +101,6 @@ public class FunctionTagMerger implements MergeResolver, ListingMergeConstants {
|
|||||||
// the middle of resolving multiple conflicts.
|
// the middle of resolving multiple conflicts.
|
||||||
private long currentlyMergingTagID;
|
private long currentlyMergingTagID;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
@@ -160,7 +158,6 @@ public class FunctionTagMerger implements MergeResolver, ListingMergeConstants {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void merge(TaskMonitor monitor) throws Exception {
|
public void merge(TaskMonitor monitor) throws Exception {
|
||||||
autoMerge();
|
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
|
// 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
|
// keep a deleted tag, so make sure the corresponding tag in Result
|
||||||
// is deleted as well.
|
// is deleted as well.
|
||||||
if (tag == null ) {
|
if (tag == null) {
|
||||||
if (resultTag != null) {
|
if (resultTag != null) {
|
||||||
resultTag.delete();
|
resultTag.delete();
|
||||||
}
|
}
|
||||||
@@ -279,8 +276,9 @@ public class FunctionTagMerger implements MergeResolver, ListingMergeConstants {
|
|||||||
// If the source tag exists, but the Result tag doesn't, we have to create a new
|
// If the source tag exists, but the Result tag doesn't, we have to create a new
|
||||||
// one in Result.
|
// one in Result.
|
||||||
else if (resultTag == null) {
|
else if (resultTag == null) {
|
||||||
functionManagerDBResult.getFunctionTagManager().createFunctionTag(tag.getName(),
|
functionManagerDBResult.getFunctionTagManager()
|
||||||
tag.getComment());
|
.createFunctionTag(tag.getName(),
|
||||||
|
tag.getComment());
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the source tag exists and Result tag exists, just update the tag
|
// If the source tag exists and Result tag exists, just update the tag
|
||||||
@@ -574,37 +572,29 @@ public class FunctionTagMerger implements MergeResolver, ListingMergeConstants {
|
|||||||
private void showMergePanel(long id, TaskMonitor monitor) {
|
private void showMergePanel(long id, TaskMonitor monitor) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final ChangeListener changeListener = new ChangeListener() {
|
final ChangeListener changeListener = e -> {
|
||||||
@Override
|
conflictOption = conflictPanel.getSelectedOptions();
|
||||||
public void stateChanged(ChangeEvent e) {
|
if (conflictOption == ASK_USER || conflictOption == CANCELED) {
|
||||||
conflictOption = conflictPanel.getSelectedOptions();
|
|
||||||
if (conflictOption == ASK_USER || conflictOption == CANCELED) {
|
|
||||||
if (mergeManager != null) {
|
|
||||||
mergeManager.setApplyEnabled(false);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (mergeManager != null) {
|
if (mergeManager != null) {
|
||||||
mergeManager.clearStatusText();
|
mergeManager.setApplyEnabled(false);
|
||||||
}
|
}
|
||||||
try {
|
return;
|
||||||
merge(conflictOption, monitor);
|
}
|
||||||
if (mergeManager != null) {
|
if (mergeManager != null) {
|
||||||
mergeManager.setApplyEnabled(true);
|
mergeManager.clearStatusText();
|
||||||
}
|
}
|
||||||
}
|
try {
|
||||||
catch (CancelledException e1) {
|
merge(conflictOption, monitor);
|
||||||
// user cancel - no need to log
|
if (mergeManager != null) {
|
||||||
|
mergeManager.setApplyEnabled(true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (CancelledException e1) {
|
||||||
|
// user cancel - no need to log
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
SwingUtilities.invokeAndWait(new Runnable() {
|
SwingUtilities.invokeAndWait(() -> setupConflictPanel(id, changeListener, monitor));
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
setupConflictPanel(id, changeListener, monitor);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
catch (InterruptedException | InvocationTargetException e) {
|
catch (InterruptedException | InvocationTargetException e) {
|
||||||
Msg.error(this, "Unexpected error showing merge panel for tag " + id, e);
|
Msg.error(this, "Unexpected error showing merge panel for tag " + id, e);
|
||||||
@@ -712,19 +702,20 @@ public class FunctionTagMerger implements MergeResolver, ListingMergeConstants {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private String getConflictInfo(TaskMonitor monitor) {
|
private String getConflictInfo(TaskMonitor monitor) {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuilder buf = new StringBuilder();
|
||||||
buf.append(
|
buf.append(
|
||||||
"<center><b>" + "Resolving conflict " + (monitor.getProgress() + 1) + " of " +
|
"<center><b>" + "Resolving conflict " + (monitor.getProgress() + 1) + " of " +
|
||||||
tagConflicts.size() + "</b></center>");
|
tagConflicts.size() + "</b></center>");
|
||||||
buf.append(HTMLUtilities.HTML_NEW_LINE);
|
buf.append(HTMLUtilities.HTML_NEW_LINE);
|
||||||
buf.append("Tag Id:");
|
buf.append("Tag Id:");
|
||||||
buf.append(HTMLUtilities.spaces(21));
|
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(HTMLUtilities.HTML_NEW_LINE);
|
||||||
buf.append("Reason for Conflict:");
|
buf.append("Reason for Conflict:");
|
||||||
buf.append(HTMLUtilities.spaces(1));
|
buf.append(HTMLUtilities.spaces(1));
|
||||||
buf.append(
|
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);
|
||||||
buf.append(HTMLUtilities.HTML_NEW_LINE);
|
buf.append(HTMLUtilities.HTML_NEW_LINE);
|
||||||
|
|
||||||
|
|||||||
+27
-43
@@ -15,22 +15,12 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.merge.listing;
|
package ghidra.app.merge.listing;
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.*;
|
||||||
import java.awt.Color;
|
import java.awt.event.*;
|
||||||
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.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import javax.swing.BorderFactory;
|
import javax.swing.*;
|
||||||
import javax.swing.ButtonGroup;
|
|
||||||
import javax.swing.JComponent;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.SwingConstants;
|
|
||||||
import javax.swing.border.Border;
|
import javax.swing.border.Border;
|
||||||
import javax.swing.border.TitledBorder;
|
import javax.swing.border.TitledBorder;
|
||||||
import javax.swing.event.ChangeListener;
|
import javax.swing.event.ChangeListener;
|
||||||
@@ -39,6 +29,7 @@ import docking.widgets.button.GRadioButton;
|
|||||||
import docking.widgets.checkbox.GCheckBox;
|
import docking.widgets.checkbox.GCheckBox;
|
||||||
import docking.widgets.label.GDHtmlLabel;
|
import docking.widgets.label.GDHtmlLabel;
|
||||||
import docking.widgets.label.GLabel;
|
import docking.widgets.label.GLabel;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Java;
|
||||||
import ghidra.app.merge.util.ConflictUtility;
|
import ghidra.app.merge.util.ConflictUtility;
|
||||||
import ghidra.util.HTMLUtilities;
|
import ghidra.util.HTMLUtilities;
|
||||||
import ghidra.util.layout.MaximizeSpecificColumnGridLayout;
|
import ghidra.util.layout.MaximizeSpecificColumnGridLayout;
|
||||||
@@ -55,7 +46,7 @@ public class VariousChoicesPanel extends ConflictPanel {
|
|||||||
|
|
||||||
private final static long serialVersionUID = 1;
|
private final static long serialVersionUID = 1;
|
||||||
private static final Border UNDERLINE_BORDER =
|
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 JPanel rowPanel;
|
||||||
private GDHtmlLabel headerLabel;
|
private GDHtmlLabel headerLabel;
|
||||||
@@ -76,7 +67,7 @@ public class VariousChoicesPanel extends ConflictPanel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for a various choices panel.
|
* Constructor for a various choices panel.
|
||||||
* @param isDoubleBuffered
|
* @param isDoubleBuffered true if double buffered
|
||||||
*/
|
*/
|
||||||
public VariousChoicesPanel(boolean isDoubleBuffered) {
|
public VariousChoicesPanel(boolean isDoubleBuffered) {
|
||||||
super(isDoubleBuffered);
|
super(isDoubleBuffered);
|
||||||
@@ -199,17 +190,14 @@ public class VariousChoicesPanel extends ConflictPanel {
|
|||||||
MyRadioButton[] rb = new MyRadioButton[choices.length];
|
MyRadioButton[] rb = new MyRadioButton[choices.length];
|
||||||
final int row = rows.size();
|
final int row = rows.size();
|
||||||
final ChoiceRow choiceRow = new ChoiceRow(titleComp, rb);
|
final ChoiceRow choiceRow = new ChoiceRow(titleComp, rb);
|
||||||
ItemListener itemListener = new ItemListener() {
|
ItemListener itemListener = e -> {
|
||||||
@Override
|
adjustUseForAllEnablement();
|
||||||
public void itemStateChanged(ItemEvent e) {
|
if (listener != null) {
|
||||||
adjustUseForAllEnablement();
|
Object source = e.getSource();
|
||||||
if (listener != null) {
|
if (((MyRadioButton) source).isSelected()) {
|
||||||
Object source = e.getSource();
|
ResolveConflictChangeEvent re =
|
||||||
if (((MyRadioButton) source).isSelected()) {
|
new ResolveConflictChangeEvent(source, row, choiceRow.getChoice());
|
||||||
ResolveConflictChangeEvent re =
|
listener.stateChanged(re);
|
||||||
new ResolveConflictChangeEvent(source, row, choiceRow.getChoice());
|
|
||||||
listener.stateChanged(re);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -246,15 +234,12 @@ public class VariousChoicesPanel extends ConflictPanel {
|
|||||||
MyCheckBox[] cb = new MyCheckBox[choices.length];
|
MyCheckBox[] cb = new MyCheckBox[choices.length];
|
||||||
final int row = rows.size();
|
final int row = rows.size();
|
||||||
final ChoiceRow choiceRow = new ChoiceRow(titleComp, cb);
|
final ChoiceRow choiceRow = new ChoiceRow(titleComp, cb);
|
||||||
ItemListener itemListener = new ItemListener() {
|
ItemListener itemListener = e -> {
|
||||||
@Override
|
adjustUseForAllEnablement();
|
||||||
public void itemStateChanged(ItemEvent e) {
|
if (listener != null) {
|
||||||
adjustUseForAllEnablement();
|
ResolveConflictChangeEvent re =
|
||||||
if (listener != null) {
|
new ResolveConflictChangeEvent(e.getSource(), row, choiceRow.getChoice());
|
||||||
ResolveConflictChangeEvent re =
|
listener.stateChanged(re);
|
||||||
new ResolveConflictChangeEvent(e.getSource(), row, choiceRow.getChoice());
|
|
||||||
listener.stateChanged(re);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
for (int i = 0; i < choices.length; i++) {
|
for (int i = 0; i < choices.length; i++) {
|
||||||
@@ -291,8 +276,8 @@ public class VariousChoicesPanel extends ConflictPanel {
|
|||||||
|
|
||||||
rowPanel.add(choiceRow.titleLabel);
|
rowPanel.add(choiceRow.titleLabel);
|
||||||
|
|
||||||
for (int i = 0; i < choiceRow.rb.length; i++) {
|
for (JComponent element : choiceRow.rb) {
|
||||||
rowPanel.add(choiceRow.rb[i]);
|
rowPanel.add(element);
|
||||||
}
|
}
|
||||||
if (row == 0) {
|
if (row == 0) {
|
||||||
add(rowPanel, BorderLayout.CENTER);
|
add(rowPanel, BorderLayout.CENTER);
|
||||||
@@ -303,8 +288,8 @@ public class VariousChoicesPanel extends ConflictPanel {
|
|||||||
ChoiceRow cr = rows.get(rowNum);
|
ChoiceRow cr = rows.get(rowNum);
|
||||||
rowPanel.remove(cr.titleLabel);
|
rowPanel.remove(cr.titleLabel);
|
||||||
JComponent[] comps = cr.rb;
|
JComponent[] comps = cr.rb;
|
||||||
for (int i = 0; i < comps.length; i++) {
|
for (JComponent comp : comps) {
|
||||||
rowPanel.remove(comps[i]);
|
rowPanel.remove(comp);
|
||||||
}
|
}
|
||||||
rows.remove(rowNum);
|
rows.remove(rowNum);
|
||||||
}
|
}
|
||||||
@@ -404,8 +389,7 @@ public class VariousChoicesPanel extends ConflictPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void removeListeners(ChoiceRow cr) {
|
private void removeListeners(ChoiceRow cr) {
|
||||||
for (int i = 0; i < cr.rb.length; i++) {
|
for (JComponent comp : cr.rb) {
|
||||||
JComponent comp = cr.rb[i];
|
|
||||||
if (comp instanceof MyRadioButton) {
|
if (comp instanceof MyRadioButton) {
|
||||||
MyRadioButton rb = (MyRadioButton) comp;
|
MyRadioButton rb = (MyRadioButton) comp;
|
||||||
ItemListener[] listeners = rb.getItemListeners();
|
ItemListener[] listeners = rb.getItemListeners();
|
||||||
@@ -496,8 +480,8 @@ public class VariousChoicesPanel extends ConflictPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean hasChoices() {
|
boolean hasChoices() {
|
||||||
for (int i = 0; i < rb.length; i++) {
|
for (JComponent element : rb) {
|
||||||
if ((rb[i] instanceof MyRadioButton) || (rb[i] instanceof MyCheckBox)) {
|
if ((element instanceof MyRadioButton) || (element instanceof MyCheckBox)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+20
-54
@@ -15,27 +15,12 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.merge.listing;
|
package ghidra.app.merge.listing;
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.*;
|
||||||
import java.awt.Color;
|
import java.awt.event.*;
|
||||||
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.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
|
|
||||||
import javax.swing.BorderFactory;
|
import javax.swing.*;
|
||||||
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.border.Border;
|
import javax.swing.border.Border;
|
||||||
import javax.swing.border.TitledBorder;
|
import javax.swing.border.TitledBorder;
|
||||||
import javax.swing.event.ChangeListener;
|
import javax.swing.event.ChangeListener;
|
||||||
@@ -44,6 +29,7 @@ import docking.widgets.button.GRadioButton;
|
|||||||
import docking.widgets.checkbox.GCheckBox;
|
import docking.widgets.checkbox.GCheckBox;
|
||||||
import docking.widgets.label.GDHtmlLabel;
|
import docking.widgets.label.GDHtmlLabel;
|
||||||
import docking.widgets.label.GDLabel;
|
import docking.widgets.label.GDLabel;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Java;
|
||||||
import ghidra.app.merge.util.ConflictUtility;
|
import ghidra.app.merge.util.ConflictUtility;
|
||||||
import ghidra.util.HTMLUtilities;
|
import ghidra.util.HTMLUtilities;
|
||||||
import ghidra.util.datastruct.LongArrayList;
|
import ghidra.util.datastruct.LongArrayList;
|
||||||
@@ -88,17 +74,11 @@ public class VerticalChoicesPanel extends ConflictPanel {
|
|||||||
private Insets textVsButtonInsets;
|
private Insets textVsButtonInsets;
|
||||||
private Insets textVsCheckBoxInsets;
|
private Insets textVsCheckBoxInsets;
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates an empty <CODE>VerticalChoicesPanel</CODE>
|
|
||||||
*/
|
|
||||||
public VerticalChoicesPanel() {
|
public VerticalChoicesPanel() {
|
||||||
super();
|
super();
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param isDoubleBuffered
|
|
||||||
*/
|
|
||||||
public VerticalChoicesPanel(boolean isDoubleBuffered) {
|
public VerticalChoicesPanel(boolean isDoubleBuffered) {
|
||||||
super(isDoubleBuffered);
|
super(isDoubleBuffered);
|
||||||
init();
|
init();
|
||||||
@@ -179,8 +159,8 @@ public class VerticalChoicesPanel extends ConflictPanel {
|
|||||||
JComponent[] headerComps = getRowComponents(0);
|
JComponent[] headerComps = getRowComponents(0);
|
||||||
if (headerComps != null) {
|
if (headerComps != null) {
|
||||||
// remove the header
|
// remove the header
|
||||||
for (int i = 0; i < headerComps.length; i++) {
|
for (JComponent headerComp : headerComps) {
|
||||||
rowPanel.remove(headerComps[i]);
|
rowPanel.remove(headerComp);
|
||||||
}
|
}
|
||||||
headerComps = null;
|
headerComps = null;
|
||||||
if (rowComps.isEmpty()) {
|
if (rowComps.isEmpty()) {
|
||||||
@@ -196,7 +176,8 @@ public class VerticalChoicesPanel extends ConflictPanel {
|
|||||||
else {
|
else {
|
||||||
rowTypes.set(0, (long) HEADER);
|
rowTypes.set(0, (long) HEADER);
|
||||||
}
|
}
|
||||||
if ((items != null) && (items.length > 0)) {
|
|
||||||
|
if (items.length > 0) {
|
||||||
if (rows.isEmpty()) {
|
if (rows.isEmpty()) {
|
||||||
rows.add(0, items);
|
rows.add(0, items);
|
||||||
}
|
}
|
||||||
@@ -209,7 +190,7 @@ public class VerticalChoicesPanel extends ConflictPanel {
|
|||||||
headerComps[i] = new MyLabel(items[i]);
|
headerComps[i] = new MyLabel(items[i]);
|
||||||
headerComps[i].setName(getComponentName(0, i));
|
headerComps[i].setName(getComponentName(0, i));
|
||||||
setRowComponent(headerComps[i], 0, i, defaultInsets);
|
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();
|
rowPanel.validate();
|
||||||
@@ -278,14 +259,11 @@ public class VerticalChoicesPanel extends ConflictPanel {
|
|||||||
final MyRadioButton firstComp = new MyRadioButton(items[0], conflictOption);
|
final MyRadioButton firstComp = new MyRadioButton(items[0], conflictOption);
|
||||||
group.add(firstComp);
|
group.add(firstComp);
|
||||||
firstComp.setName(name);
|
firstComp.setName(name);
|
||||||
ItemListener itemListener = new ItemListener() {
|
ItemListener itemListener = e -> {
|
||||||
@Override
|
if (listener != null && ((JRadioButton) e.getSource()).isSelected()) {
|
||||||
public void itemStateChanged(ItemEvent e) {
|
ResolveConflictChangeEvent event =
|
||||||
if (listener != null && ((JRadioButton) e.getSource()).isSelected()) {
|
new ResolveConflictChangeEvent(firstComp, row, getSelectedOptions());
|
||||||
ResolveConflictChangeEvent event =
|
listener.stateChanged(event);
|
||||||
new ResolveConflictChangeEvent(firstComp, row, getSelectedOptions());
|
|
||||||
listener.stateChanged(event);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
firstComp.addItemListener(itemListener);
|
firstComp.addItemListener(itemListener);
|
||||||
@@ -315,12 +293,9 @@ public class VerticalChoicesPanel extends ConflictPanel {
|
|||||||
rows.add(items);
|
rows.add(items);
|
||||||
MyCheckBox firstComp = new MyCheckBox(items[0], conflictOption);
|
MyCheckBox firstComp = new MyCheckBox(items[0], conflictOption);
|
||||||
firstComp.setName(name);
|
firstComp.setName(name);
|
||||||
ItemListener itemListener = new ItemListener() {
|
ItemListener itemListener = e -> {
|
||||||
@Override
|
if (listener != null) {
|
||||||
public void itemStateChanged(ItemEvent e) {
|
listener.stateChanged(null);
|
||||||
if (listener != null) {
|
|
||||||
listener.stateChanged(null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
firstComp.addItemListener(itemListener);
|
firstComp.addItemListener(itemListener);
|
||||||
@@ -432,9 +407,6 @@ public class VerticalChoicesPanel extends ConflictPanel {
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected int getSelectedOptions() {
|
protected int getSelectedOptions() {
|
||||||
int option = 0;
|
int option = 0;
|
||||||
for (int row = 0; row < rows.size(); row++) {
|
for (int row = 0; row < rows.size(); row++) {
|
||||||
@@ -449,11 +421,6 @@ public class VerticalChoicesPanel extends ConflictPanel {
|
|||||||
return option;
|
return option;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param row
|
|
||||||
* @param i
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private JComponent getComponent(int row, int column) {
|
private JComponent getComponent(int row, int column) {
|
||||||
JComponent[] comps = getRowComponents(row);
|
JComponent[] comps = getRowComponents(row);
|
||||||
if (column < comps.length) {
|
if (column < comps.length) {
|
||||||
@@ -639,8 +606,7 @@ public class VerticalChoicesPanel extends ConflictPanel {
|
|||||||
int rowCount = rowComps.size();
|
int rowCount = rowComps.size();
|
||||||
for (int row = 0; row < rowCount; row++) {
|
for (int row = 0; row < rowCount; row++) {
|
||||||
JComponent[] comps = getRowComponents(row);
|
JComponent[] comps = getRowComponents(row);
|
||||||
for (int i = 0; i < comps.length; i++) {
|
for (JComponent component : comps) {
|
||||||
JComponent component = comps[i];
|
|
||||||
if (component instanceof MyRadioButton &&
|
if (component instanceof MyRadioButton &&
|
||||||
((MyRadioButton) component).isSelected()) {
|
((MyRadioButton) component).isSelected()) {
|
||||||
conflictOption |= ((MyRadioButton) component).option;
|
conflictOption |= ((MyRadioButton) component).option;
|
||||||
@@ -666,8 +632,8 @@ public class VerticalChoicesPanel extends ConflictPanel {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean hasChoice() {
|
public boolean hasChoice() {
|
||||||
for (Iterator<Long> iterator = rowTypes.iterator(); iterator.hasNext();) {
|
for (Long rowType2 : rowTypes) {
|
||||||
long rowType = iterator.next().longValue();
|
long rowType = rowType2.longValue();
|
||||||
if (rowType == RADIO_BUTTON || rowType == CHECK_BOX) {
|
if (rowType == RADIO_BUTTON || rowType == CHECK_BOX) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ import javax.swing.*;
|
|||||||
|
|
||||||
import docking.widgets.label.GDLabel;
|
import docking.widgets.label.GDLabel;
|
||||||
import docking.widgets.label.GIconLabel;
|
import docking.widgets.label.GIconLabel;
|
||||||
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||||
import ghidra.util.layout.PairLayout;
|
import ghidra.util.layout.PairLayout;
|
||||||
import resources.ResourceManager;
|
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 CHANGED_ICON = ResourceManager.loadImage("images/changed16.gif");
|
||||||
private final static ImageIcon NO_CHANGE_ICON =
|
private final static ImageIcon NO_CHANGE_ICON =
|
||||||
ResourceManager.loadImage("images/EmptyIcon16.gif");
|
ResourceManager.loadImage("images/EmptyIcon16.gif");
|
||||||
private final static Color CHANGED_COLOR = Color.BLACK;
|
private final static Color CHANGED_COLOR = Colors.FOREGROUND;
|
||||||
private final static Color NO_CHANGE_COLOR = Color.GRAY;
|
private final static Color NO_CHANGE_COLOR = Messages.HINT;
|
||||||
|
|
||||||
TreeChangePanel(String title) {
|
TreeChangePanel(String title) {
|
||||||
super(new BorderLayout());
|
super(new BorderLayout());
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
/* ###
|
/* ###
|
||||||
* IP: GHIDRA
|
* IP: GHIDRA
|
||||||
* REVIEWED: YES
|
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -17,12 +16,13 @@
|
|||||||
package ghidra.app.merge.util;
|
package ghidra.app.merge.util;
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Color;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.text.*;
|
import javax.swing.text.*;
|
||||||
|
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||||
import ghidra.app.merge.MergeConstants;
|
import ghidra.app.merge.MergeConstants;
|
||||||
|
import ghidra.util.Msg;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Panel that shows the current conflict number and the total number of
|
* Panel that shows the current conflict number and the total number of
|
||||||
@@ -45,6 +45,7 @@ public class ConflictCountPanel extends JPanel {
|
|||||||
super(new BorderLayout());
|
super(new BorderLayout());
|
||||||
create();
|
create();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the counts, e.g., Conflict # 1 of 3.
|
* Update the counts, e.g., Conflict # 1 of 3.
|
||||||
* @param currentCount current
|
* @param currentCount current
|
||||||
@@ -57,12 +58,14 @@ public class ConflictCountPanel extends JPanel {
|
|||||||
try {
|
try {
|
||||||
doc.insertString(offset, "Conflict # ", textAttrSet);
|
doc.insertString(offset, "Conflict # ", textAttrSet);
|
||||||
offset = doc.getLength();
|
offset = doc.getLength();
|
||||||
doc.insertString(offset, " "+currentCount +" ", countAttrSet);
|
doc.insertString(offset, " " + currentCount + " ", countAttrSet);
|
||||||
offset = doc.getLength();
|
offset = doc.getLength();
|
||||||
doc.insertString(offset, " of ", textAttrSet);
|
doc.insertString(offset, " of ", textAttrSet);
|
||||||
offset = doc.getLength();
|
offset = doc.getLength();
|
||||||
doc.insertString(offset, " "+totalCount +" ", countAttrSet);
|
doc.insertString(offset, " " + totalCount + " ", countAttrSet);
|
||||||
} catch (BadLocationException e) {
|
}
|
||||||
|
catch (BadLocationException e) {
|
||||||
|
Msg.debug(this, "Exception updating text", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -81,10 +84,10 @@ public class ConflictCountPanel extends JPanel {
|
|||||||
|
|
||||||
SimpleAttributeSet set = new SimpleAttributeSet();
|
SimpleAttributeSet set = new SimpleAttributeSet();
|
||||||
set.addAttribute(StyleConstants.Bold, Boolean.TRUE);
|
set.addAttribute(StyleConstants.Bold, Boolean.TRUE);
|
||||||
set.addAttribute(StyleConstants.Foreground, Color.RED);
|
set.addAttribute(StyleConstants.Foreground, Messages.ERROR);
|
||||||
|
|
||||||
textAttrSet = new SimpleAttributeSet();
|
textAttrSet = new SimpleAttributeSet();
|
||||||
textAttrSet.addAttribute(StyleConstants.FontSize, new Integer(12));
|
textAttrSet.addAttribute(StyleConstants.FontSize, 12);
|
||||||
|
|
||||||
countAttrSet = new SimpleAttributeSet();
|
countAttrSet = new SimpleAttributeSet();
|
||||||
countAttrSet.addAttribute(StyleConstants.Bold, Boolean.TRUE);
|
countAttrSet.addAttribute(StyleConstants.Bold, Boolean.TRUE);
|
||||||
|
|||||||
@@ -20,24 +20,24 @@ import java.awt.Color;
|
|||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
|
import generic.theme.GColor;
|
||||||
|
|
||||||
public class DecoratorPanel extends JPanel {
|
public class DecoratorPanel extends JPanel {
|
||||||
|
|
||||||
|
private static final Color DISCONNECTED = new GColor("color.border.provider.disconnected");
|
||||||
|
|
||||||
public DecoratorPanel(JComponent component, boolean isConnected) {
|
public DecoratorPanel(JComponent component, boolean isConnected) {
|
||||||
setLayout(new BorderLayout());
|
setLayout(new BorderLayout());
|
||||||
add(component);
|
add(component);
|
||||||
setConnected( isConnected );
|
setConnected(isConnected);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setConnected( boolean isConnected ) {
|
public void setConnected(boolean isConnected) {
|
||||||
if ( !isConnected ) {
|
if (!isConnected) {
|
||||||
setBorder( BorderFactory.createLineBorder( Color.ORANGE, 2 ) );
|
setBorder(BorderFactory.createLineBorder(DISCONNECTED, 2));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setBorder( BorderFactory.createEmptyBorder() );
|
setBorder(BorderFactory.createEmptyBorder());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// public void setNorthPanel(JComponent comp) {
|
|
||||||
// add(comp, BorderLayout.NORTH);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
/* ###
|
/* ###
|
||||||
* IP: GHIDRA
|
* IP: GHIDRA
|
||||||
* REVIEWED: YES
|
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -16,15 +15,18 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.nav;
|
package ghidra.app.nav;
|
||||||
|
|
||||||
import ghidra.app.util.viewer.util.TitledPanel;
|
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
|
import generic.theme.GColor;
|
||||||
|
import ghidra.app.util.viewer.util.TitledPanel;
|
||||||
|
|
||||||
public class ListingPanelContainer extends JPanel {
|
public class ListingPanelContainer extends JPanel {
|
||||||
|
|
||||||
|
private static final Color DISCONNECTED = new GColor("color.border.provider.disconnected");
|
||||||
|
|
||||||
private JSplitPane splitPane;
|
private JSplitPane splitPane;
|
||||||
private TitledPanel leftTitlePanel;
|
private TitledPanel leftTitlePanel;
|
||||||
private TitledPanel rightTitlePanelPanel;
|
private TitledPanel rightTitlePanelPanel;
|
||||||
@@ -35,7 +37,7 @@ public class ListingPanelContainer extends JPanel {
|
|||||||
this.leftListingPanel = leftListingPanel;
|
this.leftListingPanel = leftListingPanel;
|
||||||
setLayout(new BorderLayout());
|
setLayout(new BorderLayout());
|
||||||
add(leftListingPanel);
|
add(leftListingPanel);
|
||||||
setConnnected( isConnected );
|
setConnnected(isConnected);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ListingPanelContainer(JComponent leftListingPanel, JComponent rightListingPanel,
|
public ListingPanelContainer(JComponent leftListingPanel, JComponent rightListingPanel,
|
||||||
@@ -46,12 +48,12 @@ public class ListingPanelContainer extends JPanel {
|
|||||||
setOtherPanel(rightListingPanel, leftTitle, rightTitle);
|
setOtherPanel(rightListingPanel, leftTitle, rightTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setConnnected( boolean isConnected ) {
|
public void setConnnected(boolean isConnected) {
|
||||||
if ( !isConnected ) {
|
if (!isConnected) {
|
||||||
setBorder( BorderFactory.createLineBorder( Color.ORANGE, 2 ) );
|
setBorder(BorderFactory.createLineBorder(DISCONNECTED, 2));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setBorder( BorderFactory.createEmptyBorder() );
|
setBorder(BorderFactory.createEmptyBorder());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,7 +61,8 @@ public class ListingPanelContainer extends JPanel {
|
|||||||
removeAll();
|
removeAll();
|
||||||
leftTitlePanel = new TitledPanel(leftTitle, leftListingPanel, 20);
|
leftTitlePanel = new TitledPanel(leftTitle, leftListingPanel, 20);
|
||||||
rightTitlePanelPanel = new TitledPanel(rightTitle, rightListingPanel, 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.setDividerLocation(0.5);
|
||||||
splitPane.setResizeWeight(0.5);
|
splitPane.setResizeWeight(0.5);
|
||||||
add(splitPane, BorderLayout.CENTER);
|
add(splitPane, BorderLayout.CENTER);
|
||||||
@@ -83,7 +86,8 @@ public class ListingPanelContainer extends JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setOrientation(boolean isSideBySide) {
|
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);
|
splitPane.setDividerLocation(0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import java.awt.Point;
|
|||||||
import javax.swing.Icon;
|
import javax.swing.Icon;
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
|
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
import resources.MultiIcon;
|
import resources.MultiIcon;
|
||||||
import resources.ResourceManager;
|
import resources.ResourceManager;
|
||||||
import resources.icons.OvalColorIcon;
|
import resources.icons.OvalColorIcon;
|
||||||
@@ -50,7 +51,7 @@ public class NavigatableIconFactory {
|
|||||||
private static ImageIcon getHighlightIcon(Icon primaryIcon) {
|
private static ImageIcon getHighlightIcon(Icon primaryIcon) {
|
||||||
int primaryWidth = primaryIcon.getIconWidth();
|
int primaryWidth = primaryIcon.getIconWidth();
|
||||||
int primaryHeight = primaryIcon.getIconHeight();
|
int primaryHeight = primaryIcon.getIconHeight();
|
||||||
Color color = new Color(255, 255, 0, 255);
|
Color color = Palette.YELLOW;
|
||||||
return ResourceManager.getImageIcon(
|
return ResourceManager.getImageIcon(
|
||||||
new OvalColorIcon(color, primaryWidth + 4, primaryHeight + 4));
|
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.GhidraFileChooser;
|
||||||
import docking.widgets.filechooser.GhidraFileChooserMode;
|
import docking.widgets.filechooser.GhidraFileChooserMode;
|
||||||
import generic.jar.ResourceFile;
|
import generic.jar.ResourceFile;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
import ghidra.app.plugin.core.analysis.AnalysisWorker;
|
import ghidra.app.plugin.core.analysis.AnalysisWorker;
|
||||||
import ghidra.app.plugin.core.analysis.AutoAnalysisManager;
|
import ghidra.app.plugin.core.analysis.AutoAnalysisManager;
|
||||||
import ghidra.app.plugin.core.colorizer.ColorizingService;
|
import ghidra.app.plugin.core.colorizer.ColorizingService;
|
||||||
@@ -421,8 +422,8 @@ public abstract class GhidraScript extends FlatProgramAPI {
|
|||||||
null,
|
null,
|
||||||
"Keep Changes?",
|
"Keep Changes?",
|
||||||
message,
|
message,
|
||||||
"<html>No (<font color=\"red\">discard</font> changes)",
|
"<html>No (<font color=\""+Palette.RED+"\">discard</font> changes)",
|
||||||
"<html>Yes (<font color=\"green\">keep</font> changes)",
|
"<html>Yes (<font color=\""+Palette.GREEN+"\">keep</font> changes)",
|
||||||
OptionDialog.QUESTION_MESSAGE);
|
OptionDialog.QUESTION_MESSAGE);
|
||||||
//@formatter:on
|
//@formatter:on
|
||||||
|
|
||||||
@@ -3684,7 +3685,7 @@ public abstract class GhidraScript extends FlatProgramAPI {
|
|||||||
state.getTool(), currentProgram, addresses);
|
state.getTool(), currentProgram, addresses);
|
||||||
TableComponentProvider<Address> tableProvider =
|
TableComponentProvider<Address> tableProvider =
|
||||||
table.showTableWithMarkers(title + " " + model.getName(), "GhidraScript", model,
|
table.showTableWithMarkers(title + " " + model.getName(), "GhidraScript", model,
|
||||||
Color.GREEN, null, "Script Results", null);
|
Palette.GREEN, null, "Script Results", null);
|
||||||
tableProvider.installRemoveItemsAction();
|
tableProvider.installRemoveItemsAction();
|
||||||
};
|
};
|
||||||
Swing.runLater(runnable);
|
Swing.runLater(runnable);
|
||||||
@@ -3701,7 +3702,7 @@ public abstract class GhidraScript extends FlatProgramAPI {
|
|||||||
AddressSetTableModel model =
|
AddressSetTableModel model =
|
||||||
new AddressSetTableModel(title, state.getTool(), currentProgram, addresses, null);
|
new AddressSetTableModel(title, state.getTool(), currentProgram, addresses, null);
|
||||||
TableComponentProvider<Address> tableProvider = table.showTableWithMarkers(title,
|
TableComponentProvider<Address> tableProvider = table.showTableWithMarkers(title,
|
||||||
"GhidraScript", model, Color.GREEN, null, "Script Results", null);
|
"GhidraScript", model, Palette.GREEN, null, "Script Results", null);
|
||||||
tableProvider.installRemoveItemsAction();
|
tableProvider.installRemoveItemsAction();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ import docking.DialogComponentProvider;
|
|||||||
import docking.action.DockingAction;
|
import docking.action.DockingAction;
|
||||||
import docking.widgets.table.*;
|
import docking.widgets.table.*;
|
||||||
import docking.widgets.table.threaded.ThreadedTableModel;
|
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.Navigatable;
|
||||||
import ghidra.app.nav.NavigatableRemovalListener;
|
import ghidra.app.nav.NavigatableRemovalListener;
|
||||||
import ghidra.app.services.GoToService;
|
import ghidra.app.services.GoToService;
|
||||||
@@ -418,7 +420,7 @@ public class TableChooserDialog extends DialogComponentProvider
|
|||||||
|
|
||||||
private class WrappingCellRenderer extends GhidraTableCellRenderer {
|
private class WrappingCellRenderer extends GhidraTableCellRenderer {
|
||||||
|
|
||||||
private Color pendingColor = new Color(192, 192, 192, 75);
|
private Color pendingColor = Palette.LIGHT_GRAY;
|
||||||
private TableCellRenderer delegate;
|
private TableCellRenderer delegate;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -443,7 +445,7 @@ public class TableChooserDialog extends DialogComponentProvider
|
|||||||
if (sharedPending.contains(ro)) {
|
if (sharedPending.contains(ro)) {
|
||||||
renderer.setBackground(pendingColor);
|
renderer.setBackground(pendingColor);
|
||||||
renderer.setForeground(data.getTable().getSelectionForeground());
|
renderer.setForeground(data.getTable().getSelectionForeground());
|
||||||
renderer.setForeground(Color.BLACK);
|
renderer.setForeground(Colors.FOREGROUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
return renderer;
|
return renderer;
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import java.awt.event.ComponentListener;
|
|||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
import docking.widgets.label.GDLabel;
|
import docking.widgets.label.GDLabel;
|
||||||
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
import ghidra.app.util.viewer.util.AddressPixelMap;
|
import ghidra.app.util.viewer.util.AddressPixelMap;
|
||||||
import ghidra.program.model.mem.MemoryBlock;
|
import ghidra.program.model.mem.MemoryBlock;
|
||||||
|
|
||||||
@@ -34,7 +35,7 @@ public class BlockPanel extends JPanel implements ComponentListener {
|
|||||||
|
|
||||||
public BlockPanel() {
|
public BlockPanel() {
|
||||||
super();
|
super();
|
||||||
setBackground(Color.WHITE);
|
setBackground(Colors.BACKGROUND);
|
||||||
addComponentListener(this);
|
addComponentListener(this);
|
||||||
metrics = getFontMetrics(FONT);
|
metrics = getFontMetrics(FONT);
|
||||||
setPreferredSize(
|
setPreferredSize(
|
||||||
@@ -44,7 +45,7 @@ public class BlockPanel extends JPanel implements ComponentListener {
|
|||||||
@Override
|
@Override
|
||||||
public void paintComponent(Graphics g) {
|
public void paintComponent(Graphics g) {
|
||||||
|
|
||||||
g.setColor(Color.BLACK);
|
g.setColor(Colors.FOREGROUND);
|
||||||
g.setFont(FONT);
|
g.setFont(FONT);
|
||||||
int height = getHeight();
|
int height = getHeight();
|
||||||
|
|
||||||
@@ -53,8 +54,8 @@ public class BlockPanel extends JPanel implements ComponentListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < blocks.length; i++) {
|
for (MemoryBlock block : blocks) {
|
||||||
Rectangle rect = map.getBlockPosition(blocks[i]);
|
Rectangle rect = map.getBlockPosition(block);
|
||||||
g.drawLine(rect.x, 0, rect.x, height - 1);
|
g.drawLine(rect.x, 0, rect.x, height - 1);
|
||||||
}
|
}
|
||||||
g.drawLine(getWidth() - 1, 0, getWidth() - 1, 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.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
import ghidra.GhidraOptions;
|
import ghidra.GhidraOptions;
|
||||||
import ghidra.app.util.viewer.options.OptionsGui;
|
import ghidra.app.util.viewer.options.OptionsGui;
|
||||||
import ghidra.app.util.viewer.options.ScreenElement;
|
import ghidra.app.util.viewer.options.ScreenElement;
|
||||||
@@ -431,7 +432,7 @@ public class SymbolInspector implements OptionsChangeListener {
|
|||||||
|
|
||||||
private Color getColor(ScreenElement se) {
|
private Color getColor(ScreenElement se) {
|
||||||
if (se == null) {
|
if (se == null) {
|
||||||
return Color.BLACK;
|
return Colors.BACKGROUND;
|
||||||
}
|
}
|
||||||
String optionName = se.getColorOptionName();
|
String optionName = se.getColorOptionName();
|
||||||
Color color = (Color) cache.get(optionName);
|
Color color = (Color) cache.get(optionName);
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import generic.theme.GColor;
|
||||||
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
import ghidra.app.util.html.*;
|
import ghidra.app.util.html.*;
|
||||||
import ghidra.app.util.viewer.options.OptionsGui;
|
import ghidra.app.util.viewer.options.OptionsGui;
|
||||||
import ghidra.program.model.address.Address;
|
import ghidra.program.model.address.Address;
|
||||||
@@ -42,7 +44,8 @@ import ghidra.util.StringUtilities;
|
|||||||
*/
|
*/
|
||||||
public class ToolTipUtils {
|
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 =
|
private static final Color PARAM_CUSTOM_STORAGE_COLOR =
|
||||||
OptionsGui.PARAMETER_CUSTOM.getDefaultColor();
|
OptionsGui.PARAMETER_CUSTOM.getDefaultColor();
|
||||||
private static final Color PARAM_DYNAMIC_STORAGE_COLOR =
|
private static final Color PARAM_DYNAMIC_STORAGE_COLOR =
|
||||||
@@ -162,7 +165,7 @@ public class ToolTipUtils {
|
|||||||
dt = DataType.DEFAULT;
|
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(HTML_SPACE);
|
||||||
buf.append(friendlyEncodeHTML(s.getName()));
|
buf.append(friendlyEncodeHTML(s.getName()));
|
||||||
|
|
||||||
@@ -256,7 +259,7 @@ public class ToolTipUtils {
|
|||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
buf.append("<tr><td width=10> </td>"); // indent
|
buf.append("<tr><td width=10> </td>"); // indent
|
||||||
buf.append("<td width=\"1%\">");
|
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%\">");
|
buf.append("</td><td width=\"1%\">");
|
||||||
|
|
||||||
boolean usesCustomStorage = false;
|
boolean usesCustomStorage = false;
|
||||||
@@ -301,7 +304,7 @@ public class ToolTipUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String functionName = StringUtilities.trimMiddle(function.getName(), LINE_LENGTH);
|
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("(");
|
buffy.append(HTML_SPACE).append("(");
|
||||||
|
|
||||||
buildParameterPreview(function, buffy);
|
buildParameterPreview(function, buffy);
|
||||||
@@ -399,7 +402,7 @@ public class ToolTipUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder pb = new StringBuilder();
|
StringBuilder pb = new StringBuilder();
|
||||||
pb.append(colorString(Color.BLACK, friendlyEncodeHTML(type)));
|
pb.append(colorString(Colors.FOREGROUND, friendlyEncodeHTML(type)));
|
||||||
pb.append(HTML_SPACE);
|
pb.append(HTML_SPACE);
|
||||||
|
|
||||||
pb.append(colorString(PARAM_NAME_COLOR, friendlyEncodeHTML(name)));
|
pb.append(colorString(PARAM_NAME_COLOR, friendlyEncodeHTML(name)));
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ import java.io.*;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||||
import ghidra.app.services.DataTypeManagerService;
|
import ghidra.app.services.DataTypeManagerService;
|
||||||
import ghidra.app.util.cparser.CPP.PreProcessor;
|
import ghidra.app.util.cparser.CPP.PreProcessor;
|
||||||
import ghidra.framework.plugintool.ServiceProvider;
|
import ghidra.framework.plugintool.ServiceProvider;
|
||||||
@@ -652,16 +654,16 @@ public class CParserUtils {
|
|||||||
StringBuffer successFailureBuffer = new StringBuffer();
|
StringBuffer successFailureBuffer = new StringBuffer();
|
||||||
successFailureBuffer.append("<blockquote>");
|
successFailureBuffer.append("<blockquote>");
|
||||||
if (errorIndex == 0) {
|
if (errorIndex == 0) {
|
||||||
successFailureBuffer.append("<font color=\"red\"><b>");
|
successFailureBuffer.append("<font color=\"" + Messages.ERROR + "\"><b>");
|
||||||
successFailureBuffer.append(HTMLUtilities.friendlyEncodeHTML(functionString));
|
successFailureBuffer.append(HTMLUtilities.friendlyEncodeHTML(functionString));
|
||||||
successFailureBuffer.append("</b></font>");
|
successFailureBuffer.append("</b></font>");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
successFailureBuffer.append("<font color=\"black\">");
|
successFailureBuffer.append("<font color=\"" + Colors.FOREGROUND + "\">");
|
||||||
successFailureBuffer.append(
|
successFailureBuffer.append(
|
||||||
HTMLUtilities.friendlyEncodeHTML(functionString.substring(0, errorIndex)));
|
HTMLUtilities.friendlyEncodeHTML(functionString.substring(0, errorIndex)));
|
||||||
successFailureBuffer.append("</font>");
|
successFailureBuffer.append("</font>");
|
||||||
successFailureBuffer.append("<font color=\"red\"><b>");
|
successFailureBuffer.append("<font color=\"" + Messages.ERROR + "\"><b>");
|
||||||
successFailureBuffer.append(
|
successFailureBuffer.append(
|
||||||
HTMLUtilities.friendlyEncodeHTML(functionString.substring(errorIndex)));
|
HTMLUtilities.friendlyEncodeHTML(functionString.substring(errorIndex)));
|
||||||
successFailureBuffer.append("</b></font>");
|
successFailureBuffer.append("</b></font>");
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package ghidra.app.util.exporter;
|
|||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||||
import ghidra.app.util.DisplayableEol;
|
import ghidra.app.util.DisplayableEol;
|
||||||
import ghidra.framework.plugintool.ServiceProvider;
|
import ghidra.framework.plugintool.ServiceProvider;
|
||||||
import ghidra.program.model.address.Address;
|
import ghidra.program.model.address.Address;
|
||||||
@@ -372,7 +373,7 @@ class ProgramTextWriter {
|
|||||||
|
|
||||||
buffy = new StringBuilder();
|
buffy = new StringBuilder();
|
||||||
if (options.isHTML()) {
|
if (options.isHTML()) {
|
||||||
writer.print("<FONT COLOR=#ff0000>");
|
writer.print("<FONT COLOR=\"" + Messages.ERROR + "\">");
|
||||||
}
|
}
|
||||||
processAddress(bytesRemovedRangeStart, null);
|
processAddress(bytesRemovedRangeStart, null);
|
||||||
buffy.append(" -> ");
|
buffy.append(" -> ");
|
||||||
|
|||||||
+4
-2
@@ -20,6 +20,8 @@ import static ghidra.util.HTMLUtilities.*;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
import ghidra.app.util.ToolTipUtils;
|
import ghidra.app.util.ToolTipUtils;
|
||||||
import ghidra.app.util.html.diff.*;
|
import ghidra.app.util.html.diff.*;
|
||||||
import ghidra.program.model.data.*;
|
import ghidra.program.model.data.*;
|
||||||
@@ -162,7 +164,7 @@ public class CompositeDataTypeHTMLRepresentation extends HTMLDataTypeRepresentat
|
|||||||
Iterator<String> warnings = warningLines.iterator();
|
Iterator<String> warnings = warningLines.iterator();
|
||||||
for (; warnings.hasNext();) {
|
for (; warnings.hasNext();) {
|
||||||
String warning = warnings.next();
|
String warning = warnings.next();
|
||||||
String warningLine = wrapStringInColor(warning, Color.RED);
|
String warningLine = wrapStringInColor(warning, Messages.ERROR);
|
||||||
|
|
||||||
//@formatter:off
|
//@formatter:off
|
||||||
append(fullHtml, truncatedHtml, lineCount++, warningLine, BR);
|
append(fullHtml, truncatedHtml, lineCount++, warningLine, BR);
|
||||||
@@ -226,7 +228,7 @@ public class CompositeDataTypeHTMLRepresentation extends HTMLDataTypeRepresentat
|
|||||||
|
|
||||||
if (!(line instanceof DataTypeLine)) {
|
if (!(line instanceof DataTypeLine)) {
|
||||||
append(fullHtml, truncatedHtml, lineCount++, TR_OPEN,
|
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);
|
line.getText(), "</FONT>", TD_CLOSE, TR_CLOSE);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -15,11 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.util.html;
|
package ghidra.app.util.html;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||||
import ghidra.app.util.ToolTipUtils;
|
import ghidra.app.util.ToolTipUtils;
|
||||||
import ghidra.app.util.html.diff.DataTypeDiff;
|
import ghidra.app.util.html.diff.DataTypeDiff;
|
||||||
import ghidra.app.util.html.diff.DataTypeDiffBuilder;
|
import ghidra.app.util.html.diff.DataTypeDiffBuilder;
|
||||||
@@ -220,7 +220,7 @@ public class TypeDefDataTypeHTMLRepresentation extends HTMLDataTypeRepresentatio
|
|||||||
Iterator<String> warnings = warningLines.iterator();
|
Iterator<String> warnings = warningLines.iterator();
|
||||||
for (; warnings.hasNext();) {
|
for (; warnings.hasNext();) {
|
||||||
String warning = warnings.next();
|
String warning = warnings.next();
|
||||||
String warningLine = wrapStringInColor(warning, Color.RED);
|
String warningLine = wrapStringInColor(warning, Messages.ERROR);
|
||||||
buffy.append(warningLine).append(BR);
|
buffy.append(warningLine).append(BR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ package ghidra.app.util.html;
|
|||||||
|
|
||||||
import java.awt.Color;
|
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
|
* 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.
|
* 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 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);
|
public void updateColor(ValidatableLine otherLine, Color invalidColor);
|
||||||
|
|
||||||
|
|||||||
+10
-8
@@ -15,6 +15,10 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.util.viewer.field;
|
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.nav.Navigatable;
|
||||||
import ghidra.app.services.GoToService;
|
import ghidra.app.services.GoToService;
|
||||||
import ghidra.framework.plugintool.ServiceProvider;
|
import ghidra.framework.plugintool.ServiceProvider;
|
||||||
@@ -22,18 +26,14 @@ import ghidra.program.model.address.Address;
|
|||||||
import ghidra.program.model.listing.Program;
|
import ghidra.program.model.listing.Program;
|
||||||
import ghidra.util.Msg;
|
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
|
* An annotated string handler that allows handles annotations that begin with
|
||||||
* {@link #SUPPORTED_ANNOTATIONS}. This class expects one string following the annotation
|
* {@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.
|
* text that is an address string and will display that string as its display text.
|
||||||
*/
|
*/
|
||||||
public class AddressAnnotatedStringHandler implements AnnotatedStringHandler {
|
public class AddressAnnotatedStringHandler implements AnnotatedStringHandler {
|
||||||
private static final String INVALID_SYMBOL_TEXT = "@address annotation must have an address"
|
private static final String INVALID_SYMBOL_TEXT =
|
||||||
+ "string";
|
"@address annotation must have an address" + "string";
|
||||||
private static final String[] SUPPORTED_ANNOTATIONS = { "address", "addr" };
|
private static final String[] SUPPORTED_ANNOTATIONS = { "address", "addr" };
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -51,7 +51,7 @@ public class AddressAnnotatedStringHandler implements AnnotatedStringHandler {
|
|||||||
Address address = program.getAddressFactory().getAddress(text[1]);
|
Address address = program.getAddressFactory().getAddress(text[1]);
|
||||||
|
|
||||||
if (address == null) {
|
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);
|
prototypeString.getFontMetrics(0), false, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,7 +69,8 @@ public class AddressAnnotatedStringHandler implements AnnotatedStringHandler {
|
|||||||
prototypeString.getFontMetrics(0), true, prototypeString.getColor(0));
|
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();
|
StringBuilder buffer = new StringBuilder();
|
||||||
for (String string : text) {
|
for (String string : text) {
|
||||||
buffer.append(string).append(" ");
|
buffer.append(string).append(" ");
|
||||||
@@ -78,6 +79,7 @@ public class AddressAnnotatedStringHandler implements AnnotatedStringHandler {
|
|||||||
return new AttributedString(buffer.toString(), Color.LIGHT_GRAY,
|
return new AttributedString(buffer.toString(), Color.LIGHT_GRAY,
|
||||||
prototypeString.getFontMetrics(0));
|
prototypeString.getFontMetrics(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getSupportedAnnotations() {
|
public String[] getSupportedAnnotations() {
|
||||||
return SUPPORTED_ANNOTATIONS;
|
return SUPPORTED_ANNOTATIONS;
|
||||||
|
|||||||
+2
-1
@@ -21,6 +21,7 @@ import java.math.BigInteger;
|
|||||||
|
|
||||||
import docking.widgets.fieldpanel.field.*;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||||
@@ -39,7 +40,7 @@ import ghidra.util.exception.AssertException;
|
|||||||
*/
|
*/
|
||||||
public class AddressFieldFactory extends FieldFactory {
|
public class AddressFieldFactory extends FieldFactory {
|
||||||
public static final String FIELD_NAME = "Address";
|
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";
|
private final static String GROUP_TITLE = "Address Field";
|
||||||
public final static String DISPLAY_BLOCK_NAME =
|
public final static String DISPLAY_BLOCK_NAME =
|
||||||
GROUP_TITLE + Options.DELIMITER + "Display Block Name";
|
GROUP_TITLE + Options.DELIMITER + "Display Block Name";
|
||||||
|
|||||||
+3
-8
@@ -21,6 +21,7 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
import docking.widgets.fieldpanel.field.*;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||||
@@ -35,7 +36,7 @@ import ghidra.program.util.ProgramLocation;
|
|||||||
*/
|
*/
|
||||||
public class AssignedVariableFieldFactory extends FieldFactory {
|
public class AssignedVariableFieldFactory extends FieldFactory {
|
||||||
public static final String FIELD_NAME = "Var Assign";
|
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.
|
* Default constructor.
|
||||||
@@ -59,15 +60,9 @@ public class AssignedVariableFieldFactory extends FieldFactory {
|
|||||||
@Override
|
@Override
|
||||||
public void fieldOptionsChanged(Options options, String optionName, Object oldValue,
|
public void fieldOptionsChanged(Options options, String optionName, Object oldValue,
|
||||||
Object newValue) {
|
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.
|
* Returns the FactoryField for the given object at index index.
|
||||||
* @param varWidth the amount of variable width spacing for any fields
|
* @param varWidth the amount of variable width spacing for any fields
|
||||||
|
|||||||
+4
-3
@@ -27,6 +27,7 @@ import java.math.BigInteger;
|
|||||||
import docking.widgets.fieldpanel.field.*;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
import docking.widgets.fieldpanel.support.RowColLocation;
|
import docking.widgets.fieldpanel.support.RowColLocation;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||||
@@ -46,8 +47,8 @@ import ghidra.util.HelpLocation;
|
|||||||
public class BytesFieldFactory extends FieldFactory {
|
public class BytesFieldFactory extends FieldFactory {
|
||||||
private static final int CHARS_IN_BYTE = 2;
|
private static final int CHARS_IN_BYTE = 2;
|
||||||
public static final String FIELD_NAME = "Bytes";
|
public static final String FIELD_NAME = "Bytes";
|
||||||
public static final Color DEFAULT_COLOR = Color.BLUE;
|
public static final Color DEFAULT_COLOR = Palette.BLUE;
|
||||||
public static final Color ALIGNMENT_BYTES_COLOR = Color.gray;
|
public static final Color ALIGNMENT_BYTES_COLOR = Palette.GRAY;
|
||||||
public final static String GROUP_TITLE = "Bytes Field";
|
public final static String GROUP_TITLE = "Bytes Field";
|
||||||
public final static String MAX_DISPLAY_LINES_MSG =
|
public final static String MAX_DISPLAY_LINES_MSG =
|
||||||
GROUP_TITLE + Options.DELIMITER + "Maximum Lines To Display";
|
GROUP_TITLE + Options.DELIMITER + "Maximum Lines To Display";
|
||||||
@@ -79,7 +80,7 @@ public class BytesFieldFactory extends FieldFactory {
|
|||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
* @param model the model that the field belongs to.
|
* @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 displayOptions the Options for display properties.
|
||||||
* @param fieldOptions the Options for field specific 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 org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import docking.widgets.fieldpanel.field.*;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
import ghidra.program.model.listing.Program;
|
import ghidra.program.model.listing.Program;
|
||||||
import ghidra.util.StringUtilities;
|
import ghidra.util.StringUtilities;
|
||||||
import ghidra.util.WordLocation;
|
import ghidra.util.WordLocation;
|
||||||
@@ -96,7 +97,7 @@ public class CommentUtils {
|
|||||||
Font dummyFont = new Font("monospaced", Font.PLAIN, 12);
|
Font dummyFont = new Font("monospaced", Font.PLAIN, 12);
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
FontMetrics fontMetrics = Toolkit.getDefaultToolkit().getFontMetrics(dummyFont);
|
FontMetrics fontMetrics = Toolkit.getDefaultToolkit().getFontMetrics(dummyFont);
|
||||||
return new AttributedString("", Color.BLACK, fontMetrics);
|
return new AttributedString("", Colors.FOREGROUND, fontMetrics);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+2
-1
@@ -24,6 +24,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
|
|
||||||
import docking.widgets.fieldpanel.field.*;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
import docking.widgets.fieldpanel.support.*;
|
import docking.widgets.fieldpanel.support.*;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
import ghidra.app.util.*;
|
import ghidra.app.util.*;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.options.OptionsGui;
|
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";
|
GROUP_TITLE + Options.DELIMITER + "Show Function Reference Automatic Comments";
|
||||||
public final static String ENABLE_PREPEND_REF_ADDRESS_MSG =
|
public final static String ENABLE_PREPEND_REF_ADDRESS_MSG =
|
||||||
GROUP_TITLE + Options.DELIMITER + "Prepend the Address to Each Referenced Comment";
|
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 boolean isWordWrap;
|
||||||
private int maxDisplayLines;
|
private int maxDisplayLines;
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ import java.awt.*;
|
|||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
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.HighlightProvider;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.options.OptionsGui;
|
import ghidra.app.util.viewer.options.OptionsGui;
|
||||||
@@ -46,7 +48,7 @@ public abstract class FieldFactory implements ExtensionPoint {
|
|||||||
protected int startX;
|
protected int startX;
|
||||||
protected int width;
|
protected int width;
|
||||||
protected Color color;
|
protected Color color;
|
||||||
protected Color underlineColor = Color.BLUE;
|
protected Color underlineColor = Palette.BLUE;
|
||||||
private FontMetrics defaultMetrics;
|
private FontMetrics defaultMetrics;
|
||||||
private FontMetrics[] fontMetrics = new FontMetrics[4];
|
private FontMetrics[] fontMetrics = new FontMetrics[4];
|
||||||
protected Font baseFont;
|
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,
|
// 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
|
// 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);
|
"Sets the " + colorOptionName);
|
||||||
displayOptions.registerOption(styleOptionName, -1, null, "Sets the " + style);
|
displayOptions.registerOption(styleOptionName, -1, null, "Sets the " + style);
|
||||||
|
|
||||||
@@ -197,7 +199,7 @@ public abstract class FieldFactory implements ExtensionPoint {
|
|||||||
* @return the color.
|
* @return the color.
|
||||||
*/
|
*/
|
||||||
public Color getDefaultColor() {
|
public Color getDefaultColor() {
|
||||||
return Color.BLACK;
|
return Colors.FOREGROUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+4
-4
@@ -15,11 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.util.viewer.field;
|
package ghidra.app.util.viewer.field;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
import docking.widgets.fieldpanel.field.*;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.options.OptionsGui;
|
import ghidra.app.util.viewer.options.OptionsGui;
|
||||||
@@ -47,8 +47,8 @@ public class FunctionPurgeFieldFactory extends FieldFactory {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FieldFactory newInstance(FieldFormatModel newModel, HighlightProvider newHlProvider,
|
public FieldFactory newInstance(FieldFormatModel newModel, HighlightProvider newHlProvider,
|
||||||
ToolOptions displayOptions, ToolOptions fieldOptions) {
|
ToolOptions toolOptions, ToolOptions fieldOptions) {
|
||||||
return new FunctionPurgeFieldFactory(newModel, newHlProvider, displayOptions, fieldOptions);
|
return new FunctionPurgeFieldFactory(newModel, newHlProvider, toolOptions, fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -79,7 +79,7 @@ public class FunctionPurgeFieldFactory extends FieldFactory {
|
|||||||
stringDepth = Integer.toHexString(depth);
|
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);
|
FieldElement text = new TextFieldElement(as, 0, 0);
|
||||||
return ListingTextField.createSingleLineTextField(this, proxy, text, startX + varWidth,
|
return ListingTextField.createSingleLineTextField(this, proxy, text, startX + varWidth,
|
||||||
width, hlProvider);
|
width, hlProvider);
|
||||||
|
|||||||
+14
-7
@@ -23,6 +23,8 @@ import java.util.List;
|
|||||||
import docking.widgets.fieldpanel.field.*;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
import docking.widgets.fieldpanel.support.RowColLocation;
|
import docking.widgets.fieldpanel.support.RowColLocation;
|
||||||
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
import ghidra.GhidraOptions;
|
import ghidra.GhidraOptions;
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
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,
|
public void displayOptionsChanged(Options options, String optionName, Object oldValue,
|
||||||
Object newValue) {
|
Object newValue) {
|
||||||
super.displayOptionsChanged(options, optionName, oldValue, newValue);
|
super.displayOptionsChanged(options, optionName, oldValue, newValue);
|
||||||
funRetColor = options.getColor(OptionsGui.FUN_RET_TYPE.getColorOptionName(), Color.BLACK);
|
funRetColor =
|
||||||
funNameColor = options.getColor(OptionsGui.FUN_NAME.getColorOptionName(), Color.BLACK);
|
options.getColor(OptionsGui.FUN_RET_TYPE.getColorOptionName(), Colors.FOREGROUND);
|
||||||
|
funNameColor =
|
||||||
|
options.getColor(OptionsGui.FUN_NAME.getColorOptionName(), Colors.FOREGROUND);
|
||||||
unresolvedThunkRefColor =
|
unresolvedThunkRefColor =
|
||||||
displayOptions.getColor(OptionsGui.BAD_REF_ADDR.getColorOptionName(),
|
displayOptions.getColor(OptionsGui.BAD_REF_ADDR.getColorOptionName(),
|
||||||
OptionsGui.BAD_REF_ADDR.getDefaultColor());
|
OptionsGui.BAD_REF_ADDR.getDefaultColor());
|
||||||
resolvedThunkRefColor =
|
resolvedThunkRefColor =
|
||||||
displayOptions.getColor(OptionsGui.EXT_REF_RESOLVED.getColorOptionName(),
|
displayOptions.getColor(OptionsGui.EXT_REF_RESOLVED.getColorOptionName(),
|
||||||
OptionsGui.EXT_REF_RESOLVED.getDefaultColor());
|
OptionsGui.EXT_REF_RESOLVED.getDefaultColor());
|
||||||
funParamsColor = options.getColor(OptionsGui.FUN_PARAMS.getColorOptionName(), Color.BLACK);
|
funParamsColor =
|
||||||
|
options.getColor(OptionsGui.FUN_PARAMS.getColorOptionName(), Colors.FOREGROUND);
|
||||||
autoParamColor =
|
autoParamColor =
|
||||||
options.getColor(OptionsGui.FUN_AUTO_PARAMS.getColorOptionName(), Color.GRAY);
|
options.getColor(OptionsGui.FUN_AUTO_PARAMS.getColorOptionName(), Palette.GRAY);
|
||||||
literalColor = options.getColor(OptionsGui.SEPARATOR.getColorOptionName(), Color.BLACK);
|
literalColor =
|
||||||
|
options.getColor(OptionsGui.SEPARATOR.getColorOptionName(), Colors.FOREGROUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -413,8 +419,8 @@ public class FunctionSignatureFieldFactory extends FieldFactory {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FieldFactory newInstance(FieldFormatModel formatModel, HighlightProvider provider,
|
public FieldFactory newInstance(FieldFormatModel formatModel, HighlightProvider provider,
|
||||||
ToolOptions displayOptions, ToolOptions fieldOptions) {
|
ToolOptions toolOptions, ToolOptions fieldOptions) {
|
||||||
return new FunctionSignatureFieldFactory(formatModel, provider, displayOptions,
|
return new FunctionSignatureFieldFactory(formatModel, provider, toolOptions,
|
||||||
fieldOptions);
|
fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -445,6 +451,7 @@ public class FunctionSignatureFieldFactory extends FieldFactory {
|
|||||||
* @param as the attributed string used to display this element.
|
* @param as the attributed string used to display this element.
|
||||||
* @param row the row of the function signature where this field element starts.
|
* @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 column the column where this field element starts within the row.
|
||||||
|
* @param functionSigIndex the function signature index
|
||||||
*/
|
*/
|
||||||
FunctionSignatureFieldElement(AttributedString as, int row, int column,
|
FunctionSignatureFieldElement(AttributedString as, int row, int column,
|
||||||
int functionSigIndex) {
|
int functionSigIndex) {
|
||||||
|
|||||||
+5
-3
@@ -21,6 +21,7 @@ import java.math.BigInteger;
|
|||||||
import docking.widgets.fieldpanel.field.AttributedString;
|
import docking.widgets.fieldpanel.field.AttributedString;
|
||||||
import docking.widgets.fieldpanel.field.TextFieldElement;
|
import docking.widgets.fieldpanel.field.TextFieldElement;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.options.OptionsGui;
|
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,
|
public void displayOptionsChanged(Options options, String optionName, Object oldValue,
|
||||||
Object newValue) {
|
Object newValue) {
|
||||||
super.displayOptionsChanged(options, optionName, oldValue, newValue);
|
super.displayOptionsChanged(options, optionName, oldValue, newValue);
|
||||||
literalColor = options.getColor(OptionsGui.SEPARATOR.getColorOptionName(), Color.BLACK);
|
literalColor =
|
||||||
|
options.getColor(OptionsGui.SEPARATOR.getColorOptionName(), Colors.FOREGROUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -125,8 +127,8 @@ public class FunctionSignatureSourceFieldFactory extends FieldFactory {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FieldFactory newInstance(FieldFormatModel formatModel, HighlightProvider provider,
|
public FieldFactory newInstance(FieldFormatModel formatModel, HighlightProvider provider,
|
||||||
ToolOptions displayOptions, ToolOptions fieldOptions) {
|
ToolOptions toolOptions, ToolOptions fieldOptions) {
|
||||||
return new FunctionSignatureSourceFieldFactory(formatModel, provider, displayOptions,
|
return new FunctionSignatureSourceFieldFactory(formatModel, provider, toolOptions,
|
||||||
fieldOptions);
|
fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-17
@@ -24,6 +24,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
|
|
||||||
import docking.widgets.fieldpanel.field.*;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.options.OptionsGui;
|
import ghidra.app.util.viewer.options.OptionsGui;
|
||||||
@@ -44,7 +45,7 @@ import ghidra.program.util.ProgramLocation;
|
|||||||
public class FunctionTagFieldFactory extends FieldFactory {
|
public class FunctionTagFieldFactory extends FieldFactory {
|
||||||
|
|
||||||
public static final String FIELD_NAME = "Function Tags";
|
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;
|
private Color literalColor;
|
||||||
|
|
||||||
@@ -59,10 +60,9 @@ public class FunctionTagFieldFactory extends FieldFactory {
|
|||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param model the model that the field belongs to.
|
* @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 displayOptions the Options for display properties.
|
||||||
* @param fieldOptions the Options for field specific properties.
|
* @param fieldOptions the Options for field specific properties.
|
||||||
* @param serviceProvider the provider for services.
|
|
||||||
*/
|
*/
|
||||||
private FunctionTagFieldFactory(FieldFormatModel model, HighlightProvider hlProvider,
|
private FunctionTagFieldFactory(FieldFormatModel model, HighlightProvider hlProvider,
|
||||||
Options displayOptions, Options fieldOptions) {
|
Options displayOptions, Options fieldOptions) {
|
||||||
@@ -73,10 +73,6 @@ public class FunctionTagFieldFactory extends FieldFactory {
|
|||||||
OptionsGui.SEPARATOR.getDefaultColor());
|
OptionsGui.SEPARATOR.getDefaultColor());
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* PUBLIC METHODS
|
|
||||||
******************************************************************************/
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ListingField getField(ProxyObj<?> proxy, int varWidth) {
|
public ListingField getField(ProxyObj<?> proxy, int varWidth) {
|
||||||
|
|
||||||
@@ -139,8 +135,8 @@ public class FunctionTagFieldFactory extends FieldFactory {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FieldFactory newInstance(FieldFormatModel formatModel, HighlightProvider provider,
|
public FieldFactory newInstance(FieldFormatModel formatModel, HighlightProvider provider,
|
||||||
ToolOptions displayOptions, ToolOptions fieldOptions) {
|
ToolOptions toolOptions, ToolOptions fieldOptions) {
|
||||||
return new FunctionTagFieldFactory(formatModel, provider, displayOptions, fieldOptions);
|
return new FunctionTagFieldFactory(formatModel, provider, toolOptions, fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -155,15 +151,12 @@ public class FunctionTagFieldFactory extends FieldFactory {
|
|||||||
super.displayOptionsChanged(options, optionName, oldValue, newValue);
|
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
|
* Creates a tags list field to be show at the beginning of each function that shows the tags
|
||||||
* assigned to that function.
|
* assigned to that function.
|
||||||
*
|
*
|
||||||
* @param function the function to retrieve the tags from
|
* @param function the function to retrieve the tags from
|
||||||
|
* @return the elements
|
||||||
*/
|
*/
|
||||||
protected List<FieldElement> createFunctionTagElements(FunctionDB function) {
|
protected List<FieldElement> createFunctionTagElements(FunctionDB function) {
|
||||||
|
|
||||||
@@ -186,10 +179,6 @@ public class FunctionTagFieldFactory extends FieldFactory {
|
|||||||
return textElements;
|
return textElements;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* PRIVATE METHODS
|
|
||||||
******************************************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all function tags associated with the given function.
|
* Returns all function tags associated with the given function.
|
||||||
*
|
*
|
||||||
|
|||||||
+8
-18
@@ -20,6 +20,8 @@ import java.math.BigInteger;
|
|||||||
|
|
||||||
import docking.widgets.fieldpanel.field.*;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
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.HighlightProvider;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||||
@@ -36,9 +38,9 @@ import ghidra.util.StringUtilities;
|
|||||||
public class InstructionMaskValueFieldFactory extends FieldFactory {
|
public class InstructionMaskValueFieldFactory extends FieldFactory {
|
||||||
|
|
||||||
public static final String FIELD_NAME = "Instr Mask/Value";
|
public static final String FIELD_NAME = "Instr Mask/Value";
|
||||||
public static final Color MASK_COLOR = new Color(0, 0, 128);
|
public static final Color MASK_COLOR = Palette.getColor("navy");
|
||||||
public static final Color VALUE_COLOR = new Color(0, 128, 0);
|
public static final Color VALUE_COLOR = Palette.GREEN;
|
||||||
public static final Color LABEL_COLOR = new Color(0, 0, 0);
|
public static final Color LABEL_COLOR = Colors.FOREGROUND;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor.
|
* Default constructor.
|
||||||
@@ -141,9 +143,6 @@ public class InstructionMaskValueFieldFactory extends FieldFactory {
|
|||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ghidra.app.util.viewer.field.FieldFactory#getProgramLocation(int, int, ghidra.app.util.viewer.field.ListingField)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public ProgramLocation getProgramLocation(int row, int col, ListingField bf) {
|
public ProgramLocation getProgramLocation(int row, int col, ListingField bf) {
|
||||||
Object obj = bf.getProxy().getObject();
|
Object obj = bf.getProxy().getObject();
|
||||||
@@ -156,9 +155,6 @@ public class InstructionMaskValueFieldFactory extends FieldFactory {
|
|||||||
col);
|
col);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ghidra.app.util.viewer.field.FieldFactory#getFieldLocation(ghidra.app.util.viewer.field.ListingField, BigInteger, int, ghidra.program.util.ProgramLocation)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public FieldLocation getFieldLocation(ListingField bf, BigInteger index, int fieldNum,
|
public FieldLocation getFieldLocation(ListingField bf, BigInteger index, int fieldNum,
|
||||||
ProgramLocation programLoc) {
|
ProgramLocation programLoc) {
|
||||||
@@ -171,9 +167,6 @@ public class InstructionMaskValueFieldFactory extends FieldFactory {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ghidra.app.util.viewer.field.FieldFactory#acceptsType(int, java.lang.Class)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean acceptsType(int category, Class<?> proxyObjectClass) {
|
public boolean acceptsType(int category, Class<?> proxyObjectClass) {
|
||||||
return category == FieldFormatModel.INSTRUCTION_OR_DATA;
|
return category == FieldFormatModel.INSTRUCTION_OR_DATA;
|
||||||
@@ -181,16 +174,13 @@ public class InstructionMaskValueFieldFactory extends FieldFactory {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FieldFactory newInstance(FieldFormatModel formatModel, HighlightProvider hsProvider,
|
public FieldFactory newInstance(FieldFormatModel formatModel, HighlightProvider hsProvider,
|
||||||
ToolOptions displayOptions, ToolOptions fieldOptions) {
|
ToolOptions toolOptions, ToolOptions fieldOptions) {
|
||||||
return new InstructionMaskValueFieldFactory(formatModel, hsProvider, displayOptions,
|
return new InstructionMaskValueFieldFactory(formatModel, hsProvider, toolOptions,
|
||||||
fieldOptions);
|
fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ghidra.app.util.viewer.field.FieldFactory#getDefaultColor()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Color getDefaultColor() {
|
public Color getDefaultColor() {
|
||||||
return Color.black;
|
return Colors.FOREGROUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-5
@@ -15,14 +15,12 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.util.viewer.field;
|
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.app.nav.Navigatable;
|
||||||
import ghidra.framework.plugintool.ServiceProvider;
|
import ghidra.framework.plugintool.ServiceProvider;
|
||||||
import ghidra.program.model.listing.Program;
|
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
|
* An annotated string handler that is used to display an error message string when there is a
|
||||||
* problem creating an annotated string.
|
* problem creating an annotated string.
|
||||||
@@ -42,7 +40,7 @@ public class InvalidAnnotatedStringHandler implements AnnotatedStringHandler {
|
|||||||
@Override
|
@Override
|
||||||
public AttributedString createAnnotatedString(AttributedString prototypeString, String[] text,
|
public AttributedString createAnnotatedString(AttributedString prototypeString, String[] text,
|
||||||
Program program) throws AnnotationException {
|
Program program) throws AnnotationException {
|
||||||
return new AttributedString(errorText, Color.RED, prototypeString.getFontMetrics(0));
|
return new AttributedString(errorText, Messages.ERROR, prototypeString.getFontMetrics(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+3
-2
@@ -23,6 +23,7 @@ import java.util.List;
|
|||||||
import docking.widgets.fieldpanel.field.*;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
import docking.widgets.fieldpanel.support.RowColLocation;
|
import docking.widgets.fieldpanel.support.RowColLocation;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||||
@@ -41,7 +42,7 @@ import ghidra.program.util.ProgramLocation;
|
|||||||
public class MemoryBlockStartFieldFactory extends FieldFactory {
|
public class MemoryBlockStartFieldFactory extends FieldFactory {
|
||||||
|
|
||||||
private static final String FIELD_NAME = "Memory Block Start";
|
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
|
* Constructor
|
||||||
@@ -54,7 +55,7 @@ public class MemoryBlockStartFieldFactory extends FieldFactory {
|
|||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
* @param model the model that the field belongs to.
|
* @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 displayOptions the Options for display properties.
|
||||||
* @param fieldOptions the Options for field specific properties.
|
* @param fieldOptions the Options for field specific properties.
|
||||||
*/
|
*/
|
||||||
|
|||||||
+6
-4
@@ -22,6 +22,8 @@ import javax.swing.event.ChangeListener;
|
|||||||
|
|
||||||
import docking.widgets.fieldpanel.field.*;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
import ghidra.GhidraOptions;
|
import ghidra.GhidraOptions;
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
@@ -43,9 +45,9 @@ import ghidra.util.HelpLocation;
|
|||||||
*/
|
*/
|
||||||
public class MnemonicFieldFactory extends FieldFactory {
|
public class MnemonicFieldFactory extends FieldFactory {
|
||||||
public static final String FIELD_NAME = "Mnemonic";
|
public static final String FIELD_NAME = "Mnemonic";
|
||||||
public static final Color OVERRIDE_COLOR = new Color(180, 0, 108);
|
public static final Color OVERRIDE_COLOR = Palette.PURPLE;
|
||||||
// TODO: Should BAD_PROTOTYPE_COLOR be an option?
|
|
||||||
private final static Color BAD_PROTOTYPE_COLOR = new Color(196, 0, 0);
|
private final static Color BAD_PROTOTYPE_COLOR = Messages.ERROR;
|
||||||
private final static String SHOW_UNDERLINE_FOR_REFERENCES =
|
private final static String SHOW_UNDERLINE_FOR_REFERENCES =
|
||||||
GhidraOptions.MNEMONIC_GROUP_TITLE + Options.DELIMITER + "Underline Fields With References";
|
GhidraOptions.MNEMONIC_GROUP_TITLE + Options.DELIMITER + "Underline Fields With References";
|
||||||
|
|
||||||
@@ -140,7 +142,7 @@ public class MnemonicFieldFactory extends FieldFactory {
|
|||||||
else {
|
else {
|
||||||
Data data = (Data) cu;
|
Data data = (Data) cu;
|
||||||
if (data.isDefined() && data.getDataType().isNotYetDefined()) {
|
if (data.isDefined() && data.getDataType().isNotYetDefined()) {
|
||||||
c = Color.RED;
|
c = Messages.ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AttributedString as =
|
AttributedString as =
|
||||||
|
|||||||
+11
-21
@@ -20,6 +20,8 @@ import java.math.BigInteger;
|
|||||||
|
|
||||||
import docking.widgets.fieldpanel.field.*;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
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.HighlightProvider;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
import ghidra.app.util.viewer.proxy.ProxyObj;
|
import ghidra.app.util.viewer.proxy.ProxyObj;
|
||||||
@@ -38,7 +40,7 @@ import ghidra.program.util.ProgramLocation;
|
|||||||
public class ParallelInstructionFieldFactory extends FieldFactory {
|
public class ParallelInstructionFieldFactory extends FieldFactory {
|
||||||
|
|
||||||
public static final String FIELD_NAME = "Parallel ||";
|
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.
|
* Default constructor.
|
||||||
@@ -60,19 +62,18 @@ public class ParallelInstructionFieldFactory extends FieldFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fieldOptionsChanged(Options options, String name, Object oldValue,
|
public void fieldOptionsChanged(Options options, String optionName, Object oldValue,
|
||||||
Object newValue) {
|
Object newValue) {
|
||||||
// don't care
|
// don't care
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the FactoryField for the given object at index index.
|
* 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 proxy the object whose properties should be displayed.
|
||||||
|
* @param varWidth the amount of variable width spacing for any fields before this one.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ListingField getField(ProxyObj proxy, int varWidth) {
|
public ListingField getField(ProxyObj<?> proxy, int varWidth) {
|
||||||
Object obj = proxy.getObject();
|
Object obj = proxy.getObject();
|
||||||
|
|
||||||
if (!enabled || !(obj instanceof Instruction)) {
|
if (!enabled || !(obj instanceof Instruction)) {
|
||||||
@@ -98,9 +99,6 @@ public class ParallelInstructionFieldFactory extends FieldFactory {
|
|||||||
width, hlProvider);
|
width, hlProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ghidra.app.util.viewer.field.FieldFactory#getProgramLocation(int, int, ghidra.app.util.viewer.field.ListingField)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public ProgramLocation getProgramLocation(int row, int col, ListingField bf) {
|
public ProgramLocation getProgramLocation(int row, int col, ListingField bf) {
|
||||||
Object obj = bf.getProxy().getObject();
|
Object obj = bf.getProxy().getObject();
|
||||||
@@ -112,9 +110,6 @@ public class ParallelInstructionFieldFactory extends FieldFactory {
|
|||||||
return new ParallelInstructionLocation(instr.getProgram(), instr.getMinAddress(), col);
|
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
|
@Override
|
||||||
public FieldLocation getFieldLocation(ListingField bf, BigInteger index, int fieldNum,
|
public FieldLocation getFieldLocation(ListingField bf, BigInteger index, int fieldNum,
|
||||||
ProgramLocation programLoc) {
|
ProgramLocation programLoc) {
|
||||||
@@ -126,25 +121,20 @@ public class ParallelInstructionFieldFactory extends FieldFactory {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ghidra.app.util.viewer.field.FieldFactory#acceptsType(int, java.lang.Class)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean acceptsType(int category, Class<?> proxyObjectClass) {
|
public boolean acceptsType(int category, Class<?> proxyObjectClass) {
|
||||||
return category == FieldFormatModel.INSTRUCTION_OR_DATA;
|
return category == FieldFormatModel.INSTRUCTION_OR_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FieldFactory newInstance(FieldFormatModel model, HighlightProvider hsProvider,
|
public FieldFactory newInstance(FieldFormatModel formatModel, HighlightProvider hsProvider,
|
||||||
ToolOptions displayOptions, ToolOptions fieldOptions) {
|
ToolOptions toolOptinos, ToolOptions fieldOptions) {
|
||||||
return new ParallelInstructionFieldFactory(model, hsProvider, displayOptions, fieldOptions);
|
return new ParallelInstructionFieldFactory(formatModel, hsProvider, toolOptinos,
|
||||||
|
fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ghidra.app.util.viewer.field.FieldFactory#getDefaultColor()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Color getDefaultColor() {
|
public Color getDefaultColor() {
|
||||||
return Color.black;
|
return Colors.FOREGROUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -24,6 +24,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
|
|
||||||
import docking.widgets.fieldpanel.field.*;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
import docking.widgets.fieldpanel.support.*;
|
import docking.widgets.fieldpanel.support.*;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
import ghidra.app.util.HelpTopics;
|
import ghidra.app.util.HelpTopics;
|
||||||
import ghidra.app.util.HighlightProvider;
|
import ghidra.app.util.HighlightProvider;
|
||||||
import ghidra.app.util.viewer.format.FieldFormatModel;
|
import ghidra.app.util.viewer.format.FieldFormatModel;
|
||||||
@@ -47,7 +48,7 @@ public class PlateFieldFactory extends FieldFactory {
|
|||||||
|
|
||||||
private static final String EMPTY_STRING = "";
|
private static final String EMPTY_STRING = "";
|
||||||
public static final String FIELD_NAME = "Plate Comment";
|
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";
|
private final static String FIELD_GROUP_TITLE = "Plate Comments Field";
|
||||||
public final static String ENABLE_WORD_WRAP_MSG =
|
public final static String ENABLE_WORD_WRAP_MSG =
|
||||||
FIELD_GROUP_TITLE + Options.DELIMITER + "Enable Word Wrapping";
|
FIELD_GROUP_TITLE + Options.DELIMITER + "Enable Word Wrapping";
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user