本文整理汇总了Java中com.intellij.util.containers.ContainerUtil.newConcurrentSet方法的典型用法代码示例。如果您正苦于以下问题:Java ContainerUtil.newConcurrentSet方法的具体用法?Java ContainerUtil.newConcurrentSet怎么用?Java ContainerUtil.newConcurrentSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.containers.ContainerUtil
的用法示例。
在下文中一共展示了ContainerUtil.newConcurrentSet方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createMap
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public static Map<SliceNode, Collection<PsiElement>> createMap() {
return new FactoryMap<SliceNode, Collection<PsiElement>>() {
@Override
protected Map<SliceNode, Collection<PsiElement>> createMap() {
return ContainerUtil.newConcurrentMap(ContainerUtil.<SliceNode>identityStrategy());
}
@Override
protected Collection<PsiElement> create(SliceNode key) {
return ContainerUtil.newConcurrentSet(LEAF_ELEMENT_EQUALITY);
}
};
}
示例2: ExternalSystemNotificationManager
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public ExternalSystemNotificationManager(@NotNull final Project project) {
myProject = project;
Disposer.register(project, this);
myNotifications = ContainerUtil.newConcurrentSet();
initializedExternalSystem = ContainerUtil.newConcurrentSet();
myMessageCounter = new MessageCounter();
}
示例3: JarFileSystemImpl
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public JarFileSystemImpl() {
boolean noCopy = SystemProperties.getBooleanProperty("idea.jars.nocopy", !SystemInfo.isWindows);
myNoCopyJarPaths = noCopy ? null : ContainerUtil.newConcurrentSet(FileUtil.PATH_HASHING_STRATEGY);
// to prevent platform .jar files from copying
boolean runningFromDist = new File(PathManager.getLibPath(), "openapi.jar").exists();
myNoCopyJarDir = !runningFromDist ? null : new File(PathManager.getHomePath());
}
示例4: getSet
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private static Set<VirtualFileListener> getSet(final String fileUrl, final Map<String, Set<VirtualFileListener>> map) {
Set<VirtualFileListener> listeners = map.get(fileUrl);
if (listeners == null) {
listeners = ContainerUtil.newConcurrentSet();
map.put(fileUrl, listeners);
}
return listeners;
}
示例5: performCompletion
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
/**
* The main method that is invoked to collect all the completion variants
* @param parameters Parameters specifying current completion environment
* @param consumer This consumer will directly add lookup elements to the lookup
*/
public void performCompletion(final CompletionParameters parameters, final Consumer<CompletionResult> consumer) {
final Set<LookupElement> lookupSet = ContainerUtil.newConcurrentSet();
getVariantsFromContributors(parameters, null, new Consumer<CompletionResult>() {
@Override
public void consume(final CompletionResult result) {
if (lookupSet.add(result.getLookupElement())) {
consumer.consume(result);
}
}
});
}
示例6: createContextWrapper
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private static CompileContext createContextWrapper(final CompileContext delegate) {
final ClassLoader loader = delegate.getClass().getClassLoader();
final UserDataHolderBase localDataHolder = new UserDataHolderBase();
final Set<Object> deletedKeysSet = ContainerUtil.newConcurrentSet();
final Class<UserDataHolder> dataHolderInterface = UserDataHolder.class;
final Class<MessageHandler> messageHandlerInterface = MessageHandler.class;
return (CompileContext)Proxy.newProxyInstance(loader, new Class[]{CompileContext.class}, new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
final Class<?> declaringClass = method.getDeclaringClass();
if (dataHolderInterface.equals(declaringClass)) {
final Object firstArgument = args[0];
if (!(firstArgument instanceof GlobalContextKey)) {
final boolean isWriteOperation = args.length == 2 /*&& void.class.equals(method.getReturnType())*/;
if (isWriteOperation) {
if (args[1] == null) {
deletedKeysSet.add(firstArgument);
}
else {
deletedKeysSet.remove(firstArgument);
}
}
else {
if (deletedKeysSet.contains(firstArgument)) {
return null;
}
}
final Object result = method.invoke(localDataHolder, args);
if (isWriteOperation || result != null) {
return result;
}
}
}
else if (messageHandlerInterface.equals(declaringClass)) {
final BuildMessage msg = (BuildMessage)args[0];
if (msg.getKind() == BuildMessage.Kind.ERROR) {
Utils.ERRORS_DETECTED_KEY.set(localDataHolder, Boolean.TRUE);
}
}
try {
return method.invoke(delegate, args);
}
catch (InvocationTargetException e) {
final Throwable targetEx = e.getTargetException();
if (targetEx instanceof ProjectBuildException) {
throw targetEx;
}
throw e;
}
}
});
}
示例7: testReDetectOnContentsChange
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public void testReDetectOnContentsChange() throws IOException {
final FileTypeRegistry fileTypeManager = FileTypeRegistry.getInstance();
assertTrue(fileTypeManager.getClass().getName(), fileTypeManager instanceof FileTypeManagerImpl);
FileType fileType = fileTypeManager.getFileTypeByFileName("x" + ModuleFileType.DOT_DEFAULT_EXTENSION);
assertTrue(fileType.toString(), fileType instanceof ModuleFileType);
fileType = fileTypeManager.getFileTypeByFileName("x" + ProjectFileType.DOT_DEFAULT_EXTENSION);
assertTrue(fileType.toString(), fileType instanceof ProjectFileType);
FileType module = fileTypeManager.findFileTypeByName("IDEA_MODULE");
assertNotNull(module);
assertFalse(module.equals(PlainTextFileType.INSTANCE));
FileType project = fileTypeManager.findFileTypeByName("IDEA_PROJECT");
assertNotNull(project);
assertFalse(project.equals(PlainTextFileType.INSTANCE));
final Set<VirtualFile> detectorCalled = ContainerUtil.newConcurrentSet();
FileTypeRegistry.FileTypeDetector detector = new FileTypeRegistry.FileTypeDetector() {
@Nullable
@Override
public FileType detect(@NotNull VirtualFile file, @NotNull ByteSequence firstBytes, @Nullable CharSequence firstCharsIfText) {
detectorCalled.add(file);
String text = firstCharsIfText.toString();
FileType result = text.startsWith("TYPE:") ? fileTypeManager.findFileTypeByName(StringUtil.trimStart(text, "TYPE:")) : null;
log("T: my detector run for "+file.getName()+"; result: "+(result == null ? null : result.getName()));
return result;
}
@Override
public int getVersion() {
return 0;
}
};
Extensions.getRootArea().getExtensionPoint(FileTypeRegistry.FileTypeDetector.EP_NAME).registerExtension(detector);
myFileTypeManager.toLog = true;
try {
log("T: ------ akjdhfksdjgf");
File f = createTempFile("xx.asfdasdfas", "akjdhfksdjgf");
VirtualFile vFile = getVirtualFile(f);
ensureRedetected(vFile, detectorCalled);
assertTrue(vFile.getFileType().toString(), vFile.getFileType() instanceof PlainTextFileType);
log("T: ------ TYPE:IDEA_MODULE");
setFileText(vFile, "TYPE:IDEA_MODULE");
ensureRedetected(vFile, detectorCalled);
assertTrue(vFile.getFileType().toString(), vFile.getFileType() instanceof ModuleFileType);
log("T: ------ TYPE:IDEA_PROJECT");
setFileText(vFile, "TYPE:IDEA_PROJECT");
ensureRedetected(vFile, detectorCalled);
assertTrue(vFile.getFileType().toString(), vFile.getFileType() instanceof ProjectFileType);
log("T: ------");
}
finally {
Extensions.getRootArea().getExtensionPoint(FileTypeRegistry.FileTypeDetector.EP_NAME).unregisterExtension(detector);
myFileTypeManager.toLog = false;
}
}