Convert Anonymous to Inner
The Convert Anonymous to Inner refactoring allows you to convert an anonymous class into a named inner class.
Place the cursor within the anonymous class to be refactored.
On the main menu, or on the context menu of the selection, select.
In the dialog that opens, specify the name for the new inner class and variables that will be used as parameters to the inner class constructor. You can also indicate whether you want to make your class static.
Click OK to create the inner class.