TextEditor: Listen to document content changes [message #308842] |
Thu, 05 October 2006 05:41  |
Eclipse User |
|
|
|
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 #308866 is a reply to message #308863] |
Fri, 06 October 2006 03:35   |
Eclipse User |
|
|
|
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 04:38   |
Eclipse User |
|
|
|
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 03:19  |
Eclipse User |
|
|
|
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
>>>>
>>>>
>>>
>>
>>
>>
|
|
|
Powered by
FUDForum. Page generated in 0.03172 seconds