Supports configurable, Eclipse like, save actions, including "organize imports", "reformat code", "rearrange code", "compile file" and some quick fixes like "add / remove 'this' qualifier", etc. The plugin executes the configured actions when the file is synchronised (or saved) on disk.
- Organize imports
- Reformat code (only changed text or all)
- Rearrange code (reorder methods, fields, etc.)
- Compile file
- Add final to local variable
- Add final to field
- Remove explicit generic type for diamond
- Qualify field access with this
- Remove unused suppress warning annotation
- Remove final from private method
- Remove unnecessary semicolon
- File exclusion with regex support
- Works on any file type Intellij IDEA can reformat (Java, XML, etc.)
- Simple option page to activate / deactivate actions
Install it from the plugin repository in Intellij IDEA (recommended):
- "File > Settings > Plugins > Browse repositories... > Search 'Save Actions' > Category 'Code tools'"
Or the plugin is available from the Intellij IDEA Community Edition plugin repository and you can also download the jar from there then add it in Intellij IDEA:
- "File > Settings > Plugins > Install plugin from disk..."
The configurations are located in "File > Settings > Other Settings > Save Actions".
Enable / disable the plugin.
Enable / disable import organization (configured in "File > Settings > Code Style > Java > Imports").
Enable / disable formatting (configured in "File > Settings > Code Style"). See "Reformat only changed code" for more options.
Enable / disable re-ordering of fields and methods (configured in "File > Settings > Code Style > Java > Arrangement").
Enable / disable formatting for changed code only. If VCS is configured, it is used to check which lines where modified. If VCS is not configured, the code will always get reformatted.
Enable / disable compiling of the modified file. The compiler might compile other files as well.
Add / remove file path exclusions to ignore files. The entries are Java regular expressions, and it matches the whole file name from the project root. A pattern that do not compile cannot be added to the list. Some examples:
Exclude 'Main.java' only in root folder:
Main\.java
Exclude file 'Foo.java' only in folder 'src':
src/Foo\.java
Exclude all xml files in any folder:
.*/.*\.xml
Will add the final modifier to any local variable (not parameters or fields).
Will add the final modifier to any class fields (not parameters or local variables).
Will remove unused right side generic types for Java 7 diamond operator.
List<String> list = new ArrayList<String>();
Becomes
List<String> list = new ArrayList<>();
Will qualify all field access with this.
Will remove any unused @SuppressWarning annotations.
Will remove final for private method.
Will remove unnecessary semicolon.
Dat plugin do not work? You want more features? You can ask me on twitter or create an issue on github.
This plugin works with Java 6+ and Intellij IDEA Community Edition build 135+ (version 13.1.6).