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


Java PsiUtil.ACCESS_LEVEL_PRIVATE属性代码示例

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


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

示例1: getMemberUseScope

@NotNull
public static SearchScope getMemberUseScope(@NotNull PsiMember member) {
  PsiFile file = member.getContainingFile();
  PsiElement topElement = file == null ? member : file;
  Project project = topElement.getProject();
  final GlobalSearchScope maximalUseScope = ResolveScopeManager.getInstance(project).getUseScope(topElement);
  if (isInServerPage(file)) return maximalUseScope;

  PsiClass aClass = member.getContainingClass();
  if (aClass instanceof PsiAnonymousClass) {
    //member from anonymous class can be called from outside the class
    PsiElement methodCallExpr = PsiUtil.isLanguageLevel8OrHigher(aClass) ? PsiTreeUtil.getTopmostParentOfType(aClass, PsiStatement.class) 
                                                                         : PsiTreeUtil.getParentOfType(aClass, PsiMethodCallExpression.class);
    return new LocalSearchScope(methodCallExpr != null ? methodCallExpr : aClass);
  }

  PsiModifierList modifierList = member.getModifierList();
  int accessLevel = modifierList == null ? PsiUtil.ACCESS_LEVEL_PUBLIC : PsiUtil.getAccessLevel(modifierList);
  if (accessLevel == PsiUtil.ACCESS_LEVEL_PUBLIC || accessLevel == PsiUtil.ACCESS_LEVEL_PROTECTED) {
    return maximalUseScope; // class use scope doesn't matter, since another very visible class can inherit from aClass
  }
  if (accessLevel == PsiUtil.ACCESS_LEVEL_PRIVATE) {
    PsiClass topClass = PsiUtil.getTopLevelClass(member);
    return topClass != null ? new LocalSearchScope(topClass) : file == null ? maximalUseScope : new LocalSearchScope(file);
  }
  if (file instanceof PsiJavaFile) {
    PsiPackage aPackage = JavaPsiFacade.getInstance(project).findPackage(((PsiJavaFile)file).getPackageName());
    if (aPackage != null) {
      SearchScope scope = PackageScope.packageScope(aPackage, false);
      return scope.intersectWith(maximalUseScope);
    }
  }
  return maximalUseScope;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:PsiImplUtil.java

示例2: getAccessLevel

@Override
public int getAccessLevel() {
  int result = PsiUtil.ACCESS_LEVEL_PRIVATE;
  if (getGetter() != null) {
    result = Math.max(result, PsiUtil.getAccessLevel(getGetter().getModifierList()));
  }
  if (getSetter() != null) {
    result = Math.max(result, PsiUtil.getAccessLevel(getSetter().getModifierList()));
  }
  if (getField() != null) {
    result = Math.max(result, PsiUtil.getAccessLevel(getField().getModifierList()));
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:PropertyGroup.java

示例3: getAccessLevel

@Override
public int getAccessLevel() {
  return PsiUtil.ACCESS_LEVEL_PRIVATE;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:ClassInitializerTreeElement.java


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