Package org.eclipse.jdt.core.dom

Examples of org.eclipse.jdt.core.dom.AST.newSimpleName()


            addInvocation.setExpression(ast.newSimpleName(CHECKPOINT_NAME));
            addInvocation.setName(ast.newSimpleName("addObject"));

            ClassInstanceCreation proxy = ast.newClassInstanceCreation();
            proxy
                    .setType(ast.newSimpleType(ast
                            .newSimpleName(_getProxyName())));
            addInvocation.arguments().add(proxy);
            body.statements().add(ast.newExpressionStatement(addInvocation));
            bodyDeclarations.add(initializer);
View Full Code Here


      expression = ast.newStringLiteral();
      ((StringLiteral) expression).setLiteralValue(value.toString());
    } else if (value.getClass().isEnum()) {
      String enumClass = value.getClass().getSimpleName();
      String enumVal = value.toString();
      expression = ast.newQualifiedName(ast.newSimpleName(enumClass), ast.newSimpleName(enumVal));

      addImportToCompilationUnit(value.getClass().getCanonicalName(), cu);
    }

    return expression;
View Full Code Here

      expression = ast.newStringLiteral();
      ((StringLiteral) expression).setLiteralValue(value.toString());
    } else if (value.getClass().isEnum()) {
      String enumClass = value.getClass().getSimpleName();
      String enumVal = value.toString();
      expression = ast.newQualifiedName(ast.newSimpleName(enumClass), ast.newSimpleName(enumVal));

      addImportToCompilationUnit(value.getClass().getCanonicalName(), cu);
    }

    return expression;
View Full Code Here

            .getJavadoc();
        final Javadoc newJavadoc = (Javadoc) ASTNode.copySubtree(ast,
            originalJavadoc);

        final EnumConstantDeclaration constDecl = createNewEnumConstantDeclarataion(
            ast, ast.newSimpleName(constantField.getElementName()),
            newJavadoc, annotationCollection);

        newEnumConstantToOldConstantFieldMap.put(constDecl, constantField);
        enumConstantDeclarationCollection.add(constDecl);
      }
View Full Code Here

      if (!Flags.isPackageDefault(flag)) {
        final Modifier newModifier = ast
            .newModifier(Modifier.ModifierKeyword
                .fromFlagValue(flag));

        newEnumDeclaration = createNewEnumDeclaration(ast, ast
            .newSimpleName((String) this.simpleTypeNames.get(col)),
            enumConstantDeclarationCollection,
            new Object[] { newModifier });
      } else
        newEnumDeclaration = createNewEnumDeclaration(ast, ast
View Full Code Here

        newEnumDeclaration = createNewEnumDeclaration(ast, ast
            .newSimpleName((String) this.simpleTypeNames.get(col)),
            enumConstantDeclarationCollection,
            new Object[] { newModifier });
      } else
        newEnumDeclaration = createNewEnumDeclaration(ast, ast
            .newSimpleName((String) this.simpleTypeNames.get(col)),
            enumConstantDeclarationCollection, new Object[] {});

      // TODO [bm] pretty dirty hack to workaround 16: Refactoring should not use UI components for code changes
      //       http://code.google.com/p/constants-to-enum-eclipse-plugin/issues/detail?id=16
View Full Code Here

    final NumberLiteral zero = ast.newNumberLiteral();
    astRewrite.replace(ie.getRightOperand(), zero, null);

    final MethodInvocation newInvocation = ast.newMethodInvocation();
    newInvocation.setExpression(leftExpCopy);
    newInvocation.setName(ast.newSimpleName("compareTo")); //$NON-NLS-1$
    newInvocation.arguments().add(rightExpCopy);

    astRewrite.replace(ie.getLeftOperand(), newInvocation, null);

    if (((ASTNode) newInvocation.arguments().get(0)).getNodeType() == ASTNode.SIMPLE_NAME
View Full Code Here

              callbackType = parameterizedType;
            }
            // prepare "callback" parameter
            SingleVariableDeclaration asyncCallback = ast.newSingleVariableDeclaration();
            asyncCallback.setType(callbackType);
            asyncCallback.setName(ast.newSimpleName("callback"));
            // add "callback" parameter
            DomGenerics.parameters(methodDeclaration).add(asyncCallback);
          }
          // remove throws
          methodDeclaration.thrownExceptions().clear();
View Full Code Here

        if (javaProject.findType(superAsyncName) != null) {
          if (type instanceof SimpleType) {
            {
              SimpleType simpleType = (SimpleType) type;
              String superAsyncNameSimple = CodeUtils.getShortClass(superAsyncName);
              simpleType.setName(ast.newSimpleName(superAsyncNameSimple));
            }
            if (!CodeUtils.isSamePackage(serviceName, superAsyncName)) {
              addImport(serviceUnit, superAsyncName);
            }
            continue;
View Full Code Here

        assert rewrite != null;
        assert primitiveTypeCreation != null;

        final AST ast = rewrite.getAST();
        MethodInvocation valueOfInvocation = ast.newMethodInvocation();
        valueOfInvocation.setName(ast.newSimpleName(VALUE_OF_METHOD_NAME));

        ITypeBinding binding = primitiveTypeCreation.getType().resolveBinding();
        if (isStaticImport()) {
            addStaticImports(rewrite, compilationUnit, binding.getQualifiedName() + "." + VALUE_OF_METHOD_NAME);
        } else {
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.