Examples of VariableDeclarationFragment


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

        String fieldtype = field.getType().toString();
        if (collect && (fieldtype.startsWith("List") || fieldtype.startsWith("java.util.List"))) {
           
            // make substitutions in template text
            StringBuffer buff = new StringBuffer(s_classText);
            VariableDeclarationFragment vardecl = (VariableDeclarationFragment)field.fragments().get(0);
            replace("$0", descript, buff);
            replace("$1", vardecl.getName().getIdentifier(), buff);
            replace("$2", NameUtilities.depluralize(NameUtils.toNameWord(basename)), buff);
            replace("$3", holder.getTypeName(type), buff);
            String cast = field.getType().isParameterizedType() ? "" : ("(" + type + ")");
            replace("$4", cast, buff);
            replace("$5", getmeth.getName().getIdentifier().substring(3), buff);
View Full Code Here

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

    IValueList extendedModifiers = parseExtendedModifiers(node);
    IValue type = visitChild(node.getType());
 
    IValueList fragments = new IValueList(values);
    for (Iterator it = node.fragments().iterator(); it.hasNext();) {
      VariableDeclarationFragment f = (VariableDeclarationFragment) it.next();
      fragments.add(visitChild(f));
    }
   
    ownValue = constructDeclarationNode("field", type, fragments.asList());
    setAnnotation("modifiers", extendedModifiers);
View Full Code Here

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

   
    IValue type = visitChild(node.getType());
   
    IValueList fragments = new IValueList(values);
    for (Iterator it = node.fragments().iterator(); it.hasNext();) {
      VariableDeclarationFragment f = (VariableDeclarationFragment) it.next();
      fragments.add(visitChild(f));
    }
   
    ownValue = constructDeclarationNode("variables", type, fragments.asList());
    setAnnotation("modifiers", extendedModifiers);
View Full Code Here

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

   
    IValue type = visitChild(node.getType());
 
    IValueList fragments = new IValueList(values);
    for (Iterator it = node.fragments().iterator(); it.hasNext();) {
      VariableDeclarationFragment f = (VariableDeclarationFragment) it.next();
      fragments.add(visitChild(f));
    }
   
    ownValue = constructDeclarationNode("variables", type, fragments.asList());
    setAnnotation("modifiers", extendedModifiers);
View Full Code Here

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

  @Test
  public void testFieldInitializer() throws Exception {
    CompilationUnit cu = EclipseTACSimpleTestDriver.parseCode("FieldInit", FIELD_INIT);
    MethodDeclaration c = EclipseTACSimpleTestDriver.getFirstMethod(cu);
    EclipseTAC tac = new EclipseTAC(c.resolveBinding());
    VariableDeclarationFragment f = EclipseTACSimpleTestDriver.getFirstField(cu);
    Expression init = f.getInitializer();
    Assert.assertNotNull(init);

    TACInstruction decl = tac.instruction(f);
    Assert.assertNotNull(decl);
    Assert.assertTrue(decl instanceof StoreFieldInstruction);
View Full Code Here

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

  @Test
  public void testFieldInitNew() throws Exception {
    CompilationUnit cu = EclipseTACSimpleTestDriver.parseCode("FieldInitNew", FIELD_INIT_NEW);
    MethodDeclaration c = EclipseTACSimpleTestDriver.getFirstMethod(cu);
    EclipseTAC tac = new EclipseTAC(c.resolveBinding());
    VariableDeclarationFragment f = EclipseTACSimpleTestDriver.getFirstField(cu);
    Expression init = f.getInitializer();
    Assert.assertNotNull(init);

    TACInstruction decl = tac.instruction(f);
    Assert.assertNotNull(decl);
    Assert.assertTrue(decl instanceof StoreFieldInstruction);
View Full Code Here

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

  @Test
  public void testFieldNoInitializer() throws Exception {
    CompilationUnit cu = EclipseTACSimpleTestDriver.parseCode("FieldNoInit", FIELD_NO_INIT);
    MethodDeclaration c = EclipseTACSimpleTestDriver.getFirstMethod(cu);
    EclipseTAC tac = new EclipseTAC(c.resolveBinding());
    VariableDeclarationFragment f = EclipseTACSimpleTestDriver.getFirstField(cu);
    Expression init = f.getInitializer();
    Assert.assertNull(init);

    TACInstruction decl = tac.instruction(f);
    Assert.assertNull(decl); // make sure the field declaration doesn't become a local
  }
View Full Code Here

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

      printModifiers(node.modifiers());
    }
    node.getType().accept(this);
    this.buffer.append(" ");//$NON-NLS-1$
    for (Iterator it = node.fragments().iterator(); it.hasNext(); ) {
      VariableDeclarationFragment f = (VariableDeclarationFragment) it.next();
      f.accept(this);
      if (it.hasNext()) {
        this.buffer.append(", ");//$NON-NLS-1$
      }
    }
    this.buffer.append(";\n");//$NON-NLS-1$
View Full Code Here

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

      printModifiers(node.modifiers());
    }
    node.getType().accept(this);
    this.buffer.append(" ");//$NON-NLS-1$
    for (Iterator it = node.fragments().iterator(); it.hasNext(); ) {
      VariableDeclarationFragment f = (VariableDeclarationFragment) it.next();
      f.accept(this);
      if (it.hasNext()) {
        this.buffer.append(", ");//$NON-NLS-1$
      }
    }
    return false;
View Full Code Here

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

      printModifiers(node.modifiers());
    }
    node.getType().accept(this);
    this.buffer.append(" ");//$NON-NLS-1$
    for (Iterator it = node.fragments().iterator(); it.hasNext(); ) {
      VariableDeclarationFragment f = (VariableDeclarationFragment) it.next();
      f.accept(this);
      if (it.hasNext()) {
        this.buffer.append(", ");//$NON-NLS-1$
      }
    }
    this.buffer.append(";\n");//$NON-NLS-1$
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.