public PsiVFSListener(Project project) { myProject = project; myFileTypeManager = FileTypeManager.getInstance(); myProjectRootManager = ProjectRootManager.getInstance(project); myManager = (PsiManagerImpl) PsiManager.getInstance(project); myFileManager = (FileManagerImpl) myManager.getFileManager(); myConnection = project.getMessageBus().connect(project); StartupManager.getInstance(project).registerPreStartupActivity(new Runnable() { @Override public void run() { myConnection.subscribe(ProjectTopics.PROJECT_ROOTS, new MyModuleRootListener()); myConnection.subscribe(FileTypeManager.TOPIC, new FileTypeListener.Adapter() { @Override public void fileTypesChanged(@NotNull FileTypeEvent e) { myFileManager.processFileTypesChanged(); } }); myConnection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new MyFileDocumentManagerAdapter()); myFileManager.markInitialized(); } }); }
@Override public void runActivity(@Nonnull UIAccess uiAccess, @Nonnull Project project) { if (project.isDefault() || ApplicationManager.getApplication().isUnitTestMode() || project.isDisposed()) { return; } MessageBusConnection connection = project.getMessageBus().connect(); connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new MyFileEditorManagerListener()); connection.subscribe(FileTypeManager.TOPIC, new FileTypeListener() { @Override public void fileTypesChanged(@Nonnull FileTypeEvent event) { reinitBreadcrumbsInAllEditors(project); } }); VirtualFileManager.getInstance().addVirtualFileListener(new MyVirtualFileListener(project), project); connection.subscribe(UISettingsListener.TOPIC, uiSettings -> reinitBreadcrumbsInAllEditors(project)); }
public PsiVFSListener(Project project) { installGlobalListener(); myProject = project; myFileTypeManager = FileTypeManager.getInstance(); myProjectRootManager = ProjectRootManager.getInstance(project); myManager = (PsiManagerImpl)PsiManager.getInstance(project); myFileManager = (FileManagerImpl)myManager.getFileManager(); StartupManager.getInstance(project).registerPreStartupActivity(() -> { MessageBusConnection connection = project.getMessageBus().connect(project); connection.subscribe(ProjectTopics.PROJECT_ROOTS, new MyModuleRootListener()); connection.subscribe(FileTypeManager.TOPIC, new FileTypeListener() { @Override public void fileTypesChanged(@Nonnull FileTypeEvent e) { myFileManager.processFileTypesChanged(); } }); connection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new MyFileDocumentManagerAdapter()); }); }
public PsiVFSListener(StartupManager startupManager, FileTypeManager fileTypeManager, PsiManager psiManager, ProjectRootManager projectRootManager) { myFileTypeManager = fileTypeManager; myProjectRootManager = projectRootManager; myProjectFileIndex = myProjectRootManager.getFileIndex(); myManager = (PsiManagerImpl) psiManager; myFileManager = (FileManagerImpl) myManager.getFileManager(); myConnection = psiManager.getProject().getMessageBus().connect(psiManager.getProject()); startupManager.registerPreStartupActivity(new Runnable() { @Override public void run() { myConnection.subscribe(VirtualFileManager.VFS_CHANGES, new BulkVirtualFileListenerAdapter(PsiVFSListener.this)); myConnection.subscribe(ProjectTopics.PROJECT_ROOTS, new MyModuleRootListener()); myConnection.subscribe(FileTypeManager.TOPIC, new FileTypeListener.Adapter() { @Override public void fileTypesChanged(FileTypeEvent e) { myFileManager.processFileTypesChanged(); } }); myConnection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new MyFileDocumentManagerAdapter()); myFileManager.markInitialized(); } }); }