Is there a way to copy code from eclipse including ine numbers

前端 未结 3 2064
情歌与酒
情歌与酒 2021-01-18 10:11

I am writing a little bit of documentation and code explanation. I would like to copy code from eclipse including line numbers, so that it becomes easier to reference the co

相关标签:
3条回答
  • 2021-01-18 10:27

    Since Eclipse 3.4 and bug 19602, you will print the line numbers if you have activated them on the Eclipse editor.

    alt text http://img706.imageshack.us/img706/7605/eclipseshowlines.png

    Printing a source will give you:

    alt text http://img341.imageshack.us/img341/9899/eclipseprint.png

    0 讨论(0)
  • 2021-01-18 10:28

    You can do it by printing a PDF of source file, then copying source with line numbers from the PDF document.

    It works for me with eclipse PDT + CutePDF, it should also work with Acrobat PDF printer

    0 讨论(0)
  • 2021-01-18 10:34

    Another not-so-clean work-around to achieve this. This is specific to the Subversive plug-in.

    3 steps to follow:

    1. Delete the piece of code you need to copy and save the source file.
    2. Right click the file and chose option Team -> Create Patch.. and save it to a file, say copy.patch
    3. Undo (Ctrl + Z) the changes to revert the deletion done in step 1 and save the source file again.

    Open the patch file and use the contents.

    This also includes the file-name (if desired) along with the line number and retains the indentation.

    0 讨论(0)
提交回复
热议问题