本文整理汇总了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);
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}