Need help implementing add, remove, edit, and reset functionality for a list data configuration in my plugin.


Hello! I am currently working on implementing a plugin that includes list data settings with add, remove, edit, and reset functionality. You can see an example of this in the image below:

This type of setting is common in IntelliJ IDEA. I have searched for a standard API that can be used for this purpose, but so far, I have not found anything related to listing settings in com.intellij.openapi.vfs.encoding.FileEncodingConfigurable. Can you suggest any resources or classes that I should refer to? Any help would be greatly appreciated. Thank you!

Comment actions Permalink


To create a table, you can use JBTable class with the proper model for storing data. There are a lot of examples in the code.

If you want to display a table of something backed by a class, e.g., every row represents MyCustomItem, take a look at com.intellij.ui.table.TableView and com.intellij.util.ui.ListTableModel. ListTableModel allows creating column definitions by extending com.intellij.util.ui.ColumnInfo in a very simple and expressive way.

To add “Add”, “Delete”, and “Edit” actions, use com.intellij.ui.ToolbarDecorator#createDecorator(javax.swing.JTable) that decorates a table in a panel with these buttons. Example:

    .setAddAction { /* e.g. display dialog with added item form */ }
    .setRemoveAction { /* e.g. TableUtil.removeSelectedItems(table) */ }
    .setEditAction { /* e.g. display dialog with edited item form */ }
    .disableUpDownActions() // if you don't need reordering
    // more options available

Reset is not directly related to the table. It is a part of reset/apply/isModified mechanism for the configurable. I suggest implementing the whole table in a separate panel that exposes the reset(), apply(), and isModified() methods that will be called from the actual configurable. See com.intellij.openapi.options.UnnamedConfigurable methods for the details.

Comment actions Permalink

Thank you for your reply, it helped me a lot!


Please sign in to leave a comment.