本文整理汇总了Java中com.intellij.util.CommonProcessors.FindFirstProcessor方法的典型用法代码示例。如果您正苦于以下问题:Java CommonProcessors.FindFirstProcessor方法的具体用法?Java CommonProcessors.FindFirstProcessor怎么用?Java CommonProcessors.FindFirstProcessor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.CommonProcessors
的用法示例。
在下文中一共展示了CommonProcessors.FindFirstProcessor方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hasStubElementsOfType
import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
public boolean hasStubElementsOfType(final DomFileElement domFileElement,
final Class<? extends DomElement> clazz) {
final VirtualFile file = domFileElement.getFile().getVirtualFile();
if (!(file instanceof VirtualFileWithId)) return false;
final String clazzName = clazz.getName();
final int virtualFileId = ((VirtualFileWithId)file).getId();
CommonProcessors.FindFirstProcessor<? super PsiFile> processor =
new CommonProcessors.FindFirstProcessor<PsiFile>();
StubIndex.getInstance().processElements(KEY, clazzName,
domFileElement.getFile().getProject(),
GlobalSearchScope.fileScope(domFileElement.getFile()),
new IdFilter() {
@Override
public boolean containsFileId(int id) {
return id == virtualFileId;
}
},
PsiFile.class,
processor
);
return processor.isFound();
}
示例2: hasStubElementsWithNamespaceKey
import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
public boolean hasStubElementsWithNamespaceKey(final DomFileElement domFileElement, final String namespaceKey) {
final VirtualFile file = domFileElement.getFile().getVirtualFile();
if (!(file instanceof VirtualFileWithId)) return false;
final int virtualFileId = ((VirtualFileWithId)file).getId();
CommonProcessors.FindFirstProcessor<PsiFile> processor = new CommonProcessors.FindFirstProcessor<PsiFile>();
StubIndex.getInstance().processElements(
KEY,
namespaceKey,
domFileElement.getFile().getProject(),
GlobalSearchScope.fileScope(domFileElement.getFile()),
new IdFilter() {
@Override
public boolean containsFileId(int id) {
return id == virtualFileId;
}
},
PsiFile.class,
processor
);
return processor.isFound();
}
示例3: hasStubElementsOfType
import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
public boolean hasStubElementsOfType(final DomFileElement domFileElement, final Class<? extends DomElement> clazz)
{
final VirtualFile file = domFileElement.getFile().getVirtualFile();
if(!(file instanceof VirtualFileWithId))
{
return false;
}
final String clazzName = clazz.getName();
final int virtualFileId = ((VirtualFileWithId) file).getId();
CommonProcessors.FindFirstProcessor<? super PsiFile> processor = new CommonProcessors.FindFirstProcessor<PsiFile>();
StubIndex.getInstance().process(KEY, clazzName, domFileElement.getFile().getProject(), GlobalSearchScope.fileScope(domFileElement.getFile())
, new IdFilter()
{
@Override
public boolean containsFileId(int id)
{
return id == virtualFileId;
}
}, processor);
return processor.isFound();
}
示例4: hasStubElementsWithNamespaceKey
import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
public boolean hasStubElementsWithNamespaceKey(final DomFileElement domFileElement, final String namespaceKey)
{
final VirtualFile file = domFileElement.getFile().getVirtualFile();
if(!(file instanceof VirtualFileWithId))
{
return false;
}
final int virtualFileId = ((VirtualFileWithId) file).getId();
CommonProcessors.FindFirstProcessor<PsiFile> processor = new CommonProcessors.FindFirstProcessor<PsiFile>();
StubIndex.getInstance().process(KEY, namespaceKey, domFileElement.getFile().getProject(), GlobalSearchScope.fileScope(domFileElement.getFile
()), new IdFilter()
{
@Override
public boolean containsFileId(int id)
{
return id == virtualFileId;
}
}, processor);
return processor.isFound();
}
示例5: findDeepestSuper
import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
@NotNull
public static PsiMethod findDeepestSuper(@NotNull final PsiMethod method) {
CommonProcessors.FindFirstProcessor<PsiMethod> processor = new CommonProcessors.FindFirstProcessor<PsiMethod>();
MethodDeepestSuperSearcher.processDeepestSuperMethods(method, processor);
final PsiMethod first = processor.getFoundValue();
return first == null ? method : first;
}
示例6: findAnnotatedMethod
import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
@Nullable
public final <T extends Annotation> Method findAnnotatedMethod(final Class<T> annotationClass, final Class startFrom) {
CommonProcessors.FindFirstProcessor<Method> processor = new CommonProcessors.FindFirstProcessor<Method>() {
@Override
protected boolean accept(Method method) {
final T annotation = method.getAnnotation(annotationClass);
return annotation != null && ReflectionUtil.isAssignable(method.getDeclaringClass(), startFrom);
}
};
processMethods(startFrom, processor);
return processor.getFoundValue();
}
示例7: findAnnotation
import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
@Nullable
public final <T extends Annotation> T findAnnotation(final Class<T> annotationClass, final Class startFrom) {
CommonProcessors.FindFirstProcessor<Method> processor = new CommonProcessors.FindFirstProcessor<Method>() {
@Override
protected boolean accept(Method method) {
final T annotation = method.getAnnotation(annotationClass);
return annotation != null;
}
};
processMethods(startFrom, processor);
final Method foundMethod = processor.getFoundValue();
return foundMethod == null ? null : foundMethod.getAnnotation(annotationClass);
}
示例8: getImplementation
import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
@Nullable
public static <T, V> V getImplementation(final T element, final Class<V> clazz) {
if (element == null) return null;
CommonProcessors.FindFirstProcessor<T> processor = new CommonProcessors.FindFirstProcessor<T>() {
@Override
public boolean process(final T t) {
return !ReflectionUtil.isAssignable(clazz, t.getClass()) || super.process(t);
}
};
new ImplementationProcessor<T>(processor, true).process(element);
return (V)processor.getFoundValue();
}
示例9: getImplementation
import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
@Nullable
public static <T, V> V getImplementation(final T element, final Class<V> clazz) {
if (element == null) return null;
CommonProcessors.FindFirstProcessor<T> processor = new CommonProcessors.FindFirstProcessor<T>() {
public boolean process(final T t) {
return !ReflectionCache.isAssignable(clazz, t.getClass()) || super.process(t);
}
};
new ImplementationProcessor<T>(processor, true).process(element);
return (V)processor.getFoundValue();
}
示例10: getImplementation
import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
@Nullable
public static <T, V> V getImplementation(final T element, final Class<V> clazz) {
if (element == null) return null;
CommonProcessors.FindFirstProcessor<T> processor = new CommonProcessors.FindFirstProcessor<T>() {
public boolean process(final T t) {
return !ReflectionUtil.isAssignable(clazz, t.getClass()) || super.process(t);
}
};
new ImplementationProcessor<T>(processor, true).process(element);
return (V)processor.getFoundValue();
}
示例11: findPackage
import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
@Override
public PsiJavaPackage findPackage(@NotNull String qualifiedName)
{
final CommonProcessors.FindFirstProcessor<VirtualFile> processor = new CommonProcessors.FindFirstProcessor<>();
processDirectories(qualifiedName, ALL_SCOPE, processor);
return processor.getFoundValue() != null ? createPackage(qualifiedName) : null;
}
示例12: findDeepestSuper
import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
@NotNull
public static PsiMethod findDeepestSuper(@NotNull final PsiMethod method)
{
CommonProcessors.FindFirstProcessor<PsiMethod> processor = new CommonProcessors.FindFirstProcessor<>();
MethodDeepestSuperSearcher.processDeepestSuperMethods(method, processor);
final PsiMethod first = processor.getFoundValue();
return first == null ? method : first;
}
示例13: findPackage
import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
@Override
public PsiPackage findPackage(@NotNull String qualifiedName) {
final CommonProcessors.FindFirstProcessor<VirtualFile> processor = new CommonProcessors.FindFirstProcessor<VirtualFile>();
processDirectories(qualifiedName, ALL_SCOPE, processor);
return processor.getFoundValue() != null ? createPackage(qualifiedName) : null;
}