コード例 #1
0
  @Override
  public UsageView showUsages(
      UsageInfo[] usages,
      UsageViewPresentation presentation,
      UsageViewManager manager,
      PsiElement[] elements) {
    final List<PsiElement> overridingMethods = new ArrayList<>();
    final List<UsageInfo> others = new ArrayList<>();
    for (UsageInfo usage : usages) {
      if (usage instanceof SafeDeleteOverridingMethodUsageInfo) {
        overridingMethods.add(((SafeDeleteOverridingMethodUsageInfo) usage).getOverridingMethod());
      } else {
        others.add(usage);
      }
    }

    UsageTarget[] targets = new UsageTarget[elements.length + overridingMethods.size()];
    for (int i = 0; i < targets.length; i++) {
      if (i < elements.length) {
        targets[i] = new PsiElement2UsageTargetAdapter(elements[i]);
      } else {
        targets[i] = new PsiElement2UsageTargetAdapter(overridingMethods.get(i - elements.length));
      }
    }

    return manager.showUsages(
        targets,
        UsageInfoToUsageConverter.convert(elements, others.toArray(new UsageInfo[others.size()])),
        presentation);
  }
コード例 #2
0
  private UsageView showUsages(
      UsageInfo[] usages, UsageViewPresentation presentation, UsageViewManager manager) {
    for (SafeDeleteProcessorDelegate delegate :
        Extensions.getExtensions(SafeDeleteProcessorDelegate.EP_NAME)) {
      if (delegate instanceof SafeDeleteProcessorDelegateBase) {
        final UsageView view =
            ((SafeDeleteProcessorDelegateBase) delegate)
                .showUsages(usages, presentation, manager, myElements);
        if (view != null) return view;
      }
    }
    UsageTarget[] targets = new UsageTarget[myElements.length];
    for (int i = 0; i < targets.length; i++) {
      targets[i] = new PsiElement2UsageTargetAdapter(myElements[i]);
    }

    return manager.showUsages(
        targets, UsageInfoToUsageConverter.convert(myElements, usages), presentation);
  }