如何在 Eclipse 中获取 SWT 和 JFace 的 JavaDoc?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/566877/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to get JavaDoc for SWT and JFace in Eclipse?
提问by steve
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.
我是 Eclipse 的新手,无法弄清楚如何在编辑时显示 SWT 和 JFace 的 JavaDocs。
How do I do this? Thanks!
我该怎么做呢?谢谢!
采纳答案by Martin Dow
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.
我假设您已经自己下载了 jars 并在您的项目中引用了它们。如果是这样,您可以右键单击项目资源管理器中的 jar(在“参考库”节点中),然后单击“属性”。在出现的窗口中,您可以定义 jar 的 JavaDoc 和源的位置(如果有的话)。
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.
您还可以通过单击 Project > Properties > Java Build Path > Libraries 并展开要添加 javadoc/source 的 jar 的节点来达到此目的。
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.
另外值得一提的是,如果您使用 Maven ( http://maven.apache.org/) 来构建您的项目,它的依赖项管理系统将负责为您查找源代码和 javadoc。但这完全是一个不同的话题。也可能值得一看 Ivy ( http://ant.apache.org/ivy/) - 类似的依赖管理系统,但可以在不向 Maven 出卖灵魂的情况下使用,我听说。
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.
您可能还表示您实际上无法看到 javadoc:窗口 > 显示视图 > 其他... > Java > JavaDoc。此视图将向您显示当前关注的任何内容的 javadoc。或者只需将鼠标悬停在某个方法上即可在弹出窗口中查看 javadoc。
回答by steve
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:
按照尤克里里的建议,我能够右键单击 jar 并设置 javadoc 位置。在这种情况下,在线 javadoc 的位置是:
http://help.eclipse.org/stable/nftopic/org.eclipse.platform.doc.isv/reference/api/
http://help.eclipse.org/stable/nftopic/org.eclipse.platform.doc.isv/reference/api/
Found from the SWT website:
从 SWT 网站找到:
http://www.eclipse.org/swt/docs.php
http://www.eclipse.org/swt/docs.php
Thanks!
谢谢!
回答by Samitha Chathuranga
Install the 'Eclipse SDK' if you want JavaDoc for everything(including plugins) installed in Eclipse. The update site for this is
如果您想要在 Eclipse 中安装的所有内容(包括插件)的 JavaDoc,请安装“Eclipse SDK”。这个的更新站点是
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.
(这是针对 eclipse juno 的。对于开普勒,使用版本号 4.3 而不是 4.4)
转到Help > Install New Software...
并提供上述“使用”部分的 url。然后您应该选择“Eclipse SDK”并安装它。
安装并重新启动 eclipse 后,只要您将鼠标悬停在特殊关键字上,所有文档都将在您的编辑器中可见。
相信我,这是最简单且 100% 正确的方法。
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.
为了进一步澄清这会发生什么,它将为“org.eclipse.swt.gtk.linux.x86_64_3.102.1.v20140206-1358.jar”和“org.eclipse.swt_3.102.1.v20140206-1334”配置javadoc路径.jar”(或在 windows org.eclipse.swt.win32.win32.x86_643.xxxx.jar 中)并且它们在项目结构的插件依赖项中适当可见。所以要手动设置javadoc支持右键单击项目>构建路径>配置构建路径>在库选项卡下>插件依赖项选择与swt相关的.jar(对于windows org.eclipse.swt.win32.win32.x86_643.xxxx.jar对于 linux org.eclipse.swt.gtk.linux.x86_64_xxxxxxx.jar)展开它并设置 javadoc 位置。对于 java 文档位置,您应该将 org.eclipse.platform.doc.isv_4.3.0.v20130606-0003.jar 的存档路径指定为“
回答by Michael Schmid
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.
一种方法是将 SWT 源 jar(例如org.eclipse.swt.gtk.linux.x86_64.source_3.7.0.v3735b.jar
)从eclipse/plugins
目录附加到引用的库。您将能够查看源代码和 Javadoc。
Found on Eclipse Community Forums: Standard Widget Toolkit (SWT) ? JavaDocs.
回答by Fabian Steeg
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).
如果您使用“插件项目”,默认情况下它们就在那里。该项目类型在“Eclipse for RCP/Plug-in Developers”或“Eclipse Classic”中可用。如果您有不同的版本,您应该能够在通过更新管理器安装“Eclipse SDK”功能后设置这样的项目(在 3.4 下的可用软件 -> Eclipse 项目更新)。
回答by Ben Hammond
I often find the javadoc at eclipse.org to be really really slow to load. The javadocs may be included with your eclipse install and thus be available locally; try Help->Help Contentsmenu and search for 'SWT' to see if this is true on your installation.
我经常发现 eclipse.org 上的 javadoc 加载起来真的很慢。javadoc 可能包含在您的 eclipse 安装中,因此可以在本地使用;尝试Help->Help Contents菜单并搜索“SWT”以查看您的安装是否正确。
回答by Svante
In case you are developing with org.eclipse.jface.text, also edit the org.eclipse.jface.text jar's javadoc location to:
如果您使用 org.eclipse.jface.text 进行开发,还要将 org.eclipse.jface.text jar 的 javadoc 位置编辑为:
http://help.eclipse.org/indigo/topic/org.eclipse.platform.doc.isv/reference/api/
http://help.eclipse.org/indigo/topic/org.eclipse.platform.doc.isv/reference/api/