Java 类com.intellij.psi.PsiTypeParameterListOwner 实例源码

项目:intellij-ce-playground    文件:GroovyTypeParameterInfoHandler.java   
@Nullable
@Override
public GrTypeArgumentList findElementForParameterInfo(@NotNull CreateParameterInfoContext context) {
  final GrTypeArgumentList parameterList = ParameterInfoUtils.findParentOfType(context.getFile(), context.getOffset(), GrTypeArgumentList.class);

  if (parameterList != null) {
    if (!(parameterList.getParent() instanceof GrCodeReferenceElement)) return null;
    final GrCodeReferenceElement ref = ((GrCodeReferenceElement)parameterList.getParent());

    final PsiElement resolved = ref.resolve();
    if (!(resolved instanceof PsiTypeParameterListOwner)) return null;

    final PsiTypeParameter[] typeParams = ((PsiTypeParameterListOwner)resolved).getTypeParameters();
    if (typeParams.length == 0) return null;

    context.setItemsToShow(typeParams);
    return parameterList;
  }

  return null;
}
项目:tools-idea    文件:GroovyTypeParameterInfoHandler.java   
@Nullable
@Override
public GrTypeArgumentList findElementForParameterInfo(CreateParameterInfoContext context) {
  final GrTypeArgumentList parameterList = ParameterInfoUtils.findParentOfType(context.getFile(), context.getOffset(), GrTypeArgumentList.class);

  if (parameterList != null) {
    if (!(parameterList.getParent() instanceof GrCodeReferenceElement)) return null;
    final GrCodeReferenceElement ref = ((GrCodeReferenceElement)parameterList.getParent());

    final PsiElement resolved = ref.resolve();
    if (!(resolved instanceof PsiTypeParameterListOwner)) return null;

    final PsiTypeParameter[] typeParams = ((PsiTypeParameterListOwner)resolved).getTypeParameters();
    if (typeParams.length == 0) return null;

    context.setItemsToShow(typeParams);
    return parameterList;
  }

  return null;
}
项目:lombok-intellij-plugin    文件:BuilderHandler.java   
public static PsiSubstitutor getBuilderSubstitutor(@NotNull PsiTypeParameterListOwner classOrMethodToBuild, @NotNull PsiClass innerClass) {
  PsiSubstitutor substitutor = PsiSubstitutor.EMPTY;
  if (innerClass.hasModifierProperty(PsiModifier.STATIC)) {
    PsiTypeParameter[] typeParameters = classOrMethodToBuild.getTypeParameters();
    PsiTypeParameter[] builderParams = innerClass.getTypeParameters();
    if (typeParameters.length == builderParams.length) {
      for (int i = 0; i < typeParameters.length; i++) {
        PsiTypeParameter typeParameter = typeParameters[i];
        substitutor = substitutor.put(typeParameter, PsiSubstitutor.EMPTY.substitute(builderParams[i]));
      }
    }
  }
  return substitutor;
}
项目:lombok-intellij-plugin    文件:BuilderHandler.java   
@NotNull
private LombokLightClassBuilder createBuilderClass(@NotNull PsiClass psiClass, @NotNull PsiTypeParameterListOwner psiTypeParameterListOwner, @NotNull String builderClassName, final boolean isStatic, @NotNull PsiAnnotation psiAnnotation) {
  final String builderClassQualifiedName = psiClass.getQualifiedName() + "." + builderClassName;

  final LombokLightClassBuilder classBuilder = new LombokLightClassBuilder(psiClass, builderClassName, builderClassQualifiedName)
    .withContainingClass(psiClass)
    .withNavigationElement(psiAnnotation)
    .withParameterTypes(psiTypeParameterListOwner instanceof PsiMethod && ((PsiMethod) psiTypeParameterListOwner).isConstructor() ? psiClass.getTypeParameterList() : psiTypeParameterListOwner.getTypeParameterList())
    .withModifier(PsiModifier.PUBLIC);
  if (isStatic) {
    classBuilder.withModifier(PsiModifier.STATIC);
  }
  return classBuilder;
}
项目:lombok-intellij-plugin    文件:BaseDelombokHandler.java   
private void rebuildTypeParameter(@NotNull PsiTypeParameterListOwner listOwner, @NotNull PsiTypeParameterListOwner resultOwner) {
  final PsiTypeParameterList fromMethodTypeParameterList = listOwner.getTypeParameterList();
  if (listOwner.hasTypeParameters() && null != fromMethodTypeParameterList) {
    PsiTypeParameterList typeParameterList = PsiMethodUtil.createTypeParameterList(fromMethodTypeParameterList);
    if (null != typeParameterList) {
      final PsiTypeParameterList resultOwnerTypeParameterList = resultOwner.getTypeParameterList();
      if (null != resultOwnerTypeParameterList) {
        resultOwnerTypeParameterList.replace(typeParameterList);
      }
    }
  }
}
项目:consulo-java    文件:MakeParameterizedStaticDialog.java   
public MakeParameterizedStaticDialog(Project project,
                                     PsiTypeParameterListOwner member,
                                     String[] nameSuggestions,
                                     InternalUsageInfo[] internalUsages) {
  super(project, member);
  myProject = project;
  myNameSuggestions = nameSuggestions;

  String type = UsageViewUtil.getType(myMember);
  setTitle(RefactoringBundle.message("make.0.static", StringUtil.capitalize(type)));
  myAnyNonFieldMembersUsed = buildVariableData(internalUsages);
  init();
}
项目:intellij-ce-playground    文件:LightTypeParameterBuilder.java   
public LightTypeParameterBuilder(@NotNull String name, PsiTypeParameterListOwner owner, int index) {
  super(owner, name);
  myOwner = owner;
  myIndex = index;
}
项目:intellij-ce-playground    文件:LightTypeParameterBuilder.java   
@Nullable
@Override
public PsiTypeParameterListOwner getOwner() {
  return myOwner;
}
项目:intellij-ce-playground    文件:SimpleMakeStaticDialog.java   
public SimpleMakeStaticDialog(Project project, PsiTypeParameterListOwner member) {
  super(project, member);
  String type = UsageViewUtil.getType(myMember);
  setTitle(RefactoringBundle.message("make.0.static", StringUtil.capitalize(type)));
  init();
}
项目:intellij-ce-playground    文件:AbstractMakeStaticDialog.java   
public AbstractMakeStaticDialog(Project project, PsiTypeParameterListOwner member) {
  super(project, true);
  myMember = member;
  myMemberName = member.getName();
}
项目:tools-idea    文件:SimpleMakeStaticDialog.java   
public SimpleMakeStaticDialog(Project project, PsiTypeParameterListOwner member) {
  super(project, member);
  String type = UsageViewUtil.getType(myMember);
  setTitle(RefactoringBundle.message("make.0.static", StringUtil.capitalize(type)));
  init();
}
项目:tools-idea    文件:AbstractMakeStaticDialog.java   
public AbstractMakeStaticDialog(Project project, PsiTypeParameterListOwner member) {
  super(project, true);
  myMember = member;
  myMemberName = member.getName();
}
项目:consulo-java    文件:LightTypeParameter.java   
@Override
public PsiTypeParameterListOwner getOwner()
{
    return getDelegate().getOwner();
}
项目:consulo-java    文件:InferenceVariable.java   
@Override
public PsiTypeParameterListOwner getOwner()
{
    return null;
}
项目:consulo-java    文件:SimpleMakeStaticDialog.java   
public SimpleMakeStaticDialog(Project project, PsiTypeParameterListOwner member) {
  super(project, member);
  String type = UsageViewUtil.getType(myMember);
  setTitle(RefactoringBundle.message("make.0.static", StringUtil.capitalize(type)));
  init();
}
项目:consulo-java    文件:AbstractMakeStaticDialog.java   
public AbstractMakeStaticDialog(Project project, PsiTypeParameterListOwner member) {
  super(project, true);
  myMember = member;
  myMemberName = member.getName();
}