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


Java UsageInfoToUsageConverter.TargetElementsDescriptor方法代码示例

本文整理汇总了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});
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:MigrationUsagesPanel.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:PsiElement2UsageTargetComposite.java

示例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);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:5,代码来源:MigrationConflictsPanel.java

示例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);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:7,代码来源:PsiElement2UsageTargetComposite.java

示例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));
        }
      }
    });
  }
}
 
开发者ID:square,项目名称:otto-intellij-plugin,代码行数:53,代码来源:OttoProjectHandler.java


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