@Override
	public boolean applyTo(Program program) {

		if (currentNamespace == null) {
			currentNamespace = program.getGlobalNamespace();
		}
		if (newNamespace == null) {
			newNamespace = program.getGlobalNamespace();
		}

		if (!parseNameAndNamespace(program, newNamespace, newName)) {
			return false; // errorMessage already set
		}

		Symbol s = getSymbol(program);
		if (s == null) {
			return false; // errorMessage already set
		}

		if (StringUtils.isBlank(newName) && s.getSource() != SourceType.DEFAULT) {
			errorMessage = "Cannot set non-default symbol name to \"\"";
			return false;
		}

		try {
			if (!currentNamespace.equals(newNamespace)) {
				s.setNameAndNamespace(newName, newNamespace, source);
			}
			else {
				s.setName(newName, source);
				if (!newName.equals(s.getName())) {
					errorMessage = "Rename failed";
					return false;
				}
			}
			return true;
		}
		catch (DuplicateNameException e) {
			errorMessage = "Symbol already exists: " + newName;
		}
		catch (InvalidInputException e) {
			errorMessage = "Invalid entry: " + e.getMessage();
		}
		catch (CircularDependencyException e) {
			errorMessage = e.getMessage();
		}
		return false;
	}
Constructs a new command for renaming a label within currentNamespace and changing the
namespace to newNamespace.

@param addr Address of label to be renamed
@param oldName the current name of the label to be renamed
@param newName the new name for the label. (null for default)
@param currentNamespace the symbol's current parent name space; null for global namespace
@param newNamespace the desired namespace; null for global namespace
@param source the source of this symbol
Ghidra/Features/Base/src/main/java/ghidra/app/cmd/label/RenameLabelCmd.java