I created a plugin.
It first changes the directory to my project folder.
Then it opens SBT and does the command gen-idea no-sbt-build-module.
When I run it in a scala worksheet, it works.
When I run it from the menu were the plugin interacts, it changes back to default-0ce3ae. (Default directory of IDE?)