本文整理汇总了Java中com.intellij.usages.UsageInfoToUsageConverter.TargetElementsDescriptor方法的典型用法代码示例。如果您正苦于以下问题:Java UsageInfoToUsageConverter.TargetElementsDescriptor方法的具体用法?Java UsageInfoToUsageConverter.TargetElementsDescriptor怎么用?Java UsageInfoToUsageConverter.TargetElementsDescriptor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.usages.UsageInfoToUsageConverter
的用法示例。
在下文中一共展示了UsageInfoToUsageConverter.TargetElementsDescriptor方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showRootUsages
import com.intellij.usages.UsageInfoToUsageConverter; //导入方法依赖的package包/类
public void showRootUsages(UsageInfo root, UsageInfo migration, final TypeMigrationLabeler labeler) {
final PsiElement rootElement = root.getElement();
if (rootElement == null) return;
final UsageInfoToUsageConverter.TargetElementsDescriptor targetElementsDescriptor =
new UsageInfoToUsageConverter.TargetElementsDescriptor(rootElement);
final Set<PsiElement> usages = labeler.getTypeUsages((TypeMigrationUsageInfo)migration, ((TypeMigrationUsageInfo)root));
if (usages != null) {
final List<UsageInfo> infos = new ArrayList<UsageInfo>(usages.size());
for (PsiElement usage : usages) {
if (usage != null && usage.isValid()) {
infos.add(new UsageInfo(usage));
}
}
showUsages(targetElementsDescriptor, infos.toArray(new UsageInfo[infos.size()]));
} else {
showUsages(targetElementsDescriptor, new UsageInfo[] {migration});
}
}
示例2: PsiElement2UsageTargetComposite
import com.intellij.usages.UsageInfoToUsageConverter; //导入方法依赖的package包/类
public PsiElement2UsageTargetComposite(@NotNull PsiElement[] primaryElements,
@NotNull PsiElement[] secondaryElements,
@NotNull FindUsagesOptions options) {
super(primaryElements[0], options);
myDescriptor = new UsageInfoToUsageConverter.TargetElementsDescriptor(primaryElements, secondaryElements);
}
示例3: showUsages
import com.intellij.usages.UsageInfoToUsageConverter; //导入方法依赖的package包/类
@Override
public void showUsages(@NotNull final UsageInfoToUsageConverter.TargetElementsDescriptor descriptor, @NotNull final UsageInfo[] usageInfos) {
super.showUsages(descriptor, usageInfos);
}
示例4: PsiElement2UsageTargetComposite
import com.intellij.usages.UsageInfoToUsageConverter; //导入方法依赖的package包/类
public PsiElement2UsageTargetComposite(@Nonnull PsiElement[] primaryElements,
@Nonnull PsiElement[] secondaryElements,
@Nonnull FindUsagesOptions options) {
super(primaryElements[0], options);
myDescriptor = new UsageInfoToUsageConverter.TargetElementsDescriptor(primaryElements, secondaryElements);
}
示例5: performSearch
import com.intellij.usages.UsageInfoToUsageConverter; //导入方法依赖的package包/类
private void performSearch(final SearchScope searchScope, final String subscribeClassName) {
JavaPsiFacade javaPsiFacade = JavaPsiFacade.getInstance(myProject);
PsiClass subscribePsiClass = javaPsiFacade.findClass(subscribeClassName,
GlobalSearchScope.allScope(myProject));
if (subscribePsiClass == null) {
// the guava or otto library isn't available in this project so do nothing
return;
}
FindUsagesHandler handler = findUsagesManager.getNewFindUsagesHandler(subscribePsiClass, false);
if (handler != null) {
UsageInfoToUsageConverter.TargetElementsDescriptor descriptor =
new UsageInfoToUsageConverter.TargetElementsDescriptor(handler.getPrimaryElements(),
handler.getSecondaryElements());
final long startTime = System.currentTimeMillis();
Processor<Usage> processor = new Processor<Usage>() {
@Override public boolean process(Usage usage) {
if (usage instanceof UsageInfo2UsageAdapter) {
PsiElement element = ((UsageInfo2UsageAdapter) usage).getElement();
if ((element = element.getContext()) instanceof PsiAnnotation) {
if ((element = element.getContext()) instanceof PsiModifierList) {
if ((element = element.getContext()) instanceof PsiMethod) {
if (PsiConsultantImpl.hasAnnotation((PsiMethod) element, subscribeClassName)) {
maybeAddSubscriberMethod((PsiMethod) element);
}
}
}
}
}
return true;
}
};
JavaClassFindUsagesOptions options = new JavaClassFindUsagesOptions(myProject);
options.searchScope = searchScope;
FindUsagesManager.startProcessUsages(handler, handler.getPrimaryElements(), handler.getSecondaryElements(), processor, options, new Runnable() {
@Override public void run() {
int eventClassCount = optimizeEventClassIndex();
if (eventClassCount > 0) {
scheduleRefreshOfEventFiles();
} else {
maybeScheduleAnotherSearch();
}
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(String.format("Searched for @Subscribe in %s in %dms",
searchScope, System.currentTimeMillis() - startTime));
}
}
});
}
}