refactoring actions in the treeviewer