It depends on the nodetype (server templates would not work).
Generally, you can try to remove() node, then call setNodeTypeID, and then add it back to the treeview.
If you experience difficulties with this, you can remove old node, and create a new one (with JavaScript) with the same text and required node type.