use of com.intellij.psi.impl.PsiTreeChangeEventImpl in project intellij-community by JetBrains.
the class PsiVFSListener method fileDeleted.
@Override
public void fileDeleted(@NotNull final VirtualFileEvent event) {
final VirtualFile vFile = event.getFile();
VirtualFile parent = event.getParent();
final PsiDirectory parentDir = getCachedDirectory(parent);
final PsiFile psiFile = myFileManager.getCachedPsiFileInner(vFile);
if (psiFile != null) {
clearViewProvider(vFile, "PSI fileDeleted");
if (parentDir != null) {
ApplicationManager.getApplication().runWriteAction(new ExternalChangeAction() {
@Override
public void run() {
PsiTreeChangeEventImpl treeEvent = new PsiTreeChangeEventImpl(myManager);
treeEvent.setParent(parentDir);
treeEvent.setChild(psiFile);
myManager.childRemoved(treeEvent);
}
});
} else if (parent != null) {
handleVfsChangeWithoutPsi(parent);
}
} else {
final PsiDirectory psiDir = myFileManager.getCachedDirectory(vFile);
if (psiDir != null) {
myFileManager.removeInvalidFilesAndDirs(false);
if (parentDir != null) {
ApplicationManager.getApplication().runWriteAction(new ExternalChangeAction() {
@Override
public void run() {
PsiTreeChangeEventImpl treeEvent = new PsiTreeChangeEventImpl(myManager);
treeEvent.setParent(parentDir);
treeEvent.setChild(psiDir);
myManager.childRemoved(treeEvent);
}
});
}
} else if (parent != null) {
handleVfsChangeWithoutPsi(parent);
}
}
}
Aggregations