List of usage examples for org.eclipse.jdt.core.dom Dimension accept
public final void accept(ASTVisitor visitor)
From source file:at.bestsolution.fxide.jdt.corext.dom.ASTFlattener.java
License:Open Source License
@Override public boolean visit(ArrayType node) { if (node.getAST().apiLevel() < AST.JLS8) { getComponentType(node).accept(this); this.fBuffer.append("[]");//$NON-NLS-1$ } else {/*from w w w . ja v a 2s .c o m*/ node.getElementType().accept(this); List<Dimension> dimensions = node.dimensions(); for (int i = 0; i < dimensions.size(); i++) { Dimension dimension = dimensions.get(i); dimension.accept(this); } } return false; }
From source file:at.bestsolution.fxide.jdt.corext.dom.ASTFlattener.java
License:Open Source License
@Override public boolean visit(MethodDeclaration node) { if (node.getJavadoc() != null) { node.getJavadoc().accept(this); }// www . j a v a 2s. co m if (node.getAST().apiLevel() >= JLS3) { printModifiers(node.modifiers()); if (!node.typeParameters().isEmpty()) { this.fBuffer.append("<");//$NON-NLS-1$ for (Iterator<TypeParameter> it = node.typeParameters().iterator(); it.hasNext();) { TypeParameter t = it.next(); t.accept(this); if (it.hasNext()) { this.fBuffer.append(", ");//$NON-NLS-1$ } } this.fBuffer.append("> ");//$NON-NLS-1$ } } if (!node.isConstructor()) { if (node.getReturnType2() != null) { node.getReturnType2().accept(this); } else { // methods really ought to have a return type this.fBuffer.append("void");//$NON-NLS-1$ } this.fBuffer.append(" ");//$NON-NLS-1$ } node.getName().accept(this); this.fBuffer.append("(");//$NON-NLS-1$ if (node.getAST().apiLevel() >= AST.JLS8) { Type receiverType = node.getReceiverType(); if (receiverType != null) { receiverType.accept(this); this.fBuffer.append(' '); SimpleName qualifier = node.getReceiverQualifier(); if (qualifier != null) { qualifier.accept(this); this.fBuffer.append('.'); } this.fBuffer.append("this"); //$NON-NLS-1$ if (node.parameters().size() > 0) { this.fBuffer.append(','); } } } for (Iterator<SingleVariableDeclaration> it = node.parameters().iterator(); it.hasNext();) { SingleVariableDeclaration v = it.next(); v.accept(this); if (it.hasNext()) { this.fBuffer.append(", ");//$NON-NLS-1$ } } this.fBuffer.append(")");//$NON-NLS-1$ if (node.getAST().apiLevel() >= AST.JLS8) { List<Dimension> dimensions = node.extraDimensions(); for (Iterator<Dimension> it = dimensions.iterator(); it.hasNext();) { Dimension e = it.next(); e.accept(this); } } else { for (int i = 0; i < node.getExtraDimensions(); i++) { this.fBuffer.append("[]"); //$NON-NLS-1$ } } List<? extends ASTNode> thrownExceptions = node.getAST().apiLevel() >= AST.JLS8 ? node.thrownExceptionTypes() : getThrownExceptions(node); if (!thrownExceptions.isEmpty()) { this.fBuffer.append(" throws ");//$NON-NLS-1$ for (Iterator<? extends ASTNode> it = thrownExceptions.iterator(); it.hasNext();) { ASTNode n = it.next(); n.accept(this); if (it.hasNext()) { this.fBuffer.append(", ");//$NON-NLS-1$ } } this.fBuffer.append(" ");//$NON-NLS-1$ } if (node.getBody() == null) { this.fBuffer.append(";");//$NON-NLS-1$ } else { node.getBody().accept(this); } return false; }
From source file:at.bestsolution.fxide.jdt.corext.dom.ASTFlattener.java
License:Open Source License
@Override public boolean visit(SingleVariableDeclaration node) { if (node.getAST().apiLevel() >= JLS3) { printModifiers(node.modifiers()); }//from w w w .ja v a 2s. c o m node.getType().accept(this); if (node.getAST().apiLevel() >= JLS3) { if (node.isVarargs()) { if (node.getAST().apiLevel() >= AST.JLS8) { this.fBuffer.append(' '); List<Annotation> annotations = node.varargsAnnotations(); printAnnotationsList(annotations); } this.fBuffer.append("...");//$NON-NLS-1$ } } this.fBuffer.append(" ");//$NON-NLS-1$ node.getName().accept(this); if (node.getAST().apiLevel() >= AST.JLS8) { List<Dimension> dimensions = node.extraDimensions(); for (Iterator<Dimension> it = dimensions.iterator(); it.hasNext();) { Dimension e = it.next(); e.accept(this); } } else { for (int i = 0; i < node.getExtraDimensions(); i++) { this.fBuffer.append("[]"); //$NON-NLS-1$ } } if (node.getInitializer() != null) { this.fBuffer.append("=");//$NON-NLS-1$ node.getInitializer().accept(this); } return false; }
From source file:at.bestsolution.fxide.jdt.corext.dom.ASTFlattener.java
License:Open Source License
@Override public boolean visit(VariableDeclarationFragment node) { node.getName().accept(this); if (node.getAST().apiLevel() >= AST.JLS8) { List<Dimension> dimensions = node.extraDimensions(); for (Iterator<Dimension> it = dimensions.iterator(); it.hasNext();) { Dimension e = it.next(); e.accept(this); }//from w w w . jav a 2 s .c o m } else { for (int i = 0; i < node.getExtraDimensions(); i++) { this.fBuffer.append("[]"); //$NON-NLS-1$ } } if (node.getInitializer() != null) { this.fBuffer.append("=");//$NON-NLS-1$ node.getInitializer().accept(this); } return false; }
From source file:org.codemucker.jmutate.ast.JAstFlattener.java
License:Open Source License
public boolean visit(ArrayType node) { if (node.getAST().apiLevel() < AST.JLS8) { visitComponentType(node);/*from www . j av a 2s . c o m*/ this.buffer.append("[]");//$NON-NLS-1$ } else { node.getElementType().accept(this); List dimensions = node.dimensions(); int size = dimensions.size(); for (int i = 0; i < size; i++) { Dimension aDimension = (Dimension) dimensions.get(i); aDimension.accept(this); } } return false; }
From source file:org.mybatis.generator.eclipse.core.merge.visitors.MethodSignatureStringifier.java
License:Apache License
@Override @SuppressWarnings("unchecked") public boolean visit(SingleVariableDeclaration node) { node.getType().accept(this); for (Dimension dimension : (List<Dimension>) node.extraDimensions()) { dimension.accept(this); }/* ww w.j a v a 2 s .com*/ return false; }
From source file:org.mybatis.generator.eclipse.core.merge.visitors.TypeStringifier.java
License:Apache License
@Override @SuppressWarnings("unchecked") public boolean visit(ArrayType node) { node.getElementType().accept(this); List<Dimension> dimensions = node.dimensions(); for (Dimension dimension : dimensions) { dimension.accept(this); }/* w ww.j av a 2s . c o m*/ return false; }
From source file:parser.AnnotationType.java
License:Open Source License
public boolean visit(ArrayType node) { this.buffer.append(strSplitCharacter); if (node.getAST().apiLevel() < AST.JLS8) { visitComponentType(node);// ww w .ja va 2 s . co m this.buffer.append("[]");//$NON-NLS-1$ } else { node.getElementType().accept(this); List dimensions = node.dimensions(); int size = dimensions.size(); for (int i = 0; i < size; i++) { Dimension aDimension = (Dimension) dimensions.get(i); aDimension.accept(this); } } this.buffer.append(strSplitCharacter); return false; }