Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Help on text editors
Help on text editors [message #247613] Mon, 31 May 2004 13:21 Go to next message
Eclipse UserFriend
Originally posted by: doug.satchwell.btinternet.com

Hi - I'm having a go at writing a text editor, but I am having trouble with
a couple of areas:

1) If a file does not have a file extension, how do I associate my editor
with it?? I believe other IDE's achieve this by opening the file and parsing
the first few lines to determine its type - does Eclipse do this?
2) The files I am interested in can only run on Linux/Unix, and so expect
the new line to be a simple '\n'. However, when I edit the file under
Windows, '\r\n' is inserted for a new line. Is there any way to prevent
this? I guess I could use the AutoIndentStrategy to perform such a
replacement - would this be the correct/best way to do it?
3) I would like to have the ability to 'nest' partitions. I see this ability
has been added by IDocumentExtension3 - but I have no idea how to configure
a partition scanner to make use of it. Has anyone got any pointers?

Any help would be appreciated!

Thanks,

Doug
Re: Help on text editors [message #247815 is a reply to message #247613] Tue, 01 June 2004 03:33 Go to previous message
Eclipse UserFriend
Doug Satchwell wrote:
> 1) If a file does not have a file extension, how do I associate my editor
> with it?? I believe other IDE's achieve this by opening the file and parsing
> the first few lines to determine its type - does Eclipse do this?

You can associate editors not just by extension. See IContentType.

> 2) The files I am interested in can only run on Linux/Unix, and so expect
> the new line to be a simple '\n'. However, when I edit the file under
> Windows, '\r\n' is inserted for a new line. Is there any way to prevent
> this? I guess I could use the AutoIndentStrategy to perform such a
> replacement - would this be the correct/best way to do it?

Implement IDocument.getLegalLineDelimiters()

> 3) I would like to have the ability to 'nest' partitions. I see this ability
> has been added by IDocumentExtension3 - but I have no idea how to configure
> a partition scanner to make use of it. Has anyone got any pointers?

Nesting partitions is not supported. Partitioning can only provide a
coarse-grained document model and is merely used for editor highlighting
etc.

HTH, tom
Previous Topic:Building M9 from source on OS X
Next Topic:Cannot open any workspace
Goto Forum:
  


Current Time: Tue May 06 13:52:26 EDT 2025

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

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

Back to the top