Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Convert TAB chars in spaces...
Convert TAB chars in spaces... [message #289652] Tue, 09 August 2005 15:18 Go to next message
Eclipse UserFriend
Originally posted by: nospam.nospam.it

Hi,

I created a new editor (extending TextEditor) and I want that when TAB is
pressed a set of spaces (for example 4) is inserted in the document instead
of TAB char.

How I can achieve this?

Thanks, Angelo
Re: Convert TAB chars in spaces... [message #289661 is a reply to message #289652] Tue, 09 August 2005 17:02 Go to previous message
Eclipse UserFriend
Originally posted by: sunil_kamath.nohotspammail.com

"Angelo" <nospam@nospam.it> wrote in message
news:944e34c057ee9bebe835b61c4fcc4f39$1@www.eclipse.org...
> Hi,
>
> I created a new editor (extending TextEditor) and I want that when TAB is
> pressed a set of spaces (for example 4) is inserted in the document
> instead
> of TAB char.
>
> How I can achieve this?
>
Create an IAutoEditStrategy which changes the tabs in the
DocumentCommand.text from '\t' to spaces.
Call TextViewer.prependAutoEditStrategy to install this strategy.
However, remember that simply replacing with 4 spaces every time is not the
correct solution.
You have to replace as many spaces as are needed to go to the next tab stop.
This could be
anything from 1 to the defined number of spaces per tab (4 in your case).
---
Sunil
Previous Topic:Plugin Start Problem
Next Topic:PropertyPage Equivalent for Properties View
Goto Forum:
  


Current Time: Tue Apr 23 09:55:41 GMT 2024

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

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

Back to the top