GhostDoc Equivalent for Eclipse(Java)
Asked Answered
F

5

12

I'm a big fan of GhostDoc's automatic comment generation in Visual Studio so am looking for an plugin that does the same job with my Java code in Eclipse. Any recommendations?

Firecure answered 15/7, 2009 at 9:47 Comment(0)
C
6

It is basically the equivalent of Javadoc, which can be generating in eclipse with the shortcut:

ALT+Shift+J

(when you are within the Java function you wish to add javadoc for)

From there, if you really want XML format, you can try and use a JELDoclet

Calie answered 15/7, 2009 at 10:48 Comment(2)
Worth pointing out you can tweak the generated javadoc through window->Preferences->Java->Code Style->Code TemplatesAlmita
Eclipse's built-in Javadoc generator is nowhere near the functionality provided by GhostDoc. See kerry carroll's answer.Miculek
S
9

You can check JAutodoc (http://jautodoc.sourceforge.net/)
From the author:

JAutodoc is an Eclipse Plugin for automatically adding Javadoc and file headers to your source code. It optionally generates initial comments from element name by using Velocity templates for Javadoc and file headers.

This one is the one I've found closest to GhostDoc.

Saprolite answered 23/3, 2011 at 21:25 Comment(0)
C
6

It is basically the equivalent of Javadoc, which can be generating in eclipse with the shortcut:

ALT+Shift+J

(when you are within the Java function you wish to add javadoc for)

From there, if you really want XML format, you can try and use a JELDoclet

Calie answered 15/7, 2009 at 10:48 Comment(2)
Worth pointing out you can tweak the generated javadoc through window->Preferences->Java->Code Style->Code TemplatesAlmita
Eclipse's built-in Javadoc generator is nowhere near the functionality provided by GhostDoc. See kerry carroll's answer.Miculek
D
5

GhostDoc has a nice extra feature that infers a description of what the method does by parsing the method name and providing this as skeletal documentation. For example, using GhostDoc on a method named GetDocumentName() might return the phrase "Gets the document name". While this is hardly more information than provided by the method name, it adds method documentation where previously none existed. Some might argue that this is barely useful. I argue to the contrary because it supports generating documentation from the source code (e.g., for tools like NDoc or SandCastle).

In my opinion the greatest benefit of GhostDoc over eclipse's "Generate Element Comment" is that it encourages programmers to begin adding documentation comments by adding an extremely fast and reliable way create this. The programmer can accept the inferred text, (suitable in 50 - 80% of cases), or expand on this for more complex methods. For the junior programmer who is not as familiar with how documentation comments are used, this can quickly shorten the learning curve and encourage good programming practices.

Dutiable answered 2/10, 2009 at 16:24 Comment(0)
P
2

Javadoc is not like GhostDoc my friend. Javadoc only creates the structure so one can write the documentation from scratch. GhostDoc actually fills up the information according to the Method/Property name.

Example:

/// <summary>
/// Gets the user from id.
/// </summary>
/// <param name="id">The id.</param>
/// <returns></returns>
private string GetUserFromId(string id);

JAutoDoc is the closest I've found so far but it's not as magical as GhostDoc.

Prophetic answered 31/5, 2013 at 23:3 Comment(0)
R
0

Never used GhostDoc, so not sure what extra functionality it gives, but if it's about generating type and method comments based on the name, parameters, return type etc. then eclipse has it built in, so no extensions needed.

Radiotelegraph answered 15/7, 2009 at 9:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.