本文整理汇总了Java中com.intellij.util.containers.MultiMap.putValue方法的典型用法代码示例。如果您正苦于以下问题:Java MultiMap.putValue方法的具体用法?Java MultiMap.putValue怎么用?Java MultiMap.putValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.containers.MultiMap
的用法示例。
在下文中一共展示了MultiMap.putValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computeChildren
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@Override
protected MultiMap<PsiFile, ClassNode> computeChildren(@Nullable PsiFile psiFile) {
MultiMap<PsiFile, ClassNode> children = new MultiMap<>();
children.putValue(aggregateRoot.getContainingFile(), new AggregateRootNode(this, aggregateRoot));
Project project = getProject();
if (project != null) {
JavaPsiFacade javaPsiFacade = JavaPsiFacade.getInstance(project);
PsiClass entityInterface = javaPsiFacade.findClass(ENTITY_INTERFACE, GlobalSearchScope.allScope(project));
PsiClass valueObjectInterface = javaPsiFacade.findClass(VO_INTERFACE, GlobalSearchScope.allScope(project));
if (entityInterface != null && valueObjectInterface != null) {
for (PsiClass psiClass : psiPackage.getClasses(GlobalSearchScope.allScope(project))) {
if (psiClass.isInheritor(entityInterface, true) && !psiClass.equals(aggregateRoot)) {
children.putValue(psiClass.getContainingFile(), new EntityNode(this, psiClass));
} else if (psiClass.isInheritor(valueObjectInterface, true)) {
children.putValue(psiClass.getContainingFile(), new ValueObjectNode(this, psiClass));
}
}
}
}
return children;
}
示例2: addInaccessibleMemberConflicts
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
public static void addInaccessibleMemberConflicts(final PsiElement element,
final UsageInfo[] usages,
final ReferencedElementsCollector collector,
final MultiMap<PsiElement, String> conflicts) {
element.accept(collector);
final Map<PsiMember, Set<PsiMember>> containersToReferenced = getInaccessible(collector.myReferencedMembers, usages, element);
final Set<PsiMember> containers = containersToReferenced.keySet();
for (PsiMember container : containers) {
Set<PsiMember> referencedInaccessible = containersToReferenced.get(container);
for (PsiMember referenced : referencedInaccessible) {
final String referencedDescription = RefactoringUIUtil.getDescription(referenced, true);
final String containerDescription = RefactoringUIUtil.getDescription(container, true);
String message = RefactoringBundle.message("0.that.is.used.in.inlined.method.is.not.accessible.from.call.site.s.in.1",
referencedDescription, containerDescription);
conflicts.putValue(container, CommonRefactoringUtil.capitalize(message));
}
}
}
示例3: 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;
}
示例4: invoke
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
private static void invoke(final Project project, Editor editor, PsiFile file, boolean isInteractive) {
PsiParameter psiParameter = FieldFromParameterUtils.findParameterAtCursor(file, editor);
if (!FileModificationService.getInstance().prepareFileForWrite(file)) return;
final PsiMethod method = psiParameter != null ? (PsiMethod)psiParameter.getDeclarationScope() : PsiTreeUtil.getParentOfType(file.findElementAt(editor.getCaretModel().getOffset()), PsiMethod.class);
LOG.assertTrue(method != null);
final HashSet<String> usedNames = new HashSet<String>();
final Iterable<PsiParameter> parameters = selectParameters(project, method, copyUnboundedParamsAndClearOriginal(method), isInteractive);
final MultiMap<PsiType, PsiParameter> types = new MultiMap<PsiType, PsiParameter>();
for (PsiParameter parameter : parameters) {
types.putValue(parameter.getType(), parameter);
}
final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(project);
final boolean preferLongerNames = settings.PREFER_LONGER_NAMES;
for (PsiParameter selected : parameters) {
try {
settings.PREFER_LONGER_NAMES = preferLongerNames || types.get(selected.getType()).size() > 1;
processParameter(project, selected, usedNames);
} finally {
settings.PREFER_LONGER_NAMES = preferLongerNames;
}
}
}
示例5: addImportElementDeclaration
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
private void addImportElementDeclaration(PyImportElement importElement,
Map<String, PsiElement> localDeclarations,
MultiMap<String, PsiElement> ambiguousDeclarations) {
final String visibleName = importElement.getVisibleName();
if (visibleName != null) {
if (ambiguousDeclarations.containsKey(visibleName)) {
ambiguousDeclarations.putValue(visibleName, importElement);
}
else if (localDeclarations.containsKey(visibleName)) {
final PsiElement oldElement = localDeclarations.get(visibleName);
ambiguousDeclarations.putValue(visibleName, oldElement);
ambiguousDeclarations.putValue(visibleName, importElement);
}
else {
localDeclarations.put(visibleName, importElement);
}
}
}
示例6: preprocessUsages
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@Override
protected boolean preprocessUsages(@NotNull Ref<UsageInfo[]> refUsages) {
final MultiMap<PsiElement, String> conflicts = new MultiMap<PsiElement, String>();
for (PsiFile psiFile : myFilesToMove.keySet()) {
try {
myFilesToMove.get(psiFile).checkMove(psiFile);
}
catch (IncorrectOperationException e) {
conflicts.putValue(psiFile, e.getMessage());
}
}
for (MoveDirectoryWithClassesHelper helper : MoveDirectoryWithClassesHelper.findAll()) {
helper.preprocessUsages(myProject, myFilesToMove.keySet(), refUsages.get(), myTargetDirectory, conflicts);
}
return showConflicts(conflicts, refUsages.get());
}
示例7: groupRefsByRoot
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@NotNull
public static MultiMap<VirtualFile, VcsRef> groupRefsByRoot(@NotNull Collection<VcsRef> refs) {
MultiMap<VirtualFile, VcsRef> map = new MultiMap<VirtualFile, VcsRef>() {
@NotNull
@Override
protected Map<VirtualFile, Collection<VcsRef>> createMap() {
return new TreeMap<VirtualFile, Collection<VcsRef>>(new Comparator<VirtualFile>() { // TODO common to VCS root sorting method
@Override
public int compare(VirtualFile o1, VirtualFile o2) {
return o1.getPresentableUrl().compareTo(o2.getPresentableUrl());
}
});
}
};
for (VcsRef ref : refs) {
map.putValue(ref.getRoot(), ref);
}
return map;
}
示例8: preprocessUsages
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@Override
protected boolean preprocessUsages(@NotNull Ref<UsageInfo[]> refUsages) {
final MultiMap<PsiElement, String> conflicts = new MultiMap<PsiElement, String>();
final JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(myProject);
final PsiClass builderClass =
psiFacade.findClass(StringUtil.getQualifiedName(myPackageName, myClassName), GlobalSearchScope.projectScope(myProject));
if (builderClass == null) {
if (!myCreateNewBuilderClass) {
conflicts.putValue(null, "Selected class was not found.");
}
} else if (myCreateNewBuilderClass){
conflicts.putValue(builderClass, "Class with chosen name already exist.");
}
if (myMoveDestination != null && myCreateNewBuilderClass) {
myMoveDestination.analyzeModuleConflicts(Collections.<PsiElement>emptyList(), conflicts, refUsages.get());
}
final PsiMethod commonConstructor = getMostCommonConstructor();
if (commonConstructor == null) {
conflicts.putValue(null, "Found constructors are not reducible to simple chain");
}
return showConflicts(conflicts, refUsages.get());
}
示例9: GroovyInplaceFieldValidator
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
public GroovyInplaceFieldValidator(GrIntroduceContext context) {
super(context, new ConflictReporter() {
@Override
public void check(PsiElement toCheck, MultiMap<PsiElement, String> conflicts, String varName) {
if (toCheck instanceof GrVariable && varName.equals(((GrVariable)toCheck).getName())) {
conflicts.putValue(toCheck, GroovyRefactoringBundle.message("field.0.is.already.defined", CommonRefactoringUtil.htmlEmphasize(varName)));
}
if (toCheck instanceof GrMethod) {
if (GroovyPropertyUtils.isSimplePropertyAccessor((PsiMethod)toCheck) &&
varName.equals(GroovyPropertyUtils.getPropertyNameByAccessorName(((PsiMethod)toCheck).getName()))) {
conflicts.putValue(toCheck, GroovyRefactoringBundle
.message("access.to.created.field.0.will.be.overriden.by.method.1", CommonRefactoringUtil.htmlEmphasize(varName),
CommonRefactoringUtil.htmlEmphasize(DescriptiveNameUtil.getDescriptiveName(toCheck))));
}
}
}
});
}
示例10: findConflicts
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
public void findConflicts(IntroduceParameterData data, UsageInfo[] usages, final MultiMap<PsiElement, String> conflicts) {
final PsiMethod method = data.getMethodToReplaceIn();
final int parametersCount = method.getParameterList().getParametersCount();
for (UsageInfo usage : usages) {
if (!isMethodUsage(usage)) continue;
final PsiElement element = usage.getElement();
final PsiCall call = RefactoringUtil.getCallExpressionByMethodReference(element);
final PsiExpressionList argList = call.getArgumentList();
if (argList != null) {
final int actualParamLength = argList.getExpressions().length;
if ((method.isVarArgs() && actualParamLength + 1 < parametersCount) ||
(!method.isVarArgs() && actualParamLength < parametersCount)) {
conflicts.putValue(call, "Incomplete call(" + call.getText() +"): " + parametersCount + " parameters expected but only " + actualParamLength + " found");
}
data.getParametersToRemove().forEach(new TIntProcedure() {
public boolean execute(int paramNum) {
if (paramNum >= actualParamLength) {
conflicts.putValue(call, "Incomplete call(" + call.getText() +"): expected to delete the " + paramNum + " parameter but only " + actualParamLength + " parameters found");
}
return true;
}
});
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:JavaIntroduceParameterMethodUsagesProcessor.java
示例11: preprocessUsages
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@Override
protected boolean preprocessUsages(@NotNull Ref<UsageInfo[]> refUsages) {
final MultiMap<PsiElement, String> conflicts = new MultiMap<PsiElement, String>();
final PsiTypeParameter[] parameters = myClass.getTypeParameters();
final Map<String, TypeParameterInfo> infos = new HashMap<String, TypeParameterInfo>();
for (TypeParameterInfo info : myNewSignature) {
final String newName = info.isForExistingParameter() ? parameters[info.getOldParameterIndex()].getName() : info.getNewName();
TypeParameterInfo existing = infos.get(newName);
if (existing != null) {
conflicts.putValue(myClass, RefactoringUIUtil.getDescription(myClass, false) + " already contains type parameter " + newName);
}
infos.put(newName, info);
}
return showConflicts(conflicts, refUsages.get());
}
示例12: 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();
}
}
}
}
}
示例13: computeChildren
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@Override
public MultiMap<PsiFile, SeedStackSimpleNode> computeChildren(PsiFile psiFile) {
if (!initialized) {
MultiMap<PsiFile, SeedStackSimpleNode> children = new MultiMap<>();
for (NavigatorSectionProvider sectionProvider : ServiceLoader.load(NavigatorSectionProvider.class, SeedStackStructure.class.getClassLoader())) {
children.putValue(null, sectionProvider.getSectionNode(this));
}
initialized = true;
return children;
} else {
return null;
}
}
示例14: computeChildren
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
@Override
public MultiMap<PsiFile, ConfigFileNode> computeChildren(PsiFile psiFile) {
Project project = getProject();
MultiMap<PsiFile, ConfigFileNode> children = new MultiMap<>();
if (project != null) {
PsiManager psiManager = PsiManager.getInstance(project);
for (VirtualFile virtualFile : CoffigUtil.findCoffigFiles(getProject())) {
PsiFile file = psiManager.findFile(virtualFile);
children.putValue(file, new ConfigFileNode(this, psiManager.findFile(virtualFile)));
}
}
return children;
}
示例15: checkConflicts
import com.intellij.util.containers.MultiMap; //导入方法依赖的package包/类
protected static void checkConflicts(final Ref<UsageInfo[]> refUsages, final MultiMap<PsiElement,String> conflicts) {
for (UsageInfo info : refUsages.get()) {
final String conflict = ((FixableUsageInfo)info).getConflictMessage();
if (conflict != null) {
conflicts.putValue(info.getElement(), XmlUtil.escape(conflict));
}
}
}