Is possible in Intellij Idea 14 do something like in Eclipse: Refactor : Extract Class? Or I should do it manually?
Not found proper option in menu, and I am startled option is not available.
Select a code fragment that you want to extract into a class. Depending on what you want to extract, from the main menu, select one of the following: Refactor | Extract | Delegate.
Press Ctrl+Shift+R and then choose Extract Class. Right-click and choose Refactor | Extract Class from the context menu.
To extract method:Press Ctrl+Alt+M or from the main menu, select Refactor | Extract | Method. In the dialog that opens, configure a method options, such as visibility, parameters, and so on. You can also change a name of the method if you need. Click OK.
The Extract Superclass refactoring lets you create a superclass for an existing class or rename the original class, so that it becomes an implementation for the newly created superclass.
Anything that's worth doing in eclipse can be done faster and easier in IntelliJ, but if you're used to eclipse then you'll have to work a little bit to understand IntelliJ's way of doing things.
If you place your cursor somewhere in the java code in question (or on the class name in the project window), the Refactor
menu will have an Extract
option. Extract Delegate
, Interface
, and Superclass
are the three options that deal directly with classes. These menu options aren't available if your cursor isn't in java class code.
The Interface
option extracts an interface, renames your class and makes it implement the interface. The 'Superclass' option extracts a superclass and changes references to refer to it rather than your, now, derived class. The Delegate
option simply extracts the methods and properties you choose into a new class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With