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

项目:che    文件:ChangeSignatureProcessor.java   
@Override
protected void changeParamgumentType(ParameterInfo info) {
  if (!(fNode instanceof MethodRef)) return;

  MethodRefParameter oldParam =
      (MethodRefParameter) ((MethodRef) fNode).parameters().get(info.getOldIndex());
  Type oldTypeNode = oldParam.getType();
  Type newTypeNode = createNewDocRefType(info);
  if (info.isNewVarargs()) {
    if (info.isOldVarargs() && !oldParam.isVarargs()) {
      // leave as array reference if old reference was not vararg
      newTypeNode = ASTNodeFactory.newArrayType(newTypeNode);
    } else {
      getASTRewrite()
          .set(oldParam, MethodRefParameter.VARARGS_PROPERTY, Boolean.TRUE, fDescription);
    }
  } else {
    if (oldParam.isVarargs()) {
      getASTRewrite()
          .set(oldParam, MethodRefParameter.VARARGS_PROPERTY, Boolean.FALSE, fDescription);
    }
  }

  getASTRewrite().replace(oldTypeNode, newTypeNode, fDescription);
  registerImportRemoveNode(oldTypeNode);
}
项目:Eclipse-Postfix-Code-Completion    文件:ChangeSignatureProcessor.java   
@Override
protected void changeParamgumentType(ParameterInfo info) {
    if (! (fNode instanceof MethodRef))
        return;

    MethodRefParameter oldParam= (MethodRefParameter) ((MethodRef) fNode).parameters().get(info.getOldIndex());
    Type oldTypeNode= oldParam.getType();
    Type newTypeNode= createNewDocRefType(info);
    if (info.isNewVarargs()) {
        if (info.isOldVarargs() && ! oldParam.isVarargs()) {
            // leave as array reference if old reference was not vararg
            newTypeNode= ASTNodeFactory.newArrayType(newTypeNode);
        } else {
            getASTRewrite().set(oldParam, MethodRefParameter.VARARGS_PROPERTY, Boolean.TRUE, fDescription);
        }
    } else {
        if (oldParam.isVarargs()) {
            getASTRewrite().set(oldParam, MethodRefParameter.VARARGS_PROPERTY, Boolean.FALSE, fDescription);
        }
    }

    getASTRewrite().replace(oldTypeNode, newTypeNode, fDescription);
    registerImportRemoveNode(oldTypeNode);
}
项目:Eclipse-Postfix-Code-Completion    文件:DelegateMethodCreator.java   
@SuppressWarnings("unchecked")
private void createArguments(final MethodDeclaration declaration, final List<? extends ASTNode> arguments, boolean methodInvocation) {
    Assert.isNotNull(declaration);
    Assert.isNotNull(arguments);
    SingleVariableDeclaration variable= null;
    final int size= declaration.parameters().size();
    for (int index= 0; index < size; index++) {
        variable= (SingleVariableDeclaration) declaration.parameters().get(index);

        if (methodInvocation) {
            // we are creating method invocation parameters
            final SimpleName expression= getAst().newSimpleName(variable.getName().getIdentifier());
            ((List<Expression>) arguments).add(expression);
        } else {
            // we are creating type info for the javadoc
            final MethodRefParameter parameter= getAst().newMethodRefParameter();
            parameter.setType(ASTNodeFactory.newType(getAst(), variable));
            if ((index == size - 1) && declaration.isVarargs())
                parameter.setVarargs(true);
            ((List<MethodRefParameter>) arguments).add(parameter);
        }
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ChangeSignatureProcessor.java   
@Override
protected void changeParamgumentType(ParameterInfo info) {
    if (! (fNode instanceof MethodRef))
        return;

    MethodRefParameter oldParam= (MethodRefParameter) ((MethodRef) fNode).parameters().get(info.getOldIndex());
    Type oldTypeNode= oldParam.getType();
    Type newTypeNode= createNewDocRefType(info);
    if (info.isNewVarargs()) {
        if (info.isOldVarargs() && ! oldParam.isVarargs()) {
            // leave as array reference of old reference was not vararg
            newTypeNode= getASTRewrite().getAST().newArrayType(newTypeNode);
        } else {
            getASTRewrite().set(oldParam, MethodRefParameter.VARARGS_PROPERTY, Boolean.TRUE, fDescription);
        }
    } else {
        if (oldParam.isVarargs()) {
            getASTRewrite().set(oldParam, MethodRefParameter.VARARGS_PROPERTY, Boolean.FALSE, fDescription);
        }
    }

    getASTRewrite().replace(oldTypeNode, newTypeNode, fDescription);
    registerImportRemoveNode(oldTypeNode);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:DelegateMethodCreator.java   
@SuppressWarnings("unchecked")
private void createArguments(final MethodDeclaration declaration, final List<? extends ASTNode> arguments, boolean methodInvocation) {
    Assert.isNotNull(declaration);
    Assert.isNotNull(arguments);
    SingleVariableDeclaration variable= null;
    final int size= declaration.parameters().size();
    for (int index= 0; index < size; index++) {
        variable= (SingleVariableDeclaration) declaration.parameters().get(index);

        if (methodInvocation) {
            // we are creating method invocation parameters
            final SimpleName expression= getAst().newSimpleName(variable.getName().getIdentifier());
            ((List<Expression>) arguments).add(expression);
        } else {
            // we are creating type info for the javadoc
            final MethodRefParameter parameter= getAst().newMethodRefParameter();
            parameter.setType(ASTNodeFactory.newType(getAst(), variable));
            if ((index == size - 1) && declaration.isVarargs())
                parameter.setVarargs(true);
            ((List<MethodRefParameter>) arguments).add(parameter);
        }
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ASTFlattener.java   
@Override
public boolean visit(MethodRef node) {
    if (node.getQualifier() != null) {
        node.getQualifier().accept(this);
    }
    this.fBuffer.append("#");//$NON-NLS-1$
    node.getName().accept(this);
    this.fBuffer.append("(");//$NON-NLS-1$
    for (Iterator<MethodRefParameter> it= node.parameters().iterator(); it.hasNext();) {
        MethodRefParameter e= it.next();
        e.accept(this);
        if (it.hasNext()) {
            this.fBuffer.append(",");//$NON-NLS-1$
        }
    }
    this.fBuffer.append(")");//$NON-NLS-1$
    return false;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:NaiveASTFlattener.java   
public boolean visit(MethodRef node) {
    if (node.getQualifier() != null) {
        node.getQualifier().accept(this);
    }
    this.buffer.append("#");//$NON-NLS-1$
    node.getName().accept(this);
    this.buffer.append("(");//$NON-NLS-1$
    for (Iterator it = node.parameters().iterator(); it.hasNext(); ) {
        MethodRefParameter e = (MethodRefParameter) it.next();
        e.accept(this);
        if (it.hasNext()) {
            this.buffer.append(",");//$NON-NLS-1$
        }
    }
    this.buffer.append(")");//$NON-NLS-1$
    return false;
}
项目:eclipse.jdt.ls    文件:ImportReferencesCollector.java   
@Override
public boolean visit(MethodRef node) {
    Name qualifier= node.getQualifier();
    if (qualifier != null) {
        typeRefFound(qualifier);
    }
    List<MethodRefParameter> list= node.parameters();
    if (list != null) {
        doVisitChildren(list); // visit MethodRefParameter with Type
    }
    return false;
}
项目:che    文件:ImportReferencesCollector.java   
@Override
public boolean visit(MethodRef node) {
  Name qualifier = node.getQualifier();
  if (qualifier != null) {
    typeRefFound(qualifier);
  }
  List<MethodRefParameter> list = node.parameters();
  if (list != null) {
    doVisitChildren(list); // visit MethodRefParameter with Type
  }
  return false;
}
项目:che    文件:ChangeSignatureProcessor.java   
private MethodRefParameter createNewMethodRefParameter(ParameterInfo info) {
  MethodRefParameter newP = getASTRewrite().getAST().newMethodRefParameter();

  // only add name iff first parameter already has a name:
  List<? extends ASTNode> parameters = getParamgumentsRewrite().getOriginalList();
  if (parameters.size() > 0)
    if (((MethodRefParameter) parameters.get(0)).getName() != null)
      newP.setName(getASTRewrite().getAST().newSimpleName(info.getNewName()));

  newP.setType(createNewDocRefType(info));
  newP.setVarargs(info.isNewVarargs());
  return newP;
}
项目:che    文件:ChangeSignatureProcessor.java   
@Override
protected void changeParamgumentName(ParameterInfo info) {
  if (!(fNode instanceof MethodRef)) return;

  MethodRefParameter oldParam =
      (MethodRefParameter) ((MethodRef) fNode).parameters().get(info.getOldIndex());
  SimpleName oldParamName = oldParam.getName();
  if (oldParamName != null)
    getASTRewrite()
        .set(oldParamName, SimpleName.IDENTIFIER_PROPERTY, info.getNewName(), fDescription);
}
项目:Eclipse-Postfix-Code-Completion    文件:ChangeSignatureProcessor.java   
private MethodRefParameter createNewMethodRefParameter(ParameterInfo info) {
    MethodRefParameter newP= getASTRewrite().getAST().newMethodRefParameter();

    // only add name iff first parameter already has a name:
    List<? extends ASTNode> parameters= getParamgumentsRewrite().getOriginalList();
    if (parameters.size() > 0)
        if (((MethodRefParameter) parameters.get(0)).getName() != null)
            newP.setName(getASTRewrite().getAST().newSimpleName(info.getNewName()));

    newP.setType(createNewDocRefType(info));
    newP.setVarargs(info.isNewVarargs());
    return newP;
}
项目:Eclipse-Postfix-Code-Completion    文件:ChangeSignatureProcessor.java   
@Override
protected void changeParamgumentName(ParameterInfo info) {
    if (! (fNode instanceof MethodRef))
        return;

    MethodRefParameter oldParam= (MethodRefParameter) ((MethodRef) fNode).parameters().get(info.getOldIndex());
    SimpleName oldParamName= oldParam.getName();
    if (oldParamName != null)
        getASTRewrite().set(oldParamName, SimpleName.IDENTIFIER_PROPERTY, info.getNewName(), fDescription);
}
项目:Eclipse-Postfix-Code-Completion    文件:ImportReferencesCollector.java   
@Override
public boolean visit(MethodRef node) {
    Name qualifier= node.getQualifier();
    if (qualifier != null) {
        typeRefFound(qualifier);
    }
    List<MethodRefParameter> list= node.parameters();
    if (list != null) {
        doVisitChildren(list); // visit MethodRefParameter with Type
    }
    return false;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ChangeSignatureProcessor.java   
private MethodRefParameter createNewMethodRefParameter(ParameterInfo info) {
    MethodRefParameter newP= getASTRewrite().getAST().newMethodRefParameter();

    // only add name iff first parameter already has a name:
    List<? extends ASTNode> parameters= getParamgumentsRewrite().getOriginalList();
    if (parameters.size() > 0)
        if (((MethodRefParameter) parameters.get(0)).getName() != null)
            newP.setName(getASTRewrite().getAST().newSimpleName(info.getNewName()));

    newP.setType(createNewDocRefType(info));
    newP.setVarargs(info.isNewVarargs());
    return newP;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ChangeSignatureProcessor.java   
@Override
protected void changeParamgumentName(ParameterInfo info) {
    if (! (fNode instanceof MethodRef))
        return;

    MethodRefParameter oldParam= (MethodRefParameter) ((MethodRef) fNode).parameters().get(info.getOldIndex());
    SimpleName oldParamName= oldParam.getName();
    if (oldParamName != null)
        getASTRewrite().set(oldParamName, SimpleName.IDENTIFIER_PROPERTY, info.getNewName(), fDescription);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ASTFlattener.java   
@Override
public boolean visit(MethodRefParameter node) {
    node.getType().accept(this);
    if (node.getAST().apiLevel() >= JLS3) {
        if (node.isVarargs()) {
            this.fBuffer.append("...");//$NON-NLS-1$
        }
    }
    if (node.getName() != null) {
        this.fBuffer.append(" ");//$NON-NLS-1$
        node.getName().accept(this);
    }
    return false;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ImportReferencesCollector.java   
@Override
public boolean visit(MethodRef node) {
    Name qualifier= node.getQualifier();
    if (qualifier != null) {
        typeRefFound(qualifier);
    }
    List<MethodRefParameter> list= node.parameters();
    if (list != null) {
        doVisitChildren(list); // visit MethodRefParameter with Type
    }
    return false;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:NaiveASTFlattener.java   
public boolean visit(MethodRefParameter node) {
    node.getType().accept(this);
    if (node.getAST().apiLevel() >= JLS3) {
        if (node.isVarargs()) {
            this.buffer.append("...");//$NON-NLS-1$
        }
    }
    if (node.getName() != null) {
        this.buffer.append(" ");//$NON-NLS-1$
        node.getName().accept(this);
    }
    return false;
}
项目:eclipse.jdt.ls    文件:ImportReferencesCollector.java   
@Override
public boolean visit(MethodRefParameter node) {
    doVisitNode(node.getType());
    return false;
}
项目:che    文件:ChangeSignatureProcessor.java   
@Override
protected MethodRefParameter createNewParamgument(
    ParameterInfo info, List<ParameterInfo> parameterInfos, List<MethodRefParameter> nodes) {
  return createNewMethodRefParameter(info);
}
项目:evosuite    文件:LoggingVisitor.java   
/** {@inheritDoc} */
@Override
public void endVisit(MethodRefParameter node) {
    logger.warn("Method endVisitMethodRefParameter for " + node + " for " + node + " not implemented!");
    super.endVisit(node);
}
项目:evosuite    文件:LoggingVisitor.java   
/** {@inheritDoc} */
@Override
public boolean visit(MethodRefParameter node) {
    logger.warn("Method visitMethodRefParameter for " + node + " not implemented!");
    return super.visit(node);
}
项目:Beagle    文件:NotRecursingAstVisitor.java   
@Override
public boolean visit(final MethodRefParameter node) {
    return false;
}
项目:Beagle    文件:InstrumentableAstNodeLister.java   
@Override
public boolean visit(final MethodRefParameter node) {
    // will never be visited
    assert false;
    return false;
}
项目:Eclipse-Postfix-Code-Completion    文件:ChangeSignatureProcessor.java   
@Override
protected MethodRefParameter createNewParamgument(ParameterInfo info, List<ParameterInfo> parameterInfos, List<MethodRefParameter> nodes) {
    return createNewMethodRefParameter(info);
}
项目:Eclipse-Postfix-Code-Completion    文件:AstMatchingNodeFinder.java   
@Override
public boolean visit(MethodRefParameter node) {
    if (node.subtreeMatch(fMatcher, fNodeToMatch))
        return matches(node);
    return super.visit(node);
}
项目:Eclipse-Postfix-Code-Completion    文件:GenericVisitor.java   
@Override
public void endVisit(MethodRefParameter node) {
    endVisitNode(node);
}
项目:Eclipse-Postfix-Code-Completion    文件:GenericVisitor.java   
@Override
public boolean visit(MethodRefParameter node) {
    return visitNode(node);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ChangeSignatureProcessor.java   
@Override
protected MethodRefParameter createNewParamgument(ParameterInfo info, List<ParameterInfo> parameterInfos, List<MethodRefParameter> nodes) {
    return createNewMethodRefParameter(info);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:AstMatchingNodeFinder.java   
@Override
public boolean visit(MethodRefParameter node) {
    if (node.subtreeMatch(fMatcher, fNodeToMatch))
        return matches(node);
    return super.visit(node);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:HierarchicalASTVisitor.java   
@Override
public boolean visit(MethodRefParameter node) {
    return visit((ASTNode)node);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:HierarchicalASTVisitor.java   
@Override
public void endVisit(MethodRefParameter node) {
    endVisit((ASTNode)node);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:GenericVisitor.java   
@Override
public boolean visit(MethodRefParameter node) {
    return visitNode(node);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:GenericVisitor.java   
@Override
public void endVisit(MethodRefParameter node) {
    endVisitNode(node);
}
项目:eclipse-i18ntools    文件:ASTNodeFinder.java   
@Override
public boolean visit(final MethodRefParameter node) {
    return this.internalVisit(node);
}
项目:j2d    文件:J2dVisitor.java   
@Override
public boolean visit(MethodRefParameter node) {
    System.out.println("Found: " + node.getClass());
    return super.visit(node);
}