]> source.dussan.org Git - gitblit.git/commitdiff
Remove cached registrations on delete or rename. Recent accelerators.
authorJames Moger <james.moger@gitblit.com>
Wed, 19 Oct 2011 02:53:14 +0000 (22:53 -0400)
committerJames Moger <james.moger@gitblit.com>
Wed, 19 Oct 2011 02:53:14 +0000 (22:53 -0400)
src/com/gitblit/client/GitblitManager.java

index 51afbc5b0588f4507795cf8e51e384194162aa0e..e5b6b43bcaae8e2f9d3beb4f37a5dcfd7897b43c 100644 (file)
@@ -234,6 +234,7 @@ public class GitblitManager extends JFrame implements RegistrationsDialog.Regist
                                passwordField.getPassword());\r
                if (!StringUtils.isEmpty(originalName) && !originalName.equals(reg.name)) {\r
                        // delete old registration\r
+                       registrations.remove(originalName);\r
                        try {\r
                                StoredConfig config = getConfig();\r
                                config.unsetSection("servers", originalName);\r
@@ -293,8 +294,11 @@ public class GitblitManager extends JFrame implements RegistrationsDialog.Regist
                if (list.size() > maxRecentCount) {\r
                        list = list.subList(0, maxRecentCount);\r
                }\r
-               for (final GitblitRegistration reg : list) {\r
+               for (int i = 0; i < list.size(); i++) {\r
+                       final GitblitRegistration reg = list.get(i);\r
                        JMenuItem item = new JMenuItem(reg.name, icon);\r
+                       item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1 + i, KeyEvent.CTRL_DOWN_MASK,\r
+                                       false));\r
                        item.addActionListener(new ActionListener() {\r
                                public void actionPerformed(ActionEvent e) {\r
                                        login(reg);\r
@@ -345,6 +349,7 @@ public class GitblitManager extends JFrame implements RegistrationsDialog.Regist
                        StoredConfig config = getConfig();\r
                        for (GitblitRegistration reg : list) {\r
                                config.unsetSection("servers", reg.name);\r
+                               registrations.remove(reg.name);\r
                        }\r
                        config.save();\r
                        success = true;\r