Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » TextEditor: Listen to document content changes
TextEditor: Listen to document content changes [message #308842] Thu, 05 October 2006 09:41 Go to next message
Eclipse UserFriend
Originally posted by: prashanto.chatterjee.softwareag.com

Hi,
I am using the eclipse' TextEditor and I wish to handle the case wherein the
editor's Document content is replaced by a call to 'set' as follows:
getDocumentProvider().getDocument(input).set(text);

This call sets the editor state to dirty. However, I wish to handle this
case specifically and set some flag that would help my logic condition.

I wish to ask the group whether it is possible to catch the content replace
of the editor's Document?

Thanks in advance and appreciate your help.

Regards,
Prashanto
Re: TextEditor: Listen to document content changes [message #308863 is a reply to message #308842] Fri, 06 October 2006 06:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: prashanto.chatterjee.softwareag.com

Hi All,
I guess I need to rephrase my question a bit for better understanding(I am
guilty of not being clear in my previous communication).

Actually, I know that internally TextEditor uses DocumentListeners to track
changes in the document's content and appropriately set the editor state to
dirty. However, these notifications and their subsequent handling is done
internally and I dont have any 'handle' methods in the editor to
additionally react to these document changes.

So, my question to the newsgroup is whether I can listen to these document
content changes so that I can perform some additional steps?

Regards,
Prashanto


"Prashanto Chatterjee" <prashanto.chatterjee@softwareag.com> wrote in
message news:eg2jvp$f8q$1@utils.eclipse.org...
> Hi,
> I am using the eclipse' TextEditor and I wish to handle the case wherein
> the editor's Document content is replaced by a call to 'set' as follows:
> getDocumentProvider().getDocument(input).set(text);
>
> This call sets the editor state to dirty. However, I wish to handle this
> case specifically and set some flag that would help my logic condition.
>
> I wish to ask the group whether it is possible to catch the content
> replace of the editor's Document?
>
> Thanks in advance and appreciate your help.
>
> Regards,
> Prashanto
>
Re: TextEditor: Listen to document content changes [message #308866 is a reply to message #308863] Fri, 06 October 2006 07:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: prashanto.chatterjee.softwareag.com

Hi Guys,
Good news - I cracked it. What I did was I made my editor which extends
TextEditor listen to document changes as follows:
getDocumentProvider().getDocument(getEditorInput()).addPreno tifiedDocumentListener(this);

The method addDocumentListener was not of much help as it does not allow us
to register a second listener

Then I implemented my logic in the method 'documentChanged(DocumentEvent
event) '.

This did the trick.

Thanks anyways,
Prashanto


"Prashanto Chatterjee" <prashanto.chatterjee@softwareag.com> wrote in
message news:eg4rdk$lg$1@utils.eclipse.org...
> Hi All,
> I guess I need to rephrase my question a bit for better understanding(I am
> guilty of not being clear in my previous communication).
>
> Actually, I know that internally TextEditor uses DocumentListeners to
> track changes in the document's content and appropriately set the editor
> state to dirty. However, these notifications and their subsequent handling
> is done internally and I dont have any 'handle' methods in the editor to
> additionally react to these document changes.
>
> So, my question to the newsgroup is whether I can listen to these document
> content changes so that I can perform some additional steps?
>
> Regards,
> Prashanto
>
>
> "Prashanto Chatterjee" <prashanto.chatterjee@softwareag.com> wrote in
> message news:eg2jvp$f8q$1@utils.eclipse.org...
>> Hi,
>> I am using the eclipse' TextEditor and I wish to handle the case wherein
>> the editor's Document content is replaced by a call to 'set' as follows:
>> getDocumentProvider().getDocument(input).set(text);
>>
>> This call sets the editor state to dirty. However, I wish to handle this
>> case specifically and set some flag that would help my logic condition.
>>
>> I wish to ask the group whether it is possible to catch the content
>> replace of the editor's Document?
>>
>> Thanks in advance and appreciate your help.
>>
>> Regards,
>> Prashanto
>>
>
>
Re: TextEditor: Listen to document content changes [message #308928 is a reply to message #308866] Tue, 10 October 2006 08:38 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
Prashanto Chatterjee wrote:

>Hi Guys,
>Good news - I cracked it. What I did was I made my editor which extends
>TextEditor listen to document changes as follows:
> getDocumentProvider().getDocument(getEditorInput()).addPreno tifiedDocumentListener(this);
>
>The method addDocumentListener was not of much help as it does not allow us
>to register a second listener
>
>
Why not? You should be able to register as many listeners as you like
using IDocument.addDocumentListener(...).
Note that addPrenotifiedDocumentListener(...) is not for public use (see
its Javadoc).

Dani

>Then I implemented my logic in the method 'documentChanged(DocumentEvent
>event) '.
>
>This did the trick.
>
>Thanks anyways,
>Prashanto
>
>
>"Prashanto Chatterjee" <prashanto.chatterjee@softwareag.com> wrote in
>message news:eg4rdk$lg$1@utils.eclipse.org...
>
>
>>Hi All,
>>I guess I need to rephrase my question a bit for better understanding(I am
>>guilty of not being clear in my previous communication).
>>
>>Actually, I know that internally TextEditor uses DocumentListeners to
>>track changes in the document's content and appropriately set the editor
>>state to dirty. However, these notifications and their subsequent handling
>>is done internally and I dont have any 'handle' methods in the editor to
>>additionally react to these document changes.
>>
>>So, my question to the newsgroup is whether I can listen to these document
>>content changes so that I can perform some additional steps?
>>
>>Regards,
>>Prashanto
>>
>>
>>"Prashanto Chatterjee" <prashanto.chatterjee@softwareag.com> wrote in
>>message news:eg2jvp$f8q$1@utils.eclipse.org...
>>
>>
>>>Hi,
>>>I am using the eclipse' TextEditor and I wish to handle the case wherein
>>>the editor's Document content is replaced by a call to 'set' as follows:
>>>getDocumentProvider().getDocument(input).set(text);
>>>
>>>This call sets the editor state to dirty. However, I wish to handle this
>>>case specifically and set some flag that would help my logic condition.
>>>
>>>I wish to ask the group whether it is possible to catch the content
>>>replace of the editor's Document?
>>>
>>>Thanks in advance and appreciate your help.
>>>
>>>Regards,
>>>Prashanto
>>>
>>>
>>>
>>
>>
>
>
>
>
Re: TextEditor: Listen to document content changes [message #308944 is a reply to message #308928] Wed, 11 October 2006 07:19 Go to previous message
Eclipse UserFriend
Originally posted by: prashanto.chatterjee.softwareag.com

Thanks for pointing it out. I had misunderstood its functionality and
confused it with another API that I had read. Its very nice of you to point
it out even when I had a working solution.

Thanks for correcting me.

Regards,
Prashanto

"Daniel Megert" <daniel_megert@ch.ibm.com> wrote in message
news:egfm6k$u8k$1@utils.eclipse.org...
> Prashanto Chatterjee wrote:
>
>>Hi Guys,
>>Good news - I cracked it. What I did was I made my editor which extends
>>TextEditor listen to document changes as follows:
>> getDocumentProvider().getDocument(getEditorInput()).addPreno tifiedDocumentListener(this);
>>
>>The method addDocumentListener was not of much help as it does not allow
>>us to register a second listener
>>
> Why not? You should be able to register as many listeners as you like
> using IDocument.addDocumentListener(...).
> Note that addPrenotifiedDocumentListener(...) is not for public use (see
> its Javadoc).
>
> Dani
>
>>Then I implemented my logic in the method 'documentChanged(DocumentEvent
>>event) '.
>>
>>This did the trick.
>>
>>Thanks anyways,
>>Prashanto
>>
>>
>>"Prashanto Chatterjee" <prashanto.chatterjee@softwareag.com> wrote in
>>message news:eg4rdk$lg$1@utils.eclipse.org...
>>
>>>Hi All,
>>>I guess I need to rephrase my question a bit for better understanding(I
>>>am guilty of not being clear in my previous communication).
>>>
>>>Actually, I know that internally TextEditor uses DocumentListeners to
>>>track changes in the document's content and appropriately set the editor
>>>state to dirty. However, these notifications and their subsequent
>>>handling is done internally and I dont have any 'handle' methods in the
>>>editor to additionally react to these document changes.
>>>
>>>So, my question to the newsgroup is whether I can listen to these
>>>document content changes so that I can perform some additional steps?
>>>
>>>Regards,
>>>Prashanto
>>>
>>>
>>>"Prashanto Chatterjee" <prashanto.chatterjee@softwareag.com> wrote in
>>>message news:eg2jvp$f8q$1@utils.eclipse.org...
>>>
>>>>Hi,
>>>>I am using the eclipse' TextEditor and I wish to handle the case wherein
>>>>the editor's Document content is replaced by a call to 'set' as follows:
>>>>getDocumentProvider().getDocument(input).set(text);
>>>>
>>>>This call sets the editor state to dirty. However, I wish to handle this
>>>>case specifically and set some flag that would help my logic condition.
>>>>
>>>>I wish to ask the group whether it is possible to catch the content
>>>>replace of the editor's Document?
>>>>
>>>>Thanks in advance and appreciate your help.
>>>>
>>>>Regards,
>>>>Prashanto
>>>>
>>>>
>>>
>>
>>
>>
Previous Topic:How would I start a browser in Eclipse but put it in an editor part?
Next Topic:Merge rows and columns
Goto Forum:
  


Current Time: Wed Jan 27 05:05:22 GMT 2021

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

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

Back to the top