Package ghidra.python

Class PythonCodeCompletionFactory

java.lang.Object
ghidra.python.PythonCodeCompletionFactory

public class PythonCodeCompletionFactory extends Object
Generates CodeCompletions from Python objects.
  • Field Details

    • COMPLETION_LABEL

      public static final String COMPLETION_LABEL
      See Also:
    • NULL_COLOR

      public static final Color NULL_COLOR
    • FUNCTION_COLOR

      public static final Color FUNCTION_COLOR
    • PACKAGE_COLOR

      public static final Color PACKAGE_COLOR
    • CLASS_COLOR

      public static final Color CLASS_COLOR
    • METHOD_COLOR

      public static final Color METHOD_COLOR
    • CODE_COLOR

      public static final Color CODE_COLOR
    • INSTANCE_COLOR

      public static final Color INSTANCE_COLOR
    • SEQUENCE_COLOR

      public static final Color SEQUENCE_COLOR
    • MAP_COLOR

      public static final Color MAP_COLOR
    • NUMBER_COLOR

      public static final Color NUMBER_COLOR
    • SPECIAL_COLOR

      public static final Color SPECIAL_COLOR
  • Constructor Details

    • PythonCodeCompletionFactory

      public PythonCodeCompletionFactory()
  • Method Details

    • newCodeCompletion

      @Deprecated public static ghidra.app.plugin.core.console.CodeCompletion newCodeCompletion(String description, String insertion, org.python.core.PyObject pyObj)
      Deprecated.
      use newCodeCompletion(String, String, PyObject, String) instead, it allows creation of substituting code completions
      Creates a new CodeCompletion from the given Python objects.
      Parameters:
      description - description of the new CodeCompletion
      insertion - what will be inserted to make the code complete
      pyObj - a Python Object
      Returns:
      A new CodeCompletion from the given Python objects.
    • newCodeCompletion

      public static ghidra.app.plugin.core.console.CodeCompletion newCodeCompletion(String description, String insertion, org.python.core.PyObject pyObj, String userInput)
      Creates a new CodeCompletion from the given Python objects.
      Parameters:
      description - description of the new CodeCompletion
      insertion - what will be inserted to make the code complete
      pyObj - a Python Object
      userInput - a word we want to complete, can be an empty string. It's used to determine which part (if any) of the input should be removed before the insertion of the completion
      Returns:
      A new CodeCompletion from the given Python objects.
    • setupOptions

      public static void setupOptions(PythonPlugin plugin, Options options)
      Sets up Python code completion Options.
      Parameters:
      plugin - python plugin as options owner
      options - an Options handle
    • changeOptions

      public static void changeOptions(Options options, String name, Object oldValue, Object newValue)
      Handle an Option change. This is named slightly differently because it is a static method, not an instance method. By the time we get here, we assume that the Option changed is indeed ours.
      Parameters:
      options - the Options handle
      name - name of the Option changed
      oldValue - the old value
      newValue - the new value
    • getCallMethods

      public static Object[] getCallMethods(org.python.core.PyObject obj)
      Returns the Java __call__ methods declared for a Python object. Some Python "methods" in the new-style Python objects are actually classes in and of themselves, re-implementing __call__ methods to tell us how to call them. This returns an array of those Methods (for code completion help).
      Parameters:
      obj - a PyObject
      Returns:
      the Java __call__ methods declared for the Python object