Eclipse formatter for Java – Compatibility fork 4.4

As you already know, I provide a NetBeans plugin to format your Java code using the Eclipse formatter engine. Currently the 4.5.x engine is embedded.

But there were several complaints that this version does not format the same way as it does using the previous version. There is a reason for that: The Eclipse formatter has been changed in an incompatible way [1]. Other formatter plugins like the one for Intellj Idea are also affected [2]

But here is a good news for all the brave NetBeans Java developers, who are still in such an environment of 4.4.x Eclipse installations: Now I provide a 4.4-fork of my own plugin. It has the same features and issues like the 4.5 plugin, but it uses the other engine and the plugin has been updated to be installed side by side to the original plugin.

2016-05-09_22h45_51

The plugin is already available from the update center from within your NetBeans IDE. Or you can download it from the plugin page [3] or from github [4].

2016-05-12_00h16_22

[1] http://eclipse-n-mati.blogspot.de/2015/06/eclipse-mars-how-to-switch-back-to.html
[2] https://github.com/krasa/EclipseCodeFormatter/issues/51
[3] http://plugins.netbeans.org/plugin/64061
[4] https://github.com/markiewb/eclipsecodeformatter_for_netbeans

 

 

Advertisements

Version 1.10.2 of Eclipse Code Formatter for Java introduces support for Workspace Mechanic and much more

In the last days and weeks I was busy enhancing the Eclipse Code Formatter plugin. The main focus was the support of the Workspace Mechanic [1] configuration file to be in compliance with my coworkers.

Offtopic: Workspace Mechanic is a plugin for Eclipse IDE itsself, which makes sure that shared Eclipse configurations are applied to your local installation. Have a look. It’s useful in a team of several developers.

Workspace Mechnanic also synchronizes the configuration of the formatter. Luckily its file format is quite simple and thus supportable by my plugin. So next to the standard XML-formatter file you can now use Workspace Mechanic EPF-files too.

I also added some other useful features you may like. That was the reason, why the release of this version took so long. For example now the “format on save”-action can optionally format the changed lines only. You can use formatter settings from .settings, you can configure the Java source level and the line feed. And the download size of the plugin has been massively decreased.

The full changelog can be found at [2]

global

In a few days it will be available as an update from within your NetBeans IDE. If you are curious and you don’t want to wait for it, then you can install it manually from [3] or [4].

Feel free to file issues and even better, provide pull-requests! We see us at NetBeans Day Germany in Munich on the 31st of March 2016. Get your ticket at [5]!

[1] Workspace Mechanic
[2] https://github.com/markiewb/eclipsecodeformatter_for_netbeans/issues?q=milestone%3A1.10.2
[3] http://plugins.netbeans.org/plugin/50877
[4] https://github.com/markiewb/eclipsecodeformatter_for_netbeans
[5] NetBeans Day Germany in Munich

Quicktip: How to display your own Java code-templates in the code completion of NetBeans IDE

After blogged about How to display your own PHP code-templates in the code completion of NetBeans IDE a NetBeans user asked me how it works for Java code.

Yes, it is possible and it is even simpler. Since NetBeans 7.4 (issue #160771) you can define the context, where code-template has to be shown. Don’t be overwhelmed by the available contexts. For completions within a block/method choose BLOCK.

2016-01-09_13h39_35

New version of Eclipse Code Formatter for Java provides support for Eclipse 4.5.1 Mars.1 and @format:off

Within the last days I had time to update the formatter plugin, which allows you to format java source code using the formatter engine of Eclipse JDT. In a few days it will be available as an update from within your NetBeans IDE. If you are curious and you don’t want to wait for it, then you can install it manually from [1] or [2].

The major change is that the jars for the formatter engine are now taken from Eclipse 4.5.1 Mars.1.

As you might know, the plugin already provided support for @format:off before – if it was enabled in the formatter file. But now it provides some code templates, so that it easier to use. See the documentation at [3]

63957236-af2c-11e5-8095-c1ee38727d49

66a04320-af2c-11e5-8d8b-35e68c25df1d

Feel free to file issues and provide pull-requests to see your enhancement in the next release! Happy coding and a happy new year!

[1] http://plugins.netbeans.org/plugin/50877
[2] https://github.com/markiewb/eclipsecodeformatter_for_netbeans
[3] https://github.com/markiewb/eclipsecodeformatter_for_netbeans/wiki/Support-of-@formatter:off

New version of Additional Java Hints plugin – 1.2.0

FYI: Recently I released the new version 1.2.0 of the “Additional Java Hints” plugin. There are some new hints/small quickfixes, which may be useful (or not) for Java developers.

  • [New Hint]: Change the modifier of a class/method/field to public/package protected/protected/private (by rasa-silva)
  • [New Hint]: Remove public/abstract/final modifiers from field declarations within interfaces
  • [New Hint]: Convert from char and string and back
  • [New Hint]: Convert number in literal to number and back
  • [New Hint]: Convert to StringUtils.isBlank()/StringUtils.isNotBlank()/StringUtils.isEmpty()
  • [New Hint]: Convert from if/else to ternary and back
  • [New Hint]: Invert ternary if/else
  • [New Hint]: Report methods that have class name
  • [Updated Hint]: “Convert to assertTrue/assertFalse” now supports junit.framework.Assert too
  • [Updated Hint]: “Replace +…” hints can now be configured

screenshot

The plugin is verified for NB 8.0 and NB 7.4 and already available from the plugin dialog within your NetBeans IDE. Or you can download it from http://plugins.netbeans.org/plugin/47589/additional-hints

As always please file issues and enhancements at https://github.com/markiewb/nb-additional-hints/issues . Pull request are also appreciated.

New version of Additional Java Hints plugin – 1.1.0

Another short note for today: I recently updated the “Additional Java Hints” plugin. There are some new hints/small quickfixes, which may be useful (or not) for Java developers. 

  • [New Hint]: Support transformation to BigDecimal constants
  • [New Hint]: Split a string at caret
  • [New Hint]: Convert to assertTrue/assertFalse
  • [New Hint]: Remove “public abstract” modifiers from method declarations within interfaces

Image

The plugin is verified for NB 7.3 and NB 7.4 and already available from the plugin dialog within your NetBeans IDE. Or you can download it from http://plugins.netbeans.org/plugin/47589/additional-hints

As always please file issues and enhancements at https://github.com/markiewb/nb-additional-hints/issues . Pull request are also appreciated.

New version of “Java Eclipse Code Formatter” plugin available

Good news for all the NetBeans IDE java developers who have to comply to formatter rules of their Eclipse JDT coworkers. I released a new version of the Eclipse Code Formatter plugin.

The major change was the integration of the formatter engine from Eclipse Kepler 4.3. The plugin now also allows you to choose which formatter profile you want to use.

Image

The plugin is available from the PPUC at http://plugins.netbeans.org/plugin/50877/eclipse-code-formatter-for-java or from your IDE (Tools|Plugin)

Supports NetBeans 7.3+ and JDK6+