FileBrowserComponent keep tree state between refresh?

Ok,

I got the FileTreeComponent and use getOpennessState and restoreOpennessState to try and restore my FileBrowserComponent tree state.

But also I can see that the tree is restore to its previous state (breakpoint in TreeViewItem::restoreOpennessState) when the FileBrowserComponent is display, the tree state is the one by default (all node closed and no selected item).

 

Here is the code I use:

    FileTreeComponent* pTreeComponent = static_cast<FileTreeComponent*> (mPresetBrowserComp->getDisplayComponent());

    ScopedPointer<XmlElement> pTreeState = pTreeComponent->getOpennessState(true);

    mPresetBrowserComp->refresh();

    //pTreeComponent->setDefaultOpenness(true);

    pTreeComponent->restoreOpennessState(*pTreeState, true);

If I replace restoreOpennessState by setDefaultOpenness then all the node are in open state.

If there something I am missing ?