Note that there are some explanatory texts on larger screens.

plurals
  1. POLabelProvider's cell.setImage() takes too long
    text
    copied!<p>I am developing an Eclipse RCP application plugin, and am having problems with a <code>TreeViewer</code> that at a certain point, has a Tree Item with very many sub-elements. In this case, it's 4000.</p> <p>The <code>TreeViewer</code> has a <code>ContentProvider</code>, a <code>LabelProvider</code>, and an input(in this case, a modelprovider).</p> <p>The <code>cell.setImage(...)</code> method inside the <code>StyledCellLabelProvider</code>s <code>update(ViewerCell cell)</code> method for 4000 elements takes more than a few seconds. I've tried skipping it and the <code>TreeViewer</code> has no problems...</p> <p>I've also thought about doing the update in a separate thread, by calling:</p> <pre><code>Display.getDefault().asyncExec(new UpdateItems(list)); </code></pre> <p>And the Runnable...</p> <pre><code>private class UpdateItems implements Runnable { private List&lt;Element&gt; elementList; private UpdateItems(List&lt;Element&gt; elementList) { this.elementList = elementList; } @Override public void run() { System.out.println("It's running!!!!"); for (Element e : elementList) { Signal s = (Signal) e; s.setShowIcon(true); s.updateElement(); //this calls an update on the item } } } </code></pre> <p>But this way, when I try to use the scroll to view the lower elements, the window freezes until done.</p> <p>Is there any way to add a listener on the <code>TreeViewer</code> in order to fire a update when a <code>TreeItem</code> is visible? And by visible I mean that it is within sight of the user inside the current view, at the current place where it is scrolled (hope this makes sense).</p> <p>Any support and opinions are appreciated!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload