IntelliJ IDEA’s Move Refactoring for ActionScript/Flex gets Smarter
At JetBrains we not only bring you new powerful features that make your life better, but also take care to polish the good old stuff to perfection. Let’s take a look at the Move refactoring for ActionScript classes, Flex components and all other types of top-level declarations (namespaces, functions, variables and constants), that has just got a little smarter. By the way, this refactoring also works for inner declarations (also known as helpers or file-local declarations), defined in ActionScript file out of the package statement.
Generally speaking there’s nothing special about Move refactoring, but in complex multi-module projects choosing a right folder may turn out harder than it seems to be. Well, not anymore it isn’t, and here’s the proof.
We’ll start with, invoking Move action by pressing F6 in editor, Project view or UML diagram (don’t forget to select your class/top-level function/whatever else first):
Here we specify the target package (thinking in terms of packages instead of directories is a lot more natural, isn’t it?). As we type, IntelliJ IDEA assists us with completion and highlights packages that don’t exist with red, which means they will be created on-the-fly, which is good, because we can start coding right away without preparing package structure in advance.
We can opt to searching for out-of-the-code usages (e.g. comments, string constants and properties files), and finally, if we need to move a class to a different source folder (e.g. to another module), all we need to to is to select an appropriate option! This way, after pressing Refactor or Preview we’ll be able to choose which module and source root to move to (current source root will be preselected):
And that’s it! No need to bother with directories anymore!
Of course, all changes can be previewed first, so that we can see the entire picture without making any actual changes, which is cool, because not all changes are safe. Press Preview and here we go:
All the usages of moved element grouped by type and location, plus we can easily exclude usages we don’t want modified.
Another interesting case is to move inner class to the top-level. This may be useful when some utility class has grown enough to deserve a separate file. Here’s an example:
Just as before, place the caret at the class and press F6:
Now accept the name and package of a new top-level class, and IntelliJ IDEA will take care about the rest.
We wish you safe refactoring, and keep watching this blog for the latest news!
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…