Home » Eclipse Projects » Remote Application Platform (RAP) » Advice is needed on org.eclipse.swt.TextUtil
|
Re: Advice is needed on org.eclipse.swt.TextUtil [message #492903 is a reply to message #492879] |
Thu, 22 October 2009 10:12 |
|
Hi Dmitry,
Dmitry Pryadkin wrote:
> I have a modified text area on javscript side. I've implemented
> positions tracking (Document#addPosition, etc).
I don't understand what you mean with "position tracking". If this is
essential for your problem, please add a pointer.
> As I've found out, org.eclipse.swt.TextUtil can be used to configure a
> text-area for delayed updates.
This mechanism prevents sending out requests on every keystroke when a
server-side modify listener is attached.
> How can I trigger some code on each request sending? I'm looking for an
> easier way, preferably without tweaking prototypes, etc.
var req = org.eclipse.swt.Request.getInstance();
req.addEventListener( "send", yourListener, context );
Please note that this is internal API and might change anytime.
Hope this helps,
Ralf
|
|
| |
Re: Advice is needed on org.eclipse.swt.TextUtil [message #492932 is a reply to message #492912] |
Thu, 22 October 2009 12:08 |
|
Hi Dmitry,
nice to hear that you could solve your problem. Just out of curiosity, I
still don't understand what addPosition means. Which API defines IDocument?
Ralf
Dmitry Pryadkin wrote:
> Ralf,
>
> My problem is solved.
>
> I wanted to trigger my own code every time TextUtil sends updates for a
> text area.
>
>> var req = org.eclipse.swt.Request.getInstance();
>> req.addEventListener( "send", yourListener, context );
>
> Indeed, it is how TextUtil itself works. In its _onSend method there is
> a call to org.eclipse.swt.TextUtil._setModified( this, false );
>
> I extended _setModified method of my text-area widget. This has allowed
> me to trigger my own code just before TextUtil sends its request.
>
>
>> I don't understand what you mean with "position tracking". If this is
>> essential for your problem, please add a pointer.
>
> The IDocument#addPosition method group works with positions. I just
> implemented a text-area that allows for these methods to be implemented.
>
>
> Dmitry
|
|
|
Re: Advice is needed on org.eclipse.swt.TextUtil [message #492942 is a reply to message #492932] |
Thu, 22 October 2009 13:05 |
Dmitry Pryadkin Messages: 146 Registered: July 2009 |
Senior Member |
|
|
Ralf,
org.eclipse.jface.text.IDocument is a jface property. Available in RCP only.
Position defines an interval in the document, by its offset and length.
Positions can change if a document is being edited by user.
Dmitry
Ralf Sternberg wrote:
> Hi Dmitry,
>
> nice to hear that you could solve your problem. Just out of curiosity, I
> still don't understand what addPosition means. Which API defines IDocument?
>
> Ralf
>
> Dmitry Pryadkin wrote:
>> Ralf,
>>
>> My problem is solved.
>>
>> I wanted to trigger my own code every time TextUtil sends updates for a
>> text area.
>>
>>> var req = org.eclipse.swt.Request.getInstance();
>>> req.addEventListener( "send", yourListener, context );
>> Indeed, it is how TextUtil itself works. In its _onSend method there is
>> a call to org.eclipse.swt.TextUtil._setModified( this, false );
>>
>> I extended _setModified method of my text-area widget. This has allowed
>> me to trigger my own code just before TextUtil sends its request.
>>
>>
>>> I don't understand what you mean with "position tracking". If this is
>>> essential for your problem, please add a pointer.
>> The IDocument#addPosition method group works with positions. I just
>> implemented a text-area that allows for these methods to be implemented.
>>
>>
>> Dmitry
|
|
|
Re: Advice is needed on org.eclipse.swt.TextUtil [message #492956 is a reply to message #492942] |
Thu, 22 October 2009 13:38 |
|
Dmitry Pryadkin wrote:
> org.eclipse.jface.text.IDocument is a jface property. Available in RCP
> only.
Ahh, yes, I could have found it myself!
> Position defines an interval in the document, by its offset and length.
> Positions can change if a document is being edited by user.
I see. That's cool, keep us posted about your success / problems!
Ralf
> Ralf Sternberg wrote:
>> Hi Dmitry,
>>
>> nice to hear that you could solve your problem. Just out of curiosity, I
>> still don't understand what addPosition means. Which API defines
>> IDocument?
>>
>> Ralf
>>
>> Dmitry Pryadkin wrote:
>>> Ralf,
>>>
>>> My problem is solved.
>>>
>>> I wanted to trigger my own code every time TextUtil sends updates for a
>>> text area.
>>>
>>>> var req = org.eclipse.swt.Request.getInstance();
>>>> req.addEventListener( "send", yourListener, context );
>>> Indeed, it is how TextUtil itself works. In its _onSend method there is
>>> a call to org.eclipse.swt.TextUtil._setModified( this, false );
>>>
>>> I extended _setModified method of my text-area widget. This has allowed
>>> me to trigger my own code just before TextUtil sends its request.
>>>
>>>
>>>> I don't understand what you mean with "position tracking". If this is
>>>> essential for your problem, please add a pointer.
>>> The IDocument#addPosition method group works with positions. I just
>>> implemented a text-area that allows for these methods to be implemented.
>>>
>>>
>>> Dmitry
|
|
|
Goto Forum:
Current Time: Mon Sep 23 13:23:35 GMT 2024
Powered by FUDForum. Page generated in 0.04171 seconds
|