1 11 package org.eclipse.jdt.internal.formatter; 12 13 import java.util.ArrayList ; 14 import java.util.List ; 15 16 import org.eclipse.jdt.core.dom.ASTNode; 17 import org.eclipse.jdt.core.dom.ASTVisitor; 18 import org.eclipse.jdt.core.dom.Expression; 19 import org.eclipse.jdt.core.dom.MethodInvocation; 20 import org.eclipse.jdt.core.dom.SuperMethodInvocation; 21 22 class MethodInvocationFragmentBuilder 23 extends ASTVisitor { 24 25 ArrayList fragmentsList; 26 27 MethodInvocationFragmentBuilder() { 28 this.fragmentsList = new ArrayList (); 29 } 30 31 public List fragments() { 32 return this.fragmentsList; 33 } 34 35 38 public boolean visit(MethodInvocation methodInvocation) { 39 final Expression expression = methodInvocation.getExpression(); 40 if (expression != null) { 41 switch(expression.getNodeType()) { 42 case ASTNode.METHOD_INVOCATION : 43 case ASTNode.SUPER_METHOD_INVOCATION : 44 expression.accept(this); 45 break; 46 default: 47 this.fragmentsList.add(expression); 48 } 49 } 50 this.fragmentsList.add(methodInvocation); 51 return false; 52 } 53 56 public boolean visit(SuperMethodInvocation methodInvocation) { 57 this.fragmentsList.add(methodInvocation); 58 return false; 59 } 60 } 61 | Popular Tags |