One of the aspects of automated refactorings that we studied using CodingSpectator was the invocation method. Eclipse JDT supports the following methods of invoking automated refactorings:
- The programmer can invoke an automated refactoring from the "Refactor" menu.
- The programmer can invoke an automated refactoring by right-clicking on a program element an selecting the desired refactoring from the context menu.
- The programmer can invoke an automated refactoring using its shortcut key.
- Eclipse proposes Quick Fixes for some compilation problems. Some Quick Fixes are refactorings, e.g. Infer Generic Type Arguments.
- Quick Assists automate small program transformations. Some of these transformations are refactorings. The programmer can press "CTRL+1" to open the Quick Assist menu and get a list of applicable refactorings to the selected piece of code. See figure below for a screenshot of the Quick Assist menu in Eclipse.
CodingSpectator records if an automated refactoring is invoked using Quick Assist. Our participants used Quick Assist to perform most refactorings except Rename. Specifically, our participants invoked 64% of the refactorings that were supported by Quick Assist (except Rename) using Quick Assist. We hypothesize that programmers use the shortcut key to invoke the Rename refactoring, because this refactoring is very common. However, since CodingSpectator did not report whether a refactoring was invoked using its shortcut key, we cannot confirm or reject this hypothesis.
Our interviews with our participants explained why Quick Assist is a preferred method of invoking refactorings. Refactorings can be quickly invoked using Quick Assist via keyboard. Quick Assist narrows down the decision space by just listing the refactorings that are applicable to the selected context. In addition, Quick Assist requires no configuration. Instead, it uses reasonable default values and lets the programmer tweak the outcome afterwards (See our technical report for more details).
We think that the Quick Assist menu of Eclipse has room for more refactorings. For example, we think it's a good idea to include refactorings like Introduce Parameter, Inline Method, and Inline Constant in Quick Assist (See Eclipse Bugs 255123, 367671, and 367672). Our study has shown the success of a context-aware and lightweight method of invoking refactorings in Eclipse. We believe that similar methods of invoking refactorings may work well in other IDEs like IntelliJ IDEA and NetBeans.