JComponent () { final String[] names = { CodeInsightBundle.message("templates.dialog.edit.variables.table.column.name"), CodeInsightBundle.message("templates.dialog.edit.variables.table.column.expression"), CodeInsightBundle.message("templates.dialog.edit.variables.table.column.default.value"), CodeInsightBundle.message("templates.dialog.edit.variables.table.column.skip.if.defined") }; // Create a model of the data. TableModel dataModel = new VariablesModel(names); // Create the table myTable = new JBTable(dataModel); myTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); myTable.setPreferredScrollableViewportSize(JBUI.size(600, -1)); myTable.setVisibleRowCount(8); myTable.getColumn(names[0]).setPreferredWidth(100); myTable.getColumn(names[1]).setPreferredWidth(300); myTable.getColumn(names[2]).setPreferredWidth(100); myTable.getColumn(names[3]).setPreferredWidth(100); if (myVariables.size() > 0) { myTable.getSelectionModel().setSelectionInterval(0, 0); } Predicate<Macro> isAcceptableInContext = macro -> myContextTypes.isEmpty() || ContainerUtil.exists(myContextTypes, macro::isAcceptableInContext); Stream<String> availableMacroNames = Arrays.stream(MacroFactory.getMacros()).filter(isAcceptableInContext).map(Macro::getPresentableName).sorted(); Set<String> uniqueNames = availableMacroNames.collect(Collectors.toCollection(LinkedHashSet::new)); DefaultCellEditor cellEditor = new ComboBoxCellEditor() { @Override protected List<String> getComboBoxItems() { return new ArrayList<>(uniqueNames); } @Override protected boolean isComboboxEditable() { return true; } }; cellEditor.setClickCountToStart(1); myTable.getColumn(names[1]).setCellEditor(cellEditor); JTextField textField = new JTextField(); /*textField.addMouseListener( new PopupHandler(){ public void invokePopup(Component comp,int x,int y){ showCellPopup((JTextField)comp,x,y); } } );*/ cellEditor = new DefaultCellEditor(textField); cellEditor.setClickCountToStart(1); myTable.setDefaultEditor(String.class, cellEditor); final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myTable).disableAddAction().disableRemoveAction(); return decorator.createPanel(); }