Example usage for org.eclipse.jdt.core.dom MethodRef parameters

List of usage examples for org.eclipse.jdt.core.dom MethodRef parameters

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.dom MethodRef parameters.

Prototype

ASTNode.NodeList parameters

To view the source code for org.eclipse.jdt.core.dom MethodRef parameters.

Click Source Link

Document

The parameter declarations (element type: MethodRefParameter ).

Usage

From source file:at.bestsolution.fxide.jdt.corext.dom.ASTFlattener.java

License:Open Source License

@Override
public boolean visit(MethodRef node) {
    if (node.getQualifier() != null) {
        node.getQualifier().accept(this);
    }/*w ww.ja va  2s.c  o m*/
    this.fBuffer.append("#");//$NON-NLS-1$
    node.getName().accept(this);
    this.fBuffer.append("(");//$NON-NLS-1$
    for (Iterator<MethodRefParameter> it = node.parameters().iterator(); it.hasNext();) {
        MethodRefParameter e = it.next();
        e.accept(this);
        if (it.hasNext()) {
            this.fBuffer.append(",");//$NON-NLS-1$
        }
    }
    this.fBuffer.append(")");//$NON-NLS-1$
    return false;
}

From source file:at.bestsolution.fxide.jdt.text.javadoc.JavadocContentAccess2.java

License:Open Source License

private void handleLink(List<? extends ASTNode> fragments) {
    //TODO: Javadoc shortens type names to minimal length according to context
    int fs = fragments.size();
    if (fs > 0) {
        Object first = fragments.get(0);
        String refTypeName = null;
        String refMemberName = null;
        String[] refMethodParamTypes = null;
        String[] refMethodParamNames = null;
        if (first instanceof Name) {
            Name name = (Name) first;
            refTypeName = name.getFullyQualifiedName();
        } else if (first instanceof MemberRef) {
            MemberRef memberRef = (MemberRef) first;
            Name qualifier = memberRef.getQualifier();
            refTypeName = qualifier == null ? "" : qualifier.getFullyQualifiedName(); //$NON-NLS-1$
            refMemberName = memberRef.getName().getIdentifier();
        } else if (first instanceof MethodRef) {
            MethodRef methodRef = (MethodRef) first;
            Name qualifier = methodRef.getQualifier();
            refTypeName = qualifier == null ? "" : qualifier.getFullyQualifiedName(); //$NON-NLS-1$
            refMemberName = methodRef.getName().getIdentifier();
            List<MethodRefParameter> params = methodRef.parameters();
            int ps = params.size();
            refMethodParamTypes = new String[ps];
            refMethodParamNames = new String[ps];
            for (int i = 0; i < ps; i++) {
                MethodRefParameter param = params.get(i);
                refMethodParamTypes[i] = ASTNodes.asString(param.getType());
                SimpleName paramName = param.getName();
                if (paramName != null)
                    refMethodParamNames[i] = paramName.getIdentifier();
            }//from   w  ww.j a v a  2  s  . c  o m
        }

        if (refTypeName != null) {
            fBuf.append("<a href='"); //$NON-NLS-1$
            try {
                String scheme = JavaElementLinks.JAVADOC_SCHEME;
                String uri = JavaElementLinks.createURI(scheme, fElement, refTypeName, refMemberName,
                        refMethodParamTypes);
                fBuf.append(uri);
            } catch (URISyntaxException e) {
                //TODO
                e.printStackTrace();
            }
            fBuf.append("'>"); //$NON-NLS-1$
            if (fs > 1 && !(fs == 2 && isWhitespaceTextElement(fragments.get(1)))) {
                handleContentElements(fragments.subList(1, fs), true);
            } else {
                fBuf.append(refTypeName);
                if (refMemberName != null) {
                    if (refTypeName.length() > 0) {
                        fBuf.append('.');
                    }
                    fBuf.append(refMemberName);
                    if (refMethodParamTypes != null) {
                        fBuf.append('(');
                        for (int i = 0; i < refMethodParamTypes.length; i++) {
                            String pType = refMethodParamTypes[i];
                            fBuf.append(pType);
                            String pName = refMethodParamNames[i];
                            if (pName != null) {
                                fBuf.append(' ').append(pName);
                            }
                            if (i < refMethodParamTypes.length - 1) {
                                fBuf.append(", "); //$NON-NLS-1$
                            }
                        }
                        fBuf.append(')');
                    }
                }
            }
            fBuf.append("</a>"); //$NON-NLS-1$
        } else {
            handleContentElements(fragments);
        }
    }
}

From source file:coloredide.utils.CopiedNaiveASTFlattener.java

License:Open Source License

public boolean visit(MethodRef node) {
    if (node.getQualifier() != null) {
        node.getQualifier().accept(this);
    }/*from  w w  w .  j a va 2s.c  o  m*/
    this.buffer.append("#");//$NON-NLS-1$
    node.getName().accept(this);
    this.buffer.append("(");//$NON-NLS-1$
    for (Iterator it = node.parameters().iterator(); it.hasNext();) {
        MethodRefParameter e = (MethodRefParameter) it.next();
        e.accept(this);
        if (it.hasNext()) {
            this.buffer.append(",");//$NON-NLS-1$
        }
    }
    this.buffer.append(")");//$NON-NLS-1$
    return false;
}

From source file:com.codenvy.ide.ext.java.server.javadoc.JavadocContentAccess2.java

License:Open Source License

private void handleLink(List<? extends ASTNode> fragments) {
    //TODO: Javadoc shortens type names to minimal length according to context
    int fs = fragments.size();
    if (fs > 0) {
        Object first = fragments.get(0);
        String refTypeName = null;
        String refMemberName = null;
        String[] refMethodParamTypes = null;
        String[] refMethodParamNames = null;
        if (first instanceof Name) {
            Name name = (Name) first;
            refTypeName = name.getFullyQualifiedName();
        } else if (first instanceof MemberRef) {
            MemberRef memberRef = (MemberRef) first;
            Name qualifier = memberRef.getQualifier();
            refTypeName = qualifier == null ? "" : qualifier.getFullyQualifiedName(); //$NON-NLS-1$
            refMemberName = memberRef.getName().getIdentifier();
        } else if (first instanceof MethodRef) {
            MethodRef methodRef = (MethodRef) first;
            Name qualifier = methodRef.getQualifier();
            refTypeName = qualifier == null ? "" : qualifier.getFullyQualifiedName(); //$NON-NLS-1$
            refMemberName = methodRef.getName().getIdentifier();
            List<MethodRefParameter> params = methodRef.parameters();
            int ps = params.size();
            refMethodParamTypes = new String[ps];
            refMethodParamNames = new String[ps];
            for (int i = 0; i < ps; i++) {
                MethodRefParameter param = params.get(i);
                refMethodParamTypes[i] = ASTNodes.asString(param.getType());
                SimpleName paramName = param.getName();
                if (paramName != null)
                    refMethodParamNames[i] = paramName.getIdentifier();
            }/*from   w w w  .  j  a v  a  2  s .com*/
        }

        if (refTypeName != null) {
            fBuf.append("<a href='"); //$NON-NLS-1$
            try {
                String scheme = urlPrefix;
                String uri = JavaElementLinks.createURI(scheme, fElement, refTypeName, refMemberName,
                        refMethodParamTypes);
                fBuf.append(uri);
            } catch (URISyntaxException e) {
                LOG.error(e.getMessage(), e);
            }
            fBuf.append("'>"); //$NON-NLS-1$
            if (fs > 1 && !(fs == 2 && isWhitespaceTextElement(fragments.get(1)))) {
                handleContentElements(fragments.subList(1, fs), true);
            } else {
                fBuf.append(refTypeName);
                if (refMemberName != null) {
                    if (refTypeName.length() > 0) {
                        fBuf.append('.');
                    }
                    fBuf.append(refMemberName);
                    if (refMethodParamTypes != null) {
                        fBuf.append('(');
                        for (int i = 0; i < refMethodParamTypes.length; i++) {
                            String pType = refMethodParamTypes[i];
                            fBuf.append(pType);
                            String pName = refMethodParamNames[i];
                            if (pName != null) {
                                fBuf.append(' ').append(pName);
                            }
                            if (i < refMethodParamTypes.length - 1) {
                                fBuf.append(", "); //$NON-NLS-1$
                            }
                        }
                        fBuf.append(')');
                    }
                }
            }
            fBuf.append("</a>"); //$NON-NLS-1$
        } else {
            handleContentElements(fragments);
        }
    }
}

From source file:com.motorola.studio.android.model.java.JavaClass.java

License:Apache License

/**
 * Adds documentation reference to a method (the see tag to the javadoc)
 * /*from  w  w  w .ja va  2s. c o  m*/
 * @param element The method declaration object
 * @param qualifiedClassName The full qualified class name to refer
 * @param methodName The method to refer
 * @param parameters The method parameters
 */
@SuppressWarnings("unchecked")
protected void addMethodReference(MethodDeclaration element, String qualifiedClassName, String methodName,
        Type[] parameters) {
    String[] fqnArray = getFQNAsArray(qualifiedClassName);

    MethodRef methodRef = ast.newMethodRef();
    methodRef.setQualifier(
            ast.newQualifiedName(ast.newName(getQualifier(fqnArray)), ast.newSimpleName(getName(fqnArray))));

    methodRef.setName(ast.newSimpleName(methodName));

    if ((parameters != null) && (parameters.length > 0)) {
        for (Type param : parameters) {
            MethodRefParameter methodParam = ast.newMethodRefParameter();
            methodParam.setType(param);
            methodRef.parameters().add(methodParam);
        }
    }

    Javadoc javadoc = element.getJavadoc();
    TagElement tagElement = ast.newTagElement();
    tagElement.setTagName(TagElement.TAG_SEE);

    if (javadoc == null) {
        javadoc = ast.newJavadoc();
        element.setJavadoc(javadoc);
    }

    tagElement.fragments().add(methodRef);
    javadoc.tags().add(tagElement);
}

From source file:com.servoy.eclipse.docgenerator.parser.JavadocExtractor.java

License:Open Source License

@Override
public boolean visit(MethodRef node) {
    storeWhitespaceIfAny(node, -1);//from   w w  w.  j  a  v a 2s .c  o  m

    ReferenceMetaModel ref = extractBinding(node.resolveBinding(), node.getQualifier(), node.getName(),
            node.parameters());
    javadocsStack.peek().addPart(ref);

    return false;
}

From source file:de.akra.idocit.java.services.JavaInterfaceParserTest.java

License:Apache License

/**
 * Creates the expected {@link JavaInterfaceArtifact} for the source
 * AllIDocItJavaTests.SOURCE_DIR + "JavaInterfaceParser.java".
 * /*  w w w .  j  av a2s.  com*/
 * @param fileName
 *            The file name of the source file.
 * @param cu
 *            The {@link CompilationUnit} of the source file.
 * @return {@link JavaInterfaceArtifact}
 * @throws JavaModelException
 */
@SuppressWarnings("unchecked")
private JavaInterfaceArtifact createExpectedArtifact(String fileName, CompilationUnit cu)
        throws JavaModelException {
    Addressee developer = DescribedItemUtils.findAddressee("Developer");

    JavaInterfaceArtifact artifact = new JavaInterfaceArtifact(SignatureElement.EMPTY_SIGNATURE_ELEMENT,
            CATEGORY_ARTIFACT, cu, Numerus.SINGULAR);
    artifact.setIdentifier(fileName);

    ICompilationUnit icu = (ICompilationUnit) cu.getJavaElement();
    artifact.setOriginalDocument(icu.getSource());

    AST ast = AST.newAST(AST.JLS3);

    /*
     * Interface
     */
    JavaInterface jInterface = new JavaInterface(artifact, CATEGORY_CLASS, Numerus.SINGULAR);
    jInterface.setIdentifier("JavaInterfaceParser");
    jInterface.setQualifiedIdentifier("JavaInterfaceParser");
    jInterface.addDocpart(makeDocumentation(developer, null,
            "<p><b>This is a test class used in JUnit test!!</b></p>The parser parses Java Interfaces, Classes and Enumerations and maps the structure to the iDocIt structure."));
    artifact.addInterface(jInterface);

    List<TagElement> tags = new ArrayList<TagElement>();
    TagElement tag = ast.newTagElement();
    tag.setTagName(TagElement.TAG_AUTHOR);
    TextElement textElem = ast.newTextElement();
    textElem.setText(" Dirk Meier-Eickhoff");
    tag.fragments().add(textElem);
    tags.add(tag);

    tag = ast.newTagElement();
    tag.setTagName(TagElement.TAG_SINCE);
    textElem = ast.newTextElement();
    textElem.setText(" 0.0.1");
    tag.fragments().add(textElem);
    tags.add(tag);

    tag = ast.newTagElement();
    tag.setTagName(TagElement.TAG_VERSION);
    textElem = ast.newTextElement();
    textElem.setText(" 0.0.1");
    tag.fragments().add(textElem);
    tags.add(tag);

    jInterface.setAdditionalTags(tags);

    List<JavaMethod> methods = new ArrayList<JavaMethod>();
    jInterface.setOperations(methods);

    /*
     * Constructor
     */
    JavaMethod method = new JavaMethod(jInterface, CATEGORY_CONSTRUCTOR,
            ThematicGridConstants.THEMATIC_GRID_DEFAULT_NAME, Numerus.SINGULAR);
    method.setIdentifier("JavaInterfaceParser");
    method.setQualifiedIdentifier("JavaInterfaceParser");
    method.addDocpart(makeDocumentation(developer, null, "This is the constructor."));
    methods.add(method);

    /*
     * Constructor -> input params
     */
    JavaParameters inputParams = new JavaParameters(method, CATEGORY_PARAMETERS, Numerus.SINGULAR, false);
    inputParams.setIdentifier(StringUtils.EMPTY);
    inputParams.setQualifiedIdentifier(StringUtils.EMPTY);
    method.setInputParameters(inputParams);

    JavaParameter param = new JavaParameter(inputParams, Numerus.SINGULAR, false);
    param.setIdentifier("compilationUnit");
    param.setQualifiedIdentifier("compilationUnit");
    param.setDataTypeName("CompilationUnit");
    param.setQualifiedDataTypeName("CompilationUnit");
    param.setSignatureElementPath("compilationUnit:CompilationUnit");
    param.addDocpart(makeDocumentation(developer, "compilationUnit:CompilationUnit",
            "The {@link CompilationUnit} that should be parsed &amp; checked."));
    inputParams.addParameter(param);

    param = new JavaParameter(inputParams, Numerus.SINGULAR, false);
    param.setIdentifier("artifactName");
    param.setQualifiedIdentifier("artifactName");
    param.setDataTypeName("String");
    param.setQualifiedDataTypeName("String");
    param.setSignatureElementPath("artifactName:String");
    param.addDocpart(makeDocumentation(developer, "artifactName:String",
            "The name for the CompilationUnit (in general the Java source file)."));
    inputParams.addParameter(param);

    param = new JavaParameter(inputParams, Numerus.SINGULAR, false);
    param.setIdentifier("delimiters");
    param.setQualifiedIdentifier("delimiters");
    param.setDataTypeName("Delimiters");
    param.setQualifiedDataTypeName("Delimiters");
    param.setSignatureElementPath("delimiters:Delimiters");
    param.addDocpart(makeDocumentation(developer, "delimiters:Delimiters",
            "The {@link Delimiters} for creating paths."));
    inputParams.addParameter(param);

    /*
     * Method
     */
    method = new JavaMethod(jInterface, CATEGORY_METHOD, ThematicGridConstants.THEMATIC_GRID_DEFAULT_NAME,
            Numerus.SINGULAR);
    method.setIdentifier("parse");
    method.setQualifiedIdentifier("parse");
    method.addDocpart(makeDocumentation(developer, null,
            "Parses the {@link CompilationUnit} <code>compilationUnit</code> (Java source file) and converts it to a {@link JavaInterfaceArtifact}. (Read {@link JavaInterfaceArtifact#copy(de.akra.idocit.common.structure.SignatureElement)})"));

    tags = new ArrayList<TagElement>();
    tag = ast.newTagElement();
    tag.setTagName(TagElement.TAG_SEE);
    SimpleName name = ast.newSimpleName("JavaModelException");
    tag.fragments().add(name);
    tags.add(tag);

    tag = ast.newTagElement();
    tag.setTagName(TagElement.TAG_SEE);
    MethodRef mRef = ast.newMethodRef();
    mRef.setName(ast.newSimpleName("parse"));

    MethodRefParameter mRefParam = ast.newMethodRefParameter();
    mRefParam.setType(ast.newPrimitiveType(PrimitiveType.INT));
    mRef.parameters().add(mRefParam);

    mRefParam = ast.newMethodRefParameter();
    mRefParam.setType(ast.newSimpleType(ast.newName("String")));
    mRef.parameters().add(mRefParam);

    tag.fragments().add(mRef);
    tags.add(tag);

    tag = ast.newTagElement();
    tag.setTagName(TagElement.TAG_AUTHOR);
    textElem = ast.newTextElement();
    textElem.setText(" Dirk Meier-Eickhoff");
    tag.fragments().add(textElem);
    tags.add(tag);

    tag = ast.newTagElement();
    tag.setTagName(TagElement.TAG_SINCE);
    textElem = ast.newTextElement();
    textElem.setText(" 0.0.1");
    tag.fragments().add(textElem);
    tags.add(tag);

    tag = ast.newTagElement();
    tag.setTagName(TagElement.TAG_VERSION);
    textElem = ast.newTextElement();
    textElem.setText(" 0.0.4");
    tag.fragments().add(textElem);
    tags.add(tag);

    method.setAdditionalTags(tags);
    methods.add(method);

    /*
     * Method -> input params
     */
    inputParams = new JavaParameters(method, CATEGORY_PARAMETERS, Numerus.SINGULAR, false);
    inputParams.setIdentifier(StringUtils.EMPTY);
    inputParams.setQualifiedIdentifier(StringUtils.EMPTY);
    method.setInputParameters(inputParams);

    param = new JavaParameter(inputParams, Numerus.SINGULAR, false);
    param.setIdentifier("anyNumber");
    param.setQualifiedIdentifier("anyNumber");
    param.setDataTypeName("int");
    param.setQualifiedDataTypeName("int");
    param.setSignatureElementPath("anyNumber:int");
    param.addDocpart(makeDocumentation(developer, "anyNumber:int", "This is only any number."));
    inputParams.addParameter(param);

    param = new JavaParameter(inputParams, Numerus.SINGULAR, false);
    param.setIdentifier("anyString");
    param.setQualifiedIdentifier("anyString");
    param.setDataTypeName("String");
    param.setQualifiedDataTypeName("String");
    param.setSignatureElementPath("anyString:String");
    param.addDocpart(makeDocumentation(developer, "anyString:String",
            "This is only any simple String. {@literal This Is A Literal}."));
    inputParams.addParameter(param);

    param = new JavaParameter(inputParams, Numerus.PLURAL, false);
    param.setIdentifier("names");
    param.setQualifiedIdentifier("names");
    param.setDataTypeName("List<String>");
    param.setQualifiedDataTypeName("List<String>");
    param.setSignatureElementPath("names:List<String>");
    param.addDocpart(makeDocumentation(developer, "names:List<String>", "The list of names"));
    inputParams.addParameter(param);

    /*
     * Method -> output param
     */
    JavaParameters outputParam = new JavaParameters(method, CATEGORY_RETURN_TYPE, Numerus.SINGULAR, false);
    outputParam.setIdentifier(StringUtils.EMPTY);
    outputParam.setQualifiedIdentifier(StringUtils.EMPTY);
    method.setOutputParameters(outputParam);

    param = new JavaParameter(outputParam, Numerus.SINGULAR, true);
    param.setIdentifier("InterfaceArtifact");
    param.setQualifiedIdentifier("InterfaceArtifact");
    param.setDataTypeName("InterfaceArtifact");
    param.setQualifiedDataTypeName("InterfaceArtifact");
    param.setSignatureElementPath("InterfaceArtifact:InterfaceArtifact");
    param.addDocpart(makeDocumentation(developer, "InterfaceArtifact:InterfaceArtifact",
            "a new {@link JavaInterfaceArtifact}."));
    outputParam.addParameter(param);

    /*
     * Method -> exceptions
     */
    List<JavaParameters> exceptionList = new ArrayList<JavaParameters>();
    method.setExceptions(exceptionList);

    JavaParameters exceptions = new JavaParameters(method, CATEGORY_THROWS, Numerus.SINGULAR, false);
    exceptions.setIdentifier(StringUtils.EMPTY);
    exceptions.setQualifiedIdentifier(StringUtils.EMPTY);
    exceptionList.add(exceptions);

    param = new JavaParameter(exceptions, Numerus.SINGULAR, false);
    param.setIdentifier("JavaModelException");
    param.setQualifiedIdentifier("JavaModelException");
    param.setDataTypeName("JavaModelException");
    param.setQualifiedDataTypeName("JavaModelException");
    param.setSignatureElementPath("JavaModelException:JavaModelException");
    param.addDocpart(makeDocumentation(developer, "JavaModelException:JavaModelException",
            "if an error occurs by getting the source code from ICompilationUnit."));
    exceptions.addParameter(param);

    param = new JavaParameter(exceptions, Numerus.SINGULAR, false);
    param.setIdentifier("SAXException");
    param.setQualifiedIdentifier("SAXException");
    param.setDataTypeName("SAXException");
    param.setQualifiedDataTypeName("SAXException");
    param.setSignatureElementPath("SAXException:SAXException");
    param.addDocpart(makeDocumentation(developer, "SAXException:SAXException", StringUtils.EMPTY));
    exceptions.addParameter(param);

    param = new JavaParameter(exceptions, Numerus.SINGULAR, false);
    param.setIdentifier("IOException");
    param.setQualifiedIdentifier("IOException");
    param.setDataTypeName("IOException");
    param.setQualifiedDataTypeName("IOException");
    param.setSignatureElementPath("IOException:IOException");
    param.addDocpart(makeDocumentation(developer, "IOException:IOException", StringUtils.EMPTY));
    exceptions.addParameter(param);

    param = new JavaParameter(exceptions, Numerus.SINGULAR, false);
    param.setIdentifier("ParserConfigurationException");
    param.setQualifiedIdentifier("ParserConfigurationException");
    param.setDataTypeName("ParserConfigurationException");
    param.setQualifiedDataTypeName("ParserConfigurationException");
    param.setSignatureElementPath("ParserConfigurationException:ParserConfigurationException");
    param.addDocpart(makeDocumentation(developer, "ParserConfigurationException:ParserConfigurationException",
            StringUtils.EMPTY));
    exceptions.addParameter(param);

    return artifact;
}

From source file:de.akra.idocit.java.utils.JavadocUtils.java

License:Apache License

/**
 * Extracts the plain text from the <code>fragments</code>.
 * /*from   www.jav  a 2 s  .c o m*/
 * @param fragments
 *            The fragments to read.
 * @param offset
 *            The index at which should be started to read. If the fragments are e.g.
 *            from a "@param" tag, then it is followed by the the variable name which
 *            should be skipped. Therefore the <code>offset</code> should be 1.
 * @return The text from the <code>fragments</code>.
 */
@SuppressWarnings("unchecked")
public static String readFragments(final List<ASTNode> fragments, final int offset) {
    final StringBuffer html = new StringBuffer();

    if (fragments != null && fragments.size() >= offset) {
        for (final ASTNode fragment : fragments.subList(offset, fragments.size())) {
            final StringBuffer tempText = new StringBuffer(fragment.getLength());

            switch (fragment.getNodeType()) {
            case ASTNode.TEXT_ELEMENT: {
                final TextElement textElem = (TextElement) fragment;
                tempText.append(textElem.getText());
                break;
            }
            case ASTNode.SIMPLE_NAME:
            case ASTNode.QUALIFIED_NAME: {
                final Name name = (Name) fragment;
                tempText.append(name.getFullyQualifiedName());
                break;
            }
            case ASTNode.METHOD_REF: {
                final MethodRef mRef = (MethodRef) fragment;
                if (mRef.getQualifier() != null) {
                    final Name qualifier = mRef.getQualifier();
                    tempText.append(qualifier.getFullyQualifiedName());
                }

                tempText.append('#');
                tempText.append(mRef.getName().getIdentifier());
                tempText.append('(');

                // write parameter list
                final List<MethodRefParameter> mRefParameters = (List<MethodRefParameter>) mRef.parameters();
                for (final MethodRefParameter mRefParam : mRefParameters) {
                    tempText.append(ReflectionHelper.extractIdentifierFrom(mRefParam.getType()));
                    if (mRefParam.isVarargs()) {
                        tempText.append("...");
                    }
                    if (mRefParam.getName() != null) {
                        tempText.append(' ');
                        tempText.append(mRefParam.getName().getFullyQualifiedName());
                    }
                    tempText.append(',');
                }
                if (!mRefParameters.isEmpty()) {
                    // remove last comma
                    tempText.deleteCharAt(tempText.length() - 1);
                }

                tempText.append(')');
                break;
            }
            case ASTNode.MEMBER_REF: {
                final MemberRef mRef = (MemberRef) fragment;
                if (mRef.getQualifier() != null) {
                    final Name qualifier = mRef.getQualifier();
                    tempText.append(qualifier.getFullyQualifiedName());
                }
                tempText.append('#');
                tempText.append(mRef.getName().getIdentifier());
                break;
            }
            case ASTNode.TAG_ELEMENT: {
                final TagElement tagElem = (TagElement) fragment;
                if (tagElem.isNested()) {
                    tempText.append('{');
                }

                tempText.append(tagElem.getTagName());
                tempText.append(' ');
                tempText.append(readFragments((List<ASTNode>) tagElem.fragments(), 0));

                if (tagElem.isNested()) {
                    tempText.append('}');
                }
                break;
            }
            default: {
                // Do nothing!
                logger.info("The fragment " + String.valueOf(fragment) + " has nodetype-value "
                        + fragment.getNodeType());
            }
            }
            appendWithSpace(html, tempText);
        }
        // delete leading space, that was added by Javadoc to separate a tag
        // from the following text (e.g. '@param My documentation').
        if (html.length() > 0 && html.charAt(0) == ' ') {
            html.deleteCharAt(0);
        }
    }
    return html.toString();
}

From source file:java5totext.input.JDTVisitor.java

License:Open Source License

@Override
public void endVisit(org.eclipse.jdt.core.dom.MethodRef node) {
    MethodRef element = (MethodRef) this.binding.get(node);
    this.initializeNode(element, node);

    if (this.binding.get(node.getName()) != null)
        element.setMethod((NamedElementRef) this.binding.get(node.getName()));
    if (this.binding.get(node.getQualifier()) != null)
        element.setQualifier((NamedElementRef) this.binding.get(node.getQualifier()));
    for (Iterator<?> i = node.parameters().iterator(); i.hasNext();) {
        MethodRefParameter itElement = (MethodRefParameter) this.binding.get(i.next());
        if (itElement != null)
            element.getParameters().add(itElement);
    }/* w  w  w. ja  v  a  2 s. co m*/
}

From source file:org.eclipse.emf.texo.generator.ImportReferenceCollector.java

License:Open Source License

@Override
public boolean visit(final MethodRef node) {
    Name qualifier = node.getQualifier();
    if (qualifier != null) {
        typeRefFound(qualifier);/*from w  ww  .ja  v  a 2  s  . c  o  m*/
    }
    List<?> list = node.parameters();
    if (list != null) {
        doVisitChildren(list); // visit MethodRefParameter with Type
    }
    return false;
}