├── .gitignore ├── settings.gradle ├── src ├── test │ ├── resources │ │ └── example.json │ └── java │ │ └── com │ │ └── futureprocessing │ │ └── idea │ │ └── shortcuts │ │ ├── RefactoringTest.java │ │ └── EditingTest.java └── main │ └── java │ └── com │ └── futureprocessing │ └── idea │ └── shortcuts │ ├── Shortcuts.java │ ├── GlobalReference.java │ ├── Shortcut.java │ ├── Refactoring.java │ └── Editing.java ├── IntelliJShortcuts.pdf ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── README.md ├── gradlew.bat └── gradlew /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle/ 2 | build/ 3 | 4 | .idea/ 5 | *.iml -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'shortcuts' 2 | 3 | -------------------------------------------------------------------------------- /src/test/resources/example.json: -------------------------------------------------------------------------------- 1 | { 2 | //"completeProperty" 3 | } -------------------------------------------------------------------------------- /IntelliJShortcuts.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tkurylek/intellij-idea-mouseless-kata/HEAD/IntelliJShortcuts.pdf -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tkurylek/intellij-idea-mouseless-kata/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /src/main/java/com/futureprocessing/idea/shortcuts/Shortcuts.java: -------------------------------------------------------------------------------- 1 | package com.futureprocessing.idea.shortcuts; 2 | 3 | public @interface Shortcuts { 4 | 5 | Shortcut[] value(); 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/com/futureprocessing/idea/shortcuts/GlobalReference.java: -------------------------------------------------------------------------------- 1 | package com.futureprocessing.idea.shortcuts; 2 | 3 | public @interface GlobalReference { 4 | 5 | String value(); 6 | } 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Nov 13 08:55:34 CET 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.2-bin.zip 7 | -------------------------------------------------------------------------------- /src/main/java/com/futureprocessing/idea/shortcuts/Shortcut.java: -------------------------------------------------------------------------------- 1 | package com.futureprocessing.idea.shortcuts; 2 | 3 | import java.lang.annotation.Repeatable; 4 | 5 | @Repeatable(value = Shortcuts.class) 6 | public @interface Shortcut { 7 | 8 | String combination(); 9 | String description(); 10 | 11 | String reference() default ""; 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/futureprocessing/idea/shortcuts/Refactoring.java: -------------------------------------------------------------------------------- 1 | package com.futureprocessing.idea.shortcuts; 2 | 3 | public class Refactoring { 4 | 5 | public void second() { 6 | } 7 | 8 | public void third() { 9 | } 10 | 11 | public void first() { 12 | } 13 | 14 | public void fifth() { 15 | } 16 | 17 | public class Fourth { 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # IntelliJ IDEA mouse-less kata 2 | 3 | ## Overview 4 | IntelliJ IDEA is a keyboard-centric IDE. Most of the actions (navigation, 5 | refactoring, debugging, etc.) can be carried out without using a mouse, 6 | which lets dramatically increase coding speed. 7 | 8 | This project will familiarize you with the most commonly used features and 9 | speed up your development while both of your hands are lying comfortable on 10 | the keyboard. 11 | 12 | ## Where should I start? 13 | Go to the test classes and select the division you'd like to master. Follow each 14 | test case one by one carefully reading the comments. -------------------------------------------------------------------------------- /src/main/java/com/futureprocessing/idea/shortcuts/Editing.java: -------------------------------------------------------------------------------- 1 | package com.futureprocessing.idea.shortcuts; 2 | 3 | public class Editing { 4 | 5 | public void toBeSafelyRemoved() { 6 | } 7 | 8 | public static class Apple { 9 | } 10 | 11 | public static class Avocado { 12 | } 13 | 14 | public static class Apricot { 15 | } 16 | 17 | public static class Asparagus { 18 | } 19 | 20 | public static class Aubergine { 21 | } 22 | 23 | public static class Banana { 24 | } 25 | 26 | public static class Beetroot { 27 | } 28 | 29 | public static class BlackEyeBean implements Bean { 30 | public BlackEyeBean() { 31 | } 32 | 33 | public BlackEyeBean(String anything) { 34 | } 35 | } 36 | 37 | public static class BroadBean implements Bean { 38 | } 39 | 40 | public interface Bean { 41 | 42 | default void method() { 43 | 44 | } 45 | } 46 | 47 | public void accept(Bean bean) { 48 | } 49 | 50 | public void acceptBeans(Bean bean) { 51 | } 52 | 53 | public void acceptMoreBeans(Bean bean) { 54 | } 55 | 56 | public void acceptManyBeans(Bean bean) { 57 | } 58 | 59 | 60 | /** 61 | * Meaningless documentation 62 | * @param apple an apple 63 | * @param avocado an avocado 64 | * @param apricot an apricot 65 | * @param asparagus an asparagus 66 | * @param aubergine an aubergine 67 | * @param banana a banana 68 | * @param beetroot a beetroot 69 | * @param blackEyeBean a blackEyeBean 70 | * @param broadBean a broadBean 71 | */ 72 | public void acceptAllVegetables(Apple apple, Avocado avocado, Apricot apricot, Asparagus asparagus, Aubergine aubergine, Banana banana, Beetroot beetroot, BlackEyeBean blackEyeBean, BroadBean broadBean) { 73 | 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/test/java/com/futureprocessing/idea/shortcuts/RefactoringTest.java: -------------------------------------------------------------------------------- 1 | package com.futureprocessing.idea.shortcuts; 2 | 3 | import org.junit.Test; 4 | 5 | public class RefactoringTest { 6 | 7 | @Test 8 | @Shortcut(combination = "ctrl+shift+up", description = "Moves symbol up") 9 | @Shortcut(combination = "ctrl+shift+up", description = "Moves symbol down") 10 | public void shouldReorderMethods() { 11 | /* 12 | * Go to Refactoring class (ctrl+shift+t) 13 | * and reorder the methods and inner classes 14 | */ 15 | } 16 | 17 | @Test 18 | @Shortcut(combination = "ctrl+alt+shift+t", description = "Pops up `Refactor This` window") 19 | @Shortcut(combination = "ctrl+f6", description = "changes method signature") 20 | public void shouldRefactorThis() { 21 | /* 22 | * change signature of refactorMySignature method 23 | * to refactorMySignature(String first, String second) 24 | */ 25 | 26 | } 27 | 28 | public void refactorMySignature(String second, String first) { 29 | } 30 | 31 | @Test 32 | @Shortcut(combination = "shift+f6", description = "Renames statements") 33 | public void shouldRenameVariable() { 34 | 35 | String integer = "abc"; 36 | } 37 | 38 | @Test 39 | @Shortcut(combination = "ctrl+alt+n", description = "Inlines variable") 40 | public void shouldInlineVariable() { 41 | 42 | String string = "abc"; 43 | new Editing.BlackEyeBean(string); 44 | } 45 | 46 | @Test 47 | @Shortcut(combination = "ctrl+alt+c", description = "Extracts constant") 48 | @Shortcut(combination = "ctrl+alt+c (twice)", description = "Extracts constant and show additional options") 49 | @Shortcut(combination = "ctrl+alt+c then alt+a", description = "Extracts constant and replaces all occurrences") 50 | public void shouldExtractConstant() { 51 | 52 | String a = "abc"; 53 | String b = "abc"; 54 | String c = "abc"; 55 | } 56 | 57 | @Test 58 | @Shortcut(combination = "ctrl+alt+v", description = "Extracts variable") 59 | public void shouldExtractVariable() { 60 | 61 | new Editing.BlackEyeBean("extractMe"); 62 | 63 | // "alsoExtractable" 64 | } 65 | 66 | @Test 67 | @Shortcut(combination = "ctrl+alt+f", description = "Extracts field") 68 | public void shouldExtractField() { 69 | 70 | new Editing.BlackEyeBean("extractMe"); 71 | 72 | // "alsoExtractable" 73 | } 74 | 75 | @Test 76 | @Shortcut(combination = "ctrl+alt+p", description = "Extracts parameter") 77 | public void shouldExtractParameter() { 78 | 79 | new Editing.BlackEyeBean("extractMe"); 80 | 81 | // "alsoExtractable" 82 | } 83 | 84 | @Test 85 | @Shortcut(combination = "ctrl+alt+m", description = "Extracts method") 86 | public void shouldExtractMethod() { 87 | 88 | new Editing.BlackEyeBean("extractMe"); 89 | 90 | // "alsoExtractable" 91 | } 92 | } -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /src/test/java/com/futureprocessing/idea/shortcuts/EditingTest.java: -------------------------------------------------------------------------------- 1 | package com.futureprocessing.idea.shortcuts; 2 | 3 | import org.junit.Test; 4 | 5 | public class EditingTest { 6 | 7 | Editing editing = new Editing(); 8 | 9 | @Test 10 | @Shortcut(combination = "ctrl+space", 11 | description = "basic code completion", 12 | reference = "https://www.jetbrains.com/idea/help/basic-code-completion-completing-names-and-keywords.html") 13 | 14 | @Shortcut(combination = "ctrl+shift+space", 15 | description = "smart auto complete - class hierarchy is considered", 16 | reference = "https://www.jetbrains.com/idea/help/smart-type-code-completion-completing-code-based-on-type-information.html") 17 | 18 | @Shortcut(combination = "ctrl+shift+space (x2) or ctrl+alt+space (once)", 19 | description = "verbose auto complete - useful for static imports", 20 | reference = "https://www.jetbrains.com/idea/help/basic-code-completion-completing-names-and-keywords.html") 21 | public void shouldPresentCodeCompletion() { 22 | 23 | /* 24 | * place cursor next to `new` keyword 25 | * notice the difference between completion modes 26 | */ 27 | // editing.accept(new ); 28 | 29 | /* 30 | * try to import static method hitting ctrl+space twice 31 | * or ctrl+alt+space once 32 | */ 33 | // singletonList 34 | } 35 | 36 | @Test 37 | @Shortcut(combination = "ctrl+space then tab", 38 | description = "smart autocomplete", 39 | reference = "https://www.jetbrains.com/idea/help/basic-code-completion-completing-names-and-keywords.html") 40 | public void shouldPresentSmartCodeCompletion() { 41 | 42 | /* 43 | * place cursor between `accept` and `Beans` 44 | * hit ctrl+space and: 45 | * - change to acceptManyBeans() 46 | * - change to acceptMoreBeans() 47 | * Accept selection using both enter and tab keys. 48 | */ 49 | editing.acceptBeans(null); 50 | } 51 | 52 | @Test 53 | @Shortcut(combination = "ctrl+shift+enter", 54 | description = "completes statement", 55 | reference = "https://www.jetbrains.com/idea/help/completing-statements.html") 56 | public void shouldCompleteStatement() { 57 | /* 58 | * Complete the following statement 59 | */ 60 | //editing.acceptManyBeans(new BlackEyeBean( 61 | } 62 | 63 | /* 64 | * Complete the following class 65 | */ 66 | // class TestClass 67 | 68 | /* 69 | * Complete the json statement: 70 | * see example with json file: example.json 71 | */ 72 | 73 | @Test 74 | @Shortcut(combination = "ctrl+p", 75 | description = "shows method parameters", 76 | reference = "https://www.jetbrains.com/idea/help/viewing-method-parameter-information.html") 77 | public void shouldShowParametersInfo() { 78 | 79 | /* 80 | * move cursor over null statement and press ctrl+p 81 | */ 82 | editing.acceptAllVegetables(null, null, null, null, null, null, null, null, null); 83 | } 84 | 85 | @Test 86 | @Shortcut(combination = "ctrl+q", 87 | description = "pops documentation for given method", 88 | reference = "https://www.jetbrains.com/idea/help/quick-pop-up-windows.html#d399110e131") 89 | public void shouldShowDocumentation() { 90 | 91 | /* 92 | * move cursor over null statement and press ctrl+q 93 | */ 94 | editing.acceptAllVegetables(null, null, null, null, null, null, null, null, null); 95 | } 96 | 97 | @Test 98 | @Shortcut(combination = "ctrl+o", 99 | description = "Overrides a method", 100 | reference = "https://www.jetbrains.com/idea/help/overriding-methods-of-a-superclass.html") 101 | public void shouldOverrideMethods() { 102 | /* 103 | * see class below 104 | */ 105 | } 106 | 107 | class OverrideMethods extends Editing { 108 | 109 | } 110 | 111 | @Test 112 | @Shortcut(combination = "ctrl+i", 113 | description = "Implements a method", 114 | reference = "https://www.jetbrains.com/idea/help/implementing-methods-of-an-interface.html") 115 | public void shouldImplementMethods() { 116 | /* 117 | * see class below 118 | */ 119 | } 120 | 121 | class ImplementMethods implements Editing.Bean { 122 | 123 | } 124 | 125 | @Test 126 | @Shortcut(combination = "ctrl+w", 127 | description = "extending selection", 128 | reference = "https://www.jetbrains.com/idea/help/selecting-text-in-the-editor.html#d1701627e179") 129 | 130 | @Shortcut(combination = "ctrl+shift+w", 131 | description = "shrinking selection", 132 | reference = "https://www.jetbrains.com/idea/help/selecting-text-in-the-editor.html#d1701627e220") 133 | public void shouldSuccessivelySelectCodeBlocks() { 134 | 135 | /* 136 | * select some text using extending and shrinking selection 137 | */ 138 | editing.acceptManyBeans(new Editing.BlackEyeBean("a bean")); 139 | } 140 | 141 | @Test 142 | @Shortcut(combination = "ctrl+shift+j", 143 | description = "joins smartly lines", 144 | reference = "https://www.jetbrains.com/idea/help/joining-lines-and-literals.html") 145 | public void shouldSmartJoinLines() { 146 | 147 | /* 148 | * smart join them separately one by one - or select whole statement 149 | */ 150 | String lipsum = "Lorem ipsum dolor sit amet enim. Etiam ullamcorper. Suspendisse a pellentesque dui, non felis." + 151 | " Maecenas malesuada elit lectus felis, malesuada ultricies. Curabitur et ligula. Ut molestie a, " + 152 | "ultricies porta urna. Vestibulum commodo volutpat a, convallis ac, laoreet enim. Phasellus " + 153 | "fermentum in, "; 154 | 155 | /* 156 | * smart join declaration and assignment into one line 157 | */ 158 | int declarationAndAssignment; 159 | declarationAndAssignment = 1; 160 | 161 | int incrementation = 1; 162 | incrementation += 20; 163 | } 164 | 165 | @Test 166 | @Shortcut(combination = "ctrl+alt+t", 167 | description = "Surround statement with if/while/do..while/try..catch etc.", 168 | reference = "https://www.jetbrains.com/idea/help/surrounding-blocks-of-code-with-language-constructs.html") 169 | public void shouldSurroundWith() { 170 | 171 | Editing.BroadBean bean = new Editing.BroadBean(); 172 | /* 173 | * surround the following with if(bean != null) 174 | */ 175 | editing.accept(bean); 176 | } 177 | 178 | @Test 179 | @Shortcut(combination = "alt+enter", 180 | description = "applies quick fix") 181 | public void shouldApplyQuickFix() { 182 | 183 | /* 184 | * remove unnecessary check for null 185 | */ 186 | Editing.BroadBean bean = new Editing.BroadBean(); 187 | if (bean != null) { 188 | editing.accept(bean); 189 | } 190 | } 191 | 192 | @Test 193 | @Shortcut(combination = "ctrl+alt+l", description = "formats code") 194 | public void shouldFormatCode() { 195 | /* 196 | * try to format whole class 197 | */ 198 | } 199 | 200 | @Test 201 | @Shortcut(combination = "ctrl+alt+o", description = "optimizes imports") 202 | public void shouldOptimizeImports() { 203 | /* 204 | * try to optimize imports for this class 205 | */ 206 | } 207 | 208 | @Test 209 | @Shortcut(combination = "ctrl+shift+v", description = "pastes from recent buffers") 210 | public void shouldPresentRecentBuffers() { 211 | String copyMeFirst = "copyMeFirst"; 212 | String copyMeSecond = "copyMeSecond"; 213 | 214 | /* 215 | * paste copyMeFirst from recent buffers as constructor parameter 216 | */ 217 | new Editing.BlackEyeBean(); 218 | } 219 | 220 | @Test 221 | @GlobalReference("http://blog.jetbrains.com/idea/2014/03/intellij-idea-13-1-rc-introduces-sublime-text-style-multiple-selections/") 222 | @Shortcut(combination = "alt+j", description = "Places another cursor in found statement") 223 | @Shortcut(combination = "F3", description = "Skips found statement - will not place another cursor") 224 | @Shortcut(combination = "ctrl+alt+shift+j", description = "Place cursors in all found statements") 225 | @Shortcut(combination = "alt+shift(hold) + mouse click", description = "Place another cursor in clicked spot") 226 | @Shortcut(combination = "scroll button (hold)", description = "Column selection mode") 227 | public void shouldPresentMulticursor() { 228 | /* 229 | * replace text using multicursor [replaceWithNth] with the First, Second, Third and so on. 230 | * Try not to use mouse selection. 231 | */ 232 | String changeMeFirst = "changeMe[replaceWithNth]"; 233 | String changeMeSecond = "changeMe[replaceWithNth]"; 234 | String changeMeThird = "changeMe[replaceWithNth]"; 235 | String changeMeFourth = "changeMe[replaceWithNth]"; 236 | } 237 | 238 | @Test 239 | @Shortcut(combination = "alt+insert", description = "generates code") 240 | public void shouldGenerateTestMethod() { 241 | /* 242 | * try to generate a test method below this one 243 | */ 244 | } 245 | 246 | @Test 247 | @Shortcut(combination = "ctrl+shift+t", description = "goes/generates test class") 248 | public void shouldGenerateTestClassForClass() { 249 | /* 250 | * try to go to the class this test is testing 251 | */ 252 | } 253 | 254 | @Test 255 | @Shortcut(combination = "ctrl+shift+u", description = "converts text to upper/lower string") 256 | public void shouldUpperLowerCase() { 257 | /* 258 | * try to change string `should be uppercase` to `SHOULD BE UPPERCASE` 259 | */ 260 | /* 261 | * try to fix the following variables naming using multicursor 262 | */ 263 | String First = "should be uppercase"; 264 | String Second = "should be uppercase"; 265 | String Third = "should be uppercase"; 266 | String Fourth = "should be uppercase"; 267 | } 268 | 269 | @Test 270 | @Shortcut(combination = "alt+delete", description = "deletes method with potential references") 271 | public void shouldSafelyDeleteMethod() { 272 | 273 | /* 274 | * try to delete the following method with its execution 275 | */ 276 | editing.toBeSafelyRemoved(); 277 | } 278 | 279 | @Test 280 | @Shortcut(combination = "ctrl+j", description = "presents available templates to be inserted") 281 | public void shouldPresentLiveTemplates() { 282 | /* 283 | * try to insert simple template 284 | */ 285 | /* 286 | * try to add `gwt` template that generates //given //when //then comments 287 | */ 288 | // gwt 289 | } 290 | 291 | @Test 292 | @Shortcut(combination = ".[template]", description = "presents available templates to be inserted") 293 | public void shouldPresentPostfixCompletion() { 294 | /* 295 | * see available postfix templates for the variable `a` below 296 | */ 297 | } 298 | 299 | public Object postFixDemo() { 300 | boolean a = false; 301 | // a.if 302 | // a.return 303 | // ... 304 | // a. 305 | return null; 306 | } 307 | } 308 | --------------------------------------------------------------------------------