Tracking Segments of text in an editor [message #129119] |
Sun, 14 September 2003 21:43  |
Eclipse User |
|
|
|
Originally posted by: btcoxx.cs.wm.edu
Hi,
I'm trying to keep track of certain segment within the text. I've
looked at the documentation and it looks like all I need to do is add
positions to my texteditor's Document using the addPosition(Sting category,
Position position) and it will track them as they change as the user types.
However, I'm not sure exactly how to access the document. I've tried doing
it by texteditor.getDocumentProvider().getDocument(Object element) although
I don't understand what the parameter should be. The documentation says
"Returns the document for the given element" although I can't figure out
what it is that I need to create or get from something else in order to get
the document object for the current text file I'm editing. If the solution
to this problem is to get the Document object associated with the particular
file and add positions to it, could you tell me exactly how to get to the
document object. If what I said above makes no sense (I'm new to eclipse)
or if I'm going about it the wrong way could you please point me in the
right direction.
Thanks in advance
Ben
|
|
|
Re: Tracking Segments of text in an editor [message #129159 is a reply to message #129119] |
Mon, 15 September 2003 03:38  |
Eclipse User |
|
|
|
Originally posted by: tom.eicher.gmx.ch.nodomain
Ben, you're on the right track. The parameter to
IDocumentProvider.getDocument(Object) is the editor input, which you can
get from the editor by calling texteditor.getEditorInput().
-tom
Ben Cox wrote:
> Hi,
> I'm trying to keep track of certain segment within the text. I've
> looked at the documentation and it looks like all I need to do is add
> positions to my texteditor's Document using the addPosition(Sting category,
> Position position) and it will track them as they change as the user types.
> However, I'm not sure exactly how to access the document. I've tried doing
> it by texteditor.getDocumentProvider().getDocument(Object element) although
> I don't understand what the parameter should be. The documentation says
> "Returns the document for the given element" although I can't figure out
> what it is that I need to create or get from something else in order to get
> the document object for the current text file I'm editing. If the solution
> to this problem is to get the Document object associated with the particular
> file and add positions to it, could you tell me exactly how to get to the
> document object. If what I said above makes no sense (I'm new to eclipse)
> or if I'm going about it the wrong way could you please point me in the
> right direction.
>
> Thanks in advance
> Ben
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.06688 seconds