void (@NotNull PsiTreeChangeEvent e) { switch (e.getPropertyName()) { case PsiTreeChangeEvent.PROP_ROOTS -> // rebuild all tree when source roots were changed rebuildCache(); case PsiTreeChangeEvent.PROP_WRITABLE, PsiTreeChangeEvent.PROP_FILE_NAME -> { PsiFile psiFile = (PsiFile)e.getElement(); if (!canContainTodoItems(psiFile)) { // don't do anything if file cannot contain to-do items return; } updateTree(); } case PsiTreeChangeEvent.PROP_DIRECTORY_NAME -> { PsiDirectory psiDirectory = (PsiDirectory)e.getElement(); Iterator<PsiFile> iterator = getFiles(psiDirectory); if (iterator.hasNext()) { updateTree(); } } } }