本文整理汇总了Java中com.intellij.util.containers.MultiMap.get方法的典型用法代码示例。如果您正苦于以下问题:Java MultiMap.get方法的具体用法?Java MultiMap.get怎么用?Java MultiMap.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.containers.MultiMap
的用法示例。
在下文中一共展示了MultiMap.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: acceptName
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
public static boolean acceptName(GrReferenceElement ref, String expected) {
final String actual = ref.getReferenceName();
if (expected.equals(actual)) return true;
if (ref.getQualifier() != null) return false;
final PsiFile file = ref.getContainingFile();
if (file instanceof GroovyFile) {
MultiMap<String, String> data = KEY.getCachedValue(file);
if (data == null) {
data = collectAliases((GroovyFile)file);
KEY.putCachedValue(file, data);
}
final Collection<String> aliases = data.get(expected);
return aliases.contains(actual);
}
return false;
}
示例2: processMethods
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
public boolean processMethods(PsiScopeProcessor processor, @NotNull ResolveState state, PsiType qualifierType, Project project) {
if (qualifierType == null) return true;
NameHint nameHint = processor.getHint(NameHint.KEY);
String name = nameHint == null ? null : nameHint.getName(state);
final MultiMap<String, PsiMethod> map = name != null ? myOriginalMethodsByNameAndType.get(name) : myOriginalMethodByType.getValue();
if (map.isEmpty()) {
return true;
}
for (String superType : ResolveUtil.getAllSuperTypes(qualifierType, project)) {
for (PsiMethod method : map.get(superType)) {
String info = GdkMethodUtil.generateOriginInfo(method);
GrGdkMethod gdk = GrGdkMethodImpl.createGdkMethod(method, myStatic, info);
if (!processor.execute(gdk, state)) {
return false;
}
}
}
return true;
}
示例3: buildSwitchedFiles
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
private void buildSwitchedFiles(final MultiMap<String, VirtualFile> switchedFiles) {
ChangesBrowserNode baseNode = ChangesBrowserNode.create(myProject, ChangesBrowserNode.SWITCHED_FILES_TAG);
model.insertNodeInto(baseNode, root, root.getChildCount());
for(String branchName: switchedFiles.keySet()) {
final List<VirtualFile> switchedFileList = new ArrayList<VirtualFile>(switchedFiles.get(branchName));
if (switchedFileList.size() > 0) {
ChangesBrowserNode branchNode = ChangesBrowserNode.create(myProject, branchName);
model.insertNodeInto(branchNode, baseNode, baseNode.getChildCount());
final ChangesGroupingPolicy policy = createGroupingPolicy();
Collections.sort(switchedFileList, VirtualFileHierarchicalComparator.getInstance());
for (VirtualFile file : switchedFileList) {
insertChangeNode(file, policy, branchNode, defaultNodeCreator(file));
}
}
}
}
示例4: addContextNode
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
private static void addContextNode(MultiMap<TemplateContextType, TemplateContextType> hierarchy,
CheckedTreeNode parent,
TemplateContextType type, TemplateContext context) {
final Collection<TemplateContextType> children = hierarchy.get(type);
final String name = UIUtil.removeMnemonic(type.getPresentableName());
final CheckedTreeNode node = new CheckedTreeNode(Pair.create(children.isEmpty() ? type : null, name));
parent.add(node);
if (children.isEmpty()) {
node.setChecked(context.isExplicitlyEnabled(type));
}
else {
for (TemplateContextType child : children) {
addContextNode(hierarchy, node, child, context);
}
final CheckedTreeNode other = new CheckedTreeNode(Pair.create(type, "Other"));
other.setChecked(context.isExplicitlyEnabled(type));
node.add(other);
}
}
示例5: convertDescription
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@NotNull
private static MultiMap<PsiElement, String> convertDescription(
@NotNull final MultiMap<PyClass, PyMemberInfo<?>> duplicateConflictDescriptions,
@NotNull final Collection<PyMemberInfo<?>> dependenciesConflicts) {
final MultiMap<PsiElement, String> result = new MultiMap<PsiElement, String>();
for (final PyClass aClass : duplicateConflictDescriptions.keySet()) {
for (final PyMemberInfo<?> pyMemberInfo : duplicateConflictDescriptions.get(aClass)) {
final String message = RefactoringBundle.message("0.already.contains.a.1",
RefactoringUIUtil.getDescription(aClass, false),
RefactoringUIUtil.getDescription(pyMemberInfo.getMember(), false));
result.putValue(aClass, message);
}
}
for (final PyMemberInfo<?> memberUnderConflict : dependenciesConflicts) {
result.putValue(memberUnderConflict.getMember(), PyBundle.message(
"refactoring.will.not.be.accessible",
RefactoringUIUtil.getDescription(memberUnderConflict.getMember(), false)
)
);
}
return result;
}
示例6: processIncludingFiles
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@Override
public void processIncludingFiles(PsiFile context, Processor<Pair<VirtualFile, FileIncludeInfo>> processor) {
context = context.getOriginalFile();
VirtualFile contextFile = context.getVirtualFile();
if (contextFile == null) return;
MultiMap<VirtualFile,FileIncludeInfoImpl> infoList = FileIncludeIndex.getIncludingFileCandidates(context.getName(), GlobalSearchScope.allScope(myProject));
for (VirtualFile candidate : infoList.keySet()) {
PsiFile psiFile = myPsiManager.findFile(candidate);
if (psiFile == null || context.equals(psiFile)) continue;
for (FileIncludeInfo info : infoList.get(candidate)) {
PsiFileSystemItem item = resolveFileInclude(info, psiFile);
if (item != null && contextFile.equals(item.getVirtualFile())) {
if (!processor.process(Pair.create(candidate, info))) {
return;
}
}
}
}
}
示例7: mergeByUnknowns
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@Nullable
public List<DfaMemoryStateImpl> mergeByUnknowns(List<DfaMemoryStateImpl> states) {
MultiMap<Integer, DfaMemoryStateImpl> byHash = new MultiMap<Integer, DfaMemoryStateImpl>();
for (DfaMemoryStateImpl state : states) {
ProgressManager.checkCanceled();
byHash.putValue(state.getPartialHashCode(false, true), state);
}
Replacements replacements = new Replacements(states);
for (Integer key : byHash.keySet()) {
Collection<DfaMemoryStateImpl> similarStates = byHash.get(key);
if (similarStates.size() < 2) continue;
for (final DfaMemoryStateImpl state1 : similarStates) {
ProgressManager.checkCanceled();
List<DfaMemoryStateImpl> complementary = ContainerUtil.filter(similarStates, new Condition<DfaMemoryStateImpl>() {
@Override
public boolean value(DfaMemoryStateImpl state2) {
return state1.equalsByRelations(state2) && state1.equalsByVariableStates(state2);
}
});
if (mergeUnknowns(replacements, complementary)) break;
}
}
return replacements.getMergeResult();
}
示例8: preprocessUsages
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@Override
protected boolean preprocessUsages(@NotNull Ref<UsageInfo[]> refUsages) {
MultiMap<PsiElement, String> conflictDescriptions = new MultiMap<PsiElement, String>();
for (ChangeSignatureUsageProcessor usageProcessor : ChangeSignatureUsageProcessor.EP_NAME.getExtensions()) {
final MultiMap<PsiElement, String> conflicts = usageProcessor.findConflicts(myChangeInfo, refUsages);
for (PsiElement key : conflicts.keySet()) {
Collection<String> collection = conflictDescriptions.get(key);
if (collection.isEmpty()) collection = new HashSet<String>();
collection.addAll(conflicts.get(key));
conflictDescriptions.put(key, collection);
}
}
final UsageInfo[] usagesIn = refUsages.get();
RenameUtil.addConflictDescriptions(usagesIn, conflictDescriptions);
Set<UsageInfo> usagesSet = new HashSet<UsageInfo>(Arrays.asList(usagesIn));
RenameUtil.removeConflictUsages(usagesSet);
if (!conflictDescriptions.isEmpty()) {
if (ApplicationManager.getApplication().isUnitTestMode()) {
throw new ConflictsInTestsException(conflictDescriptions.values());
}
ConflictsDialog dialog = prepareConflictsDialog(conflictDescriptions, usagesIn);
if (!dialog.showAndGet()) {
if (dialog.isShowConflicts()) prepareSuccessful();
return false;
}
}
refUsages.set(usagesSet.toArray(new UsageInfo[usagesSet.size()]));
prepareSuccessful();
return true;
}
示例9: convertMap
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
private static Map<String, PsiMethod[]> convertMap(MultiMap<String, PsiMethod> multiMap) {
Map<String, PsiMethod[]> res = new HashMap<String, PsiMethod[]>();
for (String methodName : multiMap.keySet()) {
Collection<PsiMethod> m = multiMap.get(methodName);
res.put(methodName, m.toArray(new PsiMethod[m.size()]));
}
return res;
}
示例10: buildItems
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
private List<TemplateItem> buildItems(MultiMap<TemplatesGroup, ProjectTemplate> map) {
List<TemplateItem> items = new ArrayList<TemplateItem>();
List<TemplatesGroup> groups = new ArrayList<TemplatesGroup>(map.keySet());
Collections.sort(groups);
for (TemplatesGroup group : groups) {
for (ProjectTemplate template : map.get(group)) {
TemplateItem templateItem = new TemplateItem(template, group);
items.add(templateItem);
}
}
return items;
}
示例11: createNodes
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@NotNull
public List<ExternalSystemNode<?>> createNodes(@NotNull ExternalProjectsView externalProjectsView,
@Nullable ExternalSystemNode<?> parent,
@NotNull DataNode<?> dataNode) {
final List<ExternalSystemNode<?>> result = new SmartList<ExternalSystemNode<?>>();
final MultiMap<Key<?>, DataNode<?>> groups = ExternalSystemApiUtil.group(dataNode.getChildren());
for (ExternalSystemViewContributor contributor : ExternalSystemViewContributor.EP_NAME.getExtensions()) {
Set<Key<?>> keys = ContainerUtil.newTreeSet(contributor.getKeys());
final MultiMap<Key<?>, DataNode<?>> dataNodes = MultiMap.create();
for (Key<?> key : keys) {
final Collection<DataNode<?>> values = groups.get(key);
if(key != null) {
dataNodes.put(key, values);
}
}
if (dataNodes.isEmpty()) continue;
final List<ExternalSystemNode<?>> childNodes = contributor.createNodes(externalProjectsView, dataNodes);
result.addAll(childNodes);
if (parent == null) continue;
for (ExternalSystemNode childNode : childNodes) {
childNode.setParent(parent);
}
}
return result;
}
示例12: checkDependencies
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
private static void checkDependencies(@NotNull MavenDomProjectModel projectModel,
@NotNull DomElementAnnotationHolder holder) {
MultiMap<DependencyConflictId, MavenDomDependency> allDuplicates = getDuplicateDependenciesMap(projectModel);
for (MavenDomDependency dependency : projectModel.getDependencies().getDependencies()) {
DependencyConflictId id = DependencyConflictId.create(dependency);
if (id != null) {
Collection<MavenDomDependency> dependencies = allDuplicates.get(id);
if (dependencies.size() > 1) {
List<MavenDomDependency> duplicatedDependencies = new ArrayList<MavenDomDependency>();
for (MavenDomDependency d : dependencies) {
if (d == dependency) continue;
if (d.getParent() == dependency.getParent()) {
duplicatedDependencies.add(d); // Dependencies in the same file must be unique by groupId:artifactId:type:classifier
}
else {
if (scope(d).equals(scope(dependency))
&& Comparing.equal(d.getVersion().getStringValue(), dependency.getVersion().getStringValue())) {
duplicatedDependencies.add(d); // Dependencies in different files must not have same groupId:artifactId:VERSION:type:classifier:SCOPE
}
}
}
if (duplicatedDependencies.size() > 0) {
addProblem(dependency, duplicatedDependencies, holder);
}
}
}
}
}
示例13: GdkMethodHolder
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
private GdkMethodHolder(final PsiClass categoryClass, final boolean isStatic, final GlobalSearchScope scope) {
myStatic = isStatic;
myScope = scope;
final MultiMap<String, PsiMethod> byName = new MultiMap<String, PsiMethod>();
myPsiManager = categoryClass.getManager();
for (PsiMethod m : categoryClass.getMethods()) {
final PsiParameter[] params = m.getParameterList().getParameters();
if (params.length == 0) continue;
if (PsiUtil.isDGMMethod(m) && (PsiImplUtil.isDeprecatedByAnnotation(m) || PsiImplUtil.isDeprecatedByDocTag(m))) {
continue;
}
byName.putValue(m.getName(), m);
}
this.myOriginalMethodByType = new VolatileNotNullLazyValue<MultiMap<String, PsiMethod>>() {
@NotNull
@Override
protected MultiMap<String, PsiMethod> compute() {
MultiMap<String, PsiMethod> map = new MultiMap<String, PsiMethod>();
for (PsiMethod method : byName.values()) {
if (!method.hasModifierProperty(PsiModifier.PUBLIC)) continue;
map.putValue(getCategoryTargetType(method).getCanonicalText(), method);
}
return map;
}
};
myOriginalMethodsByNameAndType = new ConcurrentFactoryMap<String, MultiMap<String, PsiMethod>>() {
@Override
protected MultiMap<String, PsiMethod> create(String name) {
MultiMap<String, PsiMethod> map = new MultiMap<String, PsiMethod>();
for (PsiMethod method : byName.get(name)) {
map.putValue(getCategoryTargetType(method).getCanonicalText(), method);
}
return map;
}
};
}
示例14: revisionsConvertor
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
public static List<BeforeAfter<AirContentRevision>> revisionsConvertor(final Project project, final List<Change> changes) throws VcsException {
final List<BeforeAfter<AirContentRevision>> result = new ArrayList<BeforeAfter<AirContentRevision>>(changes.size());
final Convertor<Change, FilePath> beforePrefferingConvertor = new Convertor<Change, FilePath>() {
public FilePath convert(Change o) {
final FilePath before = ChangesUtil.getBeforePath(o);
return before == null ? ChangesUtil.getAfterPath(o) : before;
}
};
final MultiMap<VcsRoot,Change> byRoots = new SortByVcsRoots<Change>(project, beforePrefferingConvertor).sort(changes);
for (VcsRoot root : byRoots.keySet()) {
final Collection<Change> rootChanges = byRoots.get(root);
if (root.getVcs() == null || root.getVcs().getOutgoingChangesProvider() == null) {
addConvertChanges(rootChanges, result);
continue;
}
final VcsOutgoingChangesProvider<?> provider = root.getVcs().getOutgoingChangesProvider();
final Collection<Change> basedOnLocal = provider.filterLocalChangesBasedOnLocalCommits(rootChanges, root.getPath());
rootChanges.removeAll(basedOnLocal);
addConvertChanges(rootChanges, result);
for (Change change : basedOnLocal) {
// dates are here instead of numbers
result.add(new BeforeAfter<AirContentRevision>(convertRevision(change.getBeforeRevision(), provider),
convertRevision(change.getAfterRevision(), provider)));
}
}
return result;
}
示例15: groupLocations
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
public Pair<List<RepositoryLocationGroup>, List<RepositoryLocation>> groupLocations(final List<RepositoryLocation> in) {
final List<RepositoryLocationGroup> groups = new ArrayList<RepositoryLocationGroup>();
final List<RepositoryLocation> singles = new ArrayList<RepositoryLocation>();
final MultiMap<SVNURL, RepositoryLocation> map = new MultiMap<SVNURL, RepositoryLocation>();
for (RepositoryLocation location : in) {
final SvnRepositoryLocation svnLocation = (SvnRepositoryLocation) location;
final String url = svnLocation.getURL();
final SVNURL root = SvnUtil.getRepositoryRoot(myVcs, url);
if (root == null) {
// should not occur
LOG.info("repository root not found for location:"+ location.toPresentableString());
singles.add(location);
} else {
map.putValue(root, svnLocation);
}
}
final Set<SVNURL> keys = map.keySet();
for (SVNURL key : keys) {
final Collection<RepositoryLocation> repositoryLocations = map.get(key);
if (repositoryLocations.size() == 1) {
singles.add(repositoryLocations.iterator().next());
} else {
final SvnRepositoryLocationGroup group = new SvnRepositoryLocationGroup(key, repositoryLocations);
groups.add(group);
}
}
return Pair.create(groups, singles);
}