JsonSchemaUpdater (@NotNull Project project, @NotNull JsonSchemaService service, @NotNull MessageBusConnection connection) { final JsonSchemaUpdater updater = new JsonSchemaUpdater(project, service); connection.subscribe(VirtualFileManager.VFS_CHANGES, new JsonSchemaVfsListener(updater)); PsiManager.getInstance(project).addPsiTreeChangeListener(new PsiTreeAnyChangeAbstractAdapter() { @Override protected void onChange(@Nullable PsiFile file) { if (file != null) updater.onFileChange(file.getViewProvider().getVirtualFile()); } }, (Disposable)service); return updater; }