Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Refresh labels of all tree items.
Refresh labels of all tree items. [message #443408] Fri, 24 September 2004 15:29 Go to next message
Eclipse UserFriend
Originally posted by: roman.korf.web.de

Hi,

I have a treeviewer with some items.
I also have an action that changes a parameter.
When the parameter changes I want to update the labels of all items in the
tree. I don't want to update the tree structure itself because it is too
time consuming. A refresh() would do that.

Anyone an idea how to do this?
Re: Refresh labels of all tree items. [message #443454 is a reply to message #443408] Fri, 24 September 2004 15:46 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: roman.korf.web.de

Sorry for the question, I solved it somehow:

The update of the labels recursively:

protected void updateLabels(TreeItem[] items) {
if(items.length == 0)
return;
for(int i = 0; i < items.length; i++) {
// update item.
updateItem(items[i], items[i].getData());
// update items children.
updateLabels(items[i].getItems());
}
}

the initial step when updating:

treeviewer.updateLabels(treeviewer.getTree().getItems());


Roman Korf wrote:

> Hi,

> I have a treeviewer with some items.
> I also have an action that changes a parameter.
> When the parameter changes I want to update the labels of all items in the
> tree. I don't want to update the tree structure itself because it is too
> time consuming. A refresh() would do that.

> Anyone an idea how to do this?
Re: Refresh labels of all tree items. [message #443461 is a reply to message #443454] Fri, 24 September 2004 19:21 Go to previous message
Nick Edgar is currently offline Nick EdgarFriend
Messages: 439
Registered: July 2009
Senior Member
If this is a parameter that affects how the label provider renders labels,
then it would be better to use fireLabelProviderChanged from within the
label provider.
e.g. from within a subclass of LabelProvider:
fireLabelProviderChanged(new LabelProviderChangedEvent(this))

Nick

"Roman Korf" <roman.korf@web.de> wrote in message
news:cj1fg4$764$1@eclipse.org...
> Sorry for the question, I solved it somehow:
>
> The update of the labels recursively:
>
> protected void updateLabels(TreeItem[] items) {
> if(items.length == 0)
> return;
> for(int i = 0; i < items.length; i++) {
> // update item.
> updateItem(items[i], items[i].getData());
> // update items children.
> updateLabels(items[i].getItems());
> }
> }
>
> the initial step when updating:
>
> treeviewer.updateLabels(treeviewer.getTree().getItems());
>
>
> Roman Korf wrote:
>
> > Hi,
>
> > I have a treeviewer with some items.
> > I also have an action that changes a parameter.
> > When the parameter changes I want to update the labels of all items in
the
> > tree. I don't want to update the tree structure itself because it is too
> > time consuming. A refresh() would do that.
>
> > Anyone an idea how to do this?
>
>
Previous Topic:Class Text accept only integer
Next Topic:Last Row table result always visible
Goto Forum:
  


Current Time: Sat Apr 27 02:09:08 GMT 2024

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

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

Back to the top