本文整理汇总了Java中com.intellij.util.CommonProcessors.FindProcessor方法的典型用法代码示例。如果您正苦于以下问题:Java CommonProcessors.FindProcessor方法的具体用法?Java CommonProcessors.FindProcessor怎么用?Java CommonProcessors.FindProcessor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.CommonProcessors
的用法示例。
在下文中一共展示了CommonProcessors.FindProcessor方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findSuiteSymbol
import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
@Nullable
private static OCStructSymbol findSuiteSymbol(Project project, String suite) {
CommonProcessors.FindProcessor<OCSymbol> processor =
new CommonProcessors.FindProcessor<OCSymbol>() {
@Override
protected boolean accept(OCSymbol symbol) {
return symbol instanceof OCStructSymbol
&& CidrGoogleTestUtil.isGoogleTestClass((OCStructSymbol) symbol);
}
};
OCGlobalProjectSymbolsCache.processTopLevelAndMemberSymbols(project, processor, suite);
if (processor.isFound()) {
return (OCStructSymbol) processor.getFoundValue();
}
Collection<OCStructSymbol> symbolsForSuite =
CidrGoogleTestUtil.findGoogleTestSymbolsForSuiteSorted(project, suite);
return Iterables.getFirst(symbolsForSuite, null);
}
示例2: findModuleDependency
import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
private Optional<Library> findModuleDependency(Module module, VirtualFile sourceVF) {
final CommonProcessors.FindProcessor<OrderEntry> processor = new CommonProcessors.FindProcessor<OrderEntry>() {
@Override
protected boolean accept(OrderEntry orderEntry) {
final String[] urls = orderEntry.getUrls(OrderRootType.CLASSES);
final boolean contains = Arrays.asList(urls).contains("jar://" + sourceVF.getPath() + "!/");
return contains && orderEntry instanceof LibraryOrderEntry;
}
};
ModuleRootManager.getInstance(module).orderEntries().forEach(processor);
Library result = null;
if (processor.getFoundValue() != null) {
result = ((LibraryOrderEntry) processor.getFoundValue()).getLibrary();
}
return Optional.ofNullable(result);
}
示例3: isEntryPoint
import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
@Override
public boolean isEntryPoint(@NotNull PsiElement psiElement) {
if (ADD_JUNIT_TO_ENTRIES) {
if (psiElement instanceof PsiClass) {
final PsiClass aClass = (PsiClass)psiElement;
if (JUnitUtil.isTestClass(aClass, false, true)) {
if (!PsiClassUtil.isRunnableClass(aClass, true, true)) {
final PsiClass topLevelClass = PsiTreeUtil.getTopmostParentOfType(aClass, PsiClass.class);
if (topLevelClass != null && PsiClassUtil.isRunnableClass(topLevelClass, true, true)) {
return true;
}
final CommonProcessors.FindProcessor<PsiClass> findProcessor = new CommonProcessors.FindProcessor<PsiClass>() {
@Override
protected boolean accept(PsiClass psiClass) {
return !psiClass.hasModifierProperty(PsiModifier.ABSTRACT);
}
};
return !ClassInheritorsSearch.search(aClass).forEach(findProcessor) && findProcessor.isFound();
}
return true;
}
}
else if (psiElement instanceof PsiMethod) {
final PsiMethod method = (PsiMethod)psiElement;
if (method.isConstructor() && method.getParameterList().getParametersCount() == 0) {
return JUnitUtil.isTestClass(method.getContainingClass());
}
if (JUnitUtil.isTestMethodOrConfig(method)) return true;
}
}
return false;
}
示例4: findUserLibrary
import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
public static Library findUserLibrary(@NotNull Module module, @NotNull final String name) {
CommonProcessors.FindProcessor<Library> processor = new CommonProcessors.FindProcessor<Library>() {
@Override
protected boolean accept(Library library) {
String libraryName = library.getName();
return libraryName != null && libraryName.startsWith(name);
}
};
OrderEnumerator.orderEntries(module).forEachLibrary(processor);
return processor.getFoundValue();
}
示例5: isEntryPoint
import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
@Override
public boolean isEntryPoint(PsiElement psiElement) {
if (ADD_JUNIT_TO_ENTRIES) {
if (psiElement instanceof PsiClass) {
final PsiClass aClass = (PsiClass)psiElement;
if (JUnitUtil.isTestClass(aClass, false, true)) {
if (!PsiClassUtil.isRunnableClass(aClass, true, true)) {
final CommonProcessors.FindProcessor<PsiClass> findProcessor = new CommonProcessors.FindProcessor<PsiClass>() {
@Override
protected boolean accept(PsiClass psiClass) {
return !psiClass.hasModifierProperty(PsiModifier.ABSTRACT);
}
};
return !ClassInheritorsSearch.search(aClass).forEach(findProcessor) && findProcessor.isFound();
}
return true;
}
}
else if (psiElement instanceof PsiMethod) {
final PsiMethod method = (PsiMethod)psiElement;
if (method.isConstructor() && method.getParameterList().getParametersCount() == 0) {
return JUnitUtil.isTestClass(method.getContainingClass());
}
if (JUnitUtil.isTestMethodOrConfig(method)) return true;
}
}
return false;
}
示例6: forEachScript
import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
@Override
public Script forEachScript(@NotNull CommonProcessors.FindProcessor<Script> scriptProcessor) {
forEachScript(((Processor<Script>)scriptProcessor));
return scriptProcessor.getFoundValue();
}
示例7: forEachScript
import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
@Nullable
Script forEachScript(@NotNull CommonProcessors.FindProcessor<Script> scriptProcessor);