void (@NotNull final PsiTreeChangeEvent event) { final PsiElement oldParent = event.getOldParent(); final PsiElement newParent = event.getNewParent(); final PsiElement child = event.getChild(); if (newParent instanceof PsiDirectory) { final Module module = ModuleUtilCore.findModuleForPsiElement(newParent); if (module == null) return; AbstractUrl childUrl = null; if (child instanceof PsiFile) { childUrl = new PsiFileUrl(((PsiDirectory)newParent).getVirtualFile().getUrl() + "/" + ((PsiFile)child).getName()); } else if (child instanceof PsiDirectory) { childUrl = new DirectoryUrl(((PsiDirectory)newParent).getVirtualFile().getUrl() + "/" + ((PsiDirectory)child).getName(), module.getName()); } for (String listName : myFavoritesRootsOrder) { final List<TreeItem<Pair<AbstractUrl, String>>> roots = myName2FavoritesRoots.get(listName); final AbstractUrl finalChildUrl = childUrl; 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 == child && finalChildUrl != null) { item.setData(Pair.create(finalChildUrl, root.second)); } else { if (element == oldParent) { item.setData(Pair.create(root.first.createUrlByElement(newParent), root.second)); } } }); } } }