Class ConflictUtility

java.lang.Object
ghidra.app.merge.util.ConflictUtility

public class ConflictUtility extends Object
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 Details

    • MAROON

      public static String MAROON
    • GREEN

      public static String GREEN
    • BLUE

      public static String BLUE
    • PURPLE

      public static String PURPLE
    • DARK_CYAN

      public static String DARK_CYAN
    • OLIVE

      public static String OLIVE
    • ORANGE

      public static String ORANGE
    • PINK

      public static String PINK
    • YELLOW

      public static String YELLOW
    • GRAY

      public static String GRAY
    • ADDRESS_COLOR

      public static String ADDRESS_COLOR
      Color to use for displaying addresses.
    • NUMBER_COLOR

      public static String NUMBER_COLOR
      Color to use for displaying numeric values.
    • EMPHASIZE_COLOR

      public static String EMPHASIZE_COLOR
      Color to use for displaying emphasized text. (for example, this is used when displaying symbols.)
    • OFFSET_COLOR

      public static String OFFSET_COLOR
      Color to use for displaying offsets.
    • NO_VALUE

      public static String 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

      public static String wrapAsHTML(String text)
      Puts HTML and BODY tags around the string.
    • colorString

      public 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.
      Parameters:
      rgbColor - (eg. "#8c0000")
      text - the text to be colored
      Returns:
      the tagged string.
    • colorString

      public 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.
      Parameters:
      rgbColor - (eg. "#8c0000")
      value - the integer number
      Returns:
      the tagged string.
    • spaces

      public static String spaces(int num)
      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

      public static void addCount(StringBuffer buf, int value)
      Adds a color number to the indicated string buffer.
      Parameters:
      buf - the string buffer
      value - the integer number
    • addAddress

      public static void addAddress(StringBuffer buf, Address addr)
      Adds a color program address to the indicated string buffer.
      Parameters:
      buf - the string buffer
      addr - the program address
    • getConflictCount

      public static String getConflictCount(int conflictNum, int totalConflicts)
      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

      public static String getConflictCount(int conflictNum, int totalConflicts, Address addr)
      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 conflicts
      addr - the address for the indicated conflicts.
      Returns:
      the message string containing HTML tags.
    • getConflictCount

      public static String getConflictCount(int conflictNum, int totalConflicts, AddressRange range)
      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 conflicts
      range - the address range for the indicated conflicts.
      Returns:
      the message string containing HTML tags.
    • getAddressConflictCount

      public static String getAddressConflictCount(int addressNum, int totalAddresses, boolean isRange)
      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

      public static String getTruncatedHTMLString(String originalString, int truncLength)
      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

      public static String getAddressString(Address address)
      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

      public static String getAddressString(Address address, boolean showAddressSpace)
      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

      public static String getNumberString(int count)
      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

      public static String getEmphasizeString(String text)
      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

      public static String getOffsetString(int offset)
      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

      public static String getHashString(long hash)
      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.