Extract as Include Improvements

posted Mar 18, 2011, 10:03 AM by Tor Norbye

The "Extract as Include" operation, previously described here, has been rewritten to use the Eclipse Refactoring infrastructure. That means that you now get the refactoring preview dialog where you can inspect the changes - and uncheck diffs you do not want to include.

We have also improved this refactoring such that it can detect and extract the same UI in other variations of the same layout!

For example, let's say you have some UI in a layout, and then you create a portrait variation of the same layout, such that you have both layouts/foo.xml and layouts-port/foo.xml. If you now use this refactoring to extract out a portion of the layout into a separate include, the refactoring will optionally look at all the variations of this layout, and if the same UI is present in other variations of this layout, then those files will also be refactored to point to the same new included layout.

Here is a screenshot which shows the refactoring preview dialog, with multiple files getting their identical sub elements replaced with a new common include: