Improved undo/redo support for editing of namespaces.

Change-Id: Id18bfa9b334b8799d84f8e74226ae395af11aea6