EditorConfig and NetBeans IDE (Part 1)

I made the first steps into EditorConfig support for NetBeans IDE.

Put a file named ".editorconfig" somewhere, e.g., the root folder, open a file, click the EditorConfig button (the mouse is the logo of EditorConfig) in the toolbar, which you can see below next to the Cut button, and then the Output window shows the parsed EditorConfig file, applied based on which type of file is currently selected.

However, I had assumed that the properties in the EditorConfig file would automatically be applied to the current file by EditorConfig. But that doesn't appear to be the case. So, for each property in EditorConfig (of which there are not many), I need to figure out how to map them to functionality in NetBeans IDE. In some cases, I guess there will not be APIs and I'll need to figure out on a case by case basis how to implement the property for the file in question.

The sources are here:


The related issue:


And here's all the code.

        category = "Tools",
        id = "org.netbeans.ec.RunEditorconfigAction"
        iconBase = "org/netbeans/ec/editorconfig.png",
        displayName = "#CTL_RunEditorconfigAction"
    @ActionReference(path = "Menu/Source", position = 200),
    @ActionReference(path = "Toolbars/Clipboard", position = 0)
@Messages("CTL_RunEditorconfigAction=Run EditorConfig")
public final class RunEditorconfigAction implements ActionListener {
    private final DataObject dobj;
    public RunEditorconfigAction(DataObject dobj) {
        this.dobj = dobj;
    public void actionPerformed(ActionEvent e) {
        InputOutput io = IOProvider.getDefault().getIO("EditorConfig", true);
        OutputWriter writer = io.getOut();
        EditorConfig ec;
        try {
            ec = new EditorConfig();
            List<EditorConfig.OutPair> l = null;
            l = ec.getProperties(dobj.getPrimaryFile().getPath());
            for (int i = 0; i < l.size(); ++i) {
                writer.println(l.get(i).getKey() + "=" + l.get(i).getVal());
        } catch (PythonException ex) {
        } catch (EditorConfigException ex) {


Right on! Keep going - thanks for this.

Posted by guest on March 13, 2014 at 07:47 AM PDT #

Can`t wait to use this!

Posted by guest on March 17, 2014 at 06:36 AM PDT #

I am pleased to read that. Once there is a plugin for it, I'll download it immediately. This is a huge step forward for the unification of team collaboration. Thank you for working on that, Geertjan.

Posted by Benny Neugebauer on March 18, 2014 at 03:28 AM PDT #

Thank you very much for your efforts!

Posted by Michael Robinson on March 18, 2014 at 11:45 PM PDT #

In France, there is a lot of disdain toward Netbeans (don't ask me why...)

My current employer is currently evaluating several Front-End editors for future developments, and I'm pushing netbeans. "Does it support editorconfig ?" someone asked me today "Because webstorm, notepad++, etc.. support it."

Since I really want Netbeans to be choosen, please consider finishing this plugin so I could answer "Yes !" ;)

Posted by sni on May 05, 2014 at 02:30 PM PDT #

Sure, working on it. About France -- I can point you to lots of NetBeans users, if you want. Also, I can give an overview to your employer, in person or via Skype, about the key NetBeans features. Just let me know (geertjan dot wielenga at oracle dot com).

Posted by Geertjan on May 05, 2014 at 02:41 PM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.


« May 2016