void (@NotNull PsiTreeChangeEvent event) { String propertyName = event.getPropertyName(); PsiElement element = event.getElement(); switch (propertyName) { case PsiTreeChangeEvent.PROP_ROOTS, PsiTreeChangeEvent.PROP_FILE_TYPES, PsiTreeChangeEvent.PROP_UNLOADED_PSI -> addSubtreeToUpdateByRoot(); case PsiTreeChangeEvent.PROP_WRITABLE -> { if (!addSubtreeToUpdateByElementFile(element) && element instanceof PsiFile) { addSubtreeToUpdateByElementFile(((PsiFile)element).getContainingDirectory()); } } case PsiTreeChangeEvent.PROP_FILE_NAME, PsiTreeChangeEvent.PROP_DIRECTORY_NAME -> { if (element instanceof PsiDirectory && isFlattenPackages()) { addSubtreeToUpdateByRoot(); return; } final PsiElement parent = element.getParent(); if (parent == null || !addSubtreeToUpdateByElementFile(parent)) { addSubtreeToUpdateByElementFile(element); } } } }