Help on text editors [message #247613] |
Mon, 31 May 2004 13:21  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.10949 seconds