当前位置: 首页>>代码示例>>Java>>正文


Java CommonProcessors.UniqueProcessor方法代码示例

本文整理汇总了Java中com.intellij.util.CommonProcessors.UniqueProcessor方法的典型用法代码示例。如果您正苦于以下问题:Java CommonProcessors.UniqueProcessor方法的具体用法?Java CommonProcessors.UniqueProcessor怎么用?Java CommonProcessors.UniqueProcessor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.util.CommonProcessors的用法示例。


在下文中一共展示了CommonProcessors.UniqueProcessor方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processAllClassNames

import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
@Override
public boolean processAllClassNames(Processor<String> processor) {
  CommonProcessors.UniqueProcessor<String> uniqueProcessor = new CommonProcessors.UniqueProcessor<String>(processor);
  for (PsiShortNamesCache cache : myCaches) {
    if (!cache.processAllClassNames(uniqueProcessor)) {
      return false;
    }
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:CompositeShortNamesCache.java

示例2: processChildren

import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
public void processChildren(@NotNull Processor<SliceUsage> processor) {
  final PsiElement element = ApplicationManager.getApplication().runReadAction(new Computable<PsiElement>() {
    @Override
    public PsiElement compute() {
      return getElement();
    }
  });
  ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
  indicator.checkCanceled();

  final Processor<SliceUsage> uniqueProcessor =
    new CommonProcessors.UniqueProcessor<SliceUsage>(processor, new TObjectHashingStrategy<SliceUsage>() {
      @Override
      public int computeHashCode(final SliceUsage object) {
        return object.getUsageInfo().hashCode();
      }

      @Override
      public boolean equals(final SliceUsage o1, final SliceUsage o2) {
        return o1.getUsageInfo().equals(o2.getUsageInfo());
      }
    });

  ApplicationManager.getApplication().runReadAction(new Runnable() {
    @Override
    public void run() {
      if (params.dataFlowToThis) {
        processUsagesFlownDownTo(element, uniqueProcessor);
      }
      else {
        processUsagesFlownFromThe(element, uniqueProcessor);
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:SliceUsage.java

示例3: processChildren

import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
public void processChildren(Processor<SliceUsage> processor) {
  final PsiElement element = getElement();
  ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
  indicator.checkCanceled();

  final Processor<SliceUsage> uniqueProcessor =
    new CommonProcessors.UniqueProcessor<SliceUsage>(processor, new TObjectHashingStrategy<SliceUsage>() {
      @Override
      public int computeHashCode(final SliceUsage object) {
        return object.getUsageInfo().hashCode();
      }

      @Override
      public boolean equals(final SliceUsage o1, final SliceUsage o2) {
        return o1.getUsageInfo().equals(o2.getUsageInfo());
      }
    });

  ApplicationManager.getApplication().runReadAction(new Runnable() {
    @Override
    public void run() {
      if (params.dataFlowToThis) {
        SliceUtil.processUsagesFlownDownTo(element, uniqueProcessor, SliceUsage.this, mySubstitutor);
      }
      else {
        SliceFUtil.processUsagesFlownFromThe(element, uniqueProcessor, SliceUsage.this);
      }
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:31,代码来源:SliceUsage.java

示例4: processAllClassNames

import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
@Override
public boolean processAllClassNames(Processor<String> processor)
{
	CommonProcessors.UniqueProcessor<String> uniqueProcessor = new CommonProcessors.UniqueProcessor<String>(processor);
	for(PsiShortNamesCache cache : myCaches)
	{
		if(!cache.processAllClassNames(uniqueProcessor))
		{
			return false;
		}
	}
	return true;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:14,代码来源:CompositeShortNamesCache.java

示例5: createUsageSearcher

import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
@NotNull
public static UsageSearcher createUsageSearcher(@NotNull final PsiElement[] primaryElements, @NotNull final PsiElement[] secondaryElements, @NotNull final FindUsagesHandler handler, @NotNull FindUsagesOptions options, final PsiFile scopeFile) {
    final FindUsagesOptions optionsClone = options.clone();
    return new UsageSearcher() {
        public void generate(@NotNull final Processor<Usage> processor) {
            Project project = (Project) ApplicationManager.getApplication().runReadAction(new Computable() {
                public Project compute() {
                    return scopeFile != null?scopeFile.getProject():primaryElements[0].getProject();
                }
            });
            dropResolveCacheRegularly(ProgressManager.getInstance().getProgressIndicator(), project);
            if(scopeFile != null) {
                optionsClone.searchScope = new LocalSearchScope(scopeFile);
            }

            final CommonProcessors.UniqueProcessor usageInfoProcessor = new CommonProcessors.UniqueProcessor(new Processor<UsageInfo>() {
                @Override
                public boolean process(final UsageInfo usageInfo) {
                    Usage usage = (Usage)ApplicationManager.getApplication().runReadAction(new Computable() {
                        public Usage compute() {
                            return UsageInfoToUsageConverter.convert(primaryElements, usageInfo);
                        }
                    });
                    return processor.process(usage);
                }
            });
            Iterable elements = ContainerUtil.concat(new PsiElement[][]{primaryElements, secondaryElements});
            optionsClone.fastTrack = new SearchRequestCollector(new SearchSession());
            if(optionsClone.searchScope instanceof GlobalSearchScope) {
                optionsClone.searchScope = optionsClone.searchScope.union(GlobalSearchScope.projectScope(project));
            }

            try {
                Iterator i$ = elements.iterator();

                while(i$.hasNext()) {
                    final PsiElement element = (PsiElement)i$.next();
                    ApplicationManager.getApplication().runReadAction(new Runnable() {
                        public void run() {

                        }
                    });
                    handler.processElementUsages(element, usageInfoProcessor, optionsClone);
                    CustomUsageSearcher[] arr$ = (CustomUsageSearcher[])Extensions.getExtensions(CustomUsageSearcher.EP_NAME);
                    int len$ = arr$.length;

                    for(int i$1 = 0; i$1 < len$; ++i$1) {
                        CustomUsageSearcher searcher = arr$[i$1];

                        try {
                            searcher.processElementUsages(element, processor, optionsClone);
                        } catch (IndexNotReadyException var17) {
                            DumbService.getInstance(element.getProject()).showDumbModeNotification("Find usages is not available during indexing");
                        } catch (ProcessCanceledException var18) {
                            throw var18;
                        } catch (Exception var19) {

                        }
                    }
                }

                PsiSearchHelper.SERVICE.getInstance(project).processRequests(optionsClone.fastTrack, new Processor<PsiReference>() {
                    public boolean process(final PsiReference ref) {
                        UsageInfo info = (UsageInfo)ApplicationManager.getApplication().runReadAction(new Computable() {
                            public UsageInfo compute() {
                                return !ref.getElement().isValid()?null:new UsageInfo(ref);
                            }
                        });
                        return info == null || usageInfoProcessor.process(info);
                    }
                });
            } finally {
                optionsClone.fastTrack = null;
            }

        }
    };
}
 
开发者ID:niorgai,项目名称:Android-Resource-Usage-Count,代码行数:79,代码来源:FindUsageUtils.java

示例6: processChildren

import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
public void processChildren(@NotNull Processor<SliceUsage> processor)
{
	final PsiElement element = ApplicationManager.getApplication().runReadAction(new Computable<PsiElement>()
	{
		@Override
		public PsiElement compute()
		{
			return getElement();
		}
	});
	ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
	indicator.checkCanceled();

	final Processor<SliceUsage> uniqueProcessor = new CommonProcessors.UniqueProcessor<SliceUsage>(processor,
			new TObjectHashingStrategy<SliceUsage>()
	{
		@Override
		public int computeHashCode(final SliceUsage object)
		{
			return object.getUsageInfo().hashCode();
		}

		@Override
		public boolean equals(final SliceUsage o1, final SliceUsage o2)
		{
			return o1.getUsageInfo().equals(o2.getUsageInfo());
		}
	});

	ApplicationManager.getApplication().runReadAction(new Runnable()
	{
		@Override
		public void run()
		{
			if(params.dataFlowToThis)
			{
				SliceUtil.processUsagesFlownDownTo(element, uniqueProcessor, SliceUsage.this, mySubstitutor, indexNesting, syntheticField);
			}
			else
			{
				SliceForwardUtil.processUsagesFlownFromThe(element, uniqueProcessor, SliceUsage.this);
			}
		}
	});
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:46,代码来源:SliceUsage.java


注:本文中的com.intellij.util.CommonProcessors.UniqueProcessor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。