Java Code Examples for org.eclipse.jdt.core.dom.SuperConstructorInvocation#getExpression()

The following examples show how to use org.eclipse.jdt.core.dom.SuperConstructorInvocation#getExpression() . 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: CodeBlock.java    From SimFix with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example 2
Source File: JavaASTFlattener.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@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;
}
 
Example 3
Source File: StyledStringVisitor.java    From JDeodorant with MIT License 6 votes vote down vote up
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;
}
 
Example 4
Source File: OperationInvocation.java    From RefactoringMiner with MIT License 5 votes vote down vote up
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);
	}
}
 
Example 5
Source File: MoveInnerToTopRefactoring.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
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);
	}
}