[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.tools] Re: TreeViewer doUpdateItem() optimization
|
Yes, you need to use equals on the text here because getText() returns a new
string. Identity comparison on the image is OK though.
Nick
"Dave Spriet" <spriet@xxxxxxxxxx> wrote in message
news:9lod5t$2m3$1@xxxxxxxxxxxxxxxx
> Instead of having
> if((text != item.getText()) || (image != item.getImage())){
> item.setText(text);
> if (image != null)
> item.setImage(image);
>
>
> I should have put the following since I am compairing strings and not
> objects:
> if(!(text.equals(item.getText())) || (image != item.getImage())){
> item.setText(text);
> if (image != null)
> item.setImage(image);