Treeview refactor

allow use of treeview from plugin externally.