Class CreateNamespacesCmd

java.lang.Object
ghidra.app.cmd.label.CreateNamespacesCmd
All Implemented Interfaces:
Command<Program>

public class CreateNamespacesCmd extends Object implements Command<Program>
This class attempts to create a namespace for each token in the provided string. Thus, when providing a namespace string, do not include the name of anything other than namespaces, such as the name of a symbol.

Example strings:

  • global::child1::child2
  • child1

To view the assumptions for creating namespaces from a path string, see the NamespaceUtils class.

Since:
Tracker Id 619
See Also:
  • Constructor Details

    • CreateNamespacesCmd

      public CreateNamespacesCmd(String namespacesString, SourceType source)
      Takes a namespace string that will be parsed and the results of which will be used for creating the namespaces if they do not exist.

      Calling this constructor is equivalent to calling:

       Command command = new CreateNamespacesCmd( namespaceString, null );
       
      Parameters:
      namespacesString - The string to be parsed.
      source - the source of the namespace
      See Also:
    • CreateNamespacesCmd

      public CreateNamespacesCmd(String namespacesString, Namespace parentNamespace, SourceType source)
      Takes a namespace string that will be parsed and the results of which will be used for creating the namespaces if they do not exist.
      Parameters:
      namespacesString - The string to be parsed.
      parentNamespace - The namespace to be used as the starting parent of the namespaces that will be created.
      source - the source of the namespace
      Throws:
      NullPointerException - if namespaceString is null.
      See Also:
  • Method Details

    • applyTo

      public boolean applyTo(Program program)
      Description copied from interface: Command
      Applies the command to the given domain object.
      Specified by:
      applyTo in interface Command<Program>
      Parameters:
      program - domain object that this command is to be applied.
      Returns:
      true if the command applied successfully
    • getNamespace

      public Namespace getNamespace()
      Returns the newly created namespace or null if one was not created.
      Returns:
      the newly created namespace or null if one was not created.
    • getStatusMsg

      public String getStatusMsg()
      Description copied from interface: Command
      Returns the status message indicating the status of the command.
      Specified by:
      getStatusMsg in interface Command<Program>
      Returns:
      reason for failure, or null if the status of the command was successful
    • getName

      public String getName()
      Description copied from interface: Command
      Returns the name of this command.
      Specified by:
      getName in interface Command<Program>
      Returns:
      the name of this command