本文整理汇总了Java中com.intellij.find.findUsages.FindUsagesHandler.getFindUsagesOptions方法的典型用法代码示例。如果您正苦于以下问题:Java FindUsagesHandler.getFindUsagesOptions方法的具体用法?Java FindUsagesHandler.getFindUsagesOptions怎么用?Java FindUsagesHandler.getFindUsagesOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.find.findUsages.FindUsagesHandler
的用法示例。
在下文中一共展示了FindUsagesHandler.getFindUsagesOptions方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findTagUsage
import com.intellij.find.findUsages.FindUsagesHandler; //导入方法依赖的package包/类
private int findTagUsage(XmlTag element) {
final FindUsagesHandler handler = FindUsageUtils.getFindUsagesHandler(element, element.getProject());
if (handler != null) {
final FindUsagesOptions findUsagesOptions = handler.getFindUsagesOptions();
final PsiElement[] primaryElements = handler.getPrimaryElements();
final PsiElement[] secondaryElements = handler.getSecondaryElements();
Factory factory = new Factory() {
public UsageSearcher create() {
return FindUsageUtils.createUsageSearcher(primaryElements, secondaryElements, handler, findUsagesOptions, (PsiFile) null);
}
};
UsageSearcher usageSearcher = (UsageSearcher)factory.create();
final AtomicInteger mCount = new AtomicInteger(0);
usageSearcher.generate(new Processor<Usage>() {
@Override
public boolean process(Usage usage) {
if (ResourceUsageCountUtils.isUsefulUsageToCount(usage)) {
mCount.incrementAndGet();
}
return true;
}
});
return mCount.get();
}
return 0;
}
示例2: findUsages
import com.intellij.find.findUsages.FindUsagesHandler; //导入方法依赖的package包/类
@NotNull
public Collection<UsageInfo> findUsages(@NotNull final PsiElement targetElement, @Nullable SearchScope scope) {
final Project project = getProject();
final FindUsagesHandler handler =
((FindManagerImpl)FindManager.getInstance(project)).getFindUsagesManager().getFindUsagesHandler(targetElement, false);
final CommonProcessors.CollectProcessor<UsageInfo> processor = new CommonProcessors.CollectProcessor<UsageInfo>();
Assert.assertNotNull("Cannot find handler for: " + targetElement, handler);
final PsiElement[] psiElements = ArrayUtil.mergeArrays(handler.getPrimaryElements(), handler.getSecondaryElements());
final FindUsagesOptions options = handler.getFindUsagesOptions(null);
if (scope != null) options.searchScope = scope;
for (PsiElement psiElement : psiElements) {
handler.processElementUsages(psiElement, processor, options);
}
return processor.getResults();
}
示例3: findUsages
import com.intellij.find.findUsages.FindUsagesHandler; //导入方法依赖的package包/类
private static Collection<UsageInfo> findUsages(@NotNull final PsiElement element) {
final FindUsagesHandler handler = createFindUsageHandler(element);
if (handler == null) {
return Lists.newArrayList();
}
final CommonProcessors.CollectProcessor<UsageInfo> processor = new CommonProcessors.CollectProcessor<UsageInfo>();
final PsiElement[] psiElements = ArrayUtil.mergeArrays(handler.getPrimaryElements(), handler.getSecondaryElements());
final FindUsagesOptions options = handler.getFindUsagesOptions(null);
for (PsiElement psiElement : psiElements) {
handler.processElementUsages(psiElement, processor, options);
}
return processor.getResults();
}
示例4: getDefaultOptions
import com.intellij.find.findUsages.FindUsagesHandler; //导入方法依赖的package包/类
@NotNull
private static FindUsagesOptions getDefaultOptions(@NotNull FindUsagesHandler handler) {
FindUsagesOptions options =
handler.getFindUsagesOptions(DataManager.getInstance().getDataContext());
// by default, scope in FindUsagesOptions is copied from the FindSettings, but we need a default one
options.searchScope = FindUsagesManager.getMaximalScope(handler);
return options;
}
示例5: getDefaultOptions
import com.intellij.find.findUsages.FindUsagesHandler; //导入方法依赖的package包/类
@NotNull
private static FindUsagesOptions getDefaultOptions(@NotNull FindUsagesHandler handler) {
FindUsagesOptions options = handler.getFindUsagesOptions(DataManager.getInstance().getDataContext());
// by default, scope in FindUsagesOptions is copied from the FindSettings, but we need a default one
options.searchScope = FindUsagesManager.getMaximalScope(handler);
return options;
}