@Override
	public void treeNodesChanged(TreeModelEvent e) {
		ProgramNode node = (ProgramNode) e.getTreePath().getLastPathComponent();

		int[] indices = e.getChildIndices();
		if (indices != null) {
			node = (ProgramNode) node.getChildAt(indices[0]);
		}

		String newName = node.getUserObject().toString().trim();
		if (newName.isEmpty()) {

			node.setUserObject(node.getName());
			Msg.showError(this, null, "Rename Failed", "Please enter a name.");

			// maintain the editing state
			SystemUtilities.runSwingLater(() -> tree.rename());
			return;
		}

		Group group = node.getGroup();
		String oldName = group.getName();
		if (newName.equals(oldName)) {
			return;    // name hasn't changed
		}

		RenameCmd cmd =
			new RenameCmd(tree.getTreeName(), (group instanceof ProgramModule), oldName, newName);
		if (tree.getTool().execute(cmd, tree.getProgram())) {

			StringKeyIndexer nameIndexer = tree.getNameIndexer();
			nameIndexer.remove(oldName);
			nameIndexer.put(newName);
		}
		else {
			node.setUserObject(node.getName());
			Msg.showError(this, tree, "Rename Failed", cmd.getStatusMsg());

			// maintain the editing state
			SystemUtilities.runSwingLater(() -> tree.rename());
		}
		tree.setEditable(false);
	}
Called when a node changes; update the Group name for the node being changed.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/programtree/ProgramTreeModelListener.java