Package org.eclipse.jdt.core.dom

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


  private void goThroughClass(String ClassContent) {
    ASTParser parser = ASTParser.newParser(AST.JLS3);
    parser.setSource(ClassContent.toCharArray());
    parser.setKind(ASTParser.K_COMPILATION_UNIT);
    final CompilationUnit cu = (CompilationUnit) parser.createAST(null);
    cu.accept(new ASTVisitor() {

      private String elNodeName;
      private boolean intoEL;
      private boolean definedId;

      public void endVisit(FieldDeclaration node) {
        elNodeName = "";
        intoEL = false;
        definedId = false;
        node.accept(new ASTVisitor() {
          public void endVisit(MarkerAnnotation node) {
            intoEL = node.getTypeName().toString()
                .equals(TapestryContants.COMPONENT_PROPERTY);
            super.endVisit(node);
          }
View Full Code Here


    return name;
  }
  public static String getGetMethodName(CompilationUnit cunit, final String fieldName){
    TypeDeclaration type = (TypeDeclaration) cunit.types().get(0);
    final String[]ret=new String[1];
    type.accept(new ASTVisitor(){
      @Override
      public boolean visit(ReturnStatement node) {
        Expression exp = node.getExpression();
        if(exp!=null&&exp instanceof SimpleName){
          String retName = ((SimpleName)exp).getFullyQualifiedName();
View Full Code Here

    });
    return ret[0];
 
  public static String findReturnFieldName(MethodDeclaration method){
    final String[]ret=new String[1];
    method.accept(new ASTVisitor(){
      @Override
      public boolean visit(ReturnStatement node) {
        Expression exp=node.getExpression();
        if(exp instanceof SimpleName ){
          ret[0]=((SimpleName)exp).getFullyQualifiedName();
View Full Code Here

    ICompilationUnit comp_unit = model_element.getCompilationUnit();
    ASTNode node = getASTNodeFromCompilationUnit(comp_unit);
   
    // Now, find the corresponding type node
    final Box<NODETYPE> result = new Box<NODETYPE>(null);
    node.accept(new ASTVisitor() {
     
      @Override
      public void postVisit(ASTNode node) {
        // If this node is a subtype of the node we are
        // interested in, then we can ask the client's
View Full Code Here

    ICompilationUnit comp_unit = model_element.getCompilationUnit();
    ASTNode node = getASTNodeFromCompilationUnit(comp_unit);
   
    // Now, find the corresponding type node
    final Box<NODETYPE> result = new Box<NODETYPE>(null);
    node.accept(new ASTVisitor() {
     
      @Override
      public void postVisit(ASTNode node) {
        // If this node is a subtype of the node we are
        // interested in, then we can ask the client's
View Full Code Here

    final Box<Boolean> is_a_test = Box.box(false);
    final Box<Boolean> is_passing_test = Box.box(false);
    final Box<Integer> failures = Box.box(0);
    final Set<String> analyses = new LinkedHashSet<String>();

    ASTVisitor annotation_visitor = new ASTVisitor() {
      // Visitor will find @PassingTest, @FailingTest, @UseAnalyses

      private Integer intValueFromBinding(IAnnotationBinding binding) {
        for (IMemberValuePairBinding pair : binding.getAllMemberValuePairs()) {
          if ("value".equals(pair.getName())) {
View Full Code Here

    final Box<Boolean> is_passing_test = Box.box(false);
    final Box<Integer> failures = Box.box(0);
    final Set<String> analyses = new LinkedHashSet<String>();
    final Set<TestType> tests = new LinkedHashSet<TestType>();

    ASTVisitor annotation_visitor = new ASTVisitor() {
      // Visitor will find @PassingTest, @FailingTest, @UseAnalyses, and @AnalysisTests
      // @AnalysisTests should not be used with the others!
     
      private TestType parseFailOrPassAnnotation(IAnnotationBinding binding, boolean isPass) {
        int numErrors = 0;
View Full Code Here

   * @see edu.cmu.cs.crystal.AbstractCrystalMethodAnalysis#analyzeMethod(org.eclipse.jdt.core.dom.MethodDeclaration)
   */
  @Override
  public void analyzeMethod(MethodDeclaration d) {
    final EclipseTAC tac = new EclipseTAC(d.resolveBinding());
    d.getBody().accept(new ASTVisitor() {

      /* (non-Javadoc)
       * @see org.eclipse.jdt.core.dom.ASTVisitor#postVisit(org.eclipse.jdt.core.dom.ASTNode)
       */
      @Override
 
View Full Code Here

        final CompilationUnit ast = createAST(javaProject, className);

        if (ast == null)
            return null;

        ast.accept(new ASTVisitor() {
            @Override
            public boolean visit(TypeDeclaration typeDecl) {
                ITypeBinding typeBinding = typeDecl.resolveBinding();
                if (typeBinding != null) {
                    if (typeBinding.getBinaryName().equals(className)) {
View Full Code Here

        final CompilationUnit ast = createAST(javaProject, className);

        if (ast == null)
            return null;

        ast.accept(new ASTVisitor() {
            @Override
            public boolean visit(MethodDeclaration methodDecl) {
                if (matches(ast, methodDecl, methodName, methodSignature)) {
                    // Create the marker attribs here
                    markerAttributes.put(IMarker.CHAR_START, methodDecl.getStartPosition());
View Full Code Here

TOP

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

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.