Xtend javadoc include images

83 views
Skip to first unread message

Alan Frye

unread,
Jun 24, 2017, 9:17:16 AM6/24/17
to Xtend Programming Language
I am trying to include some images inside javadoc comments for an xtend class, however the images are not showing up. I have done this in the past with normal java classes by including the image files in doc-files folder and adding an html img tag to the javadoc comments. 

Karsten Thoms

unread,
Jun 26, 2017, 3:44:52 AM6/26/17
to xtend...@googlegroups.com
Hi Alan,

it is just like in Java. If you manage to add an icon to a normal Java class then it should work also in Xtend. You may check the Javadoc on the transpiled .java class for your Xtend class. Documentation on Javadoc says the files should be in a sub-folder „doc-files“ of your source and named after the class.

On maybe not the nicest way, but definitely working, is to embed a base64 encoded version of the image:
/**
 * Some doc with image <img src="data:image/gif;base64,R0lGODlhEAAQAOYAAPnwYfnwZfz4nPz4nvz4ofz4ovvwiPvwivvvi_vvjPvwjPvwj_bgT_nob_nocPnpcKqYMvbfTfbgV_bgWPbgWfbgWvbgXvbgYfPTNPPVNb-qPe3FJe3FKPDPPPnVRPnYTcexT_DIO_DIPfvJLPvLLfDIQe_GQsChP8ywVMahPceiP-KmFMKZNcWeO8ahP_KxH8KVMsCVNMSbOuKcE72NL8KVN9-ZFbiBK7qGPLiFPLaEPbqGPbeEPLaDPbWBPcKAMcKBMeV5Br99Mr58M-V5B7BtJrNmJ____wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAEcALAAAAAAQABAAAAd-gEeCg4SFhiAwLDE0NyCGghojHwQJFR0vGo8tJB6Uli9FjzozGQERGytBQ48-IQ-el6uGPa4ECBSXQo88IQ4FBxO5jzm9BQYSwoY4Ig4EB58_jzslDgMKFpdA0iYNAgsX2dI2GAAMHCtERo8o4-XnRBCPRyAuKikyNSfy-4OBADs"/>
 */

Best wishes,
~Karsten
signature.asc

Alan Frye

unread,
Jun 26, 2017, 10:56:24 AM6/26/17
to Xtend Programming Language
Thanks for  the reply Karsten! Here is what the javadoc comment look like in the xtend class

/**

* @param topic - topic used to publish the message of message queue

* @parm message - message content that is put on the message queue 

* <br/>

* <img src="doc-files/MQPublisher-1.png" />

*/


I have also created the doc-files folder in the same folder as the .xtend file and when I hover the method I get a square with a ? mark inside where the image is suppose to be. It appears to me that it can not find the relative path to the png file.  If I hard code the absolute path it works as expected.  


Where should I create the doc-files folder?  

Karsten Thoms

unread,
Jun 26, 2017, 11:00:03 AM6/26/17
to xtend...@googlegroups.com
I have the same issue with a normal Java class. I have to admit that I never tried to include an image in Javadoc so far. From what I understand is that „doc-files“ must be a subfolder in the source tree. Also mandatory is that the image is copied to the output folder to the build.

First try to include an image in a normal Java class. If you get this working, you should also get it into Xtend. And maybe it’s just an issue with the Javadoc view? What happens if you generate the Javadocs?

And if this all fails, encode it as described.

-- 
You received this message because you are subscribed to the Google Groups "Xtend Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xtend-lang+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

signature.asc

Alan Frye

unread,
Jun 26, 2017, 12:11:42 PM6/26/17
to Xtend Programming Language
I have got it to work in plain java project but not in an xtend project. I will try the encoding but of you like I can include the java project that I created with the image embedded.

Thanks again!

Karsten Thoms

unread,
Jun 26, 2017, 1:00:04 PM6/26/17
to xtend...@googlegroups.com
Yes, please. This would help us to debug it.

~Karsten

Christian Dietrich

unread,
Jun 26, 2017, 2:37:22 PM6/26/17
to Xtend Programming Language
just gave it a try and

<img src="{@docRoot}/doc-files/MQPublisher-1.png" alt="xxxx"/>

seems to work fine for me with both xtend and java (javadoc called from gradle)

Alan Frye

unread,
Jun 26, 2017, 5:18:56 PM6/26/17
to xtend...@googlegroups.com
Thanks I will give it a try. Also when you are it did the images shoe up in the eclipse editor as well or just in the HTML version of the documentation 

--
You received this message because you are subscribed to a topic in the Google Groups "Xtend Programming Language" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/xtend-lang/Iz3-QcwibqU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to xtend-lang+...@googlegroups.com.

Christian Dietrich

unread,
Jun 27, 2017, 1:08:49 PM6/27/17
to Xtend Programming Language
they dont show up, neither in java file nor in xtend file

Alan Frye

unread,
Jul 6, 2017, 10:22:12 AM7/6/17
to xtend...@googlegroups.com
Christain,

Thanks for the reply. I am attaching a sample project that I put together with plain java that includes an image in the javadoc and the image does show up in the eclipse editor as well as the javadoc html output. If I do the same thing in an xtext project it does not show in the editor without using an absolute path.

Thanks,
Alan

On Tue, Jun 27, 2017 at 1:08 PM, Christian Dietrich <christian.di...@gmail.com> wrote:
they dont show up, neither in java file nor in xtend file

--
You received this message because you are subscribed to a topic in the Google Groups "Xtend Programming Language" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/xtend-lang/Iz3-QcwibqU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to xtend-lang+unsubscribe@googlegroups.com.
TestProjectDoc-zip.sample

Christian Dietrich

unread,
Jul 7, 2017, 1:12:09 AM7/7/17
to Xtend Programming Language
can you please file a enhancement request for this at github.com/eclipse/xtext-xtend

Christian Dietrich

unread,
Jul 7, 2017, 1:25:11 AM7/7/17
to Xtend Programming Language
its actually a bug. filing an issue is a good idea anyway

Christian Dietrich

unread,
Jul 10, 2017, 12:04:06 AM7/10/17
to Xtend Programming Language
Reply all
Reply to author
Forward
0 new messages