本文整理汇总了Java中com.intellij.util.containers.ContainerUtil.map2List方法的典型用法代码示例。如果您正苦于以下问题:Java ContainerUtil.map2List方法的具体用法?Java ContainerUtil.map2List怎么用?Java ContainerUtil.map2List使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.containers.ContainerUtil
的用法示例。
在下文中一共展示了ContainerUtil.map2List方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: invoke
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
public void invoke(@NotNull Project project,
@NotNull PsiFile file,
@Nullable("is null when called from inspection") Editor editor,
@NotNull PsiElement startElement,
@NotNull PsiElement endElement) {
PsiClass myTargetClass = (PsiClass)startElement;
if (!FileModificationService.getInstance().preparePsiElementForWrite(myTargetClass.getContainingFile())) return;
PsiMethod method = createMethod(myTargetClass);
List<Pair<PsiExpression, PsiType>> arguments =
ContainerUtil.map2List(method.getParameterList().getParameters(), new Function<PsiParameter, Pair<PsiExpression, PsiType>>() {
@Override
public Pair<PsiExpression, PsiType> fun(PsiParameter psiParameter) {
return Pair.create(null, psiParameter.getType());
}
});
method = (PsiMethod)JavaCodeStyleManager.getInstance(project).shortenClassReferences(myTargetClass.add(method));
CreateMethodFromUsageFix.doCreate(myTargetClass, method, arguments, PsiSubstitutor.EMPTY, ExpectedTypeInfo.EMPTY_ARRAY, method);
}
示例2: collectAndCheckHighlightings
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private long collectAndCheckHighlightings(final boolean checkWarnings,
final boolean checkInfos,
final boolean checkWeakWarnings,
@NotNull VirtualFile[] files) {
final List<Trinity<PsiFile, Editor, ExpectedHighlightingData>> datas =
ContainerUtil.map2List(files, new Function<VirtualFile, Trinity<PsiFile, Editor, ExpectedHighlightingData>>() {
@Override
public Trinity<PsiFile, Editor, ExpectedHighlightingData> fun(final VirtualFile file) {
final PsiFile psiFile = myPsiManager.findFile(file);
Assert.assertNotNull(psiFile);
final Document document = PsiDocumentManager.getInstance(getProject()).getDocument(psiFile);
Assert.assertNotNull(document);
ExpectedHighlightingData data = new ExpectedHighlightingData(document, checkWarnings, checkWeakWarnings, checkInfos, psiFile);
data.init();
return Trinity.create(psiFile, createEditor(file), data);
}
});
long elapsed = 0;
for (Trinity<PsiFile, Editor, ExpectedHighlightingData> trinity : datas) {
myEditor = trinity.second;
myFile = trinity.first.getVirtualFile();
elapsed += collectAndCheckHighlighting(trinity.third);
}
return elapsed;
}
示例3: execute
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public void execute() throws HgCommandException, VcsException {
if (StringUtil.isEmptyOrSpaces(myMessage)) {
throw new HgCommandException(HgVcsMessages.message("hg4idea.commit.error.messageEmpty"));
}
if (myFiles.isEmpty()) {
executeChunked(Collections.<List<String>>emptyList());
}
else {
List<String> relativePaths = ContainerUtil.map2List(myFiles, new Function<HgFile, String>() {
@Override
public String fun(HgFile file) {
return file.getRelativePath();
}
});
List<List<String>> chunkedCommits = VcsFileUtil.chunkRelativePaths(relativePaths);
executeChunked(chunkedCommits);
}
myRepository.update();
final MessageBus messageBus = myProject.getMessageBus();
messageBus.syncPublisher(HgVcs.REMOTE_TOPIC).update(myProject, null);
}
示例4: overrideOrImplementMethods
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
public static List<PsiGenerationInfo<PsiMethod>> overrideOrImplementMethods(PsiClass aClass,
Collection<PsiMethodMember> candidates,
boolean toCopyJavaDoc,
boolean toInsertAtOverride)
throws IncorrectOperationException {
List<CandidateInfo> candidateInfos = ContainerUtil.map2List(candidates, new Function<PsiMethodMember, CandidateInfo>() {
@Override
public CandidateInfo fun(final PsiMethodMember s) {
return new CandidateInfo(s.getElement(), s.getSubstitutor());
}
});
final List<PsiMethod> methods = overrideOrImplementMethodCandidates(aClass, candidateInfos, toCopyJavaDoc, toInsertAtOverride);
return convert2GenerationInfos(methods);
}
示例5: convert2GenerationInfos
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public static List<PsiGenerationInfo<PsiMethod>> convert2GenerationInfos(final Collection<PsiMethod> methods) {
return ContainerUtil.map2List(methods, new Function<PsiMethod, PsiGenerationInfo<PsiMethod>>() {
@Override
public PsiGenerationInfo<PsiMethod> fun(final PsiMethod s) {
return createGenerationInfo(s);
}
});
}
示例6: resolvePackage
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public Collection<PsiPackage> resolvePackage() {
final PsiPackageReference packageReference = getLastReference();
if (packageReference == null) {
return Collections.emptyList();
}
return ContainerUtil.map2List(packageReference.multiResolve(false), new NullableFunction<ResolveResult, PsiPackage>() {
@Override
public PsiPackage fun(final ResolveResult resolveResult) {
return (PsiPackage)resolveResult.getElement();
}
});
}
示例7: getRecentGroup
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
private static List<List<String>> getRecentGroup(Deque<UserGroup> stateField) {
return ContainerUtil.map2List(stateField, new Function<UserGroup, List<String>>() {
@Override
public List<String> fun(UserGroup group) {
return group.users;
}
});
}
示例8: virtualToIoFiles
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public static List<File> virtualToIoFiles(@NotNull Collection<VirtualFile> scope) {
return ContainerUtil.map2List(scope, new Function<VirtualFile, File>() {
@Override
public File fun(VirtualFile file) {
return virtualToIoFile(file);
}
});
}
示例9: mapToList
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public static <T, U> List<Pair<T, U>> mapToList(Map<T, U> map) {
return ContainerUtil.map2List(map.entrySet(), new Function<Map.Entry<T, U>, Pair<T, U>>() {
public Pair<T, U> fun(Map.Entry<T, U> tuEntry) {
return Pair.create(tuEntry.getKey(), tuEntry.getValue());
}
});
}
示例10: toAbsolute
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
public static List<String> toAbsolute(@NotNull Collection<String> relPaths, @NotNull final Project project) {
return ContainerUtil.map2List(relPaths, new Function<String, String>() {
@Override
public String fun(String s) {
try {
return FileUtil.toSystemIndependentName((new File(project.getBasePath() + "/" + s).getCanonicalPath()));
}
catch (IOException e) {
e.printStackTrace();
return "";
}
}
});
}
示例11: getSDKVersions
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public Collection<String> getSDKVersions(Library[] libraries) {
return ContainerUtil.map2List(libraries, new Function<Library, String>() {
@Override
public String fun(Library library) {
return getSDKLibVersion(library);
}
});
}
示例12: FileTemplateNode
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
FileTemplateNode(FileTemplateDescriptor descriptor) {
this(descriptor.getDisplayName(),
descriptor.getIcon(),
descriptor instanceof FileTemplateGroupDescriptor ? ContainerUtil.map2List(((FileTemplateGroupDescriptor)descriptor).getTemplates(), new Function<FileTemplateDescriptor, FileTemplateNode>() {
@Override
public FileTemplateNode fun(FileTemplateDescriptor s) {
return new FileTemplateNode(s);
}
}) : Collections.<FileTemplateNode>emptyList(),
descriptor instanceof FileTemplateGroupDescriptor ? null : descriptor.getFileName());
}
示例13: getPatternsAndMatchers
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
private static List<Pair<String, MinusculeMatcher>> getPatternsAndMatchers(@NotNull String qualifierPattern, @NotNull final ChooseByNameBase base) {
return ContainerUtil.map2List(split(qualifierPattern, base), new Function<String, Pair<String, MinusculeMatcher>>() {
@NotNull
@Override
public Pair<String, MinusculeMatcher> fun(String s) {
String namePattern = addSearchAnywherePatternDecorationIfNeeded(base, getNamePattern(base, s));
return Pair.create(namePattern, buildPatternMatcher(namePattern, NameUtil.MatchingCaseSensitivity.NONE));
}
});
}
示例14: createEnumFactory
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
static Factory<List<Pair<String, Icon>>> createEnumFactory(final Class<? extends Enum> aClass) {
return new Factory<List<Pair<String, Icon>>>() {
@Override
public List<Pair<String, Icon>> create() {
return ContainerUtil.map2List(aClass.getEnumConstants(), new Function<Enum, Pair<String, Icon>>() {
@Override
public Pair<String, Icon> fun(final Enum s) {
return Pair.create(NamedEnumUtil.getEnumValueByElement(s), ElementPresentationManager.getIcon(s));
}
});
}
};
}
示例15: generateMemberPrototypes
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
@NotNull
protected List<? extends GenerationInfo> generateMemberPrototypes(PsiClass aClass, ClassMember[] originalMembers) throws IncorrectOperationException {
Project project = aClass.getProject();
final boolean useInstanceofToCheckParameterType = CodeInsightSettings.getInstance().USE_INSTANCEOF_ON_EQUALS_PARAMETER;
GroovyGenerateEqualsHelper helper = new GroovyGenerateEqualsHelper(project, aClass, myEqualsFields, myHashCodeFields, myNonNullFields, useInstanceofToCheckParameterType);
Collection<PsiMethod> methods = helper.generateMembers();
return ContainerUtil.map2List(methods, new Function<PsiMethod, PsiGenerationInfo<PsiMethod>>() {
@Override
public PsiGenerationInfo<PsiMethod> fun(final PsiMethod s) {
return new GroovyGenerationInfo<PsiMethod>(s);
}
});
}