本文整理汇总了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;
}
}