本文整理汇总了Java中com.intellij.openapi.util.MultiValuesMap类的典型用法代码示例。如果您正苦于以下问题:Java MultiValuesMap类的具体用法?Java MultiValuesMap怎么用?Java MultiValuesMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MultiValuesMap类属于com.intellij.openapi.util包,在下文中一共展示了MultiValuesMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFileToArtifactsMap
import com.intellij.openapi.util.MultiValuesMap; //导入依赖的package包/类
public CachedValue<MultiValuesMap<VirtualFile, Artifact>> getFileToArtifactsMap() {
if (myFile2Artifacts == null) {
myFile2Artifacts =
CachedValuesManager.getManager(myProject).createCachedValue(new CachedValueProvider<MultiValuesMap<VirtualFile, Artifact>>() {
public Result<MultiValuesMap<VirtualFile, Artifact>> compute() {
MultiValuesMap<VirtualFile, Artifact> result = computeFileToArtifactsMap();
List<ModificationTracker> trackers = new ArrayList<ModificationTracker>();
trackers.add(ArtifactManager.getInstance(myProject).getModificationTracker());
for (ComplexPackagingElementType<?> type : PackagingElementFactory.getInstance().getComplexElementTypes()) {
ContainerUtil.addIfNotNull(type.getAllSubstitutionsModificationTracker(myProject), trackers);
}
return Result.create(result, trackers.toArray(new ModificationTracker[trackers.size()]));
}
}, false);
}
return myFile2Artifacts;
}
示例2: computeFileToArtifactsMap
import com.intellij.openapi.util.MultiValuesMap; //导入依赖的package包/类
private MultiValuesMap<VirtualFile, Artifact> computeFileToArtifactsMap() {
final MultiValuesMap<VirtualFile, Artifact> result = new MultiValuesMap<VirtualFile, Artifact>();
final ArtifactManager artifactManager = ArtifactManager.getInstance(myProject);
for (final Artifact artifact : artifactManager.getArtifacts()) {
final PackagingElementResolvingContext context = artifactManager.getResolvingContext();
ArtifactUtil.processPackagingElements(artifact, null, new PackagingElementProcessor<PackagingElement<?>>() {
@Override
public boolean process(@NotNull PackagingElement<?> element, @NotNull PackagingElementPath path) {
if (element instanceof FileOrDirectoryCopyPackagingElement<?>) {
final VirtualFile root = ((FileOrDirectoryCopyPackagingElement)element).findFile();
if (root != null) {
result.put(root, artifact);
}
}
else if (element instanceof ModuleOutputPackagingElement) {
for (VirtualFile sourceRoot : ((ModuleOutputPackagingElement)element).getSourceRoots(context)) {
result.put(sourceRoot, artifact);
}
}
return true;
}
}, context, true);
}
return result;
}
示例3: findArtifacts
import com.intellij.openapi.util.MultiValuesMap; //导入依赖的package包/类
@Override
public Collection<? extends Artifact> findArtifacts(@NotNull VirtualFile sourceFile) {
final MultiValuesMap<VirtualFile, Artifact> map = getFileToArtifactsMap().getValue();
if (map.isEmpty()) {
return Collections.emptyList();
}
List<Artifact> result = null;
VirtualFile file = sourceFile;
while (file != null) {
final Collection<Artifact> artifacts = map.get(file);
if (artifacts != null) {
if (result == null) {
result = new SmartList<Artifact>();
}
result.addAll(artifacts);
}
file = file.getParent();
}
return result != null ? result : Collections.<Artifact>emptyList();
}
示例4: computeParentPathToArtifactMap
import com.intellij.openapi.util.MultiValuesMap; //导入依赖的package包/类
private MultiValuesMap<String, Artifact> computeParentPathToArtifactMap() {
final MultiValuesMap<String, Artifact> result = new MultiValuesMap<String, Artifact>();
for (final Artifact artifact : myArtifactManager.getArtifacts()) {
ArtifactUtil.processFileOrDirectoryCopyElements(artifact, new PackagingElementProcessor<FileOrDirectoryCopyPackagingElement<?>>() {
@Override
public boolean process(@NotNull FileOrDirectoryCopyPackagingElement<?> element, @NotNull PackagingElementPath pathToElement) {
String path = element.getFilePath();
while (path.length() > 0) {
result.put(path, artifact);
path = PathUtil.getParentPath(path);
}
return true;
}
}, myArtifactManager.getResolvingContext(), false);
}
return result;
}
示例5: checkContainsMethod
import com.intellij.openapi.util.MultiValuesMap; //导入依赖的package包/类
public static void checkContainsMethod(final Object rootElement,
final AbstractTreeStructure structure,
Function<AbstractTreeNode, VirtualFile[]> converterFunction) {
MultiValuesMap<VirtualFile, AbstractTreeNode> map = new MultiValuesMap<VirtualFile, AbstractTreeNode>();
collect((AbstractTreeNode)rootElement, map, structure, converterFunction);
for (VirtualFile eachFile : map.keySet()) {
Collection<AbstractTreeNode> nodes = map.values();
for (final AbstractTreeNode node : nodes) {
ProjectViewNode eachNode = (ProjectViewNode)node;
boolean actual = eachNode.contains(eachFile);
boolean expected = map.get(eachFile).contains(eachNode);
if (actual != expected) {
boolean actual1 = eachNode.contains(eachFile);
boolean expected1 = map.get(eachFile).contains(eachNode);
Assert.assertTrue("file=" + eachFile + " node=" + eachNode.getTestPresentation() + " expected:" + expected, false);
}
}
}
}
示例6: getRoots
import com.intellij.openapi.util.MultiValuesMap; //导入依赖的package包/类
private synchronized Map<Module, MultiValuesMap<LogicalRootType, LogicalRoot>> getRoots(final ModuleManager moduleManager) {
if (myRoots == null) {
myRoots = new THashMap<Module, MultiValuesMap<LogicalRootType, LogicalRoot>>();
final Module[] modules = moduleManager.getModules();
for (Module module : modules) {
final MultiValuesMap<LogicalRootType, LogicalRoot> map = new MultiValuesMap<LogicalRootType, LogicalRoot>();
for (Map.Entry<LogicalRootType, Collection<NotNullFunction>> entry : myProviders.entrySet()) {
final Collection<NotNullFunction> functions = entry.getValue();
for (NotNullFunction function : functions) {
map.putAll(entry.getKey(), (List<LogicalRoot>) function.fun(module));
}
}
myRoots.put(module, map);
}
}
return myRoots;
}
示例7: getAllExtensions
import com.intellij.openapi.util.MultiValuesMap; //导入依赖的package包/类
@NotNull
@Override
public Collection<StructureViewExtension> getAllExtensions(@NotNull Class<? extends PsiElement> type) {
Collection<StructureViewExtension> result = myImplExtensions.get(type);
if (result == null) {
MultiValuesMap<Class<? extends PsiElement>, StructureViewExtension> map = myExtensions.getValue();
for (Class<? extends PsiElement> registeredType : map.keySet()) {
if (ReflectionUtil.isAssignable(registeredType, type)) {
final Collection<StructureViewExtension> extensions = map.get(registeredType);
for (StructureViewExtension extension : extensions) {
myImplExtensions.put(type, extension);
}
}
}
result = myImplExtensions.get(type);
if (result == null) return Collections.emptyList();
}
return result;
}
示例8: getAddersMap
import com.intellij.openapi.util.MultiValuesMap; //导入依赖的package包/类
@Nullable
private MultiValuesMap<XmlName, JavaMethod> getAddersMap(final JavaMethod method) {
final Class<?>[] parameterTypes = method.getParameterTypes();
switch (parameterTypes.length) {
case 0:
return collectionAdders;
case 1:
if (Class.class.equals(parameterTypes[0])) return collectionClassAdders;
if (isInt(parameterTypes[0])) return collectionIndexAdders;
break;
case 2:
if (isIndexClassAdder(parameterTypes[0], parameterTypes[1])) return collectionIndexClassAdders;
if (isIndexClassAdder(parameterTypes[1], parameterTypes[0])) return collectionClassIndexAdders;
}
return null;
}
示例9: getAllExtensions
import com.intellij.openapi.util.MultiValuesMap; //导入依赖的package包/类
@Override
public Collection<StructureViewExtension> getAllExtensions(Class<? extends PsiElement> type) {
Collection<StructureViewExtension> result = myImplExtensions.get(type);
if (result == null) {
MultiValuesMap<Class<? extends PsiElement>, StructureViewExtension> map = myExtensions.getValue();
for (Class<? extends PsiElement> registeredType : map.keySet()) {
if (ReflectionCache.isAssignable(registeredType, type)) {
final Collection<StructureViewExtension> extensions = map.get(registeredType);
for (StructureViewExtension extension : extensions) {
myImplExtensions.put(type, extension);
}
}
}
result = myImplExtensions.get(type);
if (result == null) return Collections.emptyList();
}
return result;
}
示例10: computeFileToArtifactsMap
import com.intellij.openapi.util.MultiValuesMap; //导入依赖的package包/类
private MultiValuesMap<VirtualFile, Artifact> computeFileToArtifactsMap() {
final MultiValuesMap<VirtualFile, Artifact> result = new MultiValuesMap<VirtualFile, Artifact>();
final ArtifactManager artifactManager = ArtifactManager.getInstance(myProject);
for (final Artifact artifact : artifactManager.getArtifacts()) {
final PackagingElementResolvingContext context = artifactManager.getResolvingContext();
ArtifactUtil.processPackagingElements(artifact, null, new PackagingElementProcessor<PackagingElement<?>>() {
@Override
public boolean process(@Nonnull PackagingElement<?> element, @Nonnull PackagingElementPath path) {
if (element instanceof FileOrDirectoryCopyPackagingElement<?>) {
final VirtualFile root = ((FileOrDirectoryCopyPackagingElement)element).findFile();
if (root != null) {
result.put(root, artifact);
}
}
else if (element instanceof ModuleOutputPackagingElement) {
for (VirtualFile sourceRoot : ((ModuleOutputPackagingElement)element).getSourceRoots(context)) {
result.put(sourceRoot, artifact);
}
}
return true;
}
}, context, true);
}
return result;
}
示例11: findArtifacts
import com.intellij.openapi.util.MultiValuesMap; //导入依赖的package包/类
@Override
public Collection<? extends Artifact> findArtifacts(@Nonnull VirtualFile sourceFile) {
final MultiValuesMap<VirtualFile, Artifact> map = getFileToArtifactsMap().getValue();
if (map.isEmpty()) {
return Collections.emptyList();
}
List<Artifact> result = null;
VirtualFile file = sourceFile;
while (file != null) {
final Collection<Artifact> artifacts = map.get(file);
if (artifacts != null) {
if (result == null) {
result = new SmartList<Artifact>();
}
result.addAll(artifacts);
}
file = file.getParent();
}
return result != null ? result : Collections.<Artifact>emptyList();
}
示例12: computeParentPathToArtifactMap
import com.intellij.openapi.util.MultiValuesMap; //导入依赖的package包/类
private MultiValuesMap<String, Artifact> computeParentPathToArtifactMap() {
final MultiValuesMap<String, Artifact> result = new MultiValuesMap<String, Artifact>();
for (final Artifact artifact : myArtifactManager.getArtifacts()) {
ArtifactUtil.processFileOrDirectoryCopyElements(artifact, new PackagingElementProcessor<FileOrDirectoryCopyPackagingElement<?>>() {
@Override
public boolean process(@Nonnull FileOrDirectoryCopyPackagingElement<?> element, @Nonnull PackagingElementPath pathToElement) {
String path = element.getFilePath();
while (path.length() > 0) {
result.put(path, artifact);
path = PathUtil.getParentPath(path);
}
return true;
}
}, myArtifactManager.getResolvingContext(), false);
}
return result;
}
示例13: getAllExtensions
import com.intellij.openapi.util.MultiValuesMap; //导入依赖的package包/类
@Override
public Collection<StructureViewExtension> getAllExtensions(Class<? extends PsiElement> type) {
Collection<StructureViewExtension> result = myImplExtensions.get(type);
if (result == null) {
MultiValuesMap<Class<? extends PsiElement>, StructureViewExtension> map = myExtensions.getValue();
for (Class<? extends PsiElement> registeredType : map.keySet()) {
if (ReflectionUtil.isAssignable(registeredType, type)) {
final Collection<StructureViewExtension> extensions = map.get(registeredType);
for (StructureViewExtension extension : extensions) {
myImplExtensions.put(type, extension);
}
}
}
result = myImplExtensions.get(type);
if (result == null) return Collections.emptyList();
}
return result;
}
示例14: modify
import com.intellij.openapi.util.MultiValuesMap; //导入依赖的package包/类
@NotNull
@Override
public Collection<AbstractTreeNode> modify(@NotNull AbstractTreeNode parent, @NotNull Collection<AbstractTreeNode> children, ViewSettings settings) {
if (parent instanceof JoinedNode) return children;
ArrayList<AbstractTreeNode> result = new ArrayList<AbstractTreeNode>();
MultiValuesMap<Object, AbstractTreeNode> executed = new MultiValuesMap<Object, AbstractTreeNode>();
for (Iterator<AbstractTreeNode> iterator = children.iterator(); iterator.hasNext();) {
ProjectViewNode treeNode = (ProjectViewNode)iterator.next();
Object o = treeNode.getValue();
if (o instanceof PsiFile) {
String name = ((PsiFile)o).getVirtualFile().getNameWithoutExtension();
executed.put(name, treeNode);
}
else {
executed.put(o, treeNode);
}
}
Iterator<Object> keys = executed.keySet().iterator();
while (keys.hasNext()) {
Object each = keys.next();
Collection<AbstractTreeNode> objects = executed.get(each);
if (objects.size() > 1) {
result.add(new JoinedNode(objects, new Joined(findPsiFileIn(objects))));
}
else if (objects.size() == 1) {
result.add(objects.iterator().next());
}
}
return result;
}
示例15: ArtifactVirtualFileListener
import com.intellij.openapi.util.MultiValuesMap; //导入依赖的package包/类
public ArtifactVirtualFileListener(Project project, final ArtifactManagerImpl artifactManager) {
myArtifactManager = artifactManager;
myParentPathsToArtifacts =
CachedValuesManager.getManager(project).createCachedValue(new CachedValueProvider<MultiValuesMap<String, Artifact>>() {
public Result<MultiValuesMap<String, Artifact>> compute() {
MultiValuesMap<String, Artifact> result = computeParentPathToArtifactMap();
return Result.createSingleDependency(result, artifactManager.getModificationTracker());
}
}, false);
}