Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Advice is needed on org.eclipse.swt.TextUtil
Advice is needed on org.eclipse.swt.TextUtil [message #492879] Thu, 22 October 2009 08:15 Go to next message
Dmitry Pryadkin is currently offline Dmitry PryadkinFriend
Messages: 146
Registered: July 2009
Senior Member
Hello rap team,

I have a modified text area on javscript side. I've implemented
positions tracking (Document#addPosition, etc).

As I've found out, org.eclipse.swt.TextUtil can be used to configure a
text-area for delayed updates.

How can I trigger some code on each request sending? I'm looking for an
easier way, preferably without tweaking prototypes, etc.

Thanks in advance,

Dmitry
Re: Advice is needed on org.eclipse.swt.TextUtil [message #492903 is a reply to message #492879] Thu, 22 October 2009 10:12 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

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 #492912 is a reply to message #492903] Thu, 22 October 2009 10:34 Go to previous messageGo to next message
Dmitry Pryadkin is currently offline Dmitry PryadkinFriend
Messages: 146
Registered: July 2009
Senior Member
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 #492932 is a reply to message #492912] Thu, 22 October 2009 12:08 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

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 Go to previous messageGo to next message
Dmitry Pryadkin is currently offline Dmitry PryadkinFriend
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 Go to previous message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

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
Previous Topic:Open views in new browser window
Next Topic:select text from controls
Goto Forum:
  


Current Time: Thu Apr 25 01:58:20 GMT 2024

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

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

Back to the top