private String retrieveText(IJavaElement elem) throws JavaModelException {
   if (elem instanceof IMember) {
     Reader reader = JavadocContentAccess.getHTMLContentReader((IMember) elem, true, true);
     if (reader != null) reader = new HTML2TextReader(reader, null);
     if (reader != null) {
       String str = getString(reader);
       BreakIterator breakIterator = BreakIterator.getSentenceInstance();
       breakIterator.setText(str);
       return str.substring(0, breakIterator.next());
     }
   }
   return ""; //$NON-NLS-1$
 }
Beispiel #2
0
  private Reader getContentReader(IMember member, IProgressMonitor monitor)
      throws JavaModelException {
    Reader contentReader = JavadocContentAccess.getContentReader(member, true);
    if (contentReader != null) {
      return contentReader;
    }

    if (member.getOpenable().getBuffer() == null) { // only if no source available
      String s = member.getAttachedJavadoc(monitor);
      if (s != null) {
        return new StringReader(s);
      }
    }
    return null;
  }