void (@NotNull VirtualFile file, @NotNull Editor editor, @NotNull Disposable disposable, @NotNull Runnable changesHandler) { PomManager.getModel(myProject).addModelListener( new PomModelListener() { @Override public void modelChanged(@NotNull PomModelEvent event) { TreeAspect aspect = ContainerUtil.findInstance(event.getChangedAspects(), TreeAspect.class); if (aspect == null) return; TreeChangeEvent change = tryCast(event.getChangeSet(aspect), TreeChangeEvent.class); if (change == null) return; PsiFile psiFile = change.getRootElement().getPsi().getContainingFile(); VirtualFile changedFile = psiFile == null ? null : psiFile.getVirtualFile(); if (!Comparing.equal(changedFile, file)) return; changesHandler.run(); } @Override public boolean isAspectChangeInteresting(@NotNull PomModelAspect aspect) { return aspect instanceof TreeAspect; } }, disposable ); }