Enum Class PluginToolUtils

java.lang.Object
java.lang.Enum<PluginToolUtils>
ghidra.framework.plugintool.PluginToolUtils
All Implemented Interfaces:
Serializable, Comparable<PluginToolUtils>, Constable

public enum PluginToolUtils extends Enum<PluginToolUtils>
  • Method Details

    • values

      public static PluginToolUtils[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static PluginToolUtils valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • inRunningToolsPreferringActive

      public static <T> T inRunningToolsPreferringActive(PluginTool tool, Function<? super PluginTool,? extends T> action)
      Attempts the given action in all running tools, starting with the active one, if applicable

      This will stop once the given action returns a non-null result, and return that result.

      Type Parameters:
      T - the type of result
      Parameters:
      tool - the front-end tool, whose running plugin tools to try
      action - the action to apply to each plugin tool
      Returns:
      the first non-null result of the action, or null if all plugin tools were exhausted
    • openInMostRecentOrLaunchedCompatibleTool

      public static PluginTool openInMostRecentOrLaunchedCompatibleTool(PluginTool tool, DomainFile domainFile)
      Opens the given domain file in the most recent tool which can accept it, or it launches a new tool to accept it

      TODO: This currently fails in the "most-recent" aspect if a non-compatible tool has focus. In that case, it'll pick any compatible tool, no matter how recently it had focus.

      Parameters:
      tool - the front-end tool
      domainFile - the domain file to open (may not be null)
      Returns:
      the (possibly new) plugin tool which accepted the domain file
    • getServiceFromRunningCompatibleTool

      public static <T> T getServiceFromRunningCompatibleTool(PluginTool tool, Class<T> serviceClass)
      Get the service for the given class from the most recent tool having it

      TODO: This currently fails in the "most-recent" aspect if a non-compatible tool has focus. In that case, it'll pick any compatible tool, no matter how recently it had focus.

      Type Parameters:
      T - the type of the service
      Parameters:
      tool - the front-end tool
      serviceClass - the class of the service
      Returns:
      the found service, or null if no running tool has it