ReformatCode (Ctrl-Alt-L) and OptimizeImports (Ctrl-Alt-O) without a dialog.
ReformatPlugin.OptimizeImports - works on the current file.
ReformatPlugin.ReformatCode - works on the current file or a selection (if there's a selection).
Regular actions (ReformatCode and OptimizeImports; with a dialog) are replaced by the plugin's actions.
You still have the access to the regular actions (Tools menu).
Plus there's an additional action: ReformatPlugin.ReformatCodeAndOptimizeImports (Ctrl-Alt-R).
It does Optimize Imports and Reformat Code on the current file (even if there's a selection).
Options: blankAfterLastMember, newArraySpace, shortenFq. Config file location: ${idea.config.path}/options/plugins/Reformat.xml
This plugin uses non-published IDEA API.
Downloads, Bugs, RFEs:
http://sourceforge.net/projects/tz-ip/
- Copy the jar file (e.g. Reformat.jar) to the plugins directory ($IDEA_HOME/plugins).
- Restart IDEA.
http://www.intellij.net/tracker/idea/viewSCR?publicId=2389
("Ability to Reformat Code (Ctrl-Alt-L) and Optimize Imports (Ctrl-Alt-O) with one command")
http://www.intellij.net/forums/thread.jsp?forum=3&thread=4680&message=164804 ("Layout Code with option for Optimize Imports?")
http://www.intellij.net/forums/thread.jsp?forum=3&thread=4329&message=141644 ("Splitted Reformat Code/Optimize Imports :(")
http://www.intellij.net/forums/thread.jsp?forum=3&thread=237&message=3035 ("Layout Code and Optimize Imports")
regular action id regular keystroke plugin action id
ReformatCode Ctrl-Alt-L ReformatPlugin.ReformatCode
OptimizeImports Ctrl-Alt-O ReformatPlugin.OptimizeImports
Ctrl-Alt-R ReformatPlugin.ReformatCodeAndOptimizeImports
Blank line at the end of the class. By default it's disabled (set to false).
See also HowToSetAnOption.
http://www.intellij.net/tracker/idea/viewSCR?publicId=249 ("Formatter. Provide "Blank lines after last member" setting")
http://www.intellij.net/tracker/idea/viewSCR?publicId=2393 ("Blank lines around method not honored at the end of the class")
class A { // Before
void f() {
}
}
class A { // After
void f() {
}
}
Space before brace in array initializer. By default it's disabled (set to false).
See also HowToSetAnOption.
http://www.intellij.net/tracker/idea/viewSCR?publicId=3228 ("Code Style: support formatting array literals")
new int[]{0, 1} // Before
new int[] {0, 1} // After
Shorten fully qualified class references. By default it's disabled (set to false).
See also HowToSetAnOption.
http://www.intellij.net/tracker/idea/viewSCR?publicId=9553 ("New code layout action: optimize (shorten) FQCN")
class A { // Before
java.util.Set set;
}
import java.util.Set;
class A { // After (actually, it depends on your code style settings)
Set set;
}
- Specify locations in build-home.properties
- ant clean main.
- Fixed FileNotFoundException bug (reported by Dani).
- Works only with Aurora builds (tested with #896).
- New option: shorten fully qualified class references.
- Removed wrap single statements option.
- New location of the options: ${idea.config.path}/options/plugins/Reformat.xml.
- Now the options data (if it's different from defaults) is not lost if you remove the plugin.
- API changes (breaks TabifierPlugin).
- Bug [ 758122 ] ReformatPlugin or TabifierPlugin error.
- Bug [ 755684 ] Sometimes enabled options don't work.
- Bug [ 756094 ] spaceBeforeBraceInArrayInitializer sometimes doesn't work.
- RFE [ 756107 ] Wrap single statements (for, while, do while, if).
- RFE [ 749836 ] BlankLineAfterLastMember, don't touch anonymous classes.
- RFE [ 736785 ] Space before the brace in "new String[] {}".
- RFE [ 736783 ] Blank line at the end of the class.
- RFE [ 736800 ] Optimize then Reformat.
- RFE [ 736834 ] Ability to hook up afterReformat listeners.
- Bug [ 738055 ] NPE at startup for #813.
- ReformatPlugin.ReformatCode, ReformatPlugin.OptimizeImports, ReformatPlugin.ReformatCodeAndOptimizeImports.
-- TimurZambalayev - May 11, 2003
|
|