• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java OverridingMethodsSearch类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.psi.search.searches.OverridingMethodsSearch的典型用法代码示例。如果您正苦于以下问题:Java OverridingMethodsSearch类的具体用法?Java OverridingMethodsSearch怎么用?Java OverridingMethodsSearch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



OverridingMethodsSearch类属于com.intellij.psi.search.searches包,在下文中一共展示了OverridingMethodsSearch类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: buildVisitor

import com.intellij.psi.search.searches.OverridingMethodsSearch; //导入依赖的package包/类
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) {
  return new HeapPollutionVisitor() {
    @Override
    protected void registerProblem(PsiMethod method, PsiIdentifier nameIdentifier) {
      final LocalQuickFix quickFix;
      if (GenericsHighlightUtil.isSafeVarargsNoOverridingCondition(method, PsiUtil.getLanguageLevel(method))) {
        quickFix = new AnnotateAsSafeVarargsQuickFix();
      }
      else {
        final PsiClass containingClass = method.getContainingClass();
        LOG.assertTrue(containingClass != null);
        boolean canBeFinal = !method.hasModifierProperty(PsiModifier.ABSTRACT) &&
                             !containingClass.isInterface() &&
                             OverridingMethodsSearch.search(method).findFirst() == null;
        quickFix = canBeFinal ? new MakeFinalAndAnnotateQuickFix() : null;
      }
      holder.registerProblem(nameIdentifier, "Possible heap pollution from parameterized vararg type #loc", quickFix);
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:PossibleHeapPollutionVarargsInspection.java


示例2: makeMethodHierarchyVoid

import com.intellij.psi.search.searches.OverridingMethodsSearch; //导入依赖的package包/类
private static void makeMethodHierarchyVoid(Project project, @NotNull PsiMethod psiMethod) {
  replaceReturnStatements(psiMethod);
  for (final PsiMethod oMethod : OverridingMethodsSearch.search(psiMethod)) {
    replaceReturnStatements(oMethod);
  }
  final PsiParameter[] params = psiMethod.getParameterList().getParameters();
  final ParameterInfoImpl[] infos = new ParameterInfoImpl[params.length];
  for (int i = 0; i < params.length; i++) {
    PsiParameter param = params[i];
    infos[i] = new ParameterInfoImpl(i, param.getName(), param.getType());
  }

  final ChangeSignatureProcessor csp = new ChangeSignatureProcessor(project,
                                                              psiMethod,
                                                              false, null, psiMethod.getName(),
                                                              PsiType.VOID,
                                                              infos);

  csp.run();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:UnusedReturnValue.java


示例3: getOverriddenMethodTooltip

import com.intellij.psi.search.searches.OverridingMethodsSearch; //导入依赖的package包/类
private static String getOverriddenMethodTooltip(@NotNull PsiMethod method) {
  PsiElementProcessor.CollectElementsWithLimit<PsiMethod> processor = new PsiElementProcessor.CollectElementsWithLimit<PsiMethod>(5);
  OverridingMethodsSearch.search(method, true).forEach(new PsiElementProcessorAdapter<PsiMethod>(processor));

  boolean isAbstract = method.hasModifierProperty(PsiModifier.ABSTRACT);

  if (processor.isOverflow()){
    return isAbstract ? DaemonBundle.message("method.is.implemented.too.many") : DaemonBundle.message("method.is.overridden.too.many");
  }

  PsiMethod[] overridings = processor.toArray(PsiMethod.EMPTY_ARRAY);
  if (overridings.length == 0) {
    final PsiClass aClass = method.getContainingClass();
    if (aClass != null && FunctionalExpressionSearch.search(aClass).findFirst() != null) {
      return "Has functional implementations";
    }
    return null;
  }

  Comparator<PsiMethod> comparator = new MethodCellRenderer(false).getComparator();
  Arrays.sort(overridings, comparator);

  String start = isAbstract ? DaemonBundle.message("method.is.implemented.header") : DaemonBundle.message("method.is.overriden.header");
  @NonNls String pattern = "&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"#javaClass/{1}\">{1}</a>";
  return composeText(overridings, start, pattern, IdeActions.ACTION_GOTO_IMPLEMENTATION);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:MarkerType.java


示例4: getParameterElementsToSearch

import com.intellij.psi.search.searches.OverridingMethodsSearch; //导入依赖的package包/类
@NotNull
private static PsiElement[] getParameterElementsToSearch(@NotNull PsiParameter parameter, @NotNull PsiMethod method) {
  PsiMethod[] overrides = OverridingMethodsSearch.search(method, true).toArray(PsiMethod.EMPTY_ARRAY);
  for (int i = 0; i < overrides.length; i++) {
    final PsiElement navigationElement = overrides[i].getNavigationElement();
    if (navigationElement instanceof PsiMethod) {
      overrides[i] = (PsiMethod)navigationElement;
    }
  }
  List<PsiElement> elementsToSearch = new ArrayList<PsiElement>(overrides.length + 1);
  elementsToSearch.add(parameter);
  int idx = method.getParameterList().getParameterIndex(parameter);
  for (PsiMethod override : overrides) {
    final PsiParameter[] parameters = override.getParameterList().getParameters();
    if (idx < parameters.length) {
      elementsToSearch.add(parameters[idx]);
    }
  }
  return PsiUtilCore.toPsiElementArray(elementsToSearch);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:JavaFindUsagesHandler.java


示例5: getPrimaryElements

import com.intellij.psi.search.searches.OverridingMethodsSearch; //导入依赖的package包/类
@Override
@NotNull
public PsiElement[] getPrimaryElements() {
  final PsiElement element = getPsiElement();
  if (element instanceof PsiParameter) {
    final PsiParameter parameter = (PsiParameter)element;
    final PsiElement scope = parameter.getDeclarationScope();
    if (scope instanceof PsiMethod) {
      final PsiMethod method = (PsiMethod)scope;
      if (PsiUtil.canBeOverriden(method)) {
        final PsiClass aClass = method.getContainingClass();
        LOG.assertTrue(aClass != null); //Otherwise can not be overriden

        boolean hasOverridden = OverridingMethodsSearch.search(method).findFirst() != null;
        if (hasOverridden && askWhetherShouldSearchForParameterInOverridingMethods(element, parameter)) {
          return getParameterElementsToSearch(parameter, method);
        }
      }
    }
  }
  return myElementsToSearch.length == 0 ? new PsiElement[]{element} : myElementsToSearch;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:JavaFindUsagesHandler.java


示例6: findUsages

import com.intellij.psi.search.searches.OverridingMethodsSearch; //导入依赖的package包/类
public void findUsages(@NotNull List<FixableUsageInfo> usages) {
  if (myUseExistingClass && existingClass != null) {
    myExistingClassCompatibleConstructor = existingClassIsCompatible(existingClass, parameters);
  }
  findUsagesForMethod(method, usages, true);

  if (myUseExistingClass && existingClass != null && !(paramsNeedingGetters.isEmpty() && paramsNeedingSetters.isEmpty())) {
    usages.add(new AppendAccessorsUsageInfo(existingClass, myGenerateAccessors, paramsNeedingGetters, paramsNeedingSetters, parameters));
  }

  final PsiMethod[] overridingMethods = OverridingMethodsSearch.search(method, true).toArray(PsiMethod.EMPTY_ARRAY);
  for (PsiMethod siblingMethod : overridingMethods) {
    findUsagesForMethod(siblingMethod, usages, false);
  }

  if (myNewVisibility != null) {
    usages.add(new BeanClassVisibilityUsageInfo(existingClass, usages.toArray(new UsageInfo[usages.size()]), myNewVisibility, myExistingClassCompatibleConstructor));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:IntroduceParameterObjectProcessor.java


示例7: addOverriddenAndImplemented

import com.intellij.psi.search.searches.OverridingMethodsSearch; //导入依赖的package包/类
private static void addOverriddenAndImplemented(PsiMethod methodPrototype, final String newName, final Map<PsiElement, String> allRenames) {
  allRenames.put(methodPrototype, newName);
  PsiMethod[] methods = methodPrototype.findDeepestSuperMethods();
  if (methods.length == 0) {
    methods = new PsiMethod[] {methodPrototype};
  }
  for (PsiMethod method : methods) {
    OverridingMethodsSearch.search(method).forEach(new Processor<PsiMethod>() {
      public boolean process(PsiMethod psiMethod) {
        RenameProcessor.assertNonCompileElement(psiMethod);
        allRenames.put(psiMethod, newName);
        return true;
      }
    });
    allRenames.put(method, newName);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:RenameJavaVariableProcessor.java


示例8: AutomaticParametersRenamer

import com.intellij.psi.search.searches.OverridingMethodsSearch; //导入依赖的package包/类
public AutomaticParametersRenamer(PsiParameter param, String newParamName) {
  final PsiElement scope = param.getDeclarationScope();
  if (scope instanceof PsiMethod) {
    final PsiMethod method = (PsiMethod)scope;
    final int parameterIndex = method.getParameterList().getParameterIndex(param);
    if (parameterIndex < 0) return;
    for (PsiMethod overrider : OverridingMethodsSearch.search(method)) {
      final PsiParameter[] parameters = overrider.getParameterList().getParameters();
      if (parameterIndex >= parameters.length) continue;
      final PsiParameter inheritedParam = parameters[parameterIndex];
      if (!Comparing.strEqual(inheritedParam.getName(), newParamName)) {
        myElements.add(inheritedParam);
        suggestAllNames(inheritedParam.getName(), newParamName);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:AutomaticParametersRenamer.java


示例9: prepareRenaming

import com.intellij.psi.search.searches.OverridingMethodsSearch; //导入依赖的package包/类
@Override
public void prepareRenaming(PsiElement element, final String newName, final Map<PsiElement, String> allRenames, SearchScope scope) {
  final PsiMethod method = (PsiMethod) element;
  OverridingMethodsSearch.search(method, scope, true).forEach(new Processor<PsiMethod>() {
    public boolean process(PsiMethod overrider) {
      if (overrider instanceof PsiMirrorElement) {
        final PsiElement prototype = ((PsiMirrorElement)overrider).getPrototype();
        if (prototype instanceof PsiMethod) {
          overrider = (PsiMethod)prototype;
        }
      }

      if (overrider instanceof SyntheticElement) return true;

      final String overriderName = overrider.getName();
      final String baseName = method.getName();
      final String newOverriderName = RefactoringUtil.suggestNewOverriderName(overriderName, baseName, newName);
      if (newOverriderName != null) {
        RenameProcessor.assertNonCompileElement(overrider);
        allRenames.put(overrider, newOverriderName);
      }
      return true;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:RenameJavaMethodProcessor.java


示例10: calculateSiblingMethods

import com.intellij.psi.search.searches.OverridingMethodsSearch; //导入依赖的package包/类
public static Set<PsiMethod> calculateSiblingMethods(PsiMethod method) {
    final Set<PsiMethod> siblingMethods = new HashSet<PsiMethod>();
    final Stack<PsiMethod> pendingMethods = new Stack<PsiMethod>();
    pendingMethods.add(method);
    while(!pendingMethods.isEmpty())
    {
        final PsiMethod methodToAnalyze = pendingMethods.pop();
        siblingMethods.add(methodToAnalyze);
      final Iterable<PsiMethod> overridingMethods = OverridingMethodsSearch.search(methodToAnalyze, false);
        for (PsiMethod overridingMethod : overridingMethods) {
            if (!siblingMethods.contains(overridingMethod) &&
                    !pendingMethods.contains(overridingMethod)) {
                pendingMethods.add(overridingMethod);
            }
        }
        final PsiMethod[] superMethods = methodToAnalyze.findSuperMethods();
        for (PsiMethod superMethod : superMethods) {
            if (!siblingMethods.contains(superMethod) &&
                    !pendingMethods.contains(superMethod)) {
                pendingMethods.add(superMethod);
            }
        }
    }
    return siblingMethods;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:MethodInheritanceUtils.java


示例11: findUsages

import com.intellij.psi.search.searches.OverridingMethodsSearch; //导入依赖的package包/类
@NotNull
protected UsageInfo[] findUsages() {
  ArrayList<UsageInfo> result = new ArrayList<UsageInfo>();

  ContainerUtil.addAll(result, MakeStaticUtil.findClassRefsInMember(myMember, true));

  if (mySettings.isReplaceUsages()) {
    findExternalUsages(result);
  }

  if (myMember instanceof PsiMethod) {
    final PsiMethod[] overridingMethods =
      OverridingMethodsSearch.search((PsiMethod)myMember, myMember.getUseScope(), false).toArray(PsiMethod.EMPTY_ARRAY);
    for (PsiMethod overridingMethod : overridingMethods) {
      if (overridingMethod != myMember) {
        result.add(new OverridingMethodUsageInfo(overridingMethod));
      }
    }
  }

  return result.toArray(new UsageInfo[result.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:MakeMethodOrClassStaticProcessor.java


示例12: fun

import com.intellij.psi.search.searches.OverridingMethodsSearch; //导入依赖的package包/类
@Nullable
@Override
public String fun(PsiElement element) {
  PsiElement parent = element.getParent();
  if (!(parent instanceof GrField)) return null;
  final List<GrAccessorMethod> accessors = GroovyPropertyUtils.getFieldAccessors((GrField)parent);

  PsiElementProcessor.CollectElementsWithLimit<PsiMethod> processor = new PsiElementProcessor.CollectElementsWithLimit<PsiMethod>(5);

  for (GrAccessorMethod method : accessors) {
    OverridingMethodsSearch.search(method, true).forEach(new PsiElementProcessorAdapter<PsiMethod>(processor));
  }
  if (processor.isOverflow()) {
    return DaemonBundle.message("method.is.overridden.too.many");
  }

  PsiMethod[] overridings = processor.toArray(new PsiMethod[processor.getCollection().size()]);
  if (overridings.length == 0) return null;

  Comparator<PsiMethod> comparator = new MethodCellRenderer(false).getComparator();
  Arrays.sort(overridings, comparator);

  String start = DaemonBundle.message("method.is.overriden.header");
  @NonNls String pattern = "&nbsp;&nbsp;&nbsp;&nbsp;{1}";
  return GutterIconTooltipHelper.composeText(overridings, start, pattern);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:GroovyMarkerTypes.java


示例13: run

import com.intellij.psi.search.searches.OverridingMethodsSearch; //导入依赖的package包/类
@Override
public void run(@NotNull final ProgressIndicator indicator) {
  super.run(indicator);
  for (PsiMethod method : PsiImplUtil.getMethodOrReflectedMethods(myMethod)) {
    OverridingMethodsSearch.search(method, true).forEach(
      new CommonProcessors.CollectProcessor<PsiMethod>() {
        @Override
        public boolean process(PsiMethod psiMethod) {
          if (!updateComponent(com.intellij.psi.impl.PsiImplUtil.handleMirror(psiMethod), myRenderer.getComparator())) {
            indicator.cancel();
          }
          indicator.checkCanceled();
          return true;
        }
      });
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:GroovyMarkerTypes.java


示例14: isPublic

import com.intellij.psi.search.searches.OverridingMethodsSearch; //导入依赖的package包/类
protected boolean isPublic(PsiModifierListOwner element) {
	if (element.hasModifierProperty(PsiModifier.PUBLIC)){
		return true;
	}
	if (element.hasModifierProperty(PsiModifier.PRIVATE)){
		return false;
	}
	if (element instanceof PsiMethod){
		Iterator<PsiMethod> i = OverridingMethodsSearch.search((PsiMethod)element).iterator();
		while (i.hasNext()){
			PsiMethod method = i.next();
			if (method.hasModifierProperty(PsiModifier.PUBLIC)){
				return true;
			}
		}
	}
	return false;
}
 
开发者ID:elusive-code,项目名称:shuffler,代码行数:19,代码来源:RenamingVisitor.java


示例15: buildVisitor

import com.intellij.psi.search.searches.OverridingMethodsSearch; //导入依赖的package包/类
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) {
  return new HeapPollutionVisitor() {
    @Override
    protected void registerProblem(PsiMethod method, PsiIdentifier nameIdentifier) {
      final LocalQuickFix quickFix;
      if (method.hasModifierProperty(PsiModifier.FINAL) ||
          method.hasModifierProperty(PsiModifier.STATIC) ||
          method.isConstructor()) {
        quickFix = new AnnotateAsSafeVarargsQuickFix();
      }
      else {
        final PsiClass containingClass = method.getContainingClass();
        LOG.assertTrue(containingClass != null);
        boolean canBeFinal = !method.hasModifierProperty(PsiModifier.ABSTRACT) &&
                             !containingClass.isInterface() &&
                             OverridingMethodsSearch.search(method).findFirst() == null;
        quickFix = canBeFinal ? new MakeFinalAndAnnotateQuickFix() : null;
      }
      holder.registerProblem(nameIdentifier, "Possible heap pollution from parameterized vararg type #loc", quickFix);
    }
  };
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:PossibleHeapPollutionVarargsInspection.java


示例16: getOverriddenMethodTooltip

import com.intellij.psi.search.searches.OverridingMethodsSearch; //导入依赖的package包/类
public static String getOverriddenMethodTooltip(PsiMethod method) {
  PsiElementProcessor.CollectElementsWithLimit<PsiMethod> processor = new PsiElementProcessor.CollectElementsWithLimit<PsiMethod>(5);
  OverridingMethodsSearch.search(method, true).forEach(new PsiElementProcessorAdapter<PsiMethod>(processor));

  boolean isAbstract = method.hasModifierProperty(PsiModifier.ABSTRACT);

  if (processor.isOverflow()){
    return isAbstract ? DaemonBundle.message("method.is.implemented.too.many") : DaemonBundle.message("method.is.overridden.too.many");
  }

  PsiMethod[] overridings = processor.toArray(new PsiMethod[processor.getCollection().size()]);
  if (overridings.length == 0) return null;

  Comparator<PsiMethod> comparator = new MethodCellRenderer(false).getComparator();
  Arrays.sort(overridings, comparator);

  String start = isAbstract ? DaemonBundle.message("method.is.implemented.header") : DaemonBundle.message("method.is.overriden.header");
  @NonNls String pattern = "&nbsp;&nbsp;&nbsp;&nbsp;{1}";
  return GutterIconTooltipHelper.composeText(overridings, start, pattern);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:MarkerType.java


示例17: navigateToOverriddenMethod

import com.intellij.psi.search.searches.OverridingMethodsSearch; //导入依赖的package包/类
public static void navigateToOverriddenMethod(MouseEvent e, final PsiMethod method) {
  if (DumbService.isDumb(method.getProject())) {
    DumbService.getInstance(method.getProject()).showDumbModeNotification(
      "Navigation to overriding classes is not possible during index update");
    return;
  }

  final PsiElementProcessor.CollectElementsWithLimit<PsiMethod> collectProcessor =
    new PsiElementProcessor.CollectElementsWithLimit<PsiMethod>(2, new THashSet<PsiMethod>());
  if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(new Runnable() {
    @Override
    public void run() {
      OverridingMethodsSearch.search(method, true).forEach(new PsiElementProcessorAdapter<PsiMethod>(collectProcessor));
    }
  }, SEARCHING_FOR_OVERRIDING_METHODS, true, method.getProject(), (JComponent)e.getComponent())) {
    return;
  }

  PsiMethod[] overridings = collectProcessor.toArray(PsiMethod.EMPTY_ARRAY);
  if (overridings.length == 0) return;
  boolean showMethodNames = !PsiUtil.allMethodsHaveSameSignature(overridings);
  MethodCellRenderer renderer = new MethodCellRenderer(showMethodNames);
  Arrays.sort(overridings, renderer.getComparator());
  final OverridingMethodsUpdater methodsUpdater = new OverridingMethodsUpdater(method, renderer);
  PsiElementListNavigator.openTargets(e, overridings, methodsUpdater.getCaption(overridings.length), "Overriding methods of " + method.getName(), renderer, methodsUpdater);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:27,代码来源:MarkerType.java


示例18: getParameterElementsToSearch

import com.intellij.psi.search.searches.OverridingMethodsSearch; //导入依赖的package包/类
@NotNull
private static PsiElement[] getParameterElementsToSearch(@NotNull PsiParameter parameter) {
  final PsiMethod method = (PsiMethod)parameter.getDeclarationScope();
  PsiMethod[] overrides = OverridingMethodsSearch.search(method, true).toArray(PsiMethod.EMPTY_ARRAY);
  for (int i = 0; i < overrides.length; i++) {
    overrides[i] = (PsiMethod)overrides[i].getNavigationElement();
  }
  List<PsiElement> elementsToSearch = new ArrayList<PsiElement>(overrides.length + 1);
  elementsToSearch.add(parameter);
  int idx = method.getParameterList().getParameterIndex(parameter);
  for (PsiMethod override : overrides) {
    final PsiParameter[] parameters = override.getParameterList().getParameters();
    if (idx < parameters.length) {
      elementsToSearch.add(parameters[idx]);
    }
  }
  return elementsToSearch.toArray(new PsiElement[elementsToSearch.size()]);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:JavaFindUsagesHandler.java


示例19: getPrimaryElements

import com.intellij.psi.search.searches.OverridingMethodsSearch; //导入依赖的package包/类
@Override
@NotNull
public PsiElement[] getPrimaryElements() {
  final PsiElement element = getPsiElement();
  if (element instanceof PsiParameter) {
    final PsiParameter parameter = (PsiParameter)element;
    final PsiElement scope = parameter.getDeclarationScope();
    if (scope instanceof PsiMethod) {
      final PsiMethod method = (PsiMethod)scope;
      if (PsiUtil.canBeOverriden(method)) {
        final PsiClass aClass = method.getContainingClass();
        LOG.assertTrue(aClass != null); //Otherwise can not be overriden

        boolean hasOverridden = OverridingMethodsSearch.search(method).findFirst() != null;
        if (hasOverridden && askWhetherShouldSearchForParameterInOverridingMethods(element, parameter)) {
          return getParameterElementsToSearch(parameter);
        }
      }
    }
  }
  return myElementsToSearch.length == 0 ? new PsiElement[]{element} : myElementsToSearch;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:JavaFindUsagesHandler.java


示例20: getParameterElementsToSearch

import com.intellij.psi.search.searches.OverridingMethodsSearch; //导入依赖的package包/类
@NotNull
private static PsiElement[] getParameterElementsToSearch(@NotNull PsiParameter parameter,
		@NotNull PsiMethod method)
{
	PsiMethod[] overrides = OverridingMethodsSearch.search(method, true).toArray(PsiMethod.EMPTY_ARRAY);
	for(int i = 0; i < overrides.length; i++)
	{
		final PsiElement navigationElement = overrides[i].getNavigationElement();
		if(navigationElement instanceof PsiMethod)
		{
			overrides[i] = (PsiMethod) navigationElement;
		}
	}
	List<PsiElement> elementsToSearch = new ArrayList<PsiElement>(overrides.length + 1);
	elementsToSearch.add(parameter);
	int idx = method.getParameterList().getParameterIndex(parameter);
	for(PsiMethod override : overrides)
	{
		final PsiParameter[] parameters = override.getParameterList().getParameters();
		if(idx < parameters.length)
		{
			elementsToSearch.add(parameters[idx]);
		}
	}
	return PsiUtilCore.toPsiElementArray(elementsToSearch);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:27,代码来源:JavaFindUsagesHandler.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java HorizontalLayoutContainer类代码示例发布时间:2022-05-22
下一篇:
Java ServerConfig类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap