fix: focus on new editor action and refresh editor actions on apply (#518)

This commit is contained in:
Phil 2024-04-27 22:49:36 +02:00 committed by GitHub
parent 8de72b3301
commit 1415f387ff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

View file

@ -28,7 +28,6 @@ import ee.carlrobert.codegpt.ui.UIUtil;
import java.awt.Dimension;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
@ -191,7 +190,12 @@ public class ConfigurationComponent {
private JPanel createTablePanel() {
return ToolbarDecorator.createDecorator(table)
.setPreferredSize(new Dimension(table.getPreferredSize().width, 140))
.setAddAction(anActionButton -> getModel().addRow(new Object[]{"", ""}))
.setAddAction(anActionButton -> {
getModel().addRow(new Object[]{"", ""});
int lastRowIndex = getModel().getRowCount() - 1;
table.changeSelection(lastRowIndex, 0, false, false);
table.editCellAt(lastRowIndex, 0);
})
.setRemoveAction(anActionButton -> getModel().removeRow(table.getSelectedRow()))
.disableUpAction()
.disableDownAction()