Search code examples
eclipseswtrcp

Internal mechanism of TreeViewer for updte


I am new to SWT and RCP I am trying to use TreeViewer.

By referring to some documents, I came to know there is method:

treeViewer.Updte(Object , Properties). 

I need to know how SWT figure out which data is for which field.


Solution

  • The method is called update:

    public void update(Object element, String[] properties)
    

    Here element must be an object that equals one of the objects returned by the content provider for the tree.

    If you have called

    treeViewer.setUseHashlookup(true);
    

    then a hash table (similar to HashMap) is used to find the tree element corresponding to the element. Otherwise the tree is just searched exhaustively to find the element.