Java 类org.eclipse.jdt.core.dom.ExpressionMethodReference 实例源码

项目:che    文件:ChangeSignatureProcessor.java   
private OccurrenceUpdate<? extends ASTNode> createOccurrenceUpdate(
    ASTNode node, CompilationUnitRewrite cuRewrite, RefactoringStatus result) {
  if (BUG_89686
      && node instanceof SimpleName
      && node.getParent() instanceof EnumConstantDeclaration) node = node.getParent();

  if (Invocations.isInvocationWithArguments(node))
    return new ReferenceUpdate(node, cuRewrite, result);
  else if (node instanceof SimpleName && node.getParent() instanceof MethodDeclaration)
    return new DeclarationUpdate((MethodDeclaration) node.getParent(), cuRewrite, result);
  else if (node instanceof MemberRef || node instanceof MethodRef)
    return new DocReferenceUpdate(node, cuRewrite, result);
  else if (ASTNodes.getParent(node, ImportDeclaration.class) != null)
    return new StaticImportUpdate(
        (ImportDeclaration) ASTNodes.getParent(node, ImportDeclaration.class), cuRewrite, result);
  else if (node instanceof LambdaExpression)
    return new LambdaExpressionUpdate((LambdaExpression) node, cuRewrite, result);
  else if (node.getLocationInParent() == ExpressionMethodReference.NAME_PROPERTY)
    return new ExpressionMethodRefUpdate(
        (ExpressionMethodReference) node.getParent(), cuRewrite, result);
  else return new NullOccurrenceUpdate(node, cuRewrite, result);
}
项目:Eclipse-Postfix-Code-Completion    文件:ChangeSignatureProcessor.java   
private OccurrenceUpdate<? extends ASTNode> createOccurrenceUpdate(ASTNode node, CompilationUnitRewrite cuRewrite, RefactoringStatus result) {
    if (BUG_89686 && node instanceof SimpleName && node.getParent() instanceof EnumConstantDeclaration)
        node= node.getParent();

    if (Invocations.isInvocationWithArguments(node))
        return new ReferenceUpdate(node, cuRewrite, result);

    else if (node instanceof SimpleName && node.getParent() instanceof MethodDeclaration)
        return new DeclarationUpdate((MethodDeclaration) node.getParent(), cuRewrite, result);

    else if (node instanceof MemberRef || node instanceof MethodRef)
        return new DocReferenceUpdate(node, cuRewrite, result);

    else if (ASTNodes.getParent(node, ImportDeclaration.class) != null)
        return new StaticImportUpdate((ImportDeclaration) ASTNodes.getParent(node, ImportDeclaration.class), cuRewrite, result);

    else if (node instanceof LambdaExpression)
        return new LambdaExpressionUpdate((LambdaExpression) node, cuRewrite, result);

    else if (node.getLocationInParent() == ExpressionMethodReference.NAME_PROPERTY)
        return new ExpressionMethodRefUpdate((ExpressionMethodReference) node.getParent(), cuRewrite, result);

    else
        return new NullOccurrenceUpdate(node, cuRewrite, result);
}
项目:Eclipse-Postfix-Code-Completion    文件:InlineConstantRefactoring.java   
@Override
public boolean visit(Name name) {
    StructuralPropertyDescriptor locationInParent= name.getLocationInParent();
    if (locationInParent == ExpressionMethodReference.NAME_PROPERTY
            || locationInParent == TypeMethodReference.NAME_PROPERTY
            || locationInParent == SuperMethodReference.NAME_PROPERTY) {
        return false;
    }

    SimpleName leftmost= getLeftmost(name);

    IBinding leftmostBinding= leftmost.resolveBinding();
    if (leftmostBinding instanceof IVariableBinding || leftmostBinding instanceof IMethodBinding || leftmostBinding instanceof ITypeBinding) {
        if (shouldUnqualify(leftmost))
            unqualifyMemberName(leftmost);
        else
            qualifyUnqualifiedMemberNameIfNecessary(leftmost);
    }

    if (leftmostBinding instanceof ITypeBinding) {
        String addedImport= fNewLocationCuRewrite.getImportRewrite().addImport((ITypeBinding)leftmostBinding, fNewLocationContext);
        fNewLocationCuRewrite.getImportRemover().registerAddedImport(addedImport);
    }

    return false;
}
项目:eclipse.jdt.ls    文件:QuickAssistProcessor.java   
private static boolean isTypeReferenceToInstanceMethod(MethodReference methodReference) {
    if (methodReference instanceof TypeMethodReference) {
        return true;
    }
    if (methodReference instanceof ExpressionMethodReference) {
        Expression expression = ((ExpressionMethodReference) methodReference).getExpression();
        if (expression instanceof Name) {
            IBinding nameBinding = ((Name) expression).resolveBinding();
            if (nameBinding != null && nameBinding instanceof ITypeBinding) {
                return true;
            }
        }
    }
    return false;
}
项目:eclipse.jdt.ls    文件:QuickAssistProcessor.java   
private static SimpleName getMethodInvocationName(MethodReference methodReference) {
    SimpleName name = null;
    if (methodReference instanceof ExpressionMethodReference) {
        name = ((ExpressionMethodReference) methodReference).getName();
    } else if (methodReference instanceof TypeMethodReference) {
        name = ((TypeMethodReference) methodReference).getName();
    } else if (methodReference instanceof SuperMethodReference) {
        name = ((SuperMethodReference) methodReference).getName();
    }
    return name;
}
项目:che    文件:ChangeSignatureProcessor.java   
protected ExpressionMethodRefUpdate(
    ExpressionMethodReference decl,
    CompilationUnitRewrite cuRewrite,
    RefactoringStatus result) {
  super(
      cuRewrite,
      cuRewrite.createGroupDescription(
          RefactoringCoreMessages.ChangeSignatureRefactoring_change_signature),
      result);
  fMethodRef = decl;
}
项目:che    文件:InlineConstantRefactoring.java   
@Override
public boolean visit(Name name) {
  StructuralPropertyDescriptor locationInParent = name.getLocationInParent();
  if (locationInParent == ExpressionMethodReference.NAME_PROPERTY
      || locationInParent == TypeMethodReference.NAME_PROPERTY
      || locationInParent == SuperMethodReference.NAME_PROPERTY) {
    return false;
  }

  SimpleName leftmost = getLeftmost(name);

  IBinding leftmostBinding = leftmost.resolveBinding();
  if (leftmostBinding instanceof IVariableBinding
      || leftmostBinding instanceof IMethodBinding
      || leftmostBinding instanceof ITypeBinding) {
    if (shouldUnqualify(leftmost)) unqualifyMemberName(leftmost);
    else qualifyUnqualifiedMemberNameIfNecessary(leftmost);
  }

  if (leftmostBinding instanceof ITypeBinding) {
    String addedImport =
        fNewLocationCuRewrite
            .getImportRewrite()
            .addImport((ITypeBinding) leftmostBinding, fNewLocationContext);
    fNewLocationCuRewrite.getImportRemover().registerAddedImport(addedImport);
  }

  return false;
}
项目:eclipse.jdt.ls    文件:ImportReferencesCollector.java   
@Override
public boolean visit(ExpressionMethodReference node) {
    evalQualifyingExpression(node.getExpression(), node.getName());
    doVisitChildren(node.typeArguments());
    return false;
}
项目:eclipse.jdt.ls    文件:ExceptionAnalyzer.java   
@Override
public boolean visit(ExpressionMethodReference node) {
    return handleMethodReference(node);
}
项目:che    文件:ImportReferencesCollector.java   
@Override
public boolean visit(ExpressionMethodReference node) {
  evalQualifyingExpression(node.getExpression(), node.getName());
  doVisitChildren(node.typeArguments());
  return false;
}
项目:Beagle    文件:NotRecursingAstVisitor.java   
@Override
public boolean visit(final ExpressionMethodReference node) {
    return false;
}
项目:Beagle    文件:InstrumentableAstNodeLister.java   
@Override
public boolean visit(final ExpressionMethodReference node) {
    return this.visitInstrumentable(node);
}
项目:Eclipse-Postfix-Code-Completion    文件:ChangeSignatureProcessor.java   
protected ExpressionMethodRefUpdate(ExpressionMethodReference decl, CompilationUnitRewrite cuRewrite, RefactoringStatus result) {
    super(cuRewrite, cuRewrite.createGroupDescription(RefactoringCoreMessages.ChangeSignatureRefactoring_change_signature), result);
    fMethodRef= decl;
}
项目:Eclipse-Postfix-Code-Completion    文件:GenericVisitor.java   
@Override
public void endVisit(ExpressionMethodReference node) {
    endVisitNode(node);
}
项目:Eclipse-Postfix-Code-Completion    文件:GenericVisitor.java   
@Override
public boolean visit(ExpressionMethodReference node) {
    return visitNode(node);
}
项目:Eclipse-Postfix-Code-Completion    文件:ImportReferencesCollector.java   
@Override
public boolean visit(ExpressionMethodReference node) {
    evalQualifyingExpression(node.getExpression(), node.getName());
    doVisitChildren(node.typeArguments());
    return false;
}