boolean renameView(TreeViewProvider treeViewProvider, String newName) {
		Listing listing = currentProgram.getListing();
		ProgramModule root = listing.getRootModule(newName);
		if (root == null) {
			String oldName = treeViewProvider.getViewName();

			if (providerMap.containsKey(newName)) {
				tool.setStatusInfo("Name " + newName + " alredy exists");
				return false;
			}

			// put an entry in the map by the new name, so that the callback from the
			// domainObjectChanged() will be able to find the tree in the map by the new name to
			// perform the update as required.
			providerMap.put(newName, treeViewProvider);

			RenameTreeCmd cmd = new RenameTreeCmd(oldName, newName);
			if (!tool.execute(cmd, currentProgram)) {
				tool.setStatusInfo(cmd.getStatusMsg());
				providerMap.remove(newName);// the change didn't work, remove the mapping
				return false;
			}

			providerMap.remove(oldName);
			providerMap.put(newName, treeViewProvider);

			if (defaultProvider == treeViewProvider) {
				defaultProvider = new TreeViewProvider(DEFAULT_TREE_NAME, this);
			}
			else {
				reloadTree(treeViewProvider.getProgramDnDTree(), false);
			}
			return true;
		}
		tool.setStatusInfo("Tree named '" + newName + "' already exists");
		return false;
	}
Method renameView.
@param treeViewProvider the provider
@param newName the new name
@return true if renamed
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/programtree/ProgramTreePlugin.java