From fb78ccd2e58344a269da736bb67102a9347b6ad2 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Mon, 15 May 2017 11:49:37 +0200 Subject: [PATCH] inline connection: MessageBusConnection --- .../intellij/psi/impl/file/impl/PsiVFSListener.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/psi/impl/file/impl/PsiVFSListener.java b/platform/lang-impl/src/com/intellij/psi/impl/file/impl/PsiVFSListener.java index 018c61129602..d777876fe3e0 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/file/impl/PsiVFSListener.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/file/impl/PsiVFSListener.java @@ -60,7 +60,6 @@ public class PsiVFSListener implements VirtualFileListener { private final ProjectRootManager myProjectRootManager; private final PsiManagerImpl myManager; private final FileManagerImpl myFileManager; - private final MessageBusConnection myConnection; private final Project myProject; private boolean myReportedUnloadedPsiChange; @@ -113,17 +112,16 @@ public class PsiVFSListener implements VirtualFileListener { myManager = (PsiManagerImpl) PsiManager.getInstance(project); myFileManager = (FileManagerImpl) myManager.getFileManager(); - myConnection = project.getMessageBus().connect(project); - StartupManager.getInstance(project).registerPreStartupActivity(() -> { - myConnection.subscribe(ProjectTopics.PROJECT_ROOTS, new MyModuleRootListener()); - myConnection.subscribe(FileTypeManager.TOPIC, new FileTypeListener() { + MessageBusConnection connection = project.getMessageBus().connect(project); + connection.subscribe(ProjectTopics.PROJECT_ROOTS, new MyModuleRootListener()); + connection.subscribe(FileTypeManager.TOPIC, new FileTypeListener() { @Override public void fileTypesChanged(@NotNull FileTypeEvent e) { myFileManager.processFileTypesChanged(); } }); - myConnection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new MyFileDocumentManagerAdapter()); + connection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new MyFileDocumentManagerAdapter()); myFileManager.markInitialized(); }); }