Package ghidra.app.merge.util
Class ConflictUtility
java.lang.Object
ghidra.app.merge.util.ConflictUtility
ConflictUtility
provides some constants and static methods
used by the Listing Merge portion of the multi-user merge.
For now, the VariousChoicesPanel and VerticalChoicesPanel use HTML in
JLabels to display color etc. This is because they also show radiobuttons
and checkboxes.-
Field Summary
Modifier and TypeFieldDescriptionstatic String
Color to use for displaying addresses.static String
static String
static String
Color to use for displaying emphasized text.static String
static String
static String
static String
String to display when a version doesn't have a value for an element of the program.static String
Color to use for displaying numeric values.static String
Color to use for displaying offsets.static String
static String
static String
static String
static String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addAddress
(StringBuffer buf, Address addr) Adds a color program address to the indicated string buffer.static void
addCount
(StringBuffer buf, int value) Adds a color number to the indicated string buffer.static String
colorString
(String rgbColor, int value) This creates a colored number by converting the number to a string and wrapping it with an HTML font tag that has a color attribute.static String
colorString
(String rgbColor, String text) This creates color text by wrapping a text string with an HTML font tag that has a color attribute.static String
getAddressConflictCount
(int addressNum, int totalAddresses, boolean isRange) Creates a standard address set conflict count message.static String
getAddressString
(Address address) Creates a string containing HTML tags to represent the address in color.static String
getAddressString
(Address address, boolean showAddressSpace) Creates a string containing HTML tags to represent the address in color.static String
getConflictCount
(int conflictNum, int totalConflicts) Creates a standard conflict count message.static String
getConflictCount
(int conflictNum, int totalConflicts, Address addr) Creates a standard conflict count message for an address.static String
getConflictCount
(int conflictNum, int totalConflicts, AddressRange range) Creates a standard conflict count message for an address range.static String
getEmphasizeString
(String text) Creates a string containing HTML tags to represent the text in color for emphasis.static String
getHashString
(long hash) Creates a string containing HTML tags to represent the hash value in color as an unsigned hexadecimal value.static String
getNumberString
(int count) Creates a string containing HTML tags to represent the integer number in color.static String
getOffsetString
(int offset) Creates a string containing HTML tags to represent the offset value in color as a hexadecimal value.static String
getTruncatedHTMLString
(String originalString, int truncLength) Surrounds the originalString with HTML tags.static String
spaces
(int num) Creates a string for the number of spaces indicated that can be used in HTML.static String
wrapAsHTML
(String text) Puts HTML and BODY tags around the string.
-
Field Details
-
MAROON
-
GREEN
-
BLUE
-
PURPLE
-
DARK_CYAN
-
OLIVE
-
ORANGE
-
PINK
-
YELLOW
-
GRAY
-
ADDRESS_COLOR
Color to use for displaying addresses. -
NUMBER_COLOR
Color to use for displaying numeric values. -
EMPHASIZE_COLOR
Color to use for displaying emphasized text. (for example, this is used when displaying symbols.) -
OFFSET_COLOR
Color to use for displaying offsets. -
NO_VALUE
String to display when a version doesn't have a value for an element of the program.
-
-
Constructor Details
-
ConflictUtility
public ConflictUtility()
-
-
Method Details
-
wrapAsHTML
Puts HTML and BODY tags around the string. -
colorString
This creates color text by wrapping a text string with an HTML font tag that has a color attribute.- Parameters:
rgbColor
- (eg. "#8c0000")text
- the text to be colored- Returns:
- the tagged string.
-
colorString
This creates a colored number by converting the number to a string and wrapping it with an HTML font tag that has a color attribute.- Parameters:
rgbColor
- (eg. "#8c0000")value
- the integer number- Returns:
- the tagged string.
-
spaces
Creates a string for the number of spaces indicated that can be used in HTML. This string can be used to preserve spacing.- Parameters:
num
- the number of spaces- Returns:
- the string representing that many spaces in HTML.
-
addCount
Adds a color number to the indicated string buffer.- Parameters:
buf
- the string buffervalue
- the integer number
-
addAddress
Adds a color program address to the indicated string buffer.- Parameters:
buf
- the string bufferaddr
- the program address
-
getConflictCount
Creates a standard conflict count message. This indicates which conflict you are resolving of some total number of conflicts.- Parameters:
conflictNum
- the current conflict number.totalConflicts
- the total number of conflicts- Returns:
- the message string containing HTML tags.
-
getConflictCount
Creates a standard conflict count message for an address. This indicates which conflict you are resolving of some total number of conflicts at a given address.- Parameters:
conflictNum
- the current conflict number.totalConflicts
- the total number of conflictsaddr
- the address for the indicated conflicts.- Returns:
- the message string containing HTML tags.
-
getConflictCount
Creates a standard conflict count message for an address range. This indicates which conflict you are resolving of some total number of conflicts for a given address range.- Parameters:
conflictNum
- the current conflict number.totalConflicts
- the total number of conflictsrange
- the address range for the indicated conflicts.- Returns:
- the message string containing HTML tags.
-
getAddressConflictCount
Creates a standard address set conflict count message. This indicates which address or address range with conflicts you are resolving of some total number of addresses or address ranges with conflicts.- Parameters:
addressNum
- the current conflicting address number.totalAddresses
- the total number of conflicting addresses.isRange
- true if the current conflict is for an address range.- Returns:
- the message string containing HTML tags.
-
getTruncatedHTMLString
Surrounds the originalString with HTML tags. It truncates the string at truncLength number of characters and adds "..." if it is longer than truncLength. It also replaces newline characters with HTML break tags.
Warning: The originalString should not contain special HTML tags. If it does, they may get truncated in the middle of a tag.- Parameters:
originalString
-truncLength
- truncate at this length- Returns:
- the truncated message string containing HTML tags.
-
getAddressString
Creates a string containing HTML tags to represent the address in color.- Parameters:
address
- the program address.- Returns:
- the message string containing HTML tags.
-
getAddressString
Creates a string containing HTML tags to represent the address in color.- Parameters:
address
- the program address.showAddressSpace
- true indicates the address string should show the address space.- Returns:
- the message string containing HTML tags.
-
getNumberString
Creates a string containing HTML tags to represent the integer number in color.- Parameters:
count
- the integer number- Returns:
- the message string containing HTML tags.
-
getEmphasizeString
Creates a string containing HTML tags to represent the text in color for emphasis.- Parameters:
text
- the text to be emphasized.- Returns:
- the message string containing HTML tags.
-
getOffsetString
Creates a string containing HTML tags to represent the offset value in color as a hexadecimal value.- Parameters:
offset
- the offset to be displayed in hexadecimal- Returns:
- the message string containing HTML tags.
-
getHashString
Creates a string containing HTML tags to represent the hash value in color as an unsigned hexadecimal value.- Parameters:
hash
- the hash to be displayed in hexadecimal- Returns:
- the message string containing HTML tags.
-