Examples of VariableDeclarationFragment


Examples of org.aspectj.org.eclipse.jdt.core.dom.VariableDeclarationFragment

  return Messages.operation_createFieldProgress;
}
private VariableDeclarationFragment getFragment(ASTNode node) {
  Iterator fragments =  ((FieldDeclaration) node).fragments().iterator();
  if (this.anchorElement != null) {
    VariableDeclarationFragment fragment = null;
    String fragmentName = this.anchorElement.getElementName();
    while (fragments.hasNext()) {
      fragment = (VariableDeclarationFragment) fragments.next();
      if (fragment.getName().getIdentifier().equals(fragmentName)) {
        return fragment;
      }
    }
    return fragment;
  } else {
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.core.dom.VariableDeclarationFragment

private String getASTNodeName() {
  if (this.alteredName != null) return this.alteredName;
  return getFragment(this.createdNode).getName().getIdentifier();
}
protected SimpleName rename(ASTNode node, SimpleName newName) {
  VariableDeclarationFragment fragment = getFragment(node);
  SimpleName oldName = fragment.getName();
  fragment.setName(newName);
  return oldName;
}
View Full Code Here

Examples of org.eclipse.jdt.core.dom.VariableDeclarationFragment

                                }
                               
                                String sType = buildFullQualifiedClassname(node.getType(), _imports, classname);

                                for (Object obj : node.fragments()) {
                                    VariableDeclarationFragment fragment = (VariableDeclarationFragment) obj;
                                   
                                   

                                   
                                    TMLScriptProperty tmlScriptProperty = new TMLScriptProperty(fragment.getName().toString(), sType, classname);
                                    if (org.eclipse.jdt.core.dom.Modifier.isStatic(node.getModifiers())) {
                                        tmlScriptProperty.setStatic(true);
                                    }
                                    properties.add(tmlScriptProperty);
                                }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.VariableDeclarationFragment

     * @param name field name
     * @param type field type
     * @return field builder
     */
    public FieldBuilder addField(String name, Type type) {
        VariableDeclarationFragment vfrag = getAST().newVariableDeclarationFragment();
        vfrag.setName(getAST().newSimpleName(name));
        FieldDeclaration fdecl = getAST().newFieldDeclaration(vfrag);
        fdecl.setType(type);
        m_fields.add(fdecl);
        return new FieldBuilder(this, fdecl);
    }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.VariableDeclarationFragment

     * Set initializer expression for field declaration.
     *
     * @param expr
     */
    public void setInitializer(ExpressionBuilderBase expr) {
        VariableDeclarationFragment frag = (VariableDeclarationFragment)m_field.fragments().get(0);
        frag.setInitializer(expr.getExpression());
    }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.VariableDeclarationFragment

     * Set initializer as a string literal.
     *
     * @param value
     */
    public void setStringInitializer(String value) {
        VariableDeclarationFragment frag = (VariableDeclarationFragment)m_field.fragments().get(0);
        StringLiteral literal = m_ast.newStringLiteral();
        literal.setLiteralValue(value);
        frag.setInitializer(literal);
    }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.VariableDeclarationFragment

     * Set initializer as a number literal.
     *
     * @param value
     */
    public void setNumberInitializer(String value) {
        VariableDeclarationFragment frag = (VariableDeclarationFragment)m_field.fragments().get(0);
        frag.setInitializer(m_ast.newNumberLiteral(value));
    }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.VariableDeclarationFragment

     *
     * @param type
     * @param vname
     */
    public void addLocalVariableDeclaration(String type, String vname) {
        VariableDeclarationFragment vfrag = m_ast.newVariableDeclarationFragment();
        vfrag.setName(m_ast.newSimpleName(vname));
        VariableDeclarationStatement stmt = m_ast.newVariableDeclarationStatement(vfrag);
        stmt.setType(m_source.createType(type));
        m_block.statements().add(stmt);
    }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.VariableDeclarationFragment

     * @param type
     * @param vname
     * @param expr initializer expression
     */
    public void addLocalVariableDeclaration(Type type, String vname, ExpressionBuilderBase expr) {
        VariableDeclarationFragment vfrag = m_ast.newVariableDeclarationFragment();
        vfrag.setName(m_ast.newSimpleName(vname));
        vfrag.setInitializer(expr.getExpression());
        VariableDeclarationStatement stmt = m_ast.newVariableDeclarationStatement(vfrag);
        stmt.setType(type);
        m_block.statements().add(stmt);
    }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.VariableDeclarationFragment

     * @param block statement body block
     */
    private void addForStatement(String name, Type type, Expression init, Expression test, Expression post,
        BlockBuilder block) {
        ForStatement stmt = m_ast.newForStatement();
        VariableDeclarationFragment declfrag = m_ast.newVariableDeclarationFragment();
        declfrag.setName(m_ast.newSimpleName(name));
        declfrag.setInitializer(init);
        VariableDeclarationExpression varexpr = m_ast.newVariableDeclarationExpression(declfrag);
        varexpr.setType(type);
        stmt.initializers().add(varexpr);
        stmt.setExpression(test);
        if (post != null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.