private LoadedRevisionsCache(final Project project) { myProject = project; myMap = (ApplicationManager.getApplication().isUnitTestMode()) ? new HashMap<String, Bunch>() : new SoftHashMap<String, Bunch>(); myConnection = project.getMessageBus().connect(); myConnection.subscribe(CommittedChangesCache.COMMITTED_TOPIC, new CommittedChangesAdapter() { @Override public void changesLoaded(final RepositoryLocation location, final List<CommittedChangeList> changes) { ApplicationManager.getApplication().invokeLater(new Runnable() { public void run() { myMap.clear(); setRefreshTime(System.currentTimeMillis()); } }); } }); Disposer.register(myProject, this); setRefreshTime(0); }
@Nullable Object getMemoizedValue(MyKey realKey) { SoftHashMap<MyKey, SoftReference> map = intermediateCache.get(realKey); if (map == null) return null; if (depth == 0) { throw new AssertionError("Memoized values with empty stack"); } for (MyKey key : map.keySet()) { final SoftReference reference = map.get(key); if (reference != null) { final Object result = reference.get(); if (result != null) { return result; } } } return null; }
private LoadedRevisionsCache(final Project project) { myProject = project; myMap = (ApplicationManager.getApplication().isUnitTestMode()) ? new HashMap<String, Bunch>() : new SoftHashMap<String, Bunch>(); myConnection = project.getMessageBus().connect(); myConnection.subscribe(CommittedChangesCache.COMMITTED_TOPIC, new CommittedChangesListener() { public void changesLoaded(final RepositoryLocation location, final List<CommittedChangeList> changes) { ApplicationManager.getApplication().invokeLater(new Runnable() { public void run() { myMap.clear(); setRefreshTime(System.currentTimeMillis()); } }); } @Override public void changesCleared() { } @Override public void presentationChanged() { } public void incomingChangesUpdated(@Nullable final List<CommittedChangeList> receivedChanges) { } public void refreshErrorStatusChanged(@Nullable final VcsException lastError) { } }); Disposer.register(myProject, this); setRefreshTime(0); }
@NotNull @Override public Result<Map<String, TaskPsiElement>> compute() { return Result.<Map<String, TaskPsiElement>>create(new SoftHashMap<String, TaskPsiElement>(), new ModificationTracker() { @Override public long getModificationCount() { return 0; } }); }
private MyCurrentUrlData() { myBranchInfo = new SoftHashMap<String, BranchInfo>(); }
private SvnRepositoryCache() { myMap = new SoftHashMap<String, List<DirectoryEntry>>(); myErrorsMap = new SoftHashMap<String, String>(); }
private SvnRepositoryCache() { myMap = new SoftHashMap<String, List<SVNDirEntry>>(); myErrorsMap = new SoftHashMap<String, SVNErrorMessage>(); }