Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » Why the label provider isn't triggered as soon as the refresh method is called?
Why the label provider isn't triggered as soon as the refresh method is called? [message #642415] Wed, 01 December 2010 04:14 Go to next message
Li Junhong is currently offline Li Junhong
Messages: 1012
Registered: July 2009
Senior Member
Hi All,

I have a treeviewer representing my domain models.

After I add a new element to the parent, the parent label should be refreshed based on our logic. So I call viewer.refresh() at the end of my adding element action. What is strange is that the content provider is called immediately, but the label provider isn't triggered after 20-30 seconds later, then the parent's label is refreshed. This strange thing will happen only once. After that, the parent label will be refreshed as soon as I create any new sub element.

My question is that why the label provider isn't triggered like the content provider? Does any body meet such situation before?

Any suggestions are all welcome.

----------------
Li

[Updated on: Wed, 01 December 2010 04:17]

Report message to a moderator

Re: Why the label provider isn't triggered as soon as the refresh method is called? [message #642417 is a reply to message #642415] Wed, 01 December 2010 04:24 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5296
Registered: July 2009
Senior Member
Why do you call refresh a much better method is to use TreeViewer#add().
When you call refresh you simply recreate the whole content of the
viewer which is killing performance.

Tom

Am 01.12.10 10:14, schrieb Li Junhong:
> Hi All,
>
> I have a treeviewer representing my domain models.
>
> After I add a new element to the parent, the parent label should be
> refreshed based on our logic. So I call viewer.refresh() at the end of
> my adding element action. What strange is that the content provider is
> called immediately, but the label provider isn't triggered after 20-30
> seconds later, then the parent's label is refreshed. This strange thing
> will happen once. After that, the parent label will be refreshed as soon
> as I create any new sub element.
>
> My question is that why the label provider isn't triggered like the
> content provider? Does any body meet such situation before?
>
> Any suggestions are all welcome.
>
> ----------------
> Li
Re: Why the label provider isn't triggered as soon as the refresh method is called? [message #642418 is a reply to message #642415] Wed, 01 December 2010 04:25 Go to previous message
Daniel Krügler is currently offline Daniel Krügler
Messages: 853
Registered: July 2009
Senior Member
On 12/1/2010 10:14, Li Junhong wrote:
> Hi All,
>
> I have a treeviewer representing my domain models.
>
> After I add a new element to the parent, the parent label should be
> refreshed based on our logic. So I call viewer.refresh() at the end of
> my adding element action. What strange is that the content provider is
> called immediately, but the label provider isn't triggered after 20-30
> seconds later,

I hope this is a typo. You don't meant *seconds*, but milli seconds,
don't you?

> then the parent's label is refreshed. This strange thing
> will happen once. After that, the parent label will be refreshed as soon
> as I create any new sub element.
>
> My question is that why the label provider isn't triggered like the
> content provider? Does any body meet such situation before?
>
> Any suggestions are all welcome.

Not such extreme delays. The delay of the label provider is expected,
though: The viewer has to ensure that further class invariants are hold,
e.g. the previous selection is attempted to be restored.

HTH & Greetings from Bremen,

Daniel Krügler
Previous Topic:Resizing dialog question
Next Topic:how to add a double-click listener on TableViewer column header
Goto Forum:
  


Current Time: Tue Sep 02 05:21:50 EDT 2014

Powered by FUDForum. Page generated in 0.17445 seconds