Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jdt-dev] Retrieve javadoc programmatically

Thanks for the hint, Jay.

your proposal could work for workspace files. In my case I would like to display javadoc for the java class library and for loaded OSGI bundles. So I am looking for something that parses the src.zip of the JDK and plugin jars/folders that contain source. Alternatively I would love to display docs loaded from JavaDoc pages, either from the web or from the internal eclipse documentation.

The focus of EASE is to script everything available on the currently running JRE, so I want to display as many information on existing classes as possible. Everything in the workspace is not relevant as it typically is not available in the running JRE. But keep those ideas coming :)

The API available is definitely internal, but as a first step the feasibility would be sufficient. As a next step I would come back to the JDT team to see how we could make the API public.

With all the new languages around that run on the JRE it might be interesting to reuse the JavaDocs eg for Groovy or JRuby integration, too.

Christian

Am 08.09.2015 um 07:01 schrieb Jayaprakash Arthanareeswaran:

Hello Christian,

If it is only the Javadoc you are interested in, you can get the ICompilationUnit by writing something like this:
   (ICompilationUnit)JavaCore.create(getFile(path))

Once you have the CU, you can work your way through to get the element (method, field etc.) you are interested in and use the following API to get the Javadoc:

    IJavaElement#getAttachedJavadoc()

Only problem with the above is, it works well for Javadoc attached as HTML, but for source, it only returns what's in the source. That's why you are perhaps using the ProposalInfo, which takes help from JavadocContentAccess2 in converting the Javadoc String to nice HTML format.

Perhaps someone from the JDT/UI can comment on your usage. But to me looks like you are using code internal to JDT.


Back to the top