Reputation: 703
Why isnt there a simple save-as option in IntelliJ IDEA? Is there a way to easily save as a file?
Upvotes: 6
Views: 5264
Reputation: 816
Short direct answer:
Press F5
and write new name of new class.
Not direct answer with question:
You should think carefully - why do you want to duplicate code?
Probably it's better to extract "future" common code to separated class and use it in your old and new classes.
Upvotes: 0
Reputation: 31
In my experience looking for alternate ways of performing simple tasks like Save as is both annoying and time-consuming, and Refactor | Copy is not a very intuitive alternative.
Upvotes: 3
Reputation: 402493
Save as is essentially the same as making a copy of the file under the different name. IntelliJ IDEA copy operation is provided via the refactoring, so you can use Refactor
| Copy (F5) instead of Save as.
Upvotes: 2
Reputation: 2116
You may want to try Refactor -> Copy...
. This creates a new .java file and rename the class name for you if the file is Java source code, otherwise simply duplicate the current file under a new name.
Upvotes: 1