Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Edit Line Numbers in Eclipse

For one of the side products, I wish to manipulate line numbers that are shown on the editor in eclipse. Basically for few lines, I wish to show it in below order:

1 
2 
3 
3_1 
3_2 
3_3 
4
and so..

Which class handles the line numbers. I tried looking at source and found MarkerField and but it is not very helpful. Is this even possible?

like image 750
Jatin Avatar asked May 06 '14 04:05

Jatin


People also ask

How do I change line numbers in Eclipse editor?

Go to Windows → Preferences → General → Text Editors → Show numberlines. Click OK, then Apply changes. Then it will show the line count automatically. Save this answer.

How do I navigate to line numbers in Eclipse?

Ctrl-L prompts you to go to a line number. Ctrl-Shift-L (in Eclipse 3.1) shows you a cheat sheet of keyboard shortcuts.

How do I show column numbers in Eclipse?

In Eclipse IDE, select “Windows” > “Preference” > “General” > “Editors” > “Text Editors” , check on the “Show line numbers” option.


1 Answers

org.eclipse.jface.text.source.LineNumberRulerColumn is responsible to display line numbers. org.eclipse.jface.text.source.LineNumberChangeRulerColumn extends above for other minor adjustments.

This is and initialized and used by org.eclipse.ui.texteditor.AbstractDecoratedTextEditor. TextEditor extends above and it is the default one used by eclipse. So to manipulate, there is a lot to be done respectively in each class.

I hope someone can provide a more comprehensive answer

like image 90
Jatin Avatar answered Sep 28 '22 03:09

Jatin