Examples of MethodRef


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

          TextElement text = (TextElement) o;
          JavadocTextElement e = factory.createJavadocTextElement();
          e.setValue(text.getText());
          result.add(e);
        } else if (o instanceof MethodRef) {
          MethodRef ref = (MethodRef) o;
          JavaMethod method = getMethodFor(ref);
          if (method != null) {
            JavadocMethodReference e = factory.createJavadocMethodReference();
            e.setReference(method);
            result.add(e);
View Full Code Here

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


  private ASTNode createNode(AST ast) {
    TagElement tag = ast.newTagElement();
    tag.setTagName(TagElement.TAG_SEE);
    MethodRef method = ast.newMethodRef();
    tag.fragments().add(method);
    SimpleName name = ast.newSimpleName("Test");
    method.setQualifier(ast.newQualifiedName(ast.newQualifiedName(ast.newName("org"), ast.newSimpleName("junit")), name));
    name = ast.newSimpleName("setUp");
    method.setName(name);
    return tag;
  }
View Full Code Here

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

      public boolean visit(Javadoc doc){
        AST ast = doc.getAST();
        TagElement tag = ast.newTagElement();
        tag.setTagName(TagElement.TAG_SEE);
        doc.tags().add(tag);
        MethodRef method = ast.newMethodRef();
        tag.fragments().add(method);
        SimpleName name = ast.newSimpleName("Test");
        method.setQualifier(ast.newQualifiedName(ast.newQualifiedName(ast.newName("org"), ast.newSimpleName("junit")), name));
        name = ast.newSimpleName("test");
        method.setName(name);
        return super.visit(doc);
      }
    };
    node.accept(visitor);
    System.out.println(node);
View Full Code Here

Examples of org.jvnet.sorcerer.Tag.MethodRef

                        // can't link to the constructor as it's synthetic
                        scan(nt.getIdentifier());
                    } else {
                        // TODO: the identifier tree might contain type parameters, packaga names, etc.
                        // we should visit those
                        gen.add(new MethodRef(sp, ep, PositionUtils.getLineNumber(lineMap, sp), PositionUtils.getColNumber(lineMap, sp), ee));
                    }
                }

                scan(nt.getEnclosingExpression());
                scan(nt.getArguments());
                scan(nt.getTypeArguments());
                scan(nt.getClassBody());

                return _;
            }


            // TODO: how is the 'super' or 'this' constructor invocation handled?

            /**
             * Method invocation of the form "exp.method()"
             */
            public Void visitMethodInvocation(MethodInvocationTree mi, Void _) {
                ExpressionTree ms = mi.getMethodSelect(); // PRIMARY.methodName portion
                Element e = TreeUtil.getElement(mi);
                if (e instanceof ExecutableElement) {// this check is needed in case the source code contains errors
                    ExecutableElement ee = (ExecutableElement) e;
                    Name methodName = ee.getSimpleName();
                    long ep = srcPos.getEndPosition(cu, ms);
                    if(ep>=0) {
                        // marker for the method name (and jump to definition)
                        long sp = ep - methodName.length();
                        gen.add(new MethodRef(sp, ep, PositionUtils.getLineNumber(lineMap, sp), PositionUtils.getColNumber(lineMap, sp), ee));
                    }
                }

                return super.visitMethodInvocation(mi,_);
            }
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.