Java 类com.intellij.psi.scope.processor.MethodsProcessor 实例源码

项目:intellij-ce-playground    文件:PsiScopesUtil.java   
private static void processDummyConstructor(MethodsProcessor processor, PsiClass aClass) {
  if (aClass instanceof PsiAnonymousClass) return;
  try {
    PsiMethod[] constructors = aClass.getConstructors();
    if (constructors.length != 0) {
      return;
    }
    final PsiElementFactory factory = JavaPsiFacade.getInstance(aClass.getProject()).getElementFactory();
    final PsiMethod dummyConstructor = factory.createConstructor();
    PsiIdentifier nameIdentifier = aClass.getNameIdentifier();
    if (nameIdentifier != null) {
      dummyConstructor.getNameIdentifier().replace(nameIdentifier);
    }
    processor.forceAddResult(dummyConstructor);
  }
  catch (IncorrectOperationException e) {
    LOG.error(e);
  }
}
项目:tools-idea    文件:PsiScopesUtil.java   
private static boolean processQualifierResult(@NotNull JavaResolveResult qualifierResult,
                                              @NotNull MethodsProcessor processor,
                                              @NotNull PsiMethodCallExpression methodCall) throws MethodProcessorSetupFailedException {
  PsiElement resolve = qualifierResult.getElement();

  if (resolve == null) {
    throw new MethodProcessorSetupFailedException("Cant determine qualifier class!");
  }

  if (resolve instanceof PsiTypeParameter) {
    processor.setAccessClass((PsiClass)resolve);
  }
  else if (resolve instanceof PsiClass) {
    PsiExpression qualifier = methodCall.getMethodExpression().getQualifierExpression();
    if (!(qualifier instanceof PsiSuperExpression)) {
      processor.setAccessClass((PsiClass)PsiUtil.getAccessObjectClass(qualifier).getElement());
    }
  }

  processor.setIsConstructor(false);
  processor.setName(methodCall.getMethodExpression().getReferenceName());
  ResolveState state = ResolveState.initial().put(PsiSubstitutor.KEY, qualifierResult.getSubstitutor());
  return resolve.processDeclarations(processor, state, methodCall, methodCall);
}
项目:tools-idea    文件:PsiScopesUtil.java   
private static void processDummyConstructor(MethodsProcessor processor, PsiClass aClass) {
  if (aClass instanceof PsiAnonymousClass) return;
  try {
    PsiMethod[] constructors = aClass.getConstructors();
    if (constructors.length != 0) {
      return;
    }
    final PsiElementFactory factory = JavaPsiFacade.getInstance(aClass.getProject()).getElementFactory();
    final PsiMethod dummyConstructor = factory.createConstructor();
    PsiIdentifier nameIdentifier = aClass.getNameIdentifier();
    if (nameIdentifier != null) {
      dummyConstructor.getNameIdentifier().replace(nameIdentifier);
    }
    processor.forceAddResult(dummyConstructor);
  }
  catch (IncorrectOperationException e) {
    LOG.error(e);
  }
}
项目:intellij-ce-playground    文件:PsiScopesUtil.java   
private static boolean processQualifierResult(@NotNull JavaResolveResult qualifierResult,
                                              @NotNull MethodsProcessor processor,
                                              @NotNull PsiMethodCallExpression methodCall) throws MethodProcessorSetupFailedException {
  PsiElement resolve = qualifierResult.getElement();

  if (resolve == null) {
    throw new MethodProcessorSetupFailedException("Cant determine qualifier class!");
  }

  if (resolve instanceof PsiTypeParameter) {
    processor.setAccessClass((PsiClass)resolve);
  }
  else if (resolve instanceof PsiClass) {
    PsiExpression qualifier = methodCall.getMethodExpression().getQualifierExpression();
    if (!(qualifier instanceof PsiSuperExpression)) {
      processor.setAccessClass((PsiClass)PsiUtil.getAccessObjectClass(qualifier).getElement());
    }
    else if (((PsiSuperExpression)qualifier).getQualifier() != null && PsiUtil.isLanguageLevel8OrHigher(qualifier) && 
             CommonClassNames.JAVA_LANG_CLONEABLE.equals(((PsiClass)resolve).getQualifiedName()) && ((PsiClass)resolve).isInterface()) {
      processor.setAccessClass((PsiClass)resolve);
    }
  }

  processor.setIsConstructor(false);
  processor.setName(methodCall.getMethodExpression().getReferenceName());
  ResolveState state = ResolveState.initial().put(PsiSubstitutor.KEY, qualifierResult.getSubstitutor());
  return resolve.processDeclarations(processor, state, methodCall, methodCall);
}
项目:intellij-ce-playground    文件:ClsClassImpl.java   
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor,
                                   @NotNull ResolveState state,
                                   PsiElement lastParent,
                                   @NotNull PsiElement place) {
  if (isEnum()) {
    if (!PsiClassImplUtil.processDeclarationsInEnum(processor, state, myInnersCache)) return false;
  }

  LanguageLevel level = processor instanceof MethodsProcessor ? ((MethodsProcessor)processor).getLanguageLevel() : PsiUtil.getLanguageLevel(place);
  return PsiClassImplUtil.processDeclarationsInClass(this, processor, state, null, lastParent, place, level, false);
}
项目:tools-idea    文件:ClsClassImpl.java   
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor,
                                   @NotNull ResolveState state,
                                   PsiElement lastParent,
                                   @NotNull PsiElement place) {
  LanguageLevel languageLevel = processor instanceof MethodsProcessor ? ((MethodsProcessor)processor).getLanguageLevel() : PsiUtil.getLanguageLevel(place);
  return PsiClassImplUtil.processDeclarationsInClass(this, processor, state, null, lastParent, place, languageLevel, false);
}
项目:consulo-java    文件:PsiScopesUtil.java   
private static boolean processQualifierResult(@NotNull JavaResolveResult qualifierResult,
        @NotNull MethodsProcessor processor,
        @NotNull PsiMethodCallExpression methodCall) throws MethodProcessorSetupFailedException
{
    PsiElement resolve = qualifierResult.getElement();

    if(resolve == null)
    {
        throw new MethodProcessorSetupFailedException("Cant determine qualifier class!");
    }

    if(resolve instanceof PsiTypeParameter)
    {
        processor.setAccessClass((PsiClass) resolve);
    }
    else if(resolve instanceof PsiClass)
    {
        PsiExpression qualifier = methodCall.getMethodExpression().getQualifierExpression();
        if(!(qualifier instanceof PsiSuperExpression))
        {
            processor.setAccessClass((PsiClass) PsiUtil.getAccessObjectClass(qualifier).getElement());
        }
        else if(((PsiSuperExpression) qualifier).getQualifier() != null && PsiUtil.isLanguageLevel8OrHigher(qualifier) &&
                CommonClassNames.JAVA_LANG_CLONEABLE.equals(((PsiClass) resolve).getQualifiedName()) && ((PsiClass) resolve).isInterface())
        {
            processor.setAccessClass((PsiClass) resolve);
        }
    }

    processor.setIsConstructor(false);
    processor.setName(methodCall.getMethodExpression().getReferenceName());
    ResolveState state = ResolveState.initial().put(PsiSubstitutor.KEY, qualifierResult.getSubstitutor());
    return resolve.processDeclarations(processor, state, methodCall, methodCall);
}
项目:consulo-java    文件:PsiScopesUtil.java   
private static void processDummyConstructor(MethodsProcessor processor, PsiClass aClass)
{
    if(aClass instanceof PsiAnonymousClass)
    {
        return;
    }
    try
    {
        PsiMethod[] constructors = aClass.getConstructors();
        if(constructors.length != 0)
        {
            return;
        }
        final PsiElementFactory factory = JavaPsiFacade.getInstance(aClass.getProject()).getElementFactory();
        final PsiMethod dummyConstructor = factory.createConstructor();
        PsiIdentifier nameIdentifier = aClass.getNameIdentifier();
        if(nameIdentifier != null)
        {
            dummyConstructor.getNameIdentifier().replace(nameIdentifier);
        }
        processor.forceAddResult(dummyConstructor);
    }
    catch(IncorrectOperationException e)
    {
        LOG.error(e);
    }
}
项目:consulo-java    文件:ClsClassImpl.java   
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent, @NotNull PsiElement place)
{
    LanguageLevel level = processor instanceof MethodsProcessor ? ((MethodsProcessor) processor).getLanguageLevel() : PsiUtil.getLanguageLevel(place);
    return PsiClassImplUtil.processDeclarationsInClass(this, processor, state, null, lastParent, place, level, false);
}