Package org.eclipse.jdt.core.dom

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


      if (!packg.isEmpty())
      {
         getOrigin().addImport(type);
      }

      SimpleName simpleName = method.getAST().newSimpleName(name);

      List list = (List) method.getStructuralProperty(MethodDeclaration.THROWN_EXCEPTIONS_PROPERTY);
      list.add(simpleName);

      return this;
View Full Code Here


      if (!packg.isEmpty())
      {
         getOrigin().addImport(type);
      }

      SimpleName simpleName = method.getAST().newSimpleName(name);

      List list = (List) method.getStructuralProperty(MethodDeclaration.THROWN_EXCEPTIONS_PROPERTY);
      list.add(simpleName);

      return this;
View Full Code Here

   }

   @Override
   public String getName()
   {
      SimpleName name = param.getName();
      if (name != null)
      {
         return name.toString();
      }
      return "";
   }
View Full Code Here

      if (!packg.isEmpty())
      {
         getOrigin().addImport(type);
      }

      SimpleName simpleName = method.getAST().newSimpleName(name);

      List list = (List) method.getStructuralProperty(MethodDeclaration.THROWN_EXCEPTIONS_PROPERTY);
      list.add(simpleName);

      return this;
View Full Code Here

  @SuppressWarnings("unchecked")
  public void generateSerialVersionUID(Classifier clazz, AST ast,
      TypeDeclaration td) {
    VariableDeclarationFragment fragment = ast
        .newVariableDeclarationFragment();
    SimpleName variableName = ast.newSimpleName("serialVersionUID");
    fragment.setName(variableName);
    NumberLiteral initializer = ast.newNumberLiteral();
    initializer.setToken("1L");
    fragment.setInitializer(initializer);
View Full Code Here

    org.eclipse.jdt.core.dom.Type chosenType = jdtHelper.getChosenType(ast,
        umlTypeName, umlQualifiedTypeName, sourceDirectoryPackageName);

    VariableDeclarationFragment fragment = ast
        .newVariableDeclarationFragment();
    SimpleName variableName = ast.newSimpleName(property.getName());
    fragment.setName(variableName);

    FieldDeclaration fieldDeclaration = ast.newFieldDeclaration(fragment);
    fieldDeclaration.setType(chosenType);
View Full Code Here

          ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD));

      // Content of getter method
      Block block = ast.newBlock();
      ReturnStatement returnStatement = ast.newReturnStatement();
      SimpleName simpleName = ast.newSimpleName(property.getName());
      returnStatement.setExpression(simpleName);
      block.statements().add(returnStatement);
      methodDeclaration.setBody(block);
    }
  }
View Full Code Here

          + "Property: " + property.getName() + " - "
          + "Property Upper: " + property.getUpper() + " - "
          + "Property Lower: " + property.getLower());

      // Left expression
      SimpleName simpleName = ast.newSimpleName(property.getName());
      ThisExpression thisExpression = ast.newThisExpression();
      FieldAccess fieldAccess = ast.newFieldAccess();
      fieldAccess.setName(simpleName);
      fieldAccess.setExpression(thisExpression);

      // Right expression
      SimpleName parameter = ast.newSimpleName(property.getName());

      Assignment assignment = ast.newAssignment();
      assignment
          .setOperator(org.eclipse.jdt.core.dom.Assignment.Operator.ASSIGN);
      assignment.setLeftHandSide(fieldAccess);
View Full Code Here

  public final static OffsetAndLength calculateOffset(BodyDeclaration declaration, boolean includingModifiers) {
    if (!(declaration instanceof MethodDeclaration ) &&
        !(declaration instanceof TypeDeclaration   )    ) {
      throw new IllegalArgumentException("declaration must be TypeDeclaration or MethodDeclaration");
    }
    SimpleName methodName = nameFor(declaration);
    if (!includingModifiers) {
      return new OffsetAndLength(methodName.getStartPosition(), methodName.getLength());
    } else {
      // including modifiers
      int endOfMethodName = methodName.getStartPosition() + methodName.getLength();
      ChildListPropertyDescriptor modifiersProperty = declaration.getModifiersProperty();
      List<ASTNode> methodModifiers =
        Generics.asT(declaration.getStructuralProperty(modifiersProperty));
      if (methodModifiers.size() > 0) {
        int startOfModifiers = methodModifiers.get(0).getStartPosition();
View Full Code Here

   *
   * @param declaration
   * @param includingModifiers - whether to include modifiers in the offset and length.
   */
  public final static OffsetAndLength calculateOffset(TypeDeclaration declaration, boolean includingModifiers) {
    SimpleName typeName = declaration.getName();
    if (!includingModifiers) {
      return new OffsetAndLength(typeName.getStartPosition(), typeName.getLength());
    } else {
      // including modifiers
      int endOfMethodName = typeName.getStartPosition() + typeName.getLength();
      ChildListPropertyDescriptor modifiersProperty = declaration.getModifiersProperty();
      List<ASTNode> methodModifiers =
        Generics.asT(declaration.getStructuralProperty(modifiersProperty));
      if (methodModifiers.size() > 0) {
        int startOfModifiers = methodModifiers.get(0).getStartPosition();
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.dom.SimpleName

Copyright © 2018 www.massapicom. 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.