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

本秂侑毒 提交于 2019-12-01 17:39:17

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

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

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!