Inspirated by Golang's const, I made this script for automation set value for constants white writing Java code.
Just:
//#constant(
int A;
int B;
//)
then save and we have:
public static final int A = 0;
public static final int B = 1;
One more example:
//#constant(
private int A = 1;
protected int B = 10;
int C = 100;
//)
The result will be:
//#constant(
private static final int A = 1;
protected static final int B = 2;
public static final int C = 3;
//)
- Install
File Watchers
plugin on IDEA or Android Studio. - On File watcher preferences (Open Preferences -> Tools -> File Watchers)
- Add new watcher with custom type
- Setup watcher
- File type: Java Source
- Scope: All Places
- Program: select
jwatcher.sh
file (remember to add execute permission) - Arguments:
$FilePath$
- Uncheck:
Immediate file synchronization
- Show console: Never
No work with this: int A; int B;
Make this become Intelij's Plugin