Using the Push ITDs In Refactoring
The refactoring may be performed for an individual field or method, for an aspect as a whole, or for all aspects in a package.
If when performing the refactoring certain aspects become "empty" (this may be the case when the corresponding aspects contain nothing but inter-type declarations), you can select to automatically delete all such aspects.
The following table shows examples of the Push ITDs In refactoring.
In the first example, the declaration of the field
closed is moved from
MyAspect to the class
In the second example, the method
close() is also moved from
Note that both these declarations (that is, the declarations of
may be moved to the class
Account at once if the refactoring is performed for
MyAspect as a whole.
Performing the Push ITDs In refactoring
Depending on the intended scope of the refactoring:
- To perform the refactoring for an individual field or method, open the aspect of interest in the editor and place the cursor within the declaration of the field or method.
- To perform the refactoring for an aspect as a whole, select the aspect of interest in the Project tool window. Alternatively, open the aspect in the editor and place the cursor somewhere outside of individual inter-type declarations (e.g. within the declaration of the aspect).
- To perform the refactoring for all aspects in a package, select the package in the Project tool window.
- Select Refactor | Push ITDs In in the main or the context menu.
- In the Push Inter-Type Declarations In dialog that opens:
- If at the previous step you clicked Preview, the Find tool window opens showing the inter-type declarations that are going to be affected. If happy with the expected result, click Do Refactor.