Example usage for org.eclipse.jdt.internal.core BinaryType getJavadocRange

List of usage examples for org.eclipse.jdt.internal.core BinaryType getJavadocRange

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.core BinaryType getJavadocRange.

Prototype

ISourceRange getJavadocRange() throws JavaModelException;

Source Link

Document

Returns the Javadoc range if this element is from source or if this element is a binary element with an attached source, null otherwise.

Usage

From source file:hydrograph.ui.expression.editor.datastructure.ClassDetails.java

License:Apache License

private String getJavaDoc(IClassFile classFile) throws JavaModelException {
    BinaryType binaryType = (BinaryType) classFile.getType();
    if (binaryType.getSource() != null && binaryType.getJavadocRange() != null) {
        String javaDoc = Constants.EMPTY_STRING;
        javaDoc = StringUtils.substring(binaryType.getSource().toString(), 0,
                binaryType.getJavadocRange().getLength());
        javaDoc = StringUtils.replaceEachRepeatedly(javaDoc, new String[] { "/*", "*/", "*" },
                new String[] { Constants.EMPTY_STRING, Constants.EMPTY_STRING, Constants.EMPTY_STRING });
    }//from   w  w w  .j a  va 2 s .  co  m
    return javaDoc;
}