private void processGroupRenamed(ProgramChangeRecord record) {
		Group group = (Group) record.getNewValue();
		String treeName = group.getTreeName();
		tree = plugin.getTree(treeName);
		if (tree == null) {
			return;
		}

		synchronized (tree.getModel().getRoot()) {

			// get expanded descendants so they can be restored to that state after the update

			Enumeration<TreePath> it = tree.getExpandedDescendants(
				((ProgramNode) tree.getModel().getRoot()).getTreePath());

			List<TreePath> expandedPaths = CollectionUtils.asList(it);

			String oldName = (String) record.getOldValue();
			String newName = group.getName();
			Listing listing = tree.getProgram().getListing();
			Group g = listing.getModule(treeName, newName);
			if (g == null) {
				g = listing.getFragment(treeName, newName);
			}

			ProgramNode[] nodes = tree.findNodes(oldName);
			for (ProgramNode node : nodes) {
				node.setName(newName);
				node.setGroup(g);
				tree.updateGroupPath(node);
			}

			tree.expandPaths(expandedPaths);

			// update nameIndexer table
			StringKeyIndexer nameIndexer = tree.getNameIndexer();
			nameIndexer.remove(oldName);
			nameIndexer.put(newName);
		}
	}
A Module or Fragment was renamed, so find all nodes with oldName and update them
with the new name and new Group object.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/programtree/ProgramListener.java