本文整理匯總了Java中com.intellij.util.containers.ContainerUtil.createConcurrentWeakMap方法的典型用法代碼示例。如果您正苦於以下問題:Java ContainerUtil.createConcurrentWeakMap方法的具體用法?Java ContainerUtil.createConcurrentWeakMap怎麽用?Java ContainerUtil.createConcurrentWeakMap使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.util.containers.ContainerUtil
的用法示例。
在下文中一共展示了ContainerUtil.createConcurrentWeakMap方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: computeForOverloadedCandidate
import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
private <T> T computeForOverloadedCandidate(final Computable<T> computable, final PsiSubstitutor substitutor) {
Map<PsiElement, CurrentCandidateProperties> map = CURRENT_CANDIDATE.get();
if (map == null) {
map = ContainerUtil.createConcurrentWeakMap();
CURRENT_CANDIDATE.set(map);
}
final PsiElement argumentList = getMarkerList();
final CurrentCandidateProperties alreadyThere = map.put(argumentList,
new CurrentCandidateProperties(this, substitutor, isVarargs(), true));
try {
return computable.compute();
}
finally {
if (alreadyThere == null) {
map.remove(argumentList);
} else {
map.put(argumentList, alreadyThere);
}
}
}
示例2: shouldAbbreviateName
import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
private static boolean shouldAbbreviateName(PsiPackage aPackage) {
final Project project = aPackage.getProject();
ConcurrentMap<PsiPackage, Boolean> map = project.getUserData(SHOULD_ABBREV_PACK_KEY);
if (map == null) {
final ConcurrentMap<PsiPackage, Boolean> newMap = ContainerUtil.createConcurrentWeakMap();
map = ((UserDataHolderEx)project).putUserDataIfAbsent(SHOULD_ABBREV_PACK_KEY, newMap);
if (map == newMap) {
((PsiManagerEx)PsiManager.getInstance(project)).registerRunnableToRunOnChange(new Runnable() {
@Override
public void run() {
newMap.clear();
}
});
}
}
Boolean ret = map.get(aPackage);
if (ret != null) return ret;
ret = scanPackages(aPackage, 1);
map.put(aPackage, ret);
return ret;
}
示例3: LoaderFactory
import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
public LoaderFactory(final Project project) {
myProject = project;
myModule2ClassLoader = ContainerUtil.createConcurrentWeakMap();
myConnection = myProject.getMessageBus().connect();
myConnection.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
public void rootsChanged(final ModuleRootEvent event) {
clearClassLoaderCache();
}
});
Disposer.register(project, new Disposable() {
public void dispose() {
myConnection.disconnect();
myModule2ClassLoader.clear();
}
});
}
示例4: xmlFileWasChanged
import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
private boolean xmlFileWasChanged(VirtualFile xmlFile, VFileEvent event) {
if (!xmlFile.isValid() || !(event instanceof VFileContentChangeEvent)) return true;
ConcurrentMap<Project, Integer> map = xmlFile.getUserData(CRC_WITHOUT_SPACES);
if (map == null) {
ConcurrentMap<Project, Integer> value = ContainerUtil.createConcurrentWeakMap();
map = xmlFile.putUserDataIfAbsent(CRC_WITHOUT_SPACES, value);
}
Integer crc = map.get(myProject);
Integer newCrc;
try {
newCrc = MavenUtil.crcWithoutSpaces(xmlFile);
}
catch (IOException ignored) {
return true;
}
if (newCrc == -1 // XML is invalid
|| newCrc.equals(crc)) {
return false;
}
else {
map.put(myProject, newCrc);
return true;
}
}