[SOLVED] File editor and its margin [message #649741] |
Thu, 20 January 2011 13:50 |
Natalie Lawrey Messages: 4 Registered: January 2011 |
Junior Member |
|
|
Hi
Have you seen "Show print margin" (General->Editors->Text Editors) option?
It enables useful vertical line. It's a nice feature which I would like to include in my own text editor. But unfortunately for me, i cannot find in eclipse source code place where it has been done.
So my question is:
1. Do you have any idea which plugins/features should I specially take into consideration
2. Or how probably it has been implemented. Any clues?
Regards
Natalie
[Updated on: Fri, 04 February 2011 10:07] Report message to a moderator
|
|
|
|
|
|
Re: File editor and its margin [message #652501 is a reply to message #649950] |
Fri, 04 February 2011 10:06 |
Natalie Lawrey Messages: 4 Registered: January 2011 |
Junior Member |
|
|
Dani Megert wrote on Fri, 21 January 2011 02:15 | On 20.01.2011 18:57, Paul Webster wrote:
> Looks like it is implemented in
> org.eclipse.ui.texteditor.AbstractDecoratedTextEditor
Correct, that editor class installs it for you. But if you have your own
editor and source viewer you can also install it through
org.eclipse.ui.texteditor.SourceViewerDecorationSupport.
|
Absolutely true...
As I promised, I've already finished my text viewer which includes a couple of features from AbstractDecoratedTextEditor and here I'm back again to share with all of you me experience.
So:
1. Vertical margin was easy, as it is only one, ready to use class MarginPainter.
marginPainter = new MarginPainter(myViewer);
marginPainter.setMarginRulerColumn(charsPerLine);
((ITextViewerExtension2) viewer).addPainter(marginPainter);
2. Custom line numbering on the left (some lines may not be counted) was also easy. I extended from class org.eclipse.jface.text.source.LineNumberRulerColumn
3. All other features that I needed (as e.g. shortcuts) was also not so hard to add.
Now my new viewer is ready to use and can be easy enabled/ disabled from the Window -> Preferences.
Eclipse RCP is really useful and well designed platform - but probably you knew that already
Thanks again for all Your help
Natalie
[Updated on: Fri, 04 February 2011 10:07] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.04353 seconds