Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Editors
Editors [message #464031] Thu, 22 February 2007 10:12 Go to next message
Eclipse UserFriend
Hi Everyone,

Iam new in using text editors.Iam using the below snippet to update my
editor.

IDocumentProvider dp = editor.getDocumentProvider();
IDocument doc = dp.getDocument(editor.getEditorInput());
int offset = doc.getLineOffset(doc.getNumberOfLines()-4);

I want to get hold of a character say in a nth position of a row and
update it.

can i get hold of individual characters in a row ..?


Best Regards,
Michael
Re: Editors [message #464062 is a reply to message #464031] Fri, 23 February 2007 06:16 Go to previous messageGo to next message
Eclipse UserFriend
michael wrote:

>
> Hi Everyone,
>
> Iam new in using text editors.Iam using the below snippet to update my
> editor.
>
> IDocumentProvider dp = editor.getDocumentProvider();
> IDocument doc = dp.getDocument(editor.getEditorInput());
> int offset = doc.getLineOffset(doc.getNumberOfLines()-4);
>
> I want to get hold of a character say in a nth position of a row and
> update it.
>
> can i get hold of individual characters in a row ..?

Take a look at the methods in IDocument.

Dani

>
>
> Best Regards,
> Michael
>
>
>
Re: Editors [message #464073 is a reply to message #464062] Fri, 23 February 2007 10:20 Go to previous messageGo to next message
Eclipse UserFriend
i want to insert a empty line after every line.
Iam trying it using replace as there is no insert method provided.Iam
iterating through all the lines in the editor and after every line iam
trying to insert a empty line,but i do not want that empty line to be
treated as a separate line as editor does.How do i need to avoid this..?
and for the empty line when ever i say
getlinelength(int offset) it returns 1 eevnthough it is empty..?

Thanks in advance
Michael
Re: Editors [message #464120 is a reply to message #464073] Mon, 26 February 2007 04:28 Go to previous message
Eclipse UserFriend
michael wrote:

>
> i want to insert a empty line after every line.
> Iam trying it using replace as there is no insert method provided.Iam
> iterating through all the lines in the editor and after every line iam
> trying to insert a empty line,but i do not want that empty line to be
> treated as a separate line as editor does.How do i need to avoid
> this..? and for the empty line when ever i say
> getlinelength(int offset) it returns 1 eevnthough it is empty..?

As said before: read the Javadoc of IDocument, e.g.

/**
* Returns the length of the given line including the line's delimiter.
*
* @param line the line of interest
* @return the length of the line
* @exception BadLocationException if the line number is invalid in
this document
*/
int getLineLength(int line) throws BadLocationException;

Dani

>
> Thanks in advance
> Michael
>
>
>
>
>
>
>
Previous Topic:Querying Eclipse app directory
Next Topic:connect mysql
Goto Forum:
  


Current Time: Fri Mar 21 11:09:19 EDT 2025

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

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

Back to the top