本文整理汇总了Java中com.intellij.util.containers.MultiMap.entrySet方法的典型用法代码示例。如果您正苦于以下问题:Java MultiMap.entrySet方法的具体用法?Java MultiMap.entrySet怎么用?Java MultiMap.entrySet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.containers.MultiMap
的用法示例。
在下文中一共展示了MultiMap.entrySet方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stripAndMerge
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
boolean stripAndMerge(Collection<DfaMemoryStateImpl> group,
Function<DfaMemoryStateImpl, DfaMemoryStateImpl> stripper) {
if (group.size() <= 1) return false;
boolean hasMerges = false;
MultiMap<DfaMemoryStateImpl, DfaMemoryStateImpl> strippedToOriginals = MultiMap.create();
for (DfaMemoryStateImpl original : group) {
strippedToOriginals.putValue(stripper.fun(original), original);
}
for (Map.Entry<DfaMemoryStateImpl, Collection<DfaMemoryStateImpl>> entry : strippedToOriginals.entrySet()) {
Collection<DfaMemoryStateImpl> merged = entry.getValue();
if (merged.size() > 1) {
myRemovedStates.addAll(merged);
myMerged.add(entry.getKey());
hasMerges = true;
}
}
return hasMerges;
}
示例2: buildVisitor
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly) {
return new SchemaVisitor() {
@Override
public void visitImports(@NotNull SchemaImports schemaTypeImports) {
super.visitImports(schemaTypeImports);
List<SchemaImportStatement> imports = schemaTypeImports.getImportStatementList();
MultiMap<Qn, SchemaImportStatement> importsByQn = ImportsManager.getImportsByQn(imports);
for (Map.Entry<Qn, Collection<SchemaImportStatement>> entry : importsByQn.entrySet()) {
entry.getValue().stream()
.filter(is -> entry.getValue().size() > 1)
.forEach(is -> holder.registerProblem(is,
InspectionBundle.message("import.duplicate.problem.descriptor"),
OptimizeImportsQuickFix.INSTANCE));
}
}
};
}
示例3: buildVisitor
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly) {
return new SchemaVisitor() {
@Override
public void visitImports(@NotNull SchemaImports schemaTypeImports) {
super.visitImports(schemaTypeImports);
List<SchemaImportStatement> imports = schemaTypeImports.getImportStatementList();
MultiMap<Qn, SchemaImportStatement> importsByQn = ImportsManager.getImportsByQn(imports);
for (Map.Entry<Qn, Collection<SchemaImportStatement>> entry : importsByQn.entrySet()) {
entry.getValue().stream()
.filter(is -> DEFAULT_IMPORTS_LIST.contains(entry.getKey()))
.forEach(is -> holder.registerProblem(is,
InspectionBundle.message("import.unnecessary.problem.descriptor"),
ProblemHighlightType.LIKE_UNUSED_SYMBOL,
OptimizeImportsQuickFix.INSTANCE));
}
}
};
}
示例4: importData
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@Override
public void importData(@NotNull Collection<DataNode<ModuleDependencyData>> toImport,
@Nullable ProjectData projectData,
@NotNull Project project,
@NotNull IdeModifiableModelsProvider modelsProvider) {
MultiMap<DataNode<ModuleData>, DataNode<ModuleDependencyData>> byModule = ExternalSystemApiUtil.groupBy(toImport, MODULE);
for (Map.Entry<DataNode<ModuleData>, Collection<DataNode<ModuleDependencyData>>> entry : byModule.entrySet()) {
Module ideModule = modelsProvider.findIdeModule(entry.getKey().getData());
if (ideModule == null) {
LOG.warn(String.format(
"Can't import module dependencies %s. Reason: target module (%s) is not found at the ide and can't be imported",
entry.getValue(), entry.getKey()
));
continue;
}
importData(entry.getValue(), ideModule, modelsProvider);
}
}
示例5: importData
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@Override
public void importData(@NotNull Collection<DataNode<ContentRootData>> toImport,
@Nullable ProjectData projectData,
@NotNull Project project,
@NotNull IdeModifiableModelsProvider modelsProvider) {
if (toImport.isEmpty()) {
return;
}
MultiMap<DataNode<ModuleData>, DataNode<ContentRootData>> byModule = ExternalSystemApiUtil.groupBy(toImport, ProjectKeys.MODULE);
for (Map.Entry<DataNode<ModuleData>, Collection<DataNode<ContentRootData>>> entry : byModule.entrySet()) {
Module module = modelsProvider.findIdeModule(entry.getKey().getData());
if (module == null) {
LOG.warn(String.format(
"Can't import content roots. Reason: target module (%s) is not found at the ide. Content roots: %s",
entry.getKey(), entry.getValue()
));
continue;
}
importData(modelsProvider, entry.getValue(), module);
}
}
示例6: importData
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@Override
public void importData(@NotNull Collection<DataNode<LibraryDependencyData>> toImport,
@Nullable ProjectData projectData,
@NotNull Project project,
@NotNull IdeModifiableModelsProvider modelsProvider) {
if (toImport.isEmpty()) {
return;
}
MultiMap<DataNode<ModuleData>, DataNode<LibraryDependencyData>> byModule = ExternalSystemApiUtil.groupBy(toImport, MODULE);
for (Map.Entry<DataNode<ModuleData>, Collection<DataNode<LibraryDependencyData>>> entry : byModule.entrySet()) {
Module module = modelsProvider.findIdeModule(entry.getKey().getData());
if (module == null) {
LOG.warn(String.format(
"Can't import library dependencies %s. Reason: target module (%s) is not found at the ide and can't be imported",
entry.getValue(), entry.getKey()
));
continue;
}
importData(entry.getValue(), module, modelsProvider);
}
}
示例7: merge
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
private void merge(MultiMap<Integer, Pair<Integer, TextDiffTypeEnum>> leftMap,
final Map<Integer, Pair<String, TextDiffTypeEnum>> whereTo) {
for (Map.Entry<Integer, Collection<Pair<Integer, TextDiffTypeEnum>>> entry : leftMap.entrySet()) {
List<Pair<Integer, TextDiffTypeEnum>> value = (List<Pair<Integer, TextDiffTypeEnum>>) entry.getValue();
if (value.size() > 1) {
Pair<Integer, TextDiffTypeEnum> pair1 = value.iterator().next();
Pair<Integer, TextDiffTypeEnum> pair2 = value.get(value.size() - 1);
TextDiffTypeEnum type = mergeDiffType(value);
whereTo.put(entry.getKey(), Pair.create(String.valueOf(pair1.getFirst()) + "-" +
String.valueOf(pair2.getFirst()), type));
} else {
Pair<Integer, TextDiffTypeEnum> pair = value.iterator().next();
whereTo.put(entry.getKey(), Pair.create(String.valueOf(pair.getFirst()), pair.getSecond()));
}
}
}
示例8: processUnderFile
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
private void processUnderFile(VirtualFile file) {
final MultiMap<VirtualFile, FileAnnotation> annotations = new MultiMap<VirtualFile, FileAnnotation>();
synchronized (myLock) {
for (VirtualFile virtualFile : myFileAnnotationMap.keySet()) {
if (VfsUtilCore.isAncestor(file, virtualFile, true)) {
final Collection<FileAnnotation> values = myFileAnnotationMap.get(virtualFile);
for (FileAnnotation value : values) {
annotations.putValue(virtualFile, value);
}
}
}
}
if (! annotations.isEmpty()) {
for (Map.Entry<VirtualFile, Collection<FileAnnotation>> entry : annotations.entrySet()) {
final VirtualFile key = entry.getKey();
final VcsRevisionNumber number = fromDiffProvider(key);
if (number == null) continue;
final Collection<FileAnnotation> fileAnnotations = entry.getValue();
for (FileAnnotation annotation : fileAnnotations) {
if (annotation.isBaseRevisionChanged(number)) {
annotation.close();
}
}
}
}
}
示例9: initTree
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
public void initTree(@NotNull MultiMap<String, PostfixTemplate> langToTemplates) {
myRoot.removeAllChildren();
for (Map.Entry<String, Collection<PostfixTemplate>> entry : langToTemplates.entrySet()) {
String id = entry.getKey();
Language language = Language.findLanguageByID(id);
String langName = language != null ? language.getDisplayName() : id;
CheckedTreeNode langNode = new CheckedTreeNode(langName);
myRoot.add(langNode);
for (PostfixTemplate template : entry.getValue()) {
CheckedTreeNode templateNode = new PostfixTemplateCheckedTreeNode(template, langName);
langNode.add(templateNode);
}
}
myModel.nodeStructureChanged(myRoot);
TreeUtil.expandAll(this);
setSelectionRow(0);
}
示例10: buildVisitor
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) {
return new JsonElementVisitor() {
@Override
public void visitObject(@NotNull JsonObject o) {
final MultiMap<String, PsiElement> keys = new MultiMap<String, PsiElement>();
for (JsonProperty property : o.getPropertyList()) {
keys.putValue(property.getName(), property.getNameElement());
}
for (Map.Entry<String, Collection<PsiElement>> entry : keys.entrySet()) {
final Collection<PsiElement> sameNamedKeys = entry.getValue();
if (sameNamedKeys.size() > 1) {
for (PsiElement element : sameNamedKeys) {
holder.registerProblem(element, JsonBundle.message("inspection.duplicate.keys.msg.duplicate.keys", entry.getKey()));
}
}
}
}
};
}
示例11: patchGroupsToOneGroup
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
public static List<FilePatch> patchGroupsToOneGroup(MultiMap<VirtualFile, TextFilePatchInProgress> patchGroups, VirtualFile baseDir)
throws IOException {
final List<FilePatch> textPatches = new ArrayList<FilePatch>();
final String baseDirPath = baseDir.getPath();
for (Map.Entry<VirtualFile, Collection<TextFilePatchInProgress>> entry : patchGroups.entrySet()) {
final VirtualFile vf = entry.getKey();
final String currBasePath = vf.getPath();
final String relativePath = VfsUtilCore.getRelativePath(vf, baseDir, '/');
final boolean toConvert = !StringUtil.isEmptyOrSpaces(relativePath) && !".".equals(relativePath);
for (TextFilePatchInProgress patchInProgress : entry.getValue()) {
final TextFilePatch patch = patchInProgress.getPatch();
if (toConvert) {
//correct paths
patch.setBeforeName(convertRelativePath(patch.getBeforeName(), currBasePath, baseDirPath));
patch.setAfterName(convertRelativePath(patch.getAfterName(), currBasePath, baseDirPath));
}
textPatches.add(patch);
}
}
return textPatches;
}
示例12: getSourceRoots
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public VirtualFile[] getSourceRoots(Module module, ProtoPsiFileRoot psiFileRoot) {
try {
if (GET_INSTANCE != null && GET_RESOURCE_ROOTS != null) {
Object configurationInstance = GET_INSTANCE.invoke(null, module.getProject());
if (configurationInstance != null) {
List<VirtualFile> result = new ArrayList<>();
MultiMap<String, String> resourceRoots = (MultiMap<String, String>) GET_RESOURCE_ROOTS.invoke(configurationInstance);
for (Map.Entry<String, Collection<String>> entry : resourceRoots.entrySet()) {
for (String uri : entry.getValue()) {
if (!Strings.isNullOrEmpty(uri) && uri.startsWith("file://")) {
String path = uri.substring(7);
VirtualFile file = LocalFileSystem.getInstance().findFileByPath(path);
if (file != null && file.isDirectory()) {
result.add(file);
}
}
}
}
return result.toArray(new VirtualFile[0]);
}
}
} catch (Exception e) {
LOGGER.warn("Could not get source roots for WebCore IDE", e);
}
return new VirtualFile[0];
}
示例13: convertToSingleElementMap
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@Nullable
private Map<Repo, VcsFullCommitDetails> convertToSingleElementMap(@NotNull MultiMap<Repo, VcsFullCommitDetails> groupedCommits) {
Map<Repo, VcsFullCommitDetails> map = ContainerUtil.newHashMap();
for (Map.Entry<Repo, Collection<VcsFullCommitDetails>> entry : groupedCommits.entrySet()) {
Collection<VcsFullCommitDetails> commits = entry.getValue();
if (commits.size() != 1) {
return null;
}
map.put(entry.getKey(), commits.iterator().next());
}
return map;
}
示例14: buildTree
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
public Set<PsiFile> buildTree(DefaultMutableTreeNode root, ConfigFileSearcher... searchers) {
final Set<PsiFile> psiFiles = new com.intellij.util.containers.HashSet<PsiFile>();
final MultiMap<Module, PsiFile> files = new MultiMap<Module, PsiFile>();
final MultiMap<VirtualFile, PsiFile> jars = new MultiMap<VirtualFile, PsiFile>();
final MultiMap<VirtualFile, PsiFile> virtualFiles = new MultiMap<VirtualFile, PsiFile>();
for (ConfigFileSearcher searcher : searchers) {
files.putAllValues(searcher.getFilesByModules());
jars.putAllValues(searcher.getJars());
virtualFiles.putAllValues(searcher.getVirtualFiles());
}
psiFiles.addAll(buildModuleNodes(files, jars, root));
for (Map.Entry<VirtualFile, Collection<PsiFile>> entry : virtualFiles.entrySet()) {
DefaultMutableTreeNode node = createFileNode(entry.getKey());
List<PsiFile> list = new ArrayList<PsiFile>(entry.getValue());
Collections.sort(list, FILE_COMPARATOR);
for (PsiFile file : list) {
node.add(createFileNode(file));
}
root.add(node);
}
return psiFiles;
}
示例15: hasNonEmptyGroups
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
private boolean hasNonEmptyGroups(MultiMap<FileType, PsiFile> filesByType) {
byte nonEmptyGroups = 0;
for (Map.Entry<FileType, Collection<PsiFile>> entry : filesByType.entrySet()) {
Collection<PsiFile> files = entry.getValue();
if (files != null && files.size() > 0) nonEmptyGroups++;
}
return nonEmptyGroups > 1;
}