ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Eclipse​Java​Formatter

by i-am-a-paull ALL

Plugin for Sublime Text 2 and 3 that allows you to format Java files with the Eclipse formatter.

Details

  • 2013.11.20.04.03.44
  • github.​com
  • github.​com
  • 11 years ago
  • 13 minutes ago
  • 13 years ago

Installs

  • Total 26K
  • Win 16K
  • Mac 6K
  • Linux 4K
Dec 26 Dec 25 Dec 24 Dec 23 Dec 22 Dec 21 Dec 20 Dec 19 Dec 18 Dec 17 Dec 16 Dec 15 Dec 14 Dec 13 Dec 12 Dec 11 Dec 10 Dec 9 Dec 8 Dec 7 Dec 6 Dec 5 Dec 4 Dec 3 Dec 2 Dec 1 Nov 30 Nov 29 Nov 28 Nov 27 Nov 26 Nov 25 Nov 24 Nov 23 Nov 22 Nov 21 Nov 20 Nov 19 Nov 18 Nov 17 Nov 16 Nov 15 Nov 14 Nov 13 Nov 12
Windows 0 1 0 0 0 3 1 2 0 2 0 1 0 1 0 0 2 0 1 4 2 3 2 1 2 0 0 2 1 0 0 0 0 1 1 1 0 0 1 0 1 0 0 0 0
Mac 1 0 1 0 0 0 1 2 0 1 0 0 0 0 1 1 0 1 0 0 0 1 1 1 1 0 1 1 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 1
Linux 0 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 1 0 0 2 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

Basic Config

At a minimum, include the following configuration block in either your user or project settings:

"EclipseJavaFormatter":
{
  // you may not even need this one if eclipse is on your path
  "eclipse_command": "/path/to/eclipse/install/eclipse",

  "config_file": "/path/to/org.eclipse.jdt.core.prefs"
}

For information on how to find and/or generate your config_file, look here: Formatting your code using the Eclipse formatter

Import Sorting

If you want, EclipseJavaFormatter can automatically sort imports after formatting. This feature is not an external call to Eclipse, and it does not attempt to do any sort of autoimporting.

"sort_imports": true

It will, however, honor any overrides that you wish to include, much like the actual eclipse import sorter.

"sort_imports_order": ["java", "javax", "org", "com"]

Note: Right now, sort_imports will blow away any comments between the first and last import statements.

Line Endings

If you need to preserve your line endings, add the following:

"restore_line_endings": true

Notes

If you use gradle and SublimeJava for your java development, you may be interested in my gradle plugin.