Examples of BodyDeclaration


Examples of com.github.antlrjavaparser.api.body.BodyDeclaration

            final List<BodyDeclaration> bodyDeclarations = td.getMembers();
            if (bodyDeclarations == null || bodyDeclarations.size() != 1) {
                throw new IllegalStateException(
                        "Illegal state: JavaParser did not return body declarations correctly");
            }
            final BodyDeclaration bd = bodyDeclarations.get(0);
            if (!(bd instanceof ConstructorDeclaration)) {
                throw new IllegalStateException(
                        "Illegal state: JavaParser did not return a method declaration correctly");
            }
            final ConstructorDeclaration cd = (ConstructorDeclaration) bd;
View Full Code Here

Examples of japa.parser.ast.body.BodyDeclaration

            final List<BodyDeclaration> bodyDeclarations = td.getMembers();
            if (bodyDeclarations == null || bodyDeclarations.size() != 1) {
                throw new IllegalStateException(
                        "Illegal state: JavaParser did not return body declarations correctly");
            }
            final BodyDeclaration bd = bodyDeclarations.get(0);
            if (!(bd instanceof FieldDeclaration)) {
                throw new IllegalStateException(
                        "Illegal state: JavaParser did not return a field declaration correctly");
            }
            final FieldDeclaration fd = (FieldDeclaration) bd;
View Full Code Here

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

        return true;
      }
      public boolean visit(AnnotationTypeDeclaration annotationTypeDeclaration) {
        List bodyDeclarations = annotationTypeDeclaration.bodyDeclarations();
        for (Iterator iter = bodyDeclarations.iterator(); iter.hasNext();) {
          BodyDeclaration bodyDeclaration = (BodyDeclaration) iter.next();
          bodyDeclaration.setProperty(CompilationUnitSorter.RELATIVE_ORDER, new Integer(bodyDeclaration.getStartPosition()));
          annotationTypeDeclaration.setProperty(CONTAINS_MALFORMED_NODES, Boolean.valueOf(isMalformed(bodyDeclaration)));
        }
        return true;
      }

      public boolean visit(AnonymousClassDeclaration anonymousClassDeclaration) {
        List bodyDeclarations = anonymousClassDeclaration.bodyDeclarations();
        for (Iterator iter = bodyDeclarations.iterator(); iter.hasNext();) {
          BodyDeclaration bodyDeclaration = (BodyDeclaration) iter.next();
          bodyDeclaration.setProperty(CompilationUnitSorter.RELATIVE_ORDER, new Integer(bodyDeclaration.getStartPosition()));
          anonymousClassDeclaration.setProperty(CONTAINS_MALFORMED_NODES, Boolean.valueOf(isMalformed(bodyDeclaration)));
        }
        return true;
      }
     
      public boolean visit(TypeDeclaration typeDeclaration) {
        List bodyDeclarations = typeDeclaration.bodyDeclarations();
        for (Iterator iter = bodyDeclarations.iterator(); iter.hasNext();) {
          BodyDeclaration bodyDeclaration = (BodyDeclaration) iter.next();
          bodyDeclaration.setProperty(CompilationUnitSorter.RELATIVE_ORDER, new Integer(bodyDeclaration.getStartPosition()));
          typeDeclaration.setProperty(CONTAINS_MALFORMED_NODES, Boolean.valueOf(isMalformed(bodyDeclaration)));
        }
        return true;
      }

      public boolean visit(EnumDeclaration enumDeclaration) {
        List bodyDeclarations = enumDeclaration.bodyDeclarations();
        for (Iterator iter = bodyDeclarations.iterator(); iter.hasNext();) {
          BodyDeclaration bodyDeclaration = (BodyDeclaration) iter.next();
          bodyDeclaration.setProperty(CompilationUnitSorter.RELATIVE_ORDER, new Integer(bodyDeclaration.getStartPosition()));
          enumDeclaration.setProperty(CONTAINS_MALFORMED_NODES, Boolean.valueOf(isMalformed(bodyDeclaration)));
        }
        List enumConstants = enumDeclaration.enumConstants();
        for (Iterator iter = enumConstants.iterator(); iter.hasNext();) {
          EnumConstantDeclaration enumConstantDeclaration = (EnumConstantDeclaration) iter.next();
View Full Code Here

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

    IValueList extendedModifiers = parseExtendedModifiers(node.modifiers());
    IValue name = values.string(node.getName().getFullyQualifiedName());
   
    IValueList bodyDeclarations = new IValueList(values);
    for (Iterator it = node.bodyDeclarations().iterator(); it.hasNext();) {
      BodyDeclaration d = (BodyDeclaration) it.next();
      bodyDeclarations.add(visitChild(d));
    }
 
    ownValue = constructDeclarationNode("annotationType", name, bodyDeclarations.asList());
    setAnnotation("modifiers", extendedModifiers);
View Full Code Here

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

 
  public boolean visit(AnonymousClassDeclaration node) {
    IValueList bodyDeclarations = new IValueList(values);
 
    for (Iterator it = node.bodyDeclarations().iterator(); it.hasNext();) {
      BodyDeclaration b = (BodyDeclaration) it.next();
      bodyDeclarations.add(visitChild(b));
    }
    ownValue = constructDeclarationNode("class", bodyDeclarations.asList());
   
    return false;
View Full Code Here

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

    }
 
    IValueList bodyDeclarations = new IValueList(values);
    if (!node.bodyDeclarations().isEmpty()) {
      for (Iterator it = node.bodyDeclarations().iterator(); it.hasNext();) {
        BodyDeclaration d = (BodyDeclaration) it.next();
        bodyDeclarations.add(visitChild(d));
      }
    }
 
    ownValue = constructDeclarationNode("enum", name, implementedInterfaces.asList(), enumConstants.asList(), bodyDeclarations.asList());
View Full Code Here

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

      }
    }
   
    IValueList bodyDeclarations = new IValueList(values);
    for (Iterator it = node.bodyDeclarations().iterator(); it.hasNext();) {
      BodyDeclaration d = (BodyDeclaration) it.next();
      bodyDeclarations.add(visitChild(d));
    }
   
    ownValue = constructDeclarationNode(objectType, name, extendsClass.asList(), implementsInterfaces.asList(), bodyDeclarations.asList());
    setAnnotation("modifiers", extendedModifiers);
View Full Code Here

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

   */
  @Override
  public void selectionChanged(SelectionChangedEvent event) {
    IStructuredSelection selection = (IStructuredSelection) event
        .getSelection();
    BodyDeclaration selected = (BodyDeclaration) selection
        .getFirstElement();

    // Show the source code of the selection
    if (preview != null) {
      if (selected != null) {
        String previewCode = "";
        String adapterCode = "";
        if (selected.getNodeType() == BodyDeclaration.TYPE_DECLARATION) {
          previewCode = (String) selected
              .getProperty(ResultProperty.RAW_SOURCE.name());
          adapterCode = (String) selected
              .getProperty(ResultProperty.TEST_RESULT.name());
        } else {
          previewCode = selected.toString();
          adapterCode = "// No adapter code available";
        }
        boolean showAdapter = Activator.getDefault()
            .getPreferenceStore()
            .getBoolean(PreferenceConstants.P_SHOW_ADAPTER);
        String searchKind = selected.getProperty(
            ResultProperty.SEARCH_KIND.name()).toString();
        if (showAdapter
            && searchKind.equals(String
                .valueOf(Search.TEST_DRIVEN_SEARCH))) {
          preview.setCode(adapterCode);
View Full Code Here

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

   */
  protected void setPreview() {
    resultTree.refresh();
    TreeItem selection = resultTree.getSelectedElement();
    if (selection != null) {
      BodyDeclaration selected = (BodyDeclaration) selection.getData();
      // Show the source code of the selection
      if (preview != null) {
        if (selected != null) {
          String previewCode = "";
          String adapterCode = "";
          if (selected.getNodeType() == BodyDeclaration.TYPE_DECLARATION) {
            previewCode = (String) selected
                .getProperty(ResultProperty.RAW_SOURCE.name());
            adapterCode = (String) selected
                .getProperty(ResultProperty.TEST_RESULT.name());
          } else {
            previewCode = selected.toString();
            adapterCode = "// Adapter not available";
          }
          boolean showAdapter = Activator.getDefault()
              .getPreferenceStore()
              .getBoolean(PreferenceConstants.P_SHOW_ADAPTER);
          String searchKind = selected.getProperty(
              ResultProperty.SEARCH_KIND.name()).toString();
          if (showAdapter
              && searchKind.equals(String
                  .valueOf(Search.TEST_DRIVEN_SEARCH))) {
            preview.setCode(adapterCode);
View Full Code Here

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

  public void dragStart(DragSourceEvent event) {
    selection = viewer.getTree().getSelection();
    if (selection == null || selection.length == 0) {
      event.doit = false;
    }
    BodyDeclaration selectedElement = (BodyDeclaration) selection[0]
        .getData();
    logger.debug("URI: "
        + selectedElement.getProperty(ResultProperty.URI.name()));
  }
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.