Examples of VariableDeclarationFragment


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

    case ASTNode.VARIABLE_DECLARATION_EXPRESSION: {
      final VariableDeclarationExpression varDec = (VariableDeclarationExpression) node;
      for (final Iterator it = varDec.fragments().iterator(); it
          .hasNext();) {
        final VariableDeclarationFragment vdf = (VariableDeclarationFragment) it
            .next();
        final IJavaElement elem = vdf.resolveBinding().getJavaElement();
        if (elem.isReadOnly() || vdf.getName().resolveBoxing())
          throw new DefinitelyNotEnumerizableException(
              Messages.ASTNodeProcessor_SourceNotPresent, vdf);
        if (vdf.resolveBinding().getType().isEqualTo(
            node.getAST().resolveWellKnownType("java.lang.Object"))) //$NON-NLS-1$
          throw new NonEnumerizableASTException(
              Messages.ASTNodeProcessor_IllegalArrayUpcast, vdf);
        this.found.add(elem);
      }
View Full Code Here

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

    Type fieldType = node.getType();
   
    List<?> fragments = node.fragments();
    for(Object o : fragments) {
      if(o instanceof VariableDeclarationFragment) {
        VariableDeclarationFragment fragment = (VariableDeclarationFragment) o;
       
        String fieldIdentifier = VisitorUtil.identifierFor(fragment);
        String encodedParentTypeQualifier = VisitorUtil.resolveAndEncode((TypeDeclaration) node.getParent()); // FIXME fails for anonymous class declarations
        String encodedFieldQualfier = encodedParentTypeQualifier + '/' + fieldIdentifier;
       
View Full Code Here

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

   @Override
   @SuppressWarnings("unchecked")
   public O removeField(final Field<O> field)
   {
      VariableDeclarationFragment fragment = (VariableDeclarationFragment) field.getInternal();
      Iterator<Object> declarationsIterator = getBodyDeclaration().bodyDeclarations().iterator();
      while (declarationsIterator.hasNext())
      {
         Object next = declarationsIterator.next();
         if (next instanceof FieldDeclaration)
         {
            FieldDeclaration declaration = (FieldDeclaration) next;
            if (declaration.equals(fragment.getParent()))
            {
               List<VariableDeclarationFragment> fragments = declaration.fragments();
               if (fragments.contains(fragment))
               {
                  if (fragments.size() == 1)
View Full Code Here

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

      String result = null;
      for (Object f : field.fragments())
      {
         if (f instanceof VariableDeclarationFragment)
         {
            VariableDeclarationFragment frag = (VariableDeclarationFragment) f;
            result = frag.getName().getFullyQualifiedName();
            break;
         }
      }
      return result;
   }
View Full Code Here

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

   {
      for (Object f : field.fragments())
      {
         if (f instanceof VariableDeclarationFragment)
         {
            VariableDeclarationFragment frag = (VariableDeclarationFragment) f;
            frag.setName(ast.newSimpleName(name));
            break;
         }
      }
      return this;
   }
View Full Code Here

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

      String result = null;
      for (Object f : field.fragments())
      {
         if (f instanceof VariableDeclarationFragment)
         {
            VariableDeclarationFragment frag = (VariableDeclarationFragment) f;
            result = frag.getInitializer().toString();
            break;
         }
      }
      return result;
   }
View Full Code Here

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

      String result = null;
      for (Object f : field.fragments())
      {
         if (f instanceof VariableDeclarationFragment)
         {
            VariableDeclarationFragment frag = (VariableDeclarationFragment) f;
            result = Strings.unquote(frag.getInitializer().toString());
            break;
         }
      }
      return result;
   }
View Full Code Here

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

      for (Object f : internal.fragments())
      {
         if (f instanceof VariableDeclarationFragment)
         {
            VariableDeclarationFragment tempFrag = (VariableDeclarationFragment) f;
            VariableDeclarationFragment localFrag = getFragment(field);
            localFrag.setInitializer((Expression) ASTNode.copySubtree(ast, tempFrag.getInitializer()));
            break;
         }
      }

      return this;
View Full Code Here

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

      return setLiteralInitializer(Strings.enquote(value));
   }

   private VariableDeclarationFragment getFragment(final FieldDeclaration field)
   {
      VariableDeclarationFragment result = null;
      for (Object f : field.fragments())
      {
         if (f instanceof VariableDeclarationFragment)
         {
            result = (VariableDeclarationFragment) f;
View Full Code Here

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

   *
   * @see net.sourceforge.earticleast.app.AbstractManipulator#deleteOldVariableDeclaration(net.sourceforge.earticleast.app.VariableBindingManager)
   */
  @Override
  protected void deleteOldVariableDeclaration(VariableBindingManager manager) {
    VariableDeclarationFragment fragment = manager
        .getVariableDeclarationFragment();
    VariableDeclarationStatement statement = (VariableDeclarationStatement) fragment
        .getParent();
    fragment.delete();
    if (statement.fragments().size() == 0) {
      statement.delete();
    }
  }
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.