public void testPostingPerformanceWithLowListenerDensityInHierarchy() { //simulating million fileWithNoDocumentChanged events on refresh in a thousand-module project MessageBusImpl childBus = new MessageBusImpl(this, myBus); childBus.connect().subscribe(TOPIC1, new T1Listener() { @Override public void t11() { } @Override public void t12() { } }); for (int i = 0; i < 1000; i++) { new MessageBusImpl(this, childBus); } PlatformTestUtil.assertTiming("Too long", 3000, new Runnable() { @Override public void run() { T1Listener publisher = myBus.syncPublisher(TOPIC1); for (int i = 0; i < 1000000; i++) { publisher.t11(); } } }); }
public CoreProjectEnvironment(Disposable parentDisposable, CoreApplicationEnvironment applicationEnvironment) { myParentDisposable = parentDisposable; myEnvironment = applicationEnvironment; myProject = new MockProject(myEnvironment.getApplication().getPicoContainer(), myParentDisposable); preregisterServices(); myFileIndexFacade = createFileIndexFacade(); myMessageBus = new MessageBusImpl("CoreProjectEnvironment", null); PsiModificationTrackerImpl modificationTracker = new PsiModificationTrackerImpl(myProject); myProject.registerService(PsiModificationTracker.class, modificationTracker); myProject.registerService(FileIndexFacade.class, myFileIndexFacade); myProject.registerService(ResolveCache.class, new ResolveCache(myMessageBus)); registerProjectExtensionPoint(PsiTreeChangePreprocessor.EP_NAME, PsiTreeChangePreprocessor.class); myPsiManager = new PsiManagerImpl(myProject, null, null, myFileIndexFacade, myMessageBus, modificationTracker); ((FileManagerImpl) myPsiManager.getFileManager()).markInitialized(); registerProjectComponent(PsiManager.class, myPsiManager); myProject.registerService(ResolveScopeManager.class, createResolveScopeManager(myPsiManager)); myProject.registerService(PsiFileFactory.class, new PsiFileFactoryImpl(myPsiManager)); myProject.registerService(CachedValuesManager.class, new CachedValuesManagerImpl(myProject, new PsiCachedValuesFactory(myPsiManager))); myProject.registerService(PsiDirectoryFactory.class, new PsiDirectoryFactoryImpl(myPsiManager)); myProject.registerService(ProjectScopeBuilder.class, createProjectScopeBuilder()); myProject.registerService(DumbService.class, new MockDumbService(myProject)); }
public CoreProjectEnvironment(Disposable parentDisposable, CoreApplicationEnvironment applicationEnvironment) { myParentDisposable = parentDisposable; myEnvironment = applicationEnvironment; myProject = new MockProject(myEnvironment.getApplication().getPicoContainer(), myParentDisposable); preregisterServices(); myFileIndexFacade = createFileIndexFacade(); myMessageBus = (MessageBusImpl)myProject.getMessageBus(); PsiModificationTrackerImpl modificationTracker = new PsiModificationTrackerImpl(myProject); myProject.registerService(PsiModificationTracker.class, modificationTracker); myProject.registerService(FileIndexFacade.class, myFileIndexFacade); myProject.registerService(ResolveCache.class, new ResolveCache(myMessageBus)); registerProjectExtensionPoint(PsiTreeChangePreprocessor.EP_NAME, PsiTreeChangePreprocessor.class); myPsiManager = new PsiManagerImpl(myProject, null, null, myFileIndexFacade, myMessageBus, modificationTracker); ((FileManagerImpl)myPsiManager.getFileManager()).markInitialized(); registerProjectComponent(PsiManager.class, myPsiManager); registerProjectComponent(PsiDocumentManager.class, new CorePsiDocumentManager(myProject, myPsiManager, myMessageBus, new MockDocumentCommitProcessor())); myProject.registerService(ResolveScopeManager.class, createResolveScopeManager(myPsiManager)); myProject.registerService(PsiFileFactory.class, new PsiFileFactoryImpl(myPsiManager)); myProject.registerService(CachedValuesManager.class, new CachedValuesManagerImpl(myProject, new PsiCachedValuesFactory(myPsiManager))); myProject.registerService(ProjectScopeBuilder.class, createProjectScopeBuilder()); myProject.registerService(DumbService.class, new MockDumbService(myProject)); }
@NotNull @Override public MessageBus getMessageBus() { return new MessageBusImpl.RootBus(""); }
@NotNull @Override public MessageBus newMessageBus(@NotNull Object owner) { return new MessageBusImpl.RootBus(owner); }
@NotNull @Override public MessageBus newMessageBus(@NotNull Object owner, @Nullable MessageBus parentBus) { return parentBus == null ? newMessageBus(owner) : new MessageBusImpl(owner, parentBus); }
public static MessageBus newMessageBus(@NotNull Object owner) { return new MessageBusImpl(owner, null); }
public static MessageBus newMessageBus(@NotNull Object owner, MessageBus parentBus) { return new MessageBusImpl(owner, parentBus); }
public CoreApplicationEnvironment(Disposable parentDisposable) { myParentDisposable = parentDisposable; Extensions.cleanRootArea(myParentDisposable); myFileTypeRegistry = new CoreFileTypeRegistry(); myEncodingRegistry = new CoreEncodingRegistry(); myApplication = createApplication(myParentDisposable); ApplicationManager.setApplication(myApplication, new StaticGetter<FileTypeRegistry>(myFileTypeRegistry), new StaticGetter<EncodingRegistry>(myEncodingRegistry), myParentDisposable); myLocalFileSystem = createLocalFileSystem(); myJarFileSystem = createJarFileSystem(); Extensions.registerAreaClass(ExtensionAreas.IDEA_PROJECT, null); final MutablePicoContainer appContainer = myApplication.getPicoContainer(); registerComponentInstance(appContainer, FileDocumentManager.class, new MockFileDocumentManagerImpl(new Function<CharSequence, Document>() { @Override public Document fun(CharSequence charSequence) { return new DocumentImpl(charSequence); } }, null)); VirtualFileSystem[] fs = {myLocalFileSystem, myJarFileSystem}; VirtualFileManagerImpl virtualFileManager = new VirtualFileManagerImpl(fs, new MessageBusImpl(myApplication, null)); registerComponentInstance(appContainer, VirtualFileManager.class, virtualFileManager); registerApplicationService(VirtualFilePointerManager.class, createVirtualFilePointerManager()); myApplication.registerService(DefaultASTFactory.class, new CoreASTFactory()); myApplication.registerService(PsiBuilderFactory.class, new PsiBuilderFactoryImpl()); myApplication.registerService(ReferenceProvidersRegistry.class, new MockReferenceProvidersRegistry()); myApplication.registerService(StubTreeLoader.class, new CoreStubTreeLoader()); myApplication.registerService(PsiReferenceService.class, new PsiReferenceServiceImpl()); myApplication.registerService(MetaDataRegistrar.class, new MetaRegistry()); registerApplicationExtensionPoint(ContentBasedFileSubstitutor.EP_NAME, ContentBasedFileSubstitutor.class); registerExtensionPoint(Extensions.getRootArea(), BinaryFileStubBuilders.EP_NAME, FileTypeExtensionPoint.class); registerExtensionPoint(Extensions.getRootArea(), FileContextProvider.EP_NAME, FileContextProvider.class); registerApplicationExtensionPoint(MetaDataContributor.EP_NAME, MetaDataContributor.class); ProgressIndicatorProvider.ourInstance = createProgressIndicatorProvider(); myApplication.registerService(JobLauncher.class, createJobLauncher()); }
public static MessageBus newMessageBus(@Nonnull Object owner) { return new MessageBusImpl.RootBus(owner); }
public static MessageBus newMessageBus(@Nonnull Object owner, @Nullable MessageBus parentBus) { return parentBus == null ? newMessageBus(owner) : new MessageBusImpl(owner, parentBus); }