Moving a Class Member to a Subclass

See Also

You can use the Push Down command to move inner classes, methods, fields to all subclasses of their current class.

To initiate the Push Down operation:

  1. In the Source Editor or Projects window, select the class member or class members that you want to move.
  2. Choose Refactor > Push Down.

    The Push Down dialog box appears and displays a list of the class's members. Make sure the checkbox for the member that you want to move is selected.

  3. (Optional) Select the Keep Abstract checkbox for any abstract methods that you want to keep defined in the current class and have implemented in the subclass. The checkbox in the left column must also be checked for the class definition to be copied to the subclass.
  4. If you click Refactor, the IDE applies the changes automatically and skips the remaining steps. If you click Preview, the Refactoring window displays the lines of code that will be changed. Review the list and clear the checkbox of any code that you do not want changed. If the class that you are pushing members from has multiple subclasses and you do not want the members to be pushed to all of them, be sure to clear the checkboxes for the corresponding subclasses. Click Do Refactoring to apply the selected changes.
See Also
Refactoring: Quick Reference
Moving a Class Member to a Superclass
Moving a Class to Another Java Package
Renaming a Class or Interface
Undoing Refactoring Changes

Legal Notices