Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » [SOLVED] File editor and its margin(Looking for a way to clone some java editor features)
[SOLVED] File editor and its margin [message #649741] Thu, 20 January 2011 13:50 Go to next message
Natalie Lawrey is currently offline Natalie LawreyFriend
Messages: 4
Registered: January 2011
Junior Member
Hi Smile

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 #649848 is a reply to message #649741] Thu, 20 January 2011 17:57 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Looks like it is implemented in
org.eclipse.ui.texteditor.AbstractDecoratedTextEditor

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: File editor and its margin [message #649950 is a reply to message #649848] Fri, 21 January 2011 07:15 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
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.

Dani
>
> PW
>
>
Re: File editor and its margin [message #649962 is a reply to message #649848] Fri, 21 January 2011 09:00 Go to previous messageGo to next message
Natalie Lawrey is currently offline Natalie LawreyFriend
Messages: 4
Registered: January 2011
Junior Member
Thanks! You are awesome!

I'll be back as soon as I finish my work and share my results with you.

Natalie
Re: File editor and its margin [message #652501 is a reply to message #649950] Fri, 04 February 2011 10:06 Go to previous message
Natalie Lawrey is currently offline Natalie LawreyFriend
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 Wink

Thanks again for all Your help
Natalie

[Updated on: Fri, 04 February 2011 10:07]

Report message to a moderator

Previous Topic:All IElementUpdater objects referenced on startup issue
Next Topic:Add Pdf File has Help
Goto Forum:
  


Current Time: Thu Apr 18 00:04:54 GMT 2024

Powered by FUDForum. Page generated in 0.02197 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top