本文整理汇总了Java中com.intellij.util.containers.ContainerUtil.filter方法的典型用法代码示例。如果您正苦于以下问题:Java ContainerUtil.filter方法的具体用法?Java ContainerUtil.filter怎么用?Java ContainerUtil.filter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.containers.ContainerUtil
的用法示例。
在下文中一共展示了ContainerUtil.filter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: collectPatterns
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private static void collectPatterns(final Project project,
final Set<String> patterns,
final String classFQName,
final String methodName,
final String frameworkId) throws IOException {
final TestDiscoveryIndex discoveryIndex = TestDiscoveryIndex.getInstance(project);
final Collection<String> testsByMethodName = discoveryIndex.getTestsByMethodName(classFQName, methodName);
if (testsByMethodName != null) {
for (String pattern : ContainerUtil.filter(testsByMethodName, new Condition<String>() {
@Override
public boolean value(String s) {
return s.startsWith(frameworkId);
}
})) {
patterns.add(pattern.substring(frameworkId.length()).replace('-', ','));
}
}
}
示例2: checkoutNewBranch
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public void checkoutNewBranch(@NotNull final String name, @NotNull List<GitRepository> repositories) {
updateInfo(repositories);
repositories = ContainerUtil.filter(repositories, new Condition<GitRepository>() {
@Override
public boolean value(GitRepository repository) {
GitLocalBranch currentBranch = repository.getCurrentBranch();
return currentBranch == null || !currentBranch.getName().equals(name);
}
});
if (!repositories.isEmpty()) {
new GitCheckoutNewBranchOperation(myProject, myFacade, myGit, myUiHandler, repositories, name).execute();
}
else {
LOG.error("Creating new branch the same as current in all repositories: " + name);
}
}
示例3: toCandidateInfoArray
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
public static ResolveResult[] toCandidateInfoArray(@Nullable List<? extends PsiElement> elements) {
if (elements == null) {
return ResolveResult.EMPTY_ARRAY;
}
elements = ContainerUtil.filter(elements, (Condition<PsiElement>) Objects::nonNull);
final ResolveResult[] result = new ResolveResult[elements.size()];
for (int i = 0, size = elements.size(); i < size; i++) {
result[i] = new PsiElementResolveResult(elements.get(i));
}
return result;
}
示例4: resolveMember
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Nullable
@Override
public List<? extends RatedResolveResult> resolveMember(@NotNull String name,
@Nullable PyExpression location,
@NotNull AccessDirection direction,
@NotNull PyResolveContext resolveContext) {
final PsiElement resolved = myImportedModule.resolve();
if (resolved != null) {
final PsiFile containingFile = location != null ? location.getContainingFile() : null;
List<PsiElement> elements = Collections.singletonList(ResolveImportUtil.resolveChild(resolved, name, containingFile, false, true));
final PyImportElement importElement = myImportedModule.getImportElement();
if (location != null && importElement != null && PyUtil.inSameFile(location, importElement) &&
ResolveImportUtil.getPointInImport(location) == PointInImport.NONE && resolved instanceof PsiFileSystemItem) {
final List<PsiElement> importedSubmodules = PyModuleType.collectImportedSubmodules((PsiFileSystemItem)resolved, location);
if (importedSubmodules != null) {
final Set<PsiElement> imported = Sets.newHashSet(importedSubmodules);
elements = ContainerUtil.filter(elements, new Condition<PsiElement>() {
@Override
public boolean value(PsiElement element) {
return imported.contains(element);
}
});
}
}
return ResolveImportUtil.rateResults(elements);
}
return null;
}
示例5: setUp
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public void setUp() throws Exception {
super.setUp();
List<VcsLogProvider> providers =
ContainerUtil.filter(Extensions.getExtensions(VcsLogManager.LOG_PROVIDER_EP, myProject), new Condition<VcsLogProvider>() {
@Override
public boolean value(VcsLogProvider provider) {
return provider.getSupportedVcs().equals(GitVcs.getKey());
}
});
assertEquals("Incorrect number of GitLogProviders", 1, providers.size());
myLogProvider = (GitLogProvider)providers.get(0);
myObjectsFactory = ServiceManager.getService(myProject, VcsLogObjectsFactory.class);
}
示例6: mergeByUnknowns
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的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();
}
示例7: getBranches
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private static List<VcsRef> getBranches(Collection<VcsRef> refs) {
return ContainerUtil.filter(refs, new Condition<VcsRef>() {
@Override
public boolean value(VcsRef ref) {
return ref.getType().isBranch();
}
});
}
示例8: inferContracts
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
List<MethodContract> inferContracts() {
List<MethodContract> contracts = doInferContracts();
if (contracts.isEmpty()) return contracts;
PsiTypeElement typeElement = myMethod.getReturnTypeElement();
final PsiType returnType = typeElement == null ? null : typeElement.getType();
boolean referenceTypeReturned = !(returnType instanceof PsiPrimitiveType);
final boolean notNull = referenceTypeReturned &&
NullableNotNullManager.getInstance(myMethod.getProject()).isNotNull(myMethod, false);
if (referenceTypeReturned) {
contracts = boxReturnValues(contracts);
}
List<MethodContract> compatible = ContainerUtil.filter(contracts, new Condition<MethodContract>() {
@Override
public boolean value(MethodContract contract) {
if (notNull && contract.returnValue == NOT_NULL_VALUE) {
return false;
}
return InferenceFromSourceUtil.isReturnTypeCompatible(returnType, contract.returnValue);
}
});
if (compatible.size() > ContractInference.MAX_CONTRACT_COUNT) {
LOG.debug("Too many contracts for " + PsiUtil.getMemberQualifiedName(myMethod) + ", shrinking the list");
return compatible.subList(0, ContractInference.MAX_CONTRACT_COUNT);
}
return compatible;
}
示例9: filterReturning
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private static List<MethodContract> filterReturning(List<MethodContract> values, final ValueConstraint result) {
return ContainerUtil.filter(values, new Condition<MethodContract>() {
@Override
public boolean value(MethodContract contract) {
return contract.returnValue == result;
}
});
}
示例10: process
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private static void process(PsiField psiField, Collection<? super RelatedItemLineMarkerInfo> result) {
if (!isExtensionPointNameDeclarationField(psiField)) return;
final PsiClass epClass = resolveExtensionPointClass(psiField);
if (epClass == null) return;
final String epName = resolveEpName(psiField);
if (epName == null) return;
ExtensionPointLocator locator = new ExtensionPointLocator(epClass);
List<ExtensionPointCandidate> targets =
ContainerUtil.filter(locator.findDirectCandidates(), new Condition<ExtensionPointCandidate>() {
@Override
public boolean value(ExtensionPointCandidate candidate) {
return epName.equals(candidate.epName);
}
});
final RelatedItemLineMarkerInfo<PsiElement> info = NavigationGutterIconBuilder
.create(AllIcons.Nodes.Plugin, CONVERTER, RELATED_ITEM_PROVIDER)
.setTargets(targets)
.setPopupTitle("Choose Extension Point")
.setTooltipText("Extension Point Declaration")
.setAlignment(GutterIconRenderer.Alignment.RIGHT)
.createLineMarkerInfo(psiField.getNameIdentifier());
result.add(info);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:ExtensionPointDeclarationRelatedItemLineMarkerProvider.java
示例11: doDoTest
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
protected Collection<HighlightInfo> doDoTest(final boolean checkWarnings, final boolean checkInfos, final boolean checkWeakWarnings) {
return ContainerUtil.filter(
checkHighlighting(new ExpectedHighlightingData(myEditor.getDocument(), checkWarnings, checkWeakWarnings, checkInfos, myFile)),
new Condition<HighlightInfo>() {
@Override
public boolean value(HighlightInfo info) {
return info.getSeverity() == HighlightSeverity.INFORMATION && checkInfos ||
info.getSeverity() == HighlightSeverity.WARNING && checkWarnings ||
info.getSeverity() == HighlightSeverity.WEAK_WARNING && checkWeakWarnings ||
info.getSeverity().compareTo(HighlightSeverity.WARNING) > 0;
}
});
}
示例12: getDirectoriesByPackageName
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
public Query<VirtualFile> getDirectoriesByPackageName(@NotNull final String packageName, final boolean includeLibrarySources) {
// Note that this method is used in upsource as well, hence, don't reduce this method's visibility.
List<VirtualFile> result = myPackageDirectoryCache.getDirectoriesByPackageName(packageName);
if (!includeLibrarySources) {
result = ContainerUtil.filter(result, new Condition<VirtualFile>() {
@Override
public boolean value(VirtualFile file) {
DirectoryInfo info = getInfoForFile(file);
return info.isInProject() && (!info.isInLibrarySource() || info.isInModuleSource() || info.hasLibraryClassRoot());
}
});
}
return new CollectionQuery<VirtualFile>(result);
}
示例13: filterByReadOnliness
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
private static VirtualFile[] filterByReadOnliness(@NotNull VirtualFile[] files) {
List<VirtualFile> result = ContainerUtil.filter(files, new Condition<VirtualFile>() {
@Override
public boolean value(VirtualFile file) {
return file.isInLocalFileSystem();
}
});
return VfsUtilCore.toVirtualFileArray(result);
}
示例14: getDescriptorsToFrame
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private List<DeviceArtDescriptor> getDescriptorsToFrame(final BufferedImage image) {
double imgAspectRatio = image.getWidth() / (double) image.getHeight();
final ScreenOrientation orientation =
imgAspectRatio >= (1 - ImageUtils.EPSILON) ? ScreenOrientation.LANDSCAPE : ScreenOrientation.PORTRAIT;
List<DeviceArtDescriptor> allDescriptors = DeviceArtDescriptor.getDescriptors(null);
return ContainerUtil.filter(allDescriptors, new Condition<DeviceArtDescriptor>() {
@Override
public boolean value(DeviceArtDescriptor descriptor) {
return descriptor.canFrameImage(image, orientation);
}
});
}
示例15: resolvePackageName
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public Collection<PsiPackage> resolvePackageName(@Nullable PsiPackage context, final String packageName) {
if (context != null) {
return ContainerUtil.filter(context.getSubPackages(getResolveScope()), new Condition<PsiPackage>() {
@Override
public boolean value(PsiPackage aPackage) {
return Comparing.equal(aPackage.getName(), packageName);
}
});
}
return Collections.emptyList();
}