Moves "auto insert at correct position" features to Scala editor

This change is quite ugly - it copies the relevant Java code. Because
this Java code is mostly broken for Scala files it doesn't make much
sense to enhance it - it should be easier to rewrite it from scratch.
Because this probably takes some time and because the Scala editor
should no longer implicitly refer to all of these Java preferences the
relevant Java code is copied instead of rewritten.

Hopefully someone finds the time soon to replace the code with something
better.

Fixes #1002056