Showing line numbers in Code editor or Code view

It is often useful to see line numbers when using the Code editor or Code view. Line numbers will appear if the preference General - Editors - Text Editors - Show line numbers has been set. You can toggle this preference by right-clicking in the margin of the Code editor or Code view and choose Show Line Numbers. Note that this preference applies to all Eclipse text editors.

When the Code view or Code editor edits a code snippet stored in the model, line numbers start at 1 as usual. However, when editing a code snippet stored in a generated file, you will notice different line numbers. This is because line numbers in this case come from the generated file.

Note that the Code editor can either show one specific code snippet, or all code snippets for the element. See Working with multiple code snippets in the Code Editor.