com.intellij.openapi.util.LowMemoryWatcher Java Examples
The following examples show how to use
com.intellij.openapi.util.LowMemoryWatcher.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProjectUnresolvedResourceStatsCollector.java From intellij with Apache License 2.0 | 6 votes |
@NonInjectable ProjectUnresolvedResourceStatsCollector( Project project, WorkspacePathResolverProvider workspacePathResolverProvider, BlazeProjectDataManager blazeProjectDataManager, WorkspaceFileFinder.Provider workspaceFileFinderProvider, FileTypeRegistry fileTypeRegistry) { this.project = project; fileToHighlightStats = Collections.synchronizedMap(new HashMap<>()); this.workspacePathResolverProvider = workspacePathResolverProvider; this.blazeProjectDataManager = blazeProjectDataManager; this.workspaceFileFinderProvider = workspaceFileFinderProvider; this.fileTypeRegistry = fileTypeRegistry; LowMemoryWatcher.register(this::clearMap, project); }
Example #2
Source File: FileManagerImpl.java From consulo with Apache License 2.0 | 6 votes |
public FileManagerImpl(@Nonnull PsiManagerImpl manager, @Nonnull Provider<FileIndexFacade> fileIndex) { myManager = manager; myFileIndex = fileIndex; myConnection = manager.getProject().getMessageBus().connect(); Disposer.register(manager.getProject(), this); LowMemoryWatcher.register(this::processQueue, this); myConnection.subscribe(DumbService.DUMB_MODE, new DumbService.DumbModeListener() { @Override public void enteredDumbMode() { processFileTypesChanged(false); } @Override public void exitDumbMode() { processFileTypesChanged(false); } }); }
Example #3
Source File: PersistentFSImpl.java From consulo with Apache License 2.0 | 5 votes |
public PersistentFSImpl() { ShutDownTracker.getInstance().registerShutdownTask(this::performShutdown); LowMemoryWatcher.register(this::clearIdCache, this); AsyncEventSupport.startListening(); //Activity activity = StartUpMeasurer.startActivity("connect FSRecords"); FSRecords.connect(); //activity.end(); }
Example #4
Source File: SemServiceImpl.java From consulo with Apache License 2.0 | 5 votes |
@Inject 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); }
Example #5
Source File: DesktopIconDeferrerImpl.java From consulo with Apache License 2.0 | 5 votes |
@Inject public DesktopIconDeferrerImpl(Application application) { final MessageBusConnection connection = application.getMessageBus().connect(); connection.subscribe(PsiModificationTracker.TOPIC, this::clear); connection.subscribe(ProjectManager.TOPIC, new ProjectManagerListener() { @Override public void projectClosed(@Nonnull Project project, @Nonnull UIAccess uiAccess) { clear(); } }); LowMemoryWatcher.register(this::clear, this); }
Example #6
Source File: MacroLineMarkerProvider.java From intellij with Apache License 2.0 | 4 votes |
private FileDataProvider(Project project) { this.project = project; LowMemoryWatcher.register(cache::clear, project); }
Example #7
Source File: PrefetchServiceImpl.java From intellij with Apache License 2.0 | 4 votes |
private PrefetchServiceImpl() { LowMemoryWatcher.register( fileToLastFetchTimeMillis::clear, ApplicationManager.getApplication()); }
Example #8
Source File: Unity3dMetaManager.java From consulo-unity3d with Apache License 2.0 | 4 votes |
@Inject public Unity3dMetaManager(Project project, VirtualFileManager virtualFileManager) { myProject = project; myProject.getMessageBus().connect().subscribe(PsiModificationTracker.TOPIC, () -> myGUIDs.clear()); virtualFileManager.addAsyncFileListener(new AsyncFileListener() { @Nonnull @Override public ChangeApplier prepareChange(@Nonnull List<? extends VFileEvent> list) { return new ChangeApplier() { @Override public void afterVfsChange() { for(VFileEvent vFileEvent : list) { VirtualFile file = vFileEvent.getFile(); if(file == null) { continue; } if(clearIfNeed(file)) { break; } } } private boolean clearIfNeed(@Nonnull VirtualFile virtualFile) { if(virtualFile.getFileType() == Unity3dMetaFileType.INSTANCE) { myAttaches.clear(); return true; } return false; } }; } }, this); LowMemoryWatcher.register(this::clear, this); }