@Override
	protected void actionPerformed(SymbolTreeActionContext context) {
		TreePath[] selectionPaths = context.getSelectedSymbolTreePaths();

		Program program = context.getProgram();
		GTreeNode node = (GTreeNode) selectionPaths[0].getLastPathComponent();

		SymbolGTree tree = context.getSymbolTree();
		GTreeNode root = tree.getViewRoot();

		Symbol symbol = ((SymbolNode) node).getSymbol();
		Namespace namespace = (Namespace) symbol.getObject();
		if (namespace != null) {
			String name = namespace.getName();
			convertToClass(program, namespace);
			program.flushEvents();

			GTreeNode classesNode = root.getChild(SymbolCategory.CLASS_CATEGORY.getName());
			if (classesNode != null) {
				context.getSymbolTree().startEditing(classesNode, name);
			}
			else {
				Msg.showInfo(this, null, "Classes Filtered Out of View",
					"New class node is filtered out of view");
			}
		}
	}
Symbol tree action for converting a namespace to a class
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/symboltree/actions/ConvertToClassAction.java