{"action":"created","comment":{"url":"https://api.github.com/repos/HubTurbo/HubTurbo/pulls/comments/34419556","id":34419556,"diff_hunk":"@@ -443,6 +448,24 @@ private void primaryRepoChanged(String repoId) {\n         logic.openPrimaryRepository(repoId);\n         logic.setDefaultRepo(repoId);\n     }\n+    \n+    public void switchDefaultRepo(){\n+        String[] openRepos = repoSelector.getContents().toArray(new String[0]);\n+        String currentRepo = logic.getDefaultRepo();\n+        \n+        // Cycle to the next open repository\n+        for (int i = 0; i < openRepos.length; i++) {\n+            if (openRepos[i].equals(currentRepo)) {\n+                if (i == openRepos.length - 1) {\n+                    primaryRepoChanged(openRepos[0]);\n+                    repoSelector.setText(openRepos[0]);\n+                } else {\n+                    primaryRepoChanged(openRepos[i + 1]);\n+                    repoSelector.setText(openRepos[i + 1]);\n+                }","path":"src/main/java/ui/UI.java","position":49,"original_position":49,"commit_id":"0e5589401086563b6f02876010401d902e7a4b6e","original_commit_id":"0e5589401086563b6f02876010401d902e7a4b6e","user":{"login":"damithc","id":1673303,"avatar_url":"https://avatars.githubusercontent.com/u/1673303?v=3","gravatar_id":"","url":"https://api.github.com/users/damithc","html_url":"https://github.com/damithc","followers_url":"https://api.github.com/users/damithc/followers","following_url":"https://api.github.com/users/damithc/following{/other_user}","gists_url":"https://api.github.com/users/damithc/gists{/gist_id}","starred_url":"https://api.github.com/users/damithc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/damithc/subscriptions","organizations_url":"https://api.github.com/users/damithc/orgs","repos_url":"https://api.github.com/users/damithc/repos","events_url":"https://api.github.com/users/damithc/events{/privacy}","received_events_url":"https://api.github.com/users/damithc/received_events","type":"User","site_admin":false},"body":"This is more readable:\r\n```\r\nboolean isLastInTheList = (i == openRepos.length - 1);\r\nint nextRepoIndex = (isLastInTheList ? 0 : i+1);\r\nprimaryRepoChanged(nextRepoIndex);\r\nrepoSelector.setText(nextRepoIndex);             \r\n```\r\n\r\nOr this:\r\n```\r\n//go back to first item if current selected item is the last one in the list\r\nint nextRepoIndex = (i == openRepos.length - 1 ? 0 : i+1);\r\nprimaryRepoChanged(nextRepoIndex);\r\nrepoSelector.setText(nextRepoIndex);             \r\n```","created_at":"2015-07-12T07:29:20Z","updated_at":"2015-07-12T07:29:20Z","html_url":"https://github.com/HubTurbo/HubTurbo/pull/736#discussion_r34419556","pull_request_url":"https://api.github.com/repos/HubTurbo/HubTurbo/pulls/736","_links":{"self":{"href":"https://api.github.com/repos/HubTurbo/HubTurbo/pulls/comments/34419556"},"html":{"href":"https://github.com/HubTurbo/HubTurbo/pull/736#discussion_r34419556"},"pull_request":{"href":"https://api.github.com/repos/HubTurbo/HubTurbo/pulls/736"}}},"pull_request":{"url":"https://api.github.com/repos/HubTurbo/HubTurbo/pulls/736","id":38567691,"html_url":"https://github.com/HubTurbo/HubTurbo/pull/736","diff_url":"https://github.com/HubTurbo/HubTurbo/pull/736.diff","patch_url":"https://github.com/HubTurbo/HubTurbo/pull/736.patch","issue_url":"https://api.github.com/repos/HubTurbo/HubTurbo/issues/736","number":736,"state":"closed","locked":false,"title":"Give a keyboard shortcut to switch default project #653","user":{"login":"Honoo","id":4407837,"avatar_url":"https://avatars.githubusercontent.com/u/4407837?v=3","gravatar_id":"","url":"https://api.github.com/users/Honoo","html_url":"https://github.com/Honoo","followers_url":"https://api.github.com/users/Honoo/followers","following_url":"https://api.github.com/users/Honoo/following{/other_user}","gists_url":"https://api.github.com/users/Honoo/gists{/gist_id}","starred_url":"https://api.github.com/users/Honoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Honoo/subscriptions","organizations_url":"https://api.github.com/users/Honoo/orgs","repos_url":"https://api.github.com/users/Honoo/repos","events_url":"https://api.github.com/users/Honoo/events{/privacy}","received_events_url":"https://api.github.com/users/Honoo/received_events","type":"User","site_admin":false},"body":"Resolves #653. The keyboard shortcut is `Ctrl` + `R`. When it is pressed, the default repository switches to the next open repository in the set of open repositories. ","created_at":"2015-06-25T16:39:13Z","updated_at":"2015-07-12T07:29:20Z","closed_at":"2015-07-12T07:03:40Z","merged_at":"2015-07-12T07:03:40Z","merge_commit_sha":"b63a2ffddf81fe266b935c28e03bf4658549471b","assignee":{"login":"acruis","id":8437638,"avatar_url":"https://avatars.githubusercontent.com/u/8437638?v=3","gravatar_id":"","url":"https://api.github.com/users/acruis","html_url":"https://github.com/acruis","followers_url":"https://api.github.com/users/acruis/followers","following_url":"https://api.github.com/users/acruis/following{/other_user}","gists_url":"https://api.github.com/users/acruis/gists{/gist_id}","starred_url":"https://api.github.com/users/acruis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acruis/subscriptions","organizations_url":"https://api.github.com/users/acruis/orgs","repos_url":"https://api.github.com/users/acruis/repos","events_url":"https://api.github.com/users/acruis/events{/privacy}","received_events_url":"https://api.github.com/users/acruis/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/HubTurbo/HubTurbo/pulls/736/commits","review_comments_url":"https://api.github.com/repos/HubTurbo/HubTurbo/pulls/736/comments","review_comment_url":"https://api.github.com/repos/HubTurbo/HubTurbo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/HubTurbo/HubTurbo/issues/736/comments","statuses_url":"https://api.github.com/repos/HubTurbo/HubTurbo/statuses/0e5589401086563b6f02876010401d902e7a4b6e","head":{"label":"Honoo:Issue653","ref":"Issue653","sha":"0e5589401086563b6f02876010401d902e7a4b6e","user":{"login":"Honoo","id":4407837,"avatar_url":"https://avatars.githubusercontent.com/u/4407837?v=3","gravatar_id":"","url":"https://api.github.com/users/Honoo","html_url":"https://github.com/Honoo","followers_url":"https://api.github.com/users/Honoo/followers","following_url":"https://api.github.com/users/Honoo/following{/other_user}","gists_url":"https://api.github.com/users/Honoo/gists{/gist_id}","starred_url":"https://api.github.com/users/Honoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Honoo/subscriptions","organizations_url":"https://api.github.com/users/Honoo/orgs","repos_url":"https://api.github.com/users/Honoo/repos","events_url":"https://api.github.com/users/Honoo/events{/privacy}","received_events_url":"https://api.github.com/users/Honoo/received_events","type":"User","site_admin":false},"repo":{"id":37814935,"name":"HubTurbo","full_name":"Honoo/HubTurbo","owner":{"login":"Honoo","id":4407837,"avatar_url":"https://avatars.githubusercontent.com/u/4407837?v=3","gravatar_id":"","url":"https://api.github.com/users/Honoo","html_url":"https://github.com/Honoo","followers_url":"https://api.github.com/users/Honoo/followers","following_url":"https://api.github.com/users/Honoo/following{/other_user}","gists_url":"https://api.github.com/users/Honoo/gists{/gist_id}","starred_url":"https://api.github.com/users/Honoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Honoo/subscriptions","organizations_url":"https://api.github.com/users/Honoo/orgs","repos_url":"https://api.github.com/users/Honoo/repos","events_url":"https://api.github.com/users/Honoo/events{/privacy}","received_events_url":"https://api.github.com/users/Honoo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Honoo/HubTurbo","description":"A companion to GitHub for your desktop","fork":true,"url":"https://api.github.com/repos/Honoo/HubTurbo","forks_url":"https://api.github.com/repos/Honoo/HubTurbo/forks","keys_url":"https://api.github.com/repos/Honoo/HubTurbo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Honoo/HubTurbo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Honoo/HubTurbo/teams","hooks_url":"https://api.github.com/repos/Honoo/HubTurbo/hooks","issue_events_url":"https://api.github.com/repos/Honoo/HubTurbo/issues/events{/number}","events_url":"https://api.github.com/repos/Honoo/HubTurbo/events","assignees_url":"https://api.github.com/repos/Honoo/HubTurbo/assignees{/user}","branches_url":"https://api.github.com/repos/Honoo/HubTurbo/branches{/branch}","tags_url":"https://api.github.com/repos/Honoo/HubTurbo/tags","blobs_url":"https://api.github.com/repos/Honoo/HubTurbo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Honoo/HubTurbo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Honoo/HubTurbo/git/refs{/sha}","trees_url":"https://api.github.com/repos/Honoo/HubTurbo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Honoo/HubTurbo/statuses/{sha}","languages_url":"https://api.github.com/repos/Honoo/HubTurbo/languages","stargazers_url":"https://api.github.com/repos/Honoo/HubTurbo/stargazers","contributors_url":"https://api.github.com/repos/Honoo/HubTurbo/contributors","subscribers_url":"https://api.github.com/repos/Honoo/HubTurbo/subscribers","subscription_url":"https://api.github.com/repos/Honoo/HubTurbo/subscription","commits_url":"https://api.github.com/repos/Honoo/HubTurbo/commits{/sha}","git_commits_url":"https://api.github.com/repos/Honoo/HubTurbo/git/commits{/sha}","comments_url":"https://api.github.com/repos/Honoo/HubTurbo/comments{/number}","issue_comment_url":"https://api.github.com/repos/Honoo/HubTurbo/issues/comments{/number}","contents_url":"https://api.github.com/repos/Honoo/HubTurbo/contents/{+path}","compare_url":"https://api.github.com/repos/Honoo/HubTurbo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Honoo/HubTurbo/merges","archive_url":"https://api.github.com/repos/Honoo/HubTurbo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Honoo/HubTurbo/downloads","issues_url":"https://api.github.com/repos/Honoo/HubTurbo/issues{/number}","pulls_url":"https://api.github.com/repos/Honoo/HubTurbo/pulls{/number}","milestones_url":"https://api.github.com/repos/Honoo/HubTurbo/milestones{/number}","notifications_url":"https://api.github.com/repos/Honoo/HubTurbo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Honoo/HubTurbo/labels{/name}","releases_url":"https://api.github.com/repos/Honoo/HubTurbo/releases{/id}","created_at":"2015-06-21T15:54:36Z","updated_at":"2015-06-21T15:54:37Z","pushed_at":"2015-07-11T16:34:57Z","git_url":"git://github.com/Honoo/HubTurbo.git","ssh_url":"git@github.com:Honoo/HubTurbo.git","clone_url":"https://github.com/Honoo/HubTurbo.git","svn_url":"https://github.com/Honoo/HubTurbo","homepage":"http://hubturbo.info","size":110187,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"HubTurbo:master","ref":"master","sha":"e86993dff59990f3405a9939504c05286fff9815","user":{"login":"HubTurbo","id":7955871,"avatar_url":"https://avatars.githubusercontent.com/u/7955871?v=3","gravatar_id":"","url":"https://api.github.com/users/HubTurbo","html_url":"https://github.com/HubTurbo","followers_url":"https://api.github.com/users/HubTurbo/followers","following_url":"https://api.github.com/users/HubTurbo/following{/other_user}","gists_url":"https://api.github.com/users/HubTurbo/gists{/gist_id}","starred_url":"https://api.github.com/users/HubTurbo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HubTurbo/subscriptions","organizations_url":"https://api.github.com/users/HubTurbo/orgs","repos_url":"https://api.github.com/users/HubTurbo/repos","events_url":"https://api.github.com/users/HubTurbo/events{/privacy}","received_events_url":"https://api.github.com/users/HubTurbo/received_events","type":"Organization","site_admin":false},"repo":{"id":20919534,"name":"HubTurbo","full_name":"HubTurbo/HubTurbo","owner":{"login":"HubTurbo","id":7955871,"avatar_url":"https://avatars.githubusercontent.com/u/7955871?v=3","gravatar_id":"","url":"https://api.github.com/users/HubTurbo","html_url":"https://github.com/HubTurbo","followers_url":"https://api.github.com/users/HubTurbo/followers","following_url":"https://api.github.com/users/HubTurbo/following{/other_user}","gists_url":"https://api.github.com/users/HubTurbo/gists{/gist_id}","starred_url":"https://api.github.com/users/HubTurbo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HubTurbo/subscriptions","organizations_url":"https://api.github.com/users/HubTurbo/orgs","repos_url":"https://api.github.com/users/HubTurbo/repos","events_url":"https://api.github.com/users/HubTurbo/events{/privacy}","received_events_url":"https://api.github.com/users/HubTurbo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/HubTurbo/HubTurbo","description":"A companion to GitHub for your desktop","fork":false,"url":"https://api.github.com/repos/HubTurbo/HubTurbo","forks_url":"https://api.github.com/repos/HubTurbo/HubTurbo/forks","keys_url":"https://api.github.com/repos/HubTurbo/HubTurbo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HubTurbo/HubTurbo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HubTurbo/HubTurbo/teams","hooks_url":"https://api.github.com/repos/HubTurbo/HubTurbo/hooks","issue_events_url":"https://api.github.com/repos/HubTurbo/HubTurbo/issues/events{/number}","events_url":"https://api.github.com/repos/HubTurbo/HubTurbo/events","assignees_url":"https://api.github.com/repos/HubTurbo/HubTurbo/assignees{/user}","branches_url":"https://api.github.com/repos/HubTurbo/HubTurbo/branches{/branch}","tags_url":"https://api.github.com/repos/HubTurbo/HubTurbo/tags","blobs_url":"https://api.github.com/repos/HubTurbo/HubTurbo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HubTurbo/HubTurbo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HubTurbo/HubTurbo/git/refs{/sha}","trees_url":"https://api.github.com/repos/HubTurbo/HubTurbo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HubTurbo/HubTurbo/statuses/{sha}","languages_url":"https://api.github.com/repos/HubTurbo/HubTurbo/languages","stargazers_url":"https://api.github.com/repos/HubTurbo/HubTurbo/stargazers","contributors_url":"https://api.github.com/repos/HubTurbo/HubTurbo/contributors","subscribers_url":"https://api.github.com/repos/HubTurbo/HubTurbo/subscribers","subscription_url":"https://api.github.com/repos/HubTurbo/HubTurbo/subscription","commits_url":"https://api.github.com/repos/HubTurbo/HubTurbo/commits{/sha}","git_commits_url":"https://api.github.com/repos/HubTurbo/HubTurbo/git/commits{/sha}","comments_url":"https://api.github.com/repos/HubTurbo/HubTurbo/comments{/number}","issue_comment_url":"https://api.github.com/repos/HubTurbo/HubTurbo/issues/comments{/number}","contents_url":"https://api.github.com/repos/HubTurbo/HubTurbo/contents/{+path}","compare_url":"https://api.github.com/repos/HubTurbo/HubTurbo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HubTurbo/HubTurbo/merges","archive_url":"https://api.github.com/repos/HubTurbo/HubTurbo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HubTurbo/HubTurbo/downloads","issues_url":"https://api.github.com/repos/HubTurbo/HubTurbo/issues{/number}","pulls_url":"https://api.github.com/repos/HubTurbo/HubTurbo/pulls{/number}","milestones_url":"https://api.github.com/repos/HubTurbo/HubTurbo/milestones{/number}","notifications_url":"https://api.github.com/repos/HubTurbo/HubTurbo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HubTurbo/HubTurbo/labels{/name}","releases_url":"https://api.github.com/repos/HubTurbo/HubTurbo/releases{/id}","created_at":"2014-06-17T10:35:39Z","updated_at":"2015-07-07T02:15:17Z","pushed_at":"2015-07-12T07:03:39Z","git_url":"git://github.com/HubTurbo/HubTurbo.git","ssh_url":"git@github.com:HubTurbo/HubTurbo.git","clone_url":"https://github.com/HubTurbo/HubTurbo.git","svn_url":"https://github.com/HubTurbo/HubTurbo","homepage":"http://hubturbo.info","size":115082,"stargazers_count":8,"watchers_count":8,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":69,"forks":8,"open_issues":69,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/HubTurbo/HubTurbo/pulls/736"},"html":{"href":"https://github.com/HubTurbo/HubTurbo/pull/736"},"issue":{"href":"https://api.github.com/repos/HubTurbo/HubTurbo/issues/736"},"comments":{"href":"https://api.github.com/repos/HubTurbo/HubTurbo/issues/736/comments"},"review_comments":{"href":"https://api.github.com/repos/HubTurbo/HubTurbo/pulls/736/comments"},"review_comment":{"href":"https://api.github.com/repos/HubTurbo/HubTurbo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/HubTurbo/HubTurbo/pulls/736/commits"},"statuses":{"href":"https://api.github.com/repos/HubTurbo/HubTurbo/statuses/0e5589401086563b6f02876010401d902e7a4b6e"}}}}