public FileManagerImpl(PsiManagerImpl manager, FileDocumentManager fileDocumentManager, FileIndexFacade fileIndex) { myManager = manager; myFileIndex = fileIndex; myConnection = manager.getProject().getMessageBus().connect(); myFileDocumentManager = fileDocumentManager; myConnection.subscribe(DumbService.DUMB_MODE, new DumbService.DumbModeListener() { @Override public void enteredDumbMode() { updateAllViewProviders(); } @Override public void exitDumbMode() { updateAllViewProviders(); } }); Disposer.register(manager.getProject(), this); LowMemoryWatcher.register(new Runnable() { @Override public void run() { processQueue(); } }, this); }
public FileManagerImpl(PsiManagerImpl manager, FileDocumentManager fileDocumentManager, FileIndexFacade fileIndex) { myManager = manager; myFileIndex = fileIndex; myConnection = manager.getProject().getMessageBus().connect(); myFileDocumentManager = fileDocumentManager; Disposer.register(manager.getProject(), this); LowMemoryWatcher.register(this::processQueue, this); myConnection.subscribe(DumbService.DUMB_MODE, new DumbService.DumbModeListener() { @Override public void enteredDumbMode() { processFileTypesChanged(); } @Override public void exitDumbMode() { processFileTypesChanged(); } }); }
public SemServiceImpl(Project project, PsiManager psiManager) { myProject = project; final MessageBusConnection connection = project.getMessageBus().connect(); connection.subscribe(PsiModificationTracker.TOPIC, new PsiModificationTracker.Listener() { @Override public void modificationCountChanged() { if (!isInsideAtomicChange()) { clearCache(); } } }); ((PsiManagerEx)psiManager).registerRunnableToRunOnChange(() -> { if (!isInsideAtomicChange()) { clearCache(); } }); LowMemoryWatcher.register(() -> { if (myCreatingSem.get() == 0) { clearCache(); } //System.out.println("SemService cache flushed"); }, project); }
public NonClasspathClassFinder(@NotNull Project project, @NotNull String... fileExtensions) { myProject = project; myPackageManager = PsiPackageManager.getInstance(myProject); myManager = PsiManager.getInstance(myProject); myFileExtensions = ArrayUtil.append(fileExtensions, "class"); final MessageBusConnection connection = project.getMessageBus().connect(project); connection.subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener() { @Override public void after(@NotNull List<? extends VFileEvent> events) { clearCache(); } }); LowMemoryWatcher.register(this::clearCache, project); }
public BaseExternalAnnotationsManager(@NotNull PsiManager psiManager) { myPsiManager = psiManager; LowMemoryWatcher.register(new Runnable() { @Override public void run() { dropCache(); } }, psiManager.getProject()); }
public SemServiceImpl(Project project, PsiManager psiManager) { myProject = project; final MessageBusConnection connection = project.getMessageBus().connect(); connection.subscribe(PsiModificationTracker.TOPIC, new PsiModificationTracker.Listener() { @Override public void modificationCountChanged() { if (!isInsideAtomicChange()) { clearCache(); } } }); ((PsiManagerEx)psiManager).registerRunnableToRunOnChange(new Runnable() { @Override public void run() { if (!isInsideAtomicChange()) { clearCache(); } } }); LowMemoryWatcher.register(new Runnable() { @Override public void run() { if (myCreatingSem.get() == 0) { clearCache(); } //System.out.println("SemService cache flushed"); } }, project); }
public IconDeferrerImpl(MessageBus bus) { final MessageBusConnection connection = bus.connect(); connection.subscribe(PsiModificationTracker.TOPIC, this::clear); connection.subscribe(ProjectLifecycleListener.TOPIC, new ProjectLifecycleListener() { @Override public void afterProjectClosed(@Nonnull Project project) { clear(); } }); LowMemoryWatcher.register(this::clear, connection); }
public SmartPointerManagerImpl(Project project) { myProject = project; myPsiDocManager = (PsiDocumentManagerBase)PsiDocumentManager.getInstance(myProject); LowMemoryWatcher.register(() -> processQueue(), project); }
MyReferenceQueue(Project project) { LowMemoryWatcher.register(() -> cleanupStaleReferences(), project); }