private static void convertToClass(Program program, Namespace ns) {
		int id = program.startTransaction(NAME);
		boolean success = false;
		try {
			NamespaceUtils.convertNamespaceToClass(ns);
			success = true;
		}
		catch (InvalidInputException e) {
			// This is thrown when the provided namespace is a function
			// It was checked in isEnabledForContext and thus cannot occur
			throw new AssertException(e);
		}
		finally {
			program.endTransaction(id, success);
		}
	}
Symbol tree action for converting a namespace to a class
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/symboltree/actions/ConvertToClassAction.java