void (@NotNull final PsiTreeChangeEvent event) { if (event.getPropertyName().equals(PsiTreeChangeEvent.PROP_FILE_NAME) || event.getPropertyName().equals(PsiTreeChangeEvent.PROP_DIRECTORY_NAME)) { final PsiElement psiElement = event.getChild(); if (psiElement instanceof PsiFile || psiElement instanceof PsiDirectory) { final Module module = ModuleUtilCore.findModuleForPsiElement(psiElement); if (module == null) return; final String url = ((PsiDirectory)psiElement.getParent()).getVirtualFile().getUrl() + "/" + event.getNewValue(); final AbstractUrl childUrl = psiElement instanceof PsiFile ? new PsiFileUrl(url) : new DirectoryUrl(url, module.getName()); for (String listName : myFavoritesRootsOrder) { final List<TreeItem<Pair<AbstractUrl, String>>> roots = myName2FavoritesRoots.get(listName); iterateTreeItems(roots, item -> { final Pair<AbstractUrl, String> root = item.getData(); final Object[] path = root.first.createPath(myProject); if (path == null || path.length < 1 || path[0] == null) { return; } final Object element = path[path.length - 1]; if (element == psiElement && psiElement instanceof PsiFile) { item.setData(Pair.create(childUrl, root.second)); } else { item.setData(root); } }); } } } }