MetadataState: use state for selections

Introduce a new state `MetadataState` that is able to track selected metadata items in order to share this state between different components of the application.

Use `MetadataState` to connect TreeCtrl and TableCtrl.
It is better do do the initialization in `setUp()` in order to get a new state for every test.