New ActionScript/Flex Refactoring: Pull Members Up
Today we’re continuing our series of posts about new ActionScript/Flex refactorings that you can find in the latest Maia EAP, with presentation of this new aid: pull class members up the classes hierarchy.
Let’s have look at this simple example. Say, we’re designing an API for handling and displaying 2D shapes. We begin with Drawable interface, surprisingly containing method draw() and Rectange class, that implements this interface and also contains property visible:
We may eventually find out that all these members are actually valid not only for rectangles, but for any other shape as well, so we’re creating a base class Shape and are about to bring them there:
Refactoring we’re talking about here makes it simple. All we need is to place the caret somewhere inside of Rectangle class code and invoke Refactor | Pull Members Up.
Note: we can move not only class members, but also interfaces from the implements list! Cool, isn’t it?
Now, select members to be moved, and their new parent — a class or interface. When we select a member that is using another, the latter is highlighted with red (if not selected). When we select an implements XXX item, all methods from XXX interface are highlighted with blue (again, unselected ones).
Well, it’s time to click OK and see what happens!
Note: When we’re pulling a class method to an interface, IntelliJ IDEA does not remove it from the class, but instead creates a method declaration in that interface. For such methods IntelliJ IDEA shows a dialog with make abstract option selected and also lets you choose how to handle their ASDoc: keep as is, copy, or move to interface.
Note: You can seamlessly pull from/to Flex MXML components.
We hope you find this refactoring useful!
Subscribe to Blog updates
Thanks, we've got you!
Import Postman Collections to the HTTP Client
We know that many of you use Postman collections and want to stay in the flow while working with them. This means staying inside IntelliJ IDEA and not switching to a different app. Great news! You can now effortlessly transform Postman collections into .http and use them in the HTTP Client …
What’s New in IntelliJ IDEA 2023.1 for Spring Developers
The IntelliJ IDEA 2023.1 release came packed with updates for Spring. This blog post will highlight the most noticeable changes, including full support for Lombok, a reworked Spring tool window, navigation for Spring Security rules, Spring Security 6 support, and more. Remember that these featur…
‘Quick’ Features in IntelliJ IDEA
A few IntelliJ IDEA features or actions include the term ‘quick’. Do they speed up certain processes? Let’s find out. In this blog post, I’ll cover what these features are, why you need them, and how you can use them. 1. Quick Lists If you have actions that you use regularly but don’t have shortcut…
5 Best Features for Profiling Java Code In IntelliJ IDEA
When it comes to apps functioning efficiently, there is always room for improvement. Fast, lag-free, smooth operation – what else can a Java developer dream of? However, when you aim for this level of perfection in your app, you will need a comprehensive toolset to monitor performance and identif…