本文整理汇总了Java中com.intellij.openapi.util.MultiValuesMap类的典型用法代码示例。如果您正苦于以下问题:Java MultiValuesMap类的具体用法?Java MultiValuesMap怎么用?Java MultiValuesMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MultiValuesMap类属于com.intellij.openapi.util包,在下文中一共展示了MultiValuesMap类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ArtifactBySourceFileFinderImpl.java
示例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;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ArtifactBySourceFileFinderImpl.java
示例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();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ArtifactBySourceFileFinderImpl.java
示例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;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ArtifactVirtualFileListener.java
示例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);
}
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ProjectViewTestUtil.java
示例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;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:LogicalRootsManagerImpl.java
示例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;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:StructureViewFactoryImpl.java
示例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;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:StaticGenericInfoBuilder.java
示例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;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:StructureViewFactoryImpl.java
示例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;
}
开发者ID:consulo,项目名称:consulo,代码行数:26,代码来源:ArtifactBySourceFileFinderImpl.java
示例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();
}
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:ArtifactBySourceFileFinderImpl.java
示例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;
}
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:ArtifactVirtualFileListener.java
示例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;
}
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:StructureViewFactoryImpl.java
示例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;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:SameNamesJoiner.java
示例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);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ArtifactVirtualFileListener.java
示例16: getLogicalRoots
import com.intellij.openapi.util.MultiValuesMap; //导入依赖的package包/类
@Override
public List<LogicalRoot> getLogicalRoots(@NotNull final Module module) {
final Map<Module, MultiValuesMap<LogicalRootType, LogicalRoot>> roots = getRoots(myModuleManager);
final MultiValuesMap<LogicalRootType, LogicalRoot> valuesMap = roots.get(module);
if (valuesMap == null) {
return Collections.emptyList();
}
return new ArrayList<LogicalRoot>(valuesMap.values());
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:LogicalRootsManagerImpl.java
示例17: getLogicalRootsOfType
import com.intellij.openapi.util.MultiValuesMap; //导入依赖的package包/类
@Override
public <T extends LogicalRoot> List<T> getLogicalRootsOfType(@NotNull final Module module, @NotNull final LogicalRootType<T> type) {
final Map<Module, MultiValuesMap<LogicalRootType, LogicalRoot>> roots = getRoots(myModuleManager);
final MultiValuesMap<LogicalRootType, LogicalRoot> map = roots.get(module);
if (map == null) {
return Collections.emptyList();
}
Collection<LogicalRoot> collection = map.get(type);
if (collection == null) return Collections.emptyList();
return new ArrayList<T>((Collection<T>)collection);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:LogicalRootsManagerImpl.java
示例18: compute
import com.intellij.openapi.util.MultiValuesMap; //导入依赖的package包/类
@NotNull
@Override
protected MultiValuesMap<Class<? extends PsiElement>, StructureViewExtension> compute() {
MultiValuesMap<Class<? extends PsiElement>, StructureViewExtension> map =
new MultiValuesMap<Class<? extends PsiElement>, StructureViewExtension>();
StructureViewExtension[] extensions = Extensions.getExtensions(StructureViewExtension.EXTENSION_POINT_NAME);
for (StructureViewExtension extension : extensions) {
map.put(extension.getType(), extension);
}
return map;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:StructureViewFactoryImpl.java
示例19: failed
import com.intellij.openapi.util.MultiValuesMap; //导入依赖的package包/类
@Nullable("null means DFA analysis has failed (too complex to analyze)")
public static Collection<PsiExpression> getCachedVariableValues(@Nullable final PsiVariable variable, @Nullable final PsiElement context) {
if (variable == null || context == null) return Collections.emptyList();
CachedValue<MultiValuesMap<PsiVariable, PsiExpression>> cachedValue = context.getUserData(DFA_VARIABLE_INFO_KEY);
if (cachedValue == null) {
final PsiElement codeBlock = DfaPsiUtil.getEnclosingCodeBlock(variable, context);
cachedValue = CachedValuesManager.getManager(context.getProject()).createCachedValue(new CachedValueProvider<MultiValuesMap<PsiVariable, PsiExpression>>() {
@Override
public Result<MultiValuesMap<PsiVariable, PsiExpression>> compute() {
final MultiValuesMap<PsiVariable, PsiExpression> result;
if (codeBlock == null) {
result = null;
}
else {
final ValuableInstructionVisitor visitor = new ValuableInstructionVisitor(context);
RunnerResult runnerResult = new ValuableDataFlowRunner().analyzeMethod(codeBlock, visitor);
if (runnerResult == RunnerResult.OK) {
result = visitor.myValues;
}
else {
result = TOO_COMPLEX;
}
}
return new Result<MultiValuesMap<PsiVariable, PsiExpression>>(result, codeBlock);
}
}, false);
context.putUserData(DFA_VARIABLE_INFO_KEY, cachedValue);
}
final MultiValuesMap<PsiVariable, PsiExpression> value = cachedValue.getValue();
if (value == TOO_COMPLEX) return null;
final Collection<PsiExpression> expressions = value == null ? null : value.get(variable);
return expressions == null ? Collections.<PsiExpression>emptyList() : expressions;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:35,代码来源:DfaUtil.java
示例20: modify
import com.intellij.openapi.util.MultiValuesMap; //导入依赖的package包/类
@Override
public Collection<AbstractTreeNode> modify(AbstractTreeNode parent, 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;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:34,代码来源:SameNamesJoiner.java
注:本文中的com.intellij.openapi.util.MultiValuesMap类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论