Example usage for org.eclipse.jdt.core.dom TagElement TAG_DOCROOT

List of usage examples for org.eclipse.jdt.core.dom TagElement TAG_DOCROOT

Introduction

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

Prototype

String TAG_DOCROOT

To view the source code for org.eclipse.jdt.core.dom TagElement TAG_DOCROOT.

Click Source Link

Document

Standard inline doc tag name (value ).

Usage

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

License:Open Source License

private boolean handleDocRoot(TagElement node) {
    if (!TagElement.TAG_DOCROOT.equals(node.getTagName()))
        return false;

    try {/*  w ww.j  a  v a2 s . co  m*/
        String url = null;
        if (fElement instanceof IMember && ((IMember) fElement).isBinary()) {
            URL javadocBaseLocation = JavaDocLocations.getJavadocBaseLocation(fElement);
            if (javadocBaseLocation != null) {
                url = javadocBaseLocation.toExternalForm();
            }
        } else {
            IPackageFragmentRoot srcRoot = JavaModelUtil.getPackageFragmentRoot(fElement);
            if (srcRoot != null) {
                IResource resource = srcRoot.getResource();
                if (resource != null) {
                    /*
                     * Too bad: Browser widget knows nothing about EFS and custom URL handlers,
                     * so IResource#getLocationURI() does not work in all cases.
                     * We only support the local file system for now.
                     * A solution could be https://bugs.eclipse.org/bugs/show_bug.cgi?id=149022 .
                     */
                    IPath location = resource.getLocation();
                    if (location != null) {
                        url = location.toFile().toURI().toASCIIString();
                    }
                }

            }
        }
        if (url != null) {
            if (url.endsWith("/")) { //$NON-NLS-1$
                url = url.substring(0, url.length() - 1);
            }
            fBuf.append(url);
            return true;
        }
    } catch (JavaModelException e) {
    }
    return false;
}

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

License:Open Source License

private boolean handleDocRoot(TagElement node) {
    if (!TagElement.TAG_DOCROOT.equals(node.getTagName()))
        return false;

    String url = null;//from w w  w  . j  a v  a  2  s.  c  o m
    if (fElement instanceof IMember && ((IMember) fElement).isBinary()) {
        //TODO
        URL javadocBaseLocation = null;//JavaUI.getJavadocBaseLocation(fElement);
        if (javadocBaseLocation != null) {
            url = javadocBaseLocation.toExternalForm();
        }
    } else {
        IPackageFragmentRoot srcRoot = JavaModelUtil.getPackageFragmentRoot(fElement);
        if (srcRoot != null) {
            IResource resource = srcRoot.getResource();
            if (resource != null) {
                /*
                 * Too bad: Browser widget knows nothing about EFS and custom URL handlers,
                 * so IResource#getLocationURI() does not work in all cases.
                 * We only support the local file system for now.
                 * A solution could be https://bugs.eclipse.org/bugs/show_bug.cgi?id=149022 .
                 */
                IPath location = resource.getLocation();
                if (location != null) {
                    url = location.toFile().toURI().toASCIIString();
                }
            }

        }
    }
    if (url != null) {
        if (url.endsWith("/")) { //$NON-NLS-1$
            url = url.substring(0, url.length() - 1);
        }
        fBuf.append(url);
        return true;
    }
    return false;
}

From source file:org.eclipse.xtext.xbase.ui.hover.XbaseHoverDocumentationProvider.java

License:Open Source License

protected boolean handleDocRoot(TagElement node) {
    if (!TagElement.TAG_DOCROOT.equals(node.getTagName()))
        return false;
    URI uri = EcoreUtil.getURI(context);
    String projectName = uri.segment(1);
    String sourceFolderName = uri.segment(2);
    IProject project = workspace.getRoot().getProject(projectName);
    if (project.exists() && project.isOpen()) {
        IFolder sourceFolder = project.getFolder(sourceFolderName);
        if (sourceFolder.exists()) {
            buffer.append(sourceFolder.getLocationURI().toASCIIString());
        }//  ww  w. jav a 2 s  .co  m
    }
    return true;
}