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


Java FindSuperElementsHelper.findSuperElements方法代码示例

本文整理汇总了Java中com.intellij.psi.impl.FindSuperElementsHelper.findSuperElements方法的典型用法代码示例。如果您正苦于以下问题:Java FindSuperElementsHelper.findSuperElements方法的具体用法?Java FindSuperElementsHelper.findSuperElements怎么用?Java FindSuperElementsHelper.findSuperElements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.psi.impl.FindSuperElementsHelper的用法示例。


在下文中一共展示了FindSuperElementsHelper.findSuperElements方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findSuperElements

import com.intellij.psi.impl.FindSuperElementsHelper; //导入方法依赖的package包/类
@NotNull
private PsiElement[] findSuperElements(@NotNull PsiFile file, int offset) {
  PsiElement element = getElement(file, offset);
  if (element == null) return PsiElement.EMPTY_ARRAY;

  final PsiElement psiElement = PsiTreeUtil.getParentOfType(element, PsiFunctionalExpression.class, PsiMember.class);
  if (psiElement instanceof PsiFunctionalExpression) {
    final PsiMethod interfaceMethod = LambdaUtil.getFunctionalInterfaceMethod(psiElement);
    if (interfaceMethod != null) {
      return ArrayUtil.prepend(interfaceMethod, interfaceMethod.findSuperMethods(false));
    }
  }

  final PsiNameIdentifierOwner parent = PsiTreeUtil.getNonStrictParentOfType(element, PsiMethod.class, PsiClass.class);
  if (parent == null) {
    return PsiElement.EMPTY_ARRAY;
  }

  return FindSuperElementsHelper.findSuperElements(parent);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:JavaGotoSuperHandler.java

示例2: isMethodReferenced

import com.intellij.psi.impl.FindSuperElementsHelper; //导入方法依赖的package包/类
public static boolean isMethodReferenced(@NotNull Project project,
                                         @NotNull PsiFile containingFile,
                                         @NotNull PsiMethod method,
                                         @NotNull ProgressIndicator progress,
                                         @NotNull GlobalUsageHelper helper) {
  if (helper.isLocallyUsed(method)) return true;

  boolean isPrivate = method.hasModifierProperty(PsiModifier.PRIVATE);
  PsiClass containingClass = method.getContainingClass();
  if (JavaHighlightUtil.isSerializationRelatedMethod(method, containingClass)) return true;
  if (isPrivate) {
    if (isIntentionalPrivateConstructor(method, containingClass)) {
      return true;
    }
    if (isImplicitUsage(project, method, progress)) {
      return true;
    }
    if (!helper.isCurrentFileAlreadyChecked()) {
      return !weAreSureThereAreNoUsages(project, containingFile, method, progress, helper);
    }
  }
  else {
    //class maybe used in some weird way, e.g. from XML, therefore the only constructor is used too
    boolean isConstructor = method.isConstructor();
    if (containingClass != null && isConstructor
        && containingClass.getConstructors().length == 1
        && isClassUsed(project, containingFile, containingClass, progress, helper)) {
      return true;
    }
    if (isImplicitUsage(project, method, progress)) return true;

    if (!isConstructor && FindSuperElementsHelper.findSuperElements(method).length != 0) {
      return true;
    }
    if (!weAreSureThereAreNoUsages(project, containingFile, method, progress, helper)) {
      return true;
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:UnusedSymbolUtil.java

示例3: findSuperElements

import com.intellij.psi.impl.FindSuperElementsHelper; //导入方法依赖的package包/类
@NotNull
private static PsiElement[] findSuperElements(final PsiElement element) {
  PsiNameIdentifierOwner parent = PsiTreeUtil.getParentOfType(element, PsiMethod.class, PsiClass.class);
  if (parent == null) {
    return PsiElement.EMPTY_ARRAY;
  }

  return FindSuperElementsHelper.findSuperElements(parent);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ShowSiblingsAction.java

示例4: composeSuperMethods

import com.intellij.psi.impl.FindSuperElementsHelper; //导入方法依赖的package包/类
@NotNull
private static PsiMethod[] composeSuperMethods(@NotNull PsiMethod method, boolean acceptSelf) {
  PsiElement[] superElements = FindSuperElementsHelper.findSuperElements(method);

  PsiMethod[] superMethods = ContainerUtil.map(superElements, new Function<PsiElement, PsiMethod>() {
    @Override
    public PsiMethod fun(PsiElement element) {
      return (PsiMethod)element;
    }
  }, PsiMethod.EMPTY_ARRAY);
  if (acceptSelf) {
    superMethods = ArrayUtil.prepend(method, superMethods);
  }
  return superMethods;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:MarkerType.java

示例5: findSuperElements

import com.intellij.psi.impl.FindSuperElementsHelper; //导入方法依赖的package包/类
@Nullable
private static PsiElement[] findSuperElements(final PsiElement element) {
  PsiNameIdentifierOwner parent = PsiTreeUtil.getParentOfType(element, PsiMethod.class, PsiClass.class);
  if (parent == null) {
    return null;
  }

  return FindSuperElementsHelper.findSuperElements(parent);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:10,代码来源:ShowSiblingsAction.java

示例6: findSuperElements

import com.intellij.psi.impl.FindSuperElementsHelper; //导入方法依赖的package包/类
@Nullable
private PsiElement[] findSuperElements(PsiFile file, int offset) {
  PsiNameIdentifierOwner parent = getElement(file, offset);
  if (parent == null) return null;

  return FindSuperElementsHelper.findSuperElements(parent);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:8,代码来源:JavaGotoSuperHandler.java

示例7: composeSuperMethods

import com.intellij.psi.impl.FindSuperElementsHelper; //导入方法依赖的package包/类
@NotNull
private static PsiMethod[] composeSuperMethods(@NotNull PsiMethod method, boolean acceptSelf)
{
	PsiElement[] superElements = FindSuperElementsHelper.findSuperElements(method);

	PsiMethod[] superMethods = ContainerUtil.map(superElements, element -> (PsiMethod) element, PsiMethod.EMPTY_ARRAY);
	if(acceptSelf)
	{
		superMethods = ArrayUtil.prepend(method, superMethods);
	}
	return superMethods;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:13,代码来源:MarkerType.java

示例8: isMethodReferenced

import com.intellij.psi.impl.FindSuperElementsHelper; //导入方法依赖的package包/类
public static boolean isMethodReferenced(@NotNull Project project,
		@NotNull PsiFile containingFile,
		@NotNull PsiMethod method,
		@NotNull ProgressIndicator progress,
		@NotNull GlobalUsageHelper helper)
{
	if(helper.isLocallyUsed(method))
	{
		return true;
	}

	boolean isPrivate = method.hasModifierProperty(PsiModifier.PRIVATE);
	PsiClass containingClass = method.getContainingClass();
	if(JavaHighlightUtil.isSerializationRelatedMethod(method, containingClass))
	{
		return true;
	}
	if(isPrivate)
	{
		if(isIntentionalPrivateConstructor(method, containingClass))
		{
			return true;
		}
		if(isImplicitUsage(project, method, progress))
		{
			return true;
		}
		if(!helper.isCurrentFileAlreadyChecked())
		{
			return !weAreSureThereAreNoUsages(project, containingFile, method, progress, helper);
		}
	}
	else
	{
		//class maybe used in some weird way, e.g. from XML, therefore the only constructor is used too
		boolean isConstructor = method.isConstructor();
		if(containingClass != null && isConstructor && containingClass.getConstructors().length == 1 &&
				isClassUsed(project, containingFile, containingClass, progress, helper))
		{
			return true;
		}
		if(isImplicitUsage(project, method, progress))
		{
			return true;
		}

		if(!isConstructor && FindSuperElementsHelper.findSuperElements(method).length != 0)
		{
			return true;
		}
		if(!weAreSureThereAreNoUsages(project, containingFile, method, progress, helper))
		{
			return true;
		}
	}
	return false;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:58,代码来源:UnusedSymbolUtil.java


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