org.eclipse.jdt.core.dom.SuperConstructorInvocation#getExpression ( )源码实例Demo

下面列出了org.eclipse.jdt.core.dom.SuperConstructorInvocation#getExpression ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: SimFix   文件: CodeBlock.java
private SuperConstructorInv visit(SuperConstructorInvocation node) {
	int startLine = _cunit.getLineNumber(node.getStartPosition());
	int endLine = _cunit.getLineNumber(node.getStartPosition() + node.getLength());
	SuperConstructorInv superConstructorInv = new SuperConstructorInv(startLine, endLine, node);

	if(node.getExpression() != null){
		Expr expression = (Expr) process(node.getExpression());
		expression.setParent(superConstructorInv);
		superConstructorInv.setExpression(expression);
	}
	
	List<Expr> arguments = new ArrayList<>();
	for(Object object : node.arguments()){
		Expr arg = (Expr) process((ASTNode) object);
		arg.setParent(superConstructorInv);
		arguments.add(arg);
	}
	superConstructorInv.setArguments(arguments);
	
	return superConstructorInv;
}
 
源代码2 项目: xtext-xtend   文件: JavaASTFlattener.java
@Override
public boolean visit(final SuperConstructorInvocation node) {
  Expression _expression = node.getExpression();
  boolean _tripleNotEquals = (_expression != null);
  if (_tripleNotEquals) {
    node.getExpression().accept(this);
    this.appendToBuffer(".");
  }
  boolean _isEmpty = node.typeArguments().isEmpty();
  boolean _not = (!_isEmpty);
  if (_not) {
    this.appendTypeParameters(node.typeArguments());
  }
  this.appendToBuffer("super(");
  this.visitAllSeparatedByComma(node.arguments());
  this.appendToBuffer(")");
  return false;
}
 
源代码3 项目: JDeodorant   文件: StyledStringVisitor.java
public boolean visit(SuperConstructorInvocation stmnt){
	/*
	 * [ Expression . ]
        [ < Type { , Type } > ]
        super ( [ Expression { , Expression } ] ) ;
	 */
	if (stmnt.getExpression() != null){
		handleExpression((Expression) stmnt.getExpression());
		appendPeriod();
	}
	handleTypeArguments(stmnt.typeArguments());
	styledString.append("super", new StyledStringStyler(keywordStyle));
	handleParameters(stmnt.arguments());
	appendSemicolon();
	return false;
}
 
源代码4 项目: RefactoringMiner   文件: OperationInvocation.java
public OperationInvocation(CompilationUnit cu, String filePath, SuperConstructorInvocation invocation) {
	this.locationInfo = new LocationInfo(cu, filePath, invocation, CodeElementType.SUPER_CONSTRUCTOR_INVOCATION);
	this.methodName = "super";
	this.typeArguments = invocation.arguments().size();
	this.arguments = new ArrayList<String>();
	List<Expression> args = invocation.arguments();
	for(Expression argument : args) {
		this.arguments.add(argument.toString());
	}
	if(invocation.getExpression() != null) {
		this.expression = invocation.getExpression().toString();
		processExpression(invocation.getExpression(), this.subExpressions);
	}
}
 
private void updateConstructorReference(final SuperConstructorInvocation invocation, final CompilationUnitRewrite targetRewrite, final ICompilationUnit unit, TextEditGroup group) throws CoreException {
	Assert.isNotNull(invocation);
	Assert.isNotNull(targetRewrite);
	Assert.isNotNull(unit);
	final ASTRewrite rewrite= targetRewrite.getASTRewrite();
	if (fCreateInstanceField)
		insertExpressionAsParameter(invocation, rewrite, unit, group);
	final Expression expression= invocation.getExpression();
	if (expression != null) {
		rewrite.remove(expression, null);
		targetRewrite.getImportRemover().registerRemovedNode(expression);
	}
}