How to get JavaDoc for SWT and JFace in Eclipse?

11,826

Solution 1

I assume you've dowloaded the jars yourself and referenced them in your project. If so, you can right click the jar in the project explorer (in the 'Referenced Libraries' node) and click 'Properties'. The window that appears you can define the location of the jar's JavaDoc and source, if you have those available.

You can also reach this by clicking Project > Properties > Java Build Path > Libraries and expanding the node for the jar to which you want to add javadoc/source.

Also worth mentioning that if you use Maven (http://maven.apache.org/) for building your project, it's dependency management system will take care of finding sources and javadocs for you. But that's a different topic entirly. Also might be worth looking at Ivy (http://ant.apache.org/ivy/) - similar dependency management system, but can be used without selling your soul to Maven, I'm told.


You might also mean that you can't actually see the javadocs: Window > Show View > Other... > Java > JavaDoc. This view will show you the javadoc for whatever is currently in focus. Or just mouse over a method to see the javadoc in a popup.

Solution 2

Following the advice from ukulele, I was able to right click on the jar and set the javadoc location. In this case the location for the online javadoc was:

http://help.eclipse.org/stable/nftopic/org.eclipse.platform.doc.isv/reference/api/

Found from the SWT website:

http://www.eclipse.org/swt/docs.php

Thanks!

Solution 3

Install the 'Eclipse SDK' if you want JavaDoc for everything(including plugins) installed in Eclipse. The update site for this is

download.eclipse.org/eclipse/updates/4.4  

(this is for eclipse juno. for kepler use version number 4.3 instead of 4.4)
Go to Help > Install New Software... and give the above url for "work with" section. Then you should select the "Eclipse SDK" and install it.
After the installation and restarring eclipse all the docs will be visible in your editor whenever you hover with mouse over a special keyword.
Trust me this is the easiest and 100% correct method.

For further clarification What will happen in this is it will configure the javadoc path for "org.eclipse.swt.gtk.linux.x86_64_3.102.1.v20140206-1358.jar" and "org.eclipse.swt_3.102.1.v20140206-1334.jar"(or in windows org.eclipse.swt.win32.win32.x86_643.xxxx.jar) and which are visible in plugin dependencies of the project structure appropriately. So to manually set the javadoc support right click project>Build path>configure build path>under libraries tab>plugin dependencies select the .jar related to the swt(for windows org.eclipse.swt.win32.win32.x86_643.xxxx.jar and for linux org.eclipse.swt.gtk.linux.x86_64_xxxxxxx.jar) expand it and set the javadoc location. For the java doc location you should give the the archive path of org.eclipse.platform.doc.isv_4.3.0.v20130606-0003.jar as "\Eclipse-Kepler\eclipse\plugins\org.eclipse.platform.doc.isv_4.3.2.v20140205-0929.jar" which is located in PATH_TO_ECLIPSE_FOLDER\eclipse\plugins (if this file is not there, u should put it there). U should give reference/api as the path within archive.

Solution 4

If you use a "Plug-in Project" they are there by default. That project type is available in "Eclipse for RCP/Plug-in Developers" or "Eclipse Classic". If you have a different version, you should be able to set up such a project after installing the "Eclipse SDK" feature via the update manager (in 3.4 under Available Software -> The Eclipse Project Updates).

Solution 5

One way is to attach the SWT source jar (for example org.eclipse.swt.gtk.linux.x86_64.source_3.7.0.v3735b.jar) from the eclipse/plugins directory to the referenced library. You'll be able to view both the source and the Javadoc.

Found on Eclipse Community Forums: Standard Widget Toolkit (SWT) » JavaDocs.

Share:
11,826
steve
Author by

steve

Updated on June 03, 2022

Comments

  • steve
    steve almost 2 years

    I'm a newbie to Eclipse and can't figure out how to get the JavaDocs for SWT and JFace to show up when I am editing.

    How do I do this? Thanks!