Skip to main content


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 09:14 Go to next message
Li Junhong is currently offline Li JunhongFriend
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 09: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 09:24 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
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 09:25 Go to previous message
Daniel Krügler is currently offline Daniel KrüglerFriend
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:Help! an issue after removed the filter
Goto Forum:
  


Current Time: Thu Apr 25 04:43:35 GMT 2024

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

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

Back to the top