有没有一种简单的方法可以在 Eclipse 中附加源代码?

问题描述:

我非常喜欢 Visual Studio 在完成您编写的代码以及您正在引用的代码(各种库/程序集)时为您提供注释文档/参数名称的方式.

I'm a big fan of the way Visual Studio will give you the comment documentation / parameter names when completing code that you have written and ALSO code that you are referencing (various libraries/assemblies).

在完成代码或将鼠标悬停在方法上时,是否有一种简单的方法可以在 Eclipse 中获取内联 javadoc/参数名称?通过插件?通过一些设置?使用大量库(Java 中经常发生的情况),然后在源 jar 中找到信息时必须访问网站或本地 javadoc 位置以查找信息,这非常烦人!

Is there an easy way to get inline javadoc/parameter names in Eclipse when doing code complete or hovering over methods? Via plugin? Via some setting? It's extremely annoying to use a lot of libraries (as happens often in Java) and then have to go to the website or local javadoc location to lookup information when you have it in the source jars right there!

简短的回答是肯定的.

您可以使用项目的属性附加源.

You can attach source using the properties for a project.

转到属性(对于项目)-> Java 构建路径-> 库

Go to Properties (for the Project) -> Java Build Path -> Libraries

选择要为其附加源/javadoc 的库,然后展开它,您将看到如下列表:

Select the Library you want to attach source/javadoc for and then expand it, you'll see a list like so:

Source Attachment: (none)
Javadoc location: (none)
Native library location: (none)
Access rules: (No restrictions)

选择 Javadoc 位置,然后单击右侧的编辑.从那里开始应该很简单.

Select Javadoc location and then click Edit on the right hahnd side. It should be quite straight forward from there.

祝你好运:)