本文整理汇总了Java中com.intellij.openapi.application.ReadActionProcessor类的典型用法代码示例。如果您正苦于以下问题:Java ReadActionProcessor类的具体用法?Java ReadActionProcessor怎么用?Java ReadActionProcessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ReadActionProcessor类属于com.intellij.openapi.application包,在下文中一共展示了ReadActionProcessor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: processPackageDirectories
import com.intellij.openapi.application.ReadActionProcessor; //导入依赖的package包/类
@Override
public boolean processPackageDirectories(@NotNull PsiPackage psiPackage,
@NotNull final GlobalSearchScope scope,
@NotNull final Processor<PsiDirectory> consumer,
boolean includeLibrarySources) {
//System.out.println( "processDirectories() : " + psiPackage + " : " + scope );
final PsiManager psiManager = PsiManager.getInstance( _project );
return PackageIndex.getInstance( _project )
.getDirsByPackageName(psiPackage.getQualifiedName(), includeLibrarySources)
.forEach(new ReadActionProcessor<VirtualFile>() {
@Override
public boolean processInReadAction(final VirtualFile dir) {
if (!scope.contains(dir)) return true;
PsiDirectory psiDir = psiManager.findDirectory(dir);
return psiDir == null || consumer.process(psiDir);
}
});
}
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:20,代码来源:ManTypeFinder.java
示例2: createImplicitDefaultAnnotationMethodConsumer
import com.intellij.openapi.application.ReadActionProcessor; //导入依赖的package包/类
public static ReadActionProcessor<PsiReference> createImplicitDefaultAnnotationMethodConsumer(final Processor<PsiReference> consumer) {
return new ReadActionProcessor<PsiReference>() {
@Override
public boolean processInReadAction(final PsiReference reference) {
if (reference instanceof PsiJavaCodeReferenceElement) {
PsiJavaCodeReferenceElement javaReference = (PsiJavaCodeReferenceElement)reference;
if (javaReference.getParent() instanceof PsiAnnotation) {
PsiNameValuePair[] members = ((PsiAnnotation)javaReference.getParent()).getParameterList().getAttributes();
if (members.length == 1 && members[0].getNameIdentifier() == null) {
PsiReference t = members[0].getReference();
if (t != null && !consumer.process(t)) return false;
}
}
}
return true;
}
};
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:PsiAnnotationMethodReferencesSearcher.java
示例3: processPackageDirectories
import com.intellij.openapi.application.ReadActionProcessor; //导入依赖的package包/类
@Override
public boolean processPackageDirectories(@NotNull PsiPackage psiPackage,
@NotNull final GlobalSearchScope scope,
@NotNull final Processor<PsiDirectory> consumer,
boolean includeLibrarySources) {
final PsiManager psiManager = PsiManager.getInstance(myProject);
return PackageIndex.getInstance(myProject)
.getDirsByPackageName(psiPackage.getQualifiedName(), includeLibrarySources)
.forEach(new ReadActionProcessor<VirtualFile>() {
@Override
public boolean processInReadAction(final VirtualFile dir) {
if (!scope.contains(dir)) return true;
PsiDirectory psiDir = psiManager.findDirectory(dir);
return psiDir == null || consumer.process(psiDir);
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:PsiElementFinderImpl.java
示例4: addAliasingUsages
import com.intellij.openapi.application.ReadActionProcessor; //导入依赖的package包/类
private static boolean addAliasingUsages(@NotNull PomTarget pomTarget,
@NotNull final FindUsagesOptions options,
@NotNull final Processor<UsageInfo> processor) {
for (AliasingPsiTargetMapper aliasingPsiTargetMapper : Extensions.getExtensions(AliasingPsiTargetMapper.EP_NAME)) {
for (final AliasingPsiTarget psiTarget : aliasingPsiTargetMapper.getTargets(pomTarget)) {
boolean success = ReferencesSearch
.search(new ReferencesSearch.SearchParameters(ApplicationManager.getApplication().runReadAction(new Computable<PsiElement>() {
@Override
public PsiElement compute() {
return PomService.convertToPsi(psiTarget);
}
}), options.searchScope, false, options.fastTrack))
.forEach(new ReadActionProcessor<PsiReference>() {
@Override
public boolean processInReadAction(final PsiReference reference) {
return addResult(reference, options, processor);
}
});
if (!success) return false;
}
}
return true;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:JavaFindUsagesHelper.java
示例5: QuerySearchRequest
import com.intellij.openapi.application.ReadActionProcessor; //导入依赖的package包/类
public QuerySearchRequest(@NotNull Query<PsiReference> query,
@NotNull final SearchRequestCollector collector,
boolean inReadAction,
@NotNull final PairProcessor<PsiReference, SearchRequestCollector> processor) {
this.query = query;
this.collector = collector;
if (inReadAction) {
this.processor = new ReadActionProcessor<PsiReference>() {
@Override
public boolean processInReadAction(PsiReference psiReference) {
return processor.process(psiReference, collector);
}
};
}
else {
this.processor = new Processor<PsiReference>() {
@Override
public boolean process(PsiReference psiReference) {
return processor.process(psiReference, collector);
}
};
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:QuerySearchRequest.java
示例6: process18MethodPointers
import com.intellij.openapi.application.ReadActionProcessor; //导入依赖的package包/类
private static boolean process18MethodPointers(@NotNull final Processor<PsiReference> processor,
@NotNull final PsiMethod constructor,
@NotNull PsiClass aClass) {
return ReferencesSearch.search(aClass).forEach(new ReadActionProcessor<PsiReference>() {
@Override
public boolean processInReadAction(PsiReference reference) {
final PsiElement element = reference.getElement();
if (element != null) {
final PsiElement parent = element.getParent();
if (parent instanceof PsiMethodReferenceExpression &&
((PsiMethodReferenceExpression)parent).getReferenceNameElement() instanceof PsiKeyword) {
if (((PsiMethodReferenceExpression)parent).isReferenceTo(constructor)) {
if (!processor.process((PsiReference)parent)) return false;
}
}
}
return true;
}
});
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:ConstructorReferencesSearchHelper.java
示例7: processPackageDirectories
import com.intellij.openapi.application.ReadActionProcessor; //导入依赖的package包/类
@Override
public boolean processPackageDirectories(@NotNull PsiPackage psiPackage,
@NotNull final GlobalSearchScope scope,
@NotNull final Processor<PsiDirectory> consumer,
boolean includeLibrarySources) {
final PsiManager psiManager = PsiManager.getInstance(getProject());
return PackageIndex.getInstance(getProject()).getDirsByPackageName(psiPackage.getQualifiedName(), includeLibrarySources)
.forEach(new ReadActionProcessor<VirtualFile>() {
@Override
public boolean processInReadAction(final VirtualFile dir) {
if (!scope.contains(dir)) return true;
PsiDirectory psiDir = psiManager.findDirectory(dir);
return psiDir == null || consumer.process(psiDir);
}
});
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:JavaPsiFacadeImpl.java
示例8: addAliasingUsages
import com.intellij.openapi.application.ReadActionProcessor; //导入依赖的package包/类
private static boolean addAliasingUsages(@NotNull PomTarget pomTarget,
@NotNull final Processor<UsageInfo> processor,
@NotNull final FindUsagesOptions options) {
for (AliasingPsiTargetMapper aliasingPsiTargetMapper : Extensions.getExtensions(AliasingPsiTargetMapper.EP_NAME)) {
for (AliasingPsiTarget psiTarget : aliasingPsiTargetMapper.getTargets(pomTarget)) {
boolean success = ReferencesSearch
.search(new ReferencesSearch.SearchParameters(PomService.convertToPsi(psiTarget), options.searchScope, false, options.fastTrack))
.forEach(new ReadActionProcessor<PsiReference>() {
@Override
public boolean processInReadAction(final PsiReference reference) {
return addResult(processor, reference, options);
}
});
if (!success) return false;
}
}
return true;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:JavaFindUsagesHandler.java
示例9: processFilesWithText
import com.intellij.openapi.application.ReadActionProcessor; //导入依赖的package包/类
public boolean processFilesWithText(@NotNull final GlobalSearchScope scope,
final short searchContext,
final boolean caseSensitively,
@NotNull String text,
@NotNull final Processor<VirtualFile> processor) {
List<IdIndexEntry> entries = getWordEntries(text, caseSensitively);
if (entries.isEmpty()) return true;
final CommonProcessors.CollectProcessor<VirtualFile> collectProcessor = new CommonProcessors.CollectProcessor<VirtualFile>();
processFilesContainingAllKeys(scope, new Condition<Integer>() {
@Override
public boolean value(Integer integer) {
return (integer.intValue() & searchContext) != 0;
}
}, collectProcessor, entries);
final FileIndexFacade index = FileIndexFacade.getInstance(myManager.getProject());
return ContainerUtil.process(collectProcessor.getResults(), new ReadActionProcessor<VirtualFile>() {
@Override
public boolean processInReadAction(VirtualFile virtualFile) {
return !index.shouldBeFound(scope, virtualFile) || processor.process(virtualFile);
}
});
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:PsiSearchHelperImpl.java
示例10: QuerySearchRequest
import com.intellij.openapi.application.ReadActionProcessor; //导入依赖的package包/类
public QuerySearchRequest(@NotNull Query<PsiReference> query,
@NotNull final SearchRequestCollector collector,
boolean inReadAction,
@NotNull final PairProcessor<PsiReference, SearchRequestCollector> processor) {
this.query = query;
this.collector = collector;
if (inReadAction) {
this.processor = new ReadActionProcessor<PsiReference>() {
@Override
public boolean processInReadAction(PsiReference psiReference) {
return processor.process(psiReference, collector);
}
};
} else {
this.processor = new Processor<PsiReference>() {
@Override
public boolean process(PsiReference psiReference) {
return processor.process(psiReference, collector);
}
};
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:QuerySearchRequest.java
示例11: localProcessor
import com.intellij.openapi.application.ReadActionProcessor; //导入依赖的package包/类
@Nonnull
private static Processor<PsiElement> localProcessor(@Nonnull final BulkOccurrenceProcessor processor,
@Nonnull final ProgressIndicator progress,
@Nonnull final StringSearcher searcher) {
return new ReadActionProcessor<PsiElement>() {
@Override
public boolean processInReadAction(PsiElement scopeElement) {
if (scopeElement instanceof PsiCompiledElement) {
// can't scan text of the element
return true;
}
return scopeElement.isValid() &&
processor.execute(scopeElement, LowLevelSearchUtil.getTextOccurrencesInScope(scopeElement, searcher, progress), searcher);
}
@Override
public String toString() {
return processor.toString();
}
};
}
开发者ID:consulo,项目名称:consulo,代码行数:23,代码来源:PsiSearchHelperImpl.java
示例12: QuerySearchRequest
import com.intellij.openapi.application.ReadActionProcessor; //导入依赖的package包/类
public QuerySearchRequest(Query<PsiReference> query,
final SearchRequestCollector collector,
boolean inReadAction, final PairProcessor<PsiReference, SearchRequestCollector> processor) {
this.query = query;
this.collector = collector;
if (inReadAction) {
this.processor = new ReadActionProcessor<PsiReference>() {
@RequiredReadAction
@Override
public boolean processInReadAction(PsiReference psiReference) {
return processor.process(psiReference, collector);
}
};
} else {
this.processor = new Processor<PsiReference>() {
@Override
public boolean process(PsiReference psiReference) {
return processor.process(psiReference, collector);
}
};
}
}
开发者ID:consulo,项目名称:consulo,代码行数:24,代码来源:QuerySearchRequest.java
示例13: processPackageDirectories
import com.intellij.openapi.application.ReadActionProcessor; //导入依赖的package包/类
@Override
public boolean processPackageDirectories(@NotNull PsiJavaPackage psiPackage, @NotNull final GlobalSearchScope scope, @NotNull final Processor<PsiDirectory> consumer)
{
final PsiManager psiManager = PsiManager.getInstance(getProject());
return DirectoryIndex.getInstance(getProject()).getDirectoriesByPackageName(psiPackage.getQualifiedName(), false).forEach(new ReadActionProcessor<VirtualFile>()
{
@RequiredReadAction
@Override
public boolean processInReadAction(final VirtualFile dir)
{
if(!scope.contains(dir))
{
return true;
}
PsiDirectory psiDir = psiManager.findDirectory(dir);
return psiDir == null || consumer.process(psiDir);
}
});
}
开发者ID:consulo,项目名称:consulo-java,代码行数:20,代码来源:JavaPsiFacadeImpl.java
示例14: addAliasingUsages
import com.intellij.openapi.application.ReadActionProcessor; //导入依赖的package包/类
private static boolean addAliasingUsages(@NotNull PomTarget pomTarget, @NotNull final FindUsagesOptions options, @NotNull final Processor<UsageInfo> processor)
{
for(AliasingPsiTargetMapper aliasingPsiTargetMapper : Extensions.getExtensions(AliasingPsiTargetMapper.EP_NAME))
{
for(final AliasingPsiTarget psiTarget : aliasingPsiTargetMapper.getTargets(pomTarget))
{
boolean success = ReferencesSearch.search(new ReferencesSearch.SearchParameters(ReadAction.compute(() -> PomService.convertToPsi(psiTarget)), options.searchScope, false, options
.fastTrack)).forEach(new ReadActionProcessor<PsiReference>()
{
@Override
public boolean processInReadAction(final PsiReference reference)
{
return addResult(reference, options, processor);
}
});
if(!success)
{
return false;
}
}
}
return true;
}
开发者ID:consulo,项目名称:consulo-java,代码行数:24,代码来源:JavaFindUsagesHelper.java
示例15: addClassesUsages
import com.intellij.openapi.application.ReadActionProcessor; //导入依赖的package包/类
private static boolean addClassesUsages(@NotNull PsiPackage aPackage,
@NotNull final JavaPackageFindUsagesOptions options,
@NotNull final Processor<UsageInfo> processor) {
ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator();
if (progress != null){
progress.pushState();
}
List<PsiClass> classes = new ArrayList<PsiClass>();
addClassesInPackage(aPackage, options.isIncludeSubpackages, classes);
for (final PsiClass aClass : classes) {
if (progress != null) {
String name = ApplicationManager.getApplication().runReadAction(new Computable<String>() {
@Override
public String compute() {
return aClass.getName();
}
});
progress.setText(FindBundle.message("find.searching.for.references.to.class.progress", name));
progress.checkCanceled();
}
boolean success = ReferencesSearch.search(new ReferencesSearch.SearchParameters(aClass, options.searchScope, false, options.fastTrack)).forEach(new ReadActionProcessor<PsiReference>() {
@Override
public boolean processInReadAction(final PsiReference psiReference) {
return addResult(psiReference, options, processor);
}
});
if (!success) return false;
}
if (progress != null){
progress.popState();
}
return true;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:JavaFindUsagesHelper.java
示例16: processFilesWithWord
import com.intellij.openapi.application.ReadActionProcessor; //导入依赖的package包/类
@Override
public boolean processFilesWithWord(@NotNull final Processor<PsiFile> psiFileProcessor, @NotNull final String word, final short occurrenceMask, @NotNull final GlobalSearchScope scope, final boolean caseSensitively) {
final List<VirtualFile> vFiles = new ArrayList<VirtualFile>(5);
collectVirtualFilesWithWord(new CommonProcessors.CollectProcessor<VirtualFile>(vFiles), word, occurrenceMask, scope, caseSensitively);
if (vFiles.isEmpty()) return true;
final Processor<VirtualFile> virtualFileProcessor = new ReadActionProcessor<VirtualFile>() {
@Override
public boolean processInReadAction(VirtualFile virtualFile) {
if (virtualFile.isValid()) {
final PsiFile psiFile = myPsiManager.findFile(virtualFile);
return psiFile == null || psiFileProcessor.process(psiFile);
}
return true;
}
};
// IMPORTANT!!!
// Since implementation of virtualFileProcessor.process() may call indices directly or indirectly,
// we cannot call it inside FileBasedIndex.processValues() method
// If we do, deadlocks are possible (IDEADEV-42137). So first we obtain files with the word specified,
// and then process them not holding indices' read lock.
for (VirtualFile vFile : vFiles) {
ProgressIndicatorProvider.checkCanceled();
if (!virtualFileProcessor.process(vFile)) {
return false;
}
}
return true;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:IndexCacheManagerImpl.java
示例17: processElementUsages
import com.intellij.openapi.application.ReadActionProcessor; //导入依赖的package包/类
public boolean processElementUsages(@NotNull final PsiElement element,
@NotNull final Processor<UsageInfo> processor,
@NotNull final FindUsagesOptions options) {
final ReadActionProcessor<PsiReference> refProcessor = new ReadActionProcessor<PsiReference>() {
@Override
public boolean processInReadAction(final PsiReference ref) {
TextRange rangeInElement = ref.getRangeInElement();
return processor.process(new UsageInfo(ref.getElement(), rangeInElement.getStartOffset(), rangeInElement.getEndOffset(), false));
}
};
final SearchScope scope = options.searchScope;
final boolean searchText = options.isSearchForTextOccurrences && scope instanceof GlobalSearchScope;
if (options.isUsages) {
boolean success =
ReferencesSearch.search(new ReferencesSearch.SearchParameters(element, scope, false, options.fastTrack)).forEach(refProcessor);
if (!success) return false;
}
if (searchText) {
if (options.fastTrack != null) {
options.fastTrack.searchCustom(new Processor<Processor<PsiReference>>() {
@Override
public boolean process(Processor<PsiReference> consumer) {
return processUsagesInText(element, processor, (GlobalSearchScope)scope);
}
});
}
else {
return processUsagesInText(element, processor, (GlobalSearchScope)scope);
}
}
return true;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:FindUsagesHandler.java
示例18: processParents
import com.intellij.openapi.application.ReadActionProcessor; //导入依赖的package包/类
private static void processParents(@NotNull Processor<SchemaTypeDef> consumer,
@NotNull SchemaTypeDef baseType,
@NotNull SchemaTypeParentsSearch.SearchParameters parameters) {
final Ref<SchemaTypeDef> currentBase = Ref.create();
final Queue<PsiAnchor> queue = new Queue<>(10);
final Set<PsiAnchor> processed = ContainerUtil.newTroveSet();
final Processor<SchemaTypeDef> processor = new ReadActionProcessor<SchemaTypeDef>() {
@Override
public boolean processInReadAction(SchemaTypeDef inheritor) {
if (!consumer.process(inheritor)) return false;
if (inheritor == null) return false;
queue.addLast(PsiAnchor.create(inheritor));
return true;
}
};
// seed
ApplicationManager.getApplication().runReadAction(() -> {
queue.addLast(PsiAnchor.create(baseType));
});
// BFS
while (!queue.isEmpty()) {
ProgressManager.checkCanceled();
final PsiAnchor anchor = queue.pullFirst();
if (!processed.add(anchor)) continue;
SchemaTypeDef typeDef = ApplicationManager.getApplication().runReadAction(
(Computable<SchemaTypeDef>) () -> (SchemaTypeDef) anchor.retrieve()
);
if (typeDef == null) continue;
currentBase.set(typeDef);
if (!SchemaDirectTypeParentsSearch.search(typeDef).forEach(processor))
return;
}
}
开发者ID:SumoLogic,项目名称:epigraph,代码行数:41,代码来源:SchemaTypeParentsSearcher.java
示例19: addClassesUsages
import com.intellij.openapi.application.ReadActionProcessor; //导入依赖的package包/类
private static boolean addClassesUsages(@NotNull PsiPackage aPackage,
@NotNull final Processor<UsageInfo> processor,
@NotNull final JavaPackageFindUsagesOptions options) {
ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator();
if (progress != null){
progress.pushState();
}
List<PsiClass> classes = new ArrayList<PsiClass>();
addClassesInPackage(aPackage, options.isIncludeSubpackages, classes);
for (final PsiClass aClass : classes) {
if (progress != null) {
progress.setText(FindBundle.message("find.searching.for.references.to.class.progress", ApplicationManager.getApplication().runReadAction(new Computable<String>(){
@Override
public String compute() {
return aClass.getName();
}
})));
progress.checkCanceled();
}
boolean success = ReferencesSearch.search(new ReferencesSearch.SearchParameters(aClass, options.searchScope, false, options.fastTrack)).forEach(new ReadActionProcessor<PsiReference>() {
@Override
public boolean processInReadAction(final PsiReference psiReference) {
return addResult(processor, psiReference, options);
}
});
if (!success) return false;
}
if (progress != null){
progress.popState();
}
return true;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:35,代码来源:JavaFindUsagesHandler.java
示例20: findUsages
import com.intellij.openapi.application.ReadActionProcessor; //导入依赖的package包/类
@NotNull
@Override
public UsageInfo[] findUsages(@NotNull final ChangeInfo info)
{
if(!(info instanceof CSharpChangeInfo))
{
return UsageInfo.EMPTY_ARRAY;
}
final List<UsageInfo> list = new ArrayList<UsageInfo>();
final ReadActionProcessor<PsiReference> refProcessor = new ReadActionProcessor<PsiReference>()
{
@RequiredReadAction
@Override
public boolean processInReadAction(final PsiReference ref)
{
final PsiElement resolve = ref.resolve();
if(resolve != info.getMethod())
{
return true;
}
TextRange rangeInElement = ref.getRangeInElement();
list.add(new UsageInfo(ref.getElement(), rangeInElement.getStartOffset(), rangeInElement.getEndOffset(), false));
return true;
}
};
ReferencesSearch.search(new ReferencesSearch.SearchParameters(info.getMethod(), info.getMethod().getResolveScope(), false)).forEach(refProcessor);
return list.toArray(UsageInfo.EMPTY_ARRAY);
}
开发者ID:consulo,项目名称:consulo-csharp,代码行数:31,代码来源:CSharpChangeSignatureUsageProcessor.java
注:本文中的com.intellij.openapi.application.ReadActionProcessor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论