Eclipse Code Formatter for Java - plugin detail

Eclipse Java Code Formatter Integration for NetBeans

NetBeans Plugin - Eclipse Code Formatter for Java
Plugin owner: markiewb
Website: https://github.com/markiewb/eclipsecodeformatter_for_netbeans
Added: 2013-10-03
License: EPL 1.0
Category: Editing
Downloaded: 1,936 times
Rating:
 4.46, by 5 users

Plugin Log Show log

Versions available

Download plugin   Download size: 5.95 MB   Last Update: 2014-06-10

This plugin is also available on the NetBeans Plugin Portal Update Center. Use 'Tools > Plugins' action from the NetBeans IDE main menu for convenient installation of this plugin


What's new in this version

Updates in 1.7.1:

  • [Bugfix 41]: Fixed: NPE when configuration file not found


Verifications for NetBeans versions

8.0 verification PASSED See verification details
Download plugin   Download size: 5.95 MB   Last Update: 2014-06-10

This plugin is also available on the NetBeans Plugin Portal Update Center. Use 'Tools > Plugins' action from the NetBeans IDE main menu for convenient installation of this plugin


What's new in this version

Updates in 1.7.1:

  • [Bugfix 41]: Fixed: NPE when configuration file not found


Verifications for NetBeans versions

7.4 verification PASSED See verification details
Download plugin   Download size: 5.95 MB   Last Update: 2014-06-10

This plugin is also available on the NetBeans Plugin Portal Update Center. Use 'Tools > Plugins' action from the NetBeans IDE main menu for convenient installation of this plugin


What's new in this version

Updates in 1.7.1:

  • [Bugfix 41]: Fixed: NPE when configuration file not found


Verifications for NetBeans versions

7.3 verification PASSED See verification details


Introduction

This plugin helps you to apply to a common code style in a team of Eclipse JDT and NetBeans IDE users. The original formatting engine of Eclipse is embedded and allows you to format the sourcecode the same way as your Eclipse co-workers do. You only have to provide a Eclipse formatter configuration file.

Plugin is in still experimental state. Known issue: When the Eclipse formatter is used all the breakpoints in the file are lost.

Features:

  • Global configuration and project specific configuration
  • Supports profiles (since 1.6)
  • On save action (Disabled by default)
  • Shows the used formatter as notification (Enabled by default)
  • Supports format of selected text (since 1.7)
1384432599_2013-11-14_13h35_05.png

Updates in 1.7:

Updates in 1.6.1:

  • [Bugfix 34]: Fixed: NPE while saving options when no profile is set

Updates in 1.6:

  • [Task 30]: Update to Eclipse formatter jars from Eclipse Kepler 4.3
  • [Feature 31]: First profile in file is always used - support selection of profile
  • [Feature 21]: Project specific options: Show link to global options

Updates in 1.5:

  • [Bugfix 18]: Fixed: Formatting with eclipse formatter introduces empty document in undo manager
  • [Task 27]: Provide a signed package for the PPUC

Updates in 1.4.1:

  • [Bugfix 25]: Fixed: Configured formatter.xml isn't used

Updates in 1.4:

Note:

Please note that this plugin only provides support for formatting. Eclipse users may miss the application of save-actions like "adding @Override annotations" or "member sort order". Such AST-based transformations are not provided by this plugin. The plugin also won't format source code with guarded sections - like the Java sources generated by the NetBeans GUI builder.

Licensing

Provide defects, request for enhancements and feedback at https://github.com/markiewb/eclipsecodeformatter_for_netbeans/issues

Compatible to NetBeans 7.3+ and JDK6+.

btn_donate_SM.gif

[ You have to be logged in to be able to comment. ]

User Comments

  

Re2: Is "Format on save" the only way to format the code?

Hi pns,

>Remapping the Shift+Alt+F doesn't work for me beacuse I still want to use Netbeans formatter in some project (not all projects I work on use eclipse formatter). Having it format on save is enough I guess.

It is much easier the following way. Remap the "format with eclipse formatter" action. In the global options of the plugin (Tools|Options|Java|Eclipse Formatter) enable the Eclipse formatter. In the specific projects, where you are forced to use NB formatter, disable the eclipse formatter in the project properties (Right click on the project node. At Properties|Formatting|Eclipse Formatting|Override global settings check "Use NetBeans Formatter".)
Posted by markiewb on Apr 03, 2014
  

Re: Is "Format on save" the only way to format the code?

Humm ok I though it was possible to somewhow "override" the keymap in projects configured for using eclipse formatter. Remapping the Shift+Alt+F doesn't work for me beacuse I still want to use Netbeans formatter in some project (not all projects I work on use eclipse formatter). Having it format on save is enough I guess.

Thanks for the reply! and the plugin! :-)
Posted by pns on Apr 03, 2014
  

Re: Is "Format on save" the only way to format the code?

@pns: The plugin does not remap the shortcut Shift-Alt-F to the action. You have to do it yourself. Use main menu "Source|Format with Eclipse formatter"
Posted by markiewb on Mar 20, 2014
  

Is "Format on save" the only way to format the code?

I configured a maven project to use eclipse formatting rules (overriding the default formatting ones). But when I hit Shift+Alt+F within a file from that project, the style applied is the default one and not the override.

However if I check "Format on Save", when saving the file it's formatted accordingly (using the overridden eclipse rules). Shoudn't Shif+Alt+F, when done in a project using eclipse rules, format the code according to those rules?
Posted by pns on Mar 20, 2014
  

Thanks a ton !!!

All developers expect me use Eclipse in my team.
Merge conflicts triggered by formatting differences have been a nightmare.
Looking forward to pleasant days with this plug-in.
Thanks again.
Posted by sarveswaran_m on Jan 29, 2014
  

Good Job!!!

Just came across this because of the NB weekly newsletter, and I must say thanks...

Tried a different eclipse code formatter plugin before but it wasn't up to scratch and crashed when I tried to save a non Java file, but this one seems to be working very well for everything, and looks very much in line with the quality I would expect from a NB feature and this is only a plugin.

Thanks
Posted by satory on Nov 19, 2013
  

Re: Great plugin

@tomzi:
- select between netbeans and eclipse formatting
-> you can configure the used formatter for each project separately

- formatting works with netbeans shortcuts
-> should work. Assign your own keyboard shortcut. Options|KeyMap

If this doesn't work, please file an issue.
Posted by markiewb on Oct 31, 2013
  

Great plugin!

Please make it work that you can:
- select between netbeans and eclipse formatting
- formatting works with netbeans shortcuts
Posted by tomzi on Oct 31, 2013
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo