From a8cb5d4931d5f7d3707fec4c1fe3f4ead572c494 Mon Sep 17 00:00:00 2001 From: James Moger Date: Tue, 18 Oct 2011 22:53:14 -0400 Subject: [PATCH] Remove cached registrations on delete or rename. Recent accelerators. --- src/com/gitblit/client/GitblitManager.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/com/gitblit/client/GitblitManager.java b/src/com/gitblit/client/GitblitManager.java index 51afbc5b..e5b6b43b 100644 --- a/src/com/gitblit/client/GitblitManager.java +++ b/src/com/gitblit/client/GitblitManager.java @@ -234,6 +234,7 @@ public class GitblitManager extends JFrame implements RegistrationsDialog.Regist passwordField.getPassword()); if (!StringUtils.isEmpty(originalName) && !originalName.equals(reg.name)) { // delete old registration + registrations.remove(originalName); try { StoredConfig config = getConfig(); config.unsetSection("servers", originalName); @@ -293,8 +294,11 @@ public class GitblitManager extends JFrame implements RegistrationsDialog.Regist if (list.size() > maxRecentCount) { list = list.subList(0, maxRecentCount); } - for (final GitblitRegistration reg : list) { + for (int i = 0; i < list.size(); i++) { + final GitblitRegistration reg = list.get(i); JMenuItem item = new JMenuItem(reg.name, icon); + item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1 + i, KeyEvent.CTRL_DOWN_MASK, + false)); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { login(reg); @@ -345,6 +349,7 @@ public class GitblitManager extends JFrame implements RegistrationsDialog.Regist StoredConfig config = getConfig(); for (GitblitRegistration reg : list) { config.unsetSection("servers", reg.name); + registrations.remove(reg.name); } config.save(); success = true; -- 2.39.5