Home » Eclipse Projects » Rich Client Platform (RCP) » [jface.text] how to stop document change notification temporarily?
| |
Re: [jface.text] how to stop document change notification temporarily? [message #660819 is a reply to message #660804] |
Mon, 21 March 2011 18:28 |
Harald Finster Messages: 37 Registered: July 2009 |
Member |
|
|
On 03/21/2011 05:27 PM, Daniel Megert wrote:
> On 21.03.2011 17:09, Harald Finster wrote:
>> Hello,
>>
>> is there a way to stop a document sending document change events to
>> its listeners temporarily?
> What's the use case for that? In general this would result in
> inconsistent states (in the listeners).
A bit complicated to explain, but anyways: my application keeps
a JavsScript program and a graphical representation of (parts of)
the program in sync. The JavaScript code is treated as the "model".
The information, which is required to paint the graphical elements
(location of boxes, bend points of arrows between boxes etc.) is
stored as JSDoc comments in the source code.
Something like
/**
* @box {x=5,y=5,with=100,height=100}
*/
box1 : { .... },
/**
* @box {x=5,y=100,with=100,height=100}
*/
box2 : { .... },
"Normally" a listener listens to document changes and triggers
an ASTParser which controls the graphical representation.
For example, if someone adds a 3rd "box" object to the source code,
the code is re-parsed and a 3rd "box" painted.
In case of changes, which affect only the graphical representation,
only the comments in the JavaScript code are affected and I can
be sure, that there are no structural/semantic changes in the
code, i.e. (computationally expensive) re-parsing the document is
not required.
Thanks for reflecting on my problem!
Harald
|
|
|
Re: [jface.text] how to stop document change notification temporarily? [message #661105 is a reply to message #660819] |
Wed, 23 March 2011 08:26 |
Dani Megert Messages: 3802 Registered: July 2009 |
Senior Member |
|
|
On 21.03.2011 19:28, Harald Finster wrote:
> On 03/21/2011 05:27 PM, Daniel Megert wrote:
>> On 21.03.2011 17:09, Harald Finster wrote:
>>> Hello,
>>>
>>> is there a way to stop a document sending document change events to
>>> its listeners temporarily?
>> What's the use case for that? In general this would result in
>> inconsistent states (in the listeners).
> A bit complicated to explain, but anyways: my application keeps
> a JavsScript program and a graphical representation of (parts of)
> the program in sync. The JavaScript code is treated as the "model".
>
> The information, which is required to paint the graphical elements
> (location of boxes, bend points of arrows between boxes etc.) is
> stored as JSDoc comments in the source code.
>
> Something like
>
> /**
> * @box {x=5,y=5,with=100,height=100}
> */
> box1 : { .... },
>
> /**
> * @box {x=5,y=100,with=100,height=100}
> */
> box2 : { .... },
>
> "Normally" a listener listens to document changes and triggers
> an ASTParser which controls the graphical representation.
>
> For example, if someone adds a 3rd "box" object to the source code,
> the code is re-parsed and a 3rd "box" painted.
>
> In case of changes, which affect only the graphical representation,
> only the comments in the JavaScript code are affected and I can
> be sure, that there are no structural/semantic changes in the
> code, i.e. (computationally expensive) re-parsing the document is
> not required.
There are other things that depend on the document changed events.
Disabling those can result in lots of unexpected problems and therefore
it's not supported to (temporarily) disable the notification. I assume
you implement your own editor. In that case what you really want to do
is tweaking the reconciler so that he only reconciles the model when needed.
Dani
> Thanks for reflecting on my problem!
>
> Harald
|
|
| |
Goto Forum:
Current Time: Fri Apr 26 23:30:11 GMT 2024
Powered by FUDForum. Page generated in 0.02911 seconds
|