IDEA-103973 Gradle wrapper detection is more generic

Changed gradle wrapper home directory discovery to act the same way that the gradle wrapper does rather than using a pattern of `gradle-*-bin.zip`.  This fixes http://youtrack.jetbrains.com/issue/IDEA-103973 and http://youtrack.jetbrains.com/issue/IDEA-106491.

I modeled the wrapper resolution code after the gradle wrapper project directly, see: https://github.com/gradle/gradle/blob/master/subprojects/wrapper/src/main/java/org/gradle/wrapper/PathAssembler.java