{"action":"created","comment":{"url":"https://api.github.com/repos/HubTurbo/HubTurbo/pulls/comments/58057245","id":58057245,"diff_hunk":"@@ -157,14 +150,40 @@ private void onBoardSaveAs() {\n         ui.showMainStage();\n         panels.selectFirstPanel();\n \n-        if (response.isPresent()) {\n-            String boardName = response.get().trim();\n-            prefs.addBoard(boardName, panelList);\n-            prefs.setLastOpenBoard(boardName);\n-            ui.triggerEvent(new BoardSavedEvent());\n-            logger.info(\"New board \" + boardName + \" saved\");\n-            ui.updateTitle();\n+        if (!response.isPresent()) {\n+            return false;\n+        }\n+\n+        String boardName = response.get().trim();\n+        prefs.addBoard(boardName, panelList);\n+        prefs.setLastOpenBoard(boardName);\n+        prefs.setLastOpenBoardPanelInfo(panelList);\n+        ui.triggerEvent(new BoardSavedEvent());\n+        logger.info(\"New board \" + boardName + \" saved\");\n+        ui.updateTitle();\n+        return true;\n+    }\n+\n+    /**\n+     * Prompts the user for whether to save the current board panel info or not\n+     * when user is closing current board (i.e. switching to another board)\n+     *\n+     * @return true if user choose to save, false if user choose to discard\n+     */\n+    private boolean promptToSaveCurrentBoard() {\n+        List<PanelInfo> currentPanelInfo = panels.getCurrentPanelInfos();\n+\n+        ConfirmChangesDialog dlg = new ConfirmChangesDialog(mainStage);\n+        Optional<ButtonType> response = dlg.showAndWait();\n+        prefs.setLastOpenBoardPanelInfo(currentPanelInfo);\n+        if (response.get() != ButtonType.OK) {\n+            logger.info(\"User abandoned unsaved changes.\");\n+            return false;\n         }\n+\n+        onBoardSave();\n+        logger.info(\"Changes to the current board saved.\");\n+        return true;","path":"src/main/java/ui/MenuControl.java","position":90,"original_position":90,"commit_id":"05a585b9e7a8122c4ef1d9315bb08f08f8c72aa3","original_commit_id":"05a585b9e7a8122c4ef1d9315bb08f08f8c72aa3","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":"Is the return value used?","created_at":"2016-03-31T13:57:25Z","updated_at":"2016-03-31T13:57:25Z","html_url":"https://github.com/HubTurbo/HubTurbo/pull/1224#discussion_r58057245","pull_request_url":"https://api.github.com/repos/HubTurbo/HubTurbo/pulls/1224","_links":{"self":{"href":"https://api.github.com/repos/HubTurbo/HubTurbo/pulls/comments/58057245"},"html":{"href":"https://github.com/HubTurbo/HubTurbo/pull/1224#discussion_r58057245"},"pull_request":{"href":"https://api.github.com/repos/HubTurbo/HubTurbo/pulls/1224"}}},"pull_request":{"url":"https://api.github.com/repos/HubTurbo/HubTurbo/pulls/1224","id":57761428,"html_url":"https://github.com/HubTurbo/HubTurbo/pull/1224","diff_url":"https://github.com/HubTurbo/HubTurbo/pull/1224.diff","patch_url":"https://github.com/HubTurbo/HubTurbo/pull/1224.patch","issue_url":"https://api.github.com/repos/HubTurbo/HubTurbo/issues/1224","number":1224,"state":"open","locked":false,"title":"Prompt user to save current board if there are unsaved changes #1199","user":{"login":"xinan","id":2834397,"avatar_url":"https://avatars.githubusercontent.com/u/2834397?v=3","gravatar_id":"","url":"https://api.github.com/users/xinan","html_url":"https://github.com/xinan","followers_url":"https://api.github.com/users/xinan/followers","following_url":"https://api.github.com/users/xinan/following{/other_user}","gists_url":"https://api.github.com/users/xinan/gists{/gist_id}","starred_url":"https://api.github.com/users/xinan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xinan/subscriptions","organizations_url":"https://api.github.com/users/xinan/orgs","repos_url":"https://api.github.com/users/xinan/repos","events_url":"https://api.github.com/users/xinan/events{/privacy}","received_events_url":"https://api.github.com/users/xinan/received_events","type":"User","site_admin":false},"body":"Fixes #1199 \r\n\r\n1. Save the initial panel info when a board is opened. \r\n2. When switching to another board, check if the current panel info is from the initial one. If so, prompt for save.\r\n","created_at":"2016-01-31T06:34:46Z","updated_at":"2016-03-31T13:57:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"210217c9bd0a6f333a881ee51a550a2d8ef9b834","assignee":{"login":"ndt93","id":5065989,"avatar_url":"https://avatars.githubusercontent.com/u/5065989?v=3","gravatar_id":"","url":"https://api.github.com/users/ndt93","html_url":"https://github.com/ndt93","followers_url":"https://api.github.com/users/ndt93/followers","following_url":"https://api.github.com/users/ndt93/following{/other_user}","gists_url":"https://api.github.com/users/ndt93/gists{/gist_id}","starred_url":"https://api.github.com/users/ndt93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ndt93/subscriptions","organizations_url":"https://api.github.com/users/ndt93/orgs","repos_url":"https://api.github.com/users/ndt93/repos","events_url":"https://api.github.com/users/ndt93/events{/privacy}","received_events_url":"https://api.github.com/users/ndt93/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/HubTurbo/HubTurbo/pulls/1224/commits","review_comments_url":"https://api.github.com/repos/HubTurbo/HubTurbo/pulls/1224/comments","review_comment_url":"https://api.github.com/repos/HubTurbo/HubTurbo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/HubTurbo/HubTurbo/issues/1224/comments","statuses_url":"https://api.github.com/repos/HubTurbo/HubTurbo/statuses/05a585b9e7a8122c4ef1d9315bb08f08f8c72aa3","head":{"label":"xinan:1199-prompt-saveboard","ref":"1199-prompt-saveboard","sha":"05a585b9e7a8122c4ef1d9315bb08f08f8c72aa3","user":{"login":"xinan","id":2834397,"avatar_url":"https://avatars.githubusercontent.com/u/2834397?v=3","gravatar_id":"","url":"https://api.github.com/users/xinan","html_url":"https://github.com/xinan","followers_url":"https://api.github.com/users/xinan/followers","following_url":"https://api.github.com/users/xinan/following{/other_user}","gists_url":"https://api.github.com/users/xinan/gists{/gist_id}","starred_url":"https://api.github.com/users/xinan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xinan/subscriptions","organizations_url":"https://api.github.com/users/xinan/orgs","repos_url":"https://api.github.com/users/xinan/repos","events_url":"https://api.github.com/users/xinan/events{/privacy}","received_events_url":"https://api.github.com/users/xinan/received_events","type":"User","site_admin":false},"repo":{"id":49402912,"name":"HubTurbo","full_name":"xinan/HubTurbo","owner":{"login":"xinan","id":2834397,"avatar_url":"https://avatars.githubusercontent.com/u/2834397?v=3","gravatar_id":"","url":"https://api.github.com/users/xinan","html_url":"https://github.com/xinan","followers_url":"https://api.github.com/users/xinan/followers","following_url":"https://api.github.com/users/xinan/following{/other_user}","gists_url":"https://api.github.com/users/xinan/gists{/gist_id}","starred_url":"https://api.github.com/users/xinan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xinan/subscriptions","organizations_url":"https://api.github.com/users/xinan/orgs","repos_url":"https://api.github.com/users/xinan/repos","events_url":"https://api.github.com/users/xinan/events{/privacy}","received_events_url":"https://api.github.com/users/xinan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/xinan/HubTurbo","description":"A companion to GitHub for your desktop","fork":true,"url":"https://api.github.com/repos/xinan/HubTurbo","forks_url":"https://api.github.com/repos/xinan/HubTurbo/forks","keys_url":"https://api.github.com/repos/xinan/HubTurbo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xinan/HubTurbo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xinan/HubTurbo/teams","hooks_url":"https://api.github.com/repos/xinan/HubTurbo/hooks","issue_events_url":"https://api.github.com/repos/xinan/HubTurbo/issues/events{/number}","events_url":"https://api.github.com/repos/xinan/HubTurbo/events","assignees_url":"https://api.github.com/repos/xinan/HubTurbo/assignees{/user}","branches_url":"https://api.github.com/repos/xinan/HubTurbo/branches{/branch}","tags_url":"https://api.github.com/repos/xinan/HubTurbo/tags","blobs_url":"https://api.github.com/repos/xinan/HubTurbo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xinan/HubTurbo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xinan/HubTurbo/git/refs{/sha}","trees_url":"https://api.github.com/repos/xinan/HubTurbo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xinan/HubTurbo/statuses/{sha}","languages_url":"https://api.github.com/repos/xinan/HubTurbo/languages","stargazers_url":"https://api.github.com/repos/xinan/HubTurbo/stargazers","contributors_url":"https://api.github.com/repos/xinan/HubTurbo/contributors","subscribers_url":"https://api.github.com/repos/xinan/HubTurbo/subscribers","subscription_url":"https://api.github.com/repos/xinan/HubTurbo/subscription","commits_url":"https://api.github.com/repos/xinan/HubTurbo/commits{/sha}","git_commits_url":"https://api.github.com/repos/xinan/HubTurbo/git/commits{/sha}","comments_url":"https://api.github.com/repos/xinan/HubTurbo/comments{/number}","issue_comment_url":"https://api.github.com/repos/xinan/HubTurbo/issues/comments{/number}","contents_url":"https://api.github.com/repos/xinan/HubTurbo/contents/{+path}","compare_url":"https://api.github.com/repos/xinan/HubTurbo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xinan/HubTurbo/merges","archive_url":"https://api.github.com/repos/xinan/HubTurbo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xinan/HubTurbo/downloads","issues_url":"https://api.github.com/repos/xinan/HubTurbo/issues{/number}","pulls_url":"https://api.github.com/repos/xinan/HubTurbo/pulls{/number}","milestones_url":"https://api.github.com/repos/xinan/HubTurbo/milestones{/number}","notifications_url":"https://api.github.com/repos/xinan/HubTurbo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xinan/HubTurbo/labels{/name}","releases_url":"https://api.github.com/repos/xinan/HubTurbo/releases{/id}","deployments_url":"https://api.github.com/repos/xinan/HubTurbo/deployments","created_at":"2016-01-11T04:54:01Z","updated_at":"2016-02-10T08:59:04Z","pushed_at":"2016-03-31T06:24:12Z","git_url":"git://github.com/xinan/HubTurbo.git","ssh_url":"git@github.com:xinan/HubTurbo.git","clone_url":"https://github.com/xinan/HubTurbo.git","svn_url":"https://github.com/xinan/HubTurbo","homepage":"http://hubturbo.info","size":134936,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":3,"forks":1,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"HubTurbo:master","ref":"master","sha":"125fdaa945b3f68d02d8b84c2e247ef1e713f1a5","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}","deployments_url":"https://api.github.com/repos/HubTurbo/HubTurbo/deployments","created_at":"2014-06-17T10:35:39Z","updated_at":"2016-03-24T07:36:39Z","pushed_at":"2016-03-31T13:13: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":136691,"stargazers_count":17,"watchers_count":17,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":36,"mirror_url":null,"open_issues_count":188,"forks":36,"open_issues":188,"watchers":17,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/HubTurbo/HubTurbo/pulls/1224"},"html":{"href":"https://github.com/HubTurbo/HubTurbo/pull/1224"},"issue":{"href":"https://api.github.com/repos/HubTurbo/HubTurbo/issues/1224"},"comments":{"href":"https://api.github.com/repos/HubTurbo/HubTurbo/issues/1224/comments"},"review_comments":{"href":"https://api.github.com/repos/HubTurbo/HubTurbo/pulls/1224/comments"},"review_comment":{"href":"https://api.github.com/repos/HubTurbo/HubTurbo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/HubTurbo/HubTurbo/pulls/1224/commits"},"statuses":{"href":"https://api.github.com/repos/HubTurbo/HubTurbo/statuses/05a585b9e7a8122c4ef1d9315bb08f08f8c72aa3"}}}}