org.eclipse.jdt.core.dom.MethodRefParameter Java Examples

The following examples show how to use org.eclipse.jdt.core.dom.MethodRefParameter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ChangeSignatureProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@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);
}
 
Example #2
Source File: JavaASTFlattener.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public boolean visit(final MethodRefParameter node) {
  node.getType().accept(this);
  boolean _isVarargs = node.isVarargs();
  if (_isVarargs) {
    this.appendToBuffer("...");
  }
  SimpleName _name = node.getName();
  boolean _tripleNotEquals = (_name != null);
  if (_tripleNotEquals) {
    this.appendSpaceToBuffer();
    node.getName().accept(this);
  }
  return false;
}
 
Example #3
Source File: ChangeSignatureProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
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;
}
 
Example #4
Source File: ChangeSignatureProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@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);
}
 
Example #5
Source File: ImportReferencesCollector.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@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;
}
 
Example #6
Source File: ChangeSignatureProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected MethodRefParameter createNewParamgument(ParameterInfo info, List<ParameterInfo> parameterInfos, List<MethodRefParameter> nodes) {
	return createNewMethodRefParameter(info);
}
 
Example #7
Source File: AstMatchingNodeFinder.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public boolean visit(MethodRefParameter node) {
	if (node.subtreeMatch(fMatcher, fNodeToMatch))
		return matches(node);
	return super.visit(node);
}
 
Example #8
Source File: GenericVisitor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void endVisit(MethodRefParameter node) {
	endVisitNode(node);
}
 
Example #9
Source File: GenericVisitor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public boolean visit(MethodRefParameter node) {
	return visitNode(node);
}