The plugin is shared between all open main window instances. To not mix data between main windows, move the logic to the plugin-view. + general cleanup/simplifications
mentioned in commit 56114a4f