If I have code that has a bunch of fully qualified names in it (java.util.List, javax.swing.JLabel, etc.) is there a command in intellij that will automatically convert those to import the package and just use the class name?
标签:
intellij-idea
相关问题
- Configure gradle plugin based on future tasks
- How to make available “open this project in Intell
- IntelliJ 2017.1.2 GOLANG debug does not work on br
- JavaFX sample issue
- Could not import the newly generated play framewor
相关文章
- In IntelliJ IDEA, how can I create a key binding t
- IntelliJ IDEA can't open projects or add SDK o
- IntelliJ Subversion Authentication Required Dialog
- Kotlin Koans with EduTools plugin: “Failed to laun
- How to set up Intellij to run javap command on a p
- How to enable “type information” for streams retur
- How to add a project to build path in IntelliJ Ide
- How do I use Gradle bootRun with --args in Intelli
In case, for new code entries if you are seeing the FQNs, just make sure that,
This can be achieved by first turning on inspection for this.
Open up the
Settings
dialog and go down to Inspections and then search forqualified
keyword and then turn onUnnecessary fully qualified name
inspection:That will make all occurrences of FQN in the code being color marked:
Now place the cursor on one of the highlighted areas and press Alt+Enter and a popup will give you the choice to
Fix all 'Unnecessary fully qualified name' problems
:And then all FQN's will have been replaced with imports at the top instead:
If you want to run this inspection on the whole project (instead of just the current file) then you can choose the
Run inspection on...
alternative in the context menu:Then choose
Whole project
:And then finally in the
Inspection Results
window choose toApply Fix
on the selection: