{"action":"created","comment":{"url":"https://api.github.com/repos/HubTurbo/addressbook/pulls/comments/63985711","id":63985711,"diff_hunk":"@@ -0,0 +1,94 @@\n+package address.prefs;\n+\n+import address.events.EventManager;\n+import address.events.MirrorLocationChangedEvent;\n+import address.events.SaveLocationChangedEvent;\n+\n+import java.util.prefs.Preferences;\n+import java.io.File;\n+\n+/**\n+ * Manages saving/retrieving of preferences on the user level.\n+ * Publicly accessible singleton class.\n+ */\n+public class PrefsManager {\n+\n+    public static final String PREF_NODE_NAME_SAVE_LOC = \"save-location\";\n+    public static final String PREF_NODE_NAME_MIRROR_LOC = \"mirror-location\";\n+\n+    public static final String DEFAULT_TEMP_FILE_PATH = \".$TEMP_ADDRESS_BOOK\";\n+\n+    private static PrefsManager instance;\n+    private static Preferences userPrefs = Preferences.userNodeForPackage(PrefsManager.class);\n+\n+    public static PrefsManager getInstance(){\n+        if (instance == null){\n+            instance = new PrefsManager();\n+        }\n+        return instance;\n+    }\n+\n+    private PrefsManager() {}\n+\n+    /**\n+     * @return the current save file preference or the default temp file if there is no recorded prederence.\n+     */\n+    public File getSaveLocation() {\n+        final String filePath = userPrefs.get(PREF_NODE_NAME_SAVE_LOC, null);\n+        return filePath == null ? new File(DEFAULT_TEMP_FILE_PATH) : new File(filePath);","path":"src/main/java/address/prefs/PrefsManager.java","position":38,"original_position":38,"commit_id":"b643cd0e63b860a849e350faf7f7be0e68db7373","original_commit_id":"b643cd0e63b860a849e350faf7f7be0e68db7373","user":{"login":"YijinL","id":7914712,"avatar_url":"https://avatars.githubusercontent.com/u/7914712?v=3","gravatar_id":"","url":"https://api.github.com/users/YijinL","html_url":"https://github.com/YijinL","followers_url":"https://api.github.com/users/YijinL/followers","following_url":"https://api.github.com/users/YijinL/following{/other_user}","gists_url":"https://api.github.com/users/YijinL/gists{/gist_id}","starred_url":"https://api.github.com/users/YijinL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YijinL/subscriptions","organizations_url":"https://api.github.com/users/YijinL/orgs","repos_url":"https://api.github.com/users/YijinL/repos","events_url":"https://api.github.com/users/YijinL/events{/privacy}","received_events_url":"https://api.github.com/users/YijinL/received_events","type":"User","site_admin":false},"body":"`filePath` is used in 2 locations on line 38, inlining it would make the ternary statement very long","created_at":"2016-05-20T03:02:45Z","updated_at":"2016-05-20T03:02:45Z","html_url":"https://github.com/HubTurbo/addressbook/pull/91#discussion_r63985711","pull_request_url":"https://api.github.com/repos/HubTurbo/addressbook/pulls/91","_links":{"self":{"href":"https://api.github.com/repos/HubTurbo/addressbook/pulls/comments/63985711"},"html":{"href":"https://github.com/HubTurbo/addressbook/pull/91#discussion_r63985711"},"pull_request":{"href":"https://api.github.com/repos/HubTurbo/addressbook/pulls/91"}}},"pull_request":{"url":"https://api.github.com/repos/HubTurbo/addressbook/pulls/91","id":70484737,"html_url":"https://github.com/HubTurbo/addressbook/pull/91","diff_url":"https://github.com/HubTurbo/addressbook/pull/91.diff","patch_url":"https://github.com/HubTurbo/addressbook/pull/91.patch","issue_url":"https://api.github.com/repos/HubTurbo/addressbook/issues/91","number":91,"state":"open","locked":false,"title":"Make save and mirror files independent #89","user":{"login":"YijinL","id":7914712,"avatar_url":"https://avatars.githubusercontent.com/u/7914712?v=3","gravatar_id":"","url":"https://api.github.com/users/YijinL","html_url":"https://github.com/YijinL","followers_url":"https://api.github.com/users/YijinL/followers","following_url":"https://api.github.com/users/YijinL/following{/other_user}","gists_url":"https://api.github.com/users/YijinL/gists{/gist_id}","starred_url":"https://api.github.com/users/YijinL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YijinL/subscriptions","organizations_url":"https://api.github.com/users/YijinL/orgs","repos_url":"https://api.github.com/users/YijinL/repos","events_url":"https://api.github.com/users/YijinL/events{/privacy}","received_events_url":"https://api.github.com/users/YijinL/received_events","type":"User","site_admin":false},"body":"Resolves #89, fixes #68.\r\n\r\n**Separating mirror and save files**\r\n- [x] Differentiate mirror and save file name changed events\r\n- [x] Show both save and mirror file names on UI\r\n- [x] Add mirror file preference key\r\n- [x] Syncing uses mirror file preference\r\n\r\n**User Operations**\r\n- [x] New File\r\n- [x] Open File\r\n- [x] Save As\r\n- [x] Choose Mirror","created_at":"2016-05-18T08:08:48Z","updated_at":"2016-05-20T03:02:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d33705a90ebb4b93fbbf0bf2e094ce668194dc21","assignee":{"login":"YijinL","id":7914712,"avatar_url":"https://avatars.githubusercontent.com/u/7914712?v=3","gravatar_id":"","url":"https://api.github.com/users/YijinL","html_url":"https://github.com/YijinL","followers_url":"https://api.github.com/users/YijinL/followers","following_url":"https://api.github.com/users/YijinL/following{/other_user}","gists_url":"https://api.github.com/users/YijinL/gists{/gist_id}","starred_url":"https://api.github.com/users/YijinL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YijinL/subscriptions","organizations_url":"https://api.github.com/users/YijinL/orgs","repos_url":"https://api.github.com/users/YijinL/repos","events_url":"https://api.github.com/users/YijinL/events{/privacy}","received_events_url":"https://api.github.com/users/YijinL/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/HubTurbo/addressbook/pulls/91/commits","review_comments_url":"https://api.github.com/repos/HubTurbo/addressbook/pulls/91/comments","review_comment_url":"https://api.github.com/repos/HubTurbo/addressbook/pulls/comments{/number}","comments_url":"https://api.github.com/repos/HubTurbo/addressbook/issues/91/comments","statuses_url":"https://api.github.com/repos/HubTurbo/addressbook/statuses/b643cd0e63b860a849e350faf7f7be0e68db7373","head":{"label":"HubTurbo:89-make-save-and-mirror-files-independent","ref":"89-make-save-and-mirror-files-independent","sha":"b643cd0e63b860a849e350faf7f7be0e68db7373","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":58317461,"name":"addressbook","full_name":"HubTurbo/addressbook","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/addressbook","description":"A small app for training and experimentation","fork":false,"url":"https://api.github.com/repos/HubTurbo/addressbook","forks_url":"https://api.github.com/repos/HubTurbo/addressbook/forks","keys_url":"https://api.github.com/repos/HubTurbo/addressbook/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HubTurbo/addressbook/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HubTurbo/addressbook/teams","hooks_url":"https://api.github.com/repos/HubTurbo/addressbook/hooks","issue_events_url":"https://api.github.com/repos/HubTurbo/addressbook/issues/events{/number}","events_url":"https://api.github.com/repos/HubTurbo/addressbook/events","assignees_url":"https://api.github.com/repos/HubTurbo/addressbook/assignees{/user}","branches_url":"https://api.github.com/repos/HubTurbo/addressbook/branches{/branch}","tags_url":"https://api.github.com/repos/HubTurbo/addressbook/tags","blobs_url":"https://api.github.com/repos/HubTurbo/addressbook/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HubTurbo/addressbook/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HubTurbo/addressbook/git/refs{/sha}","trees_url":"https://api.github.com/repos/HubTurbo/addressbook/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HubTurbo/addressbook/statuses/{sha}","languages_url":"https://api.github.com/repos/HubTurbo/addressbook/languages","stargazers_url":"https://api.github.com/repos/HubTurbo/addressbook/stargazers","contributors_url":"https://api.github.com/repos/HubTurbo/addressbook/contributors","subscribers_url":"https://api.github.com/repos/HubTurbo/addressbook/subscribers","subscription_url":"https://api.github.com/repos/HubTurbo/addressbook/subscription","commits_url":"https://api.github.com/repos/HubTurbo/addressbook/commits{/sha}","git_commits_url":"https://api.github.com/repos/HubTurbo/addressbook/git/commits{/sha}","comments_url":"https://api.github.com/repos/HubTurbo/addressbook/comments{/number}","issue_comment_url":"https://api.github.com/repos/HubTurbo/addressbook/issues/comments{/number}","contents_url":"https://api.github.com/repos/HubTurbo/addressbook/contents/{+path}","compare_url":"https://api.github.com/repos/HubTurbo/addressbook/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HubTurbo/addressbook/merges","archive_url":"https://api.github.com/repos/HubTurbo/addressbook/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HubTurbo/addressbook/downloads","issues_url":"https://api.github.com/repos/HubTurbo/addressbook/issues{/number}","pulls_url":"https://api.github.com/repos/HubTurbo/addressbook/pulls{/number}","milestones_url":"https://api.github.com/repos/HubTurbo/addressbook/milestones{/number}","notifications_url":"https://api.github.com/repos/HubTurbo/addressbook/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HubTurbo/addressbook/labels{/name}","releases_url":"https://api.github.com/repos/HubTurbo/addressbook/releases{/id}","deployments_url":"https://api.github.com/repos/HubTurbo/addressbook/deployments","created_at":"2016-05-08T15:05:27Z","updated_at":"2016-05-08T23:35:38Z","pushed_at":"2016-05-20T02:51:05Z","git_url":"git://github.com/HubTurbo/addressbook.git","ssh_url":"git@github.com:HubTurbo/addressbook.git","clone_url":"https://github.com/HubTurbo/addressbook.git","svn_url":"https://github.com/HubTurbo/addressbook","homepage":null,"size":497,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":20,"forks":2,"open_issues":20,"watchers":1,"default_branch":"master"}},"base":{"label":"HubTurbo:master","ref":"master","sha":"113eb07416d990f265ad1495d43c4ac9785da430","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":58317461,"name":"addressbook","full_name":"HubTurbo/addressbook","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/addressbook","description":"A small app for training and experimentation","fork":false,"url":"https://api.github.com/repos/HubTurbo/addressbook","forks_url":"https://api.github.com/repos/HubTurbo/addressbook/forks","keys_url":"https://api.github.com/repos/HubTurbo/addressbook/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HubTurbo/addressbook/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HubTurbo/addressbook/teams","hooks_url":"https://api.github.com/repos/HubTurbo/addressbook/hooks","issue_events_url":"https://api.github.com/repos/HubTurbo/addressbook/issues/events{/number}","events_url":"https://api.github.com/repos/HubTurbo/addressbook/events","assignees_url":"https://api.github.com/repos/HubTurbo/addressbook/assignees{/user}","branches_url":"https://api.github.com/repos/HubTurbo/addressbook/branches{/branch}","tags_url":"https://api.github.com/repos/HubTurbo/addressbook/tags","blobs_url":"https://api.github.com/repos/HubTurbo/addressbook/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HubTurbo/addressbook/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HubTurbo/addressbook/git/refs{/sha}","trees_url":"https://api.github.com/repos/HubTurbo/addressbook/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HubTurbo/addressbook/statuses/{sha}","languages_url":"https://api.github.com/repos/HubTurbo/addressbook/languages","stargazers_url":"https://api.github.com/repos/HubTurbo/addressbook/stargazers","contributors_url":"https://api.github.com/repos/HubTurbo/addressbook/contributors","subscribers_url":"https://api.github.com/repos/HubTurbo/addressbook/subscribers","subscription_url":"https://api.github.com/repos/HubTurbo/addressbook/subscription","commits_url":"https://api.github.com/repos/HubTurbo/addressbook/commits{/sha}","git_commits_url":"https://api.github.com/repos/HubTurbo/addressbook/git/commits{/sha}","comments_url":"https://api.github.com/repos/HubTurbo/addressbook/comments{/number}","issue_comment_url":"https://api.github.com/repos/HubTurbo/addressbook/issues/comments{/number}","contents_url":"https://api.github.com/repos/HubTurbo/addressbook/contents/{+path}","compare_url":"https://api.github.com/repos/HubTurbo/addressbook/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HubTurbo/addressbook/merges","archive_url":"https://api.github.com/repos/HubTurbo/addressbook/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HubTurbo/addressbook/downloads","issues_url":"https://api.github.com/repos/HubTurbo/addressbook/issues{/number}","pulls_url":"https://api.github.com/repos/HubTurbo/addressbook/pulls{/number}","milestones_url":"https://api.github.com/repos/HubTurbo/addressbook/milestones{/number}","notifications_url":"https://api.github.com/repos/HubTurbo/addressbook/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HubTurbo/addressbook/labels{/name}","releases_url":"https://api.github.com/repos/HubTurbo/addressbook/releases{/id}","deployments_url":"https://api.github.com/repos/HubTurbo/addressbook/deployments","created_at":"2016-05-08T15:05:27Z","updated_at":"2016-05-08T23:35:38Z","pushed_at":"2016-05-20T02:51:05Z","git_url":"git://github.com/HubTurbo/addressbook.git","ssh_url":"git@github.com:HubTurbo/addressbook.git","clone_url":"https://github.com/HubTurbo/addressbook.git","svn_url":"https://github.com/HubTurbo/addressbook","homepage":null,"size":497,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":20,"forks":2,"open_issues":20,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/HubTurbo/addressbook/pulls/91"},"html":{"href":"https://github.com/HubTurbo/addressbook/pull/91"},"issue":{"href":"https://api.github.com/repos/HubTurbo/addressbook/issues/91"},"comments":{"href":"https://api.github.com/repos/HubTurbo/addressbook/issues/91/comments"},"review_comments":{"href":"https://api.github.com/repos/HubTurbo/addressbook/pulls/91/comments"},"review_comment":{"href":"https://api.github.com/repos/HubTurbo/addressbook/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/HubTurbo/addressbook/pulls/91/commits"},"statuses":{"href":"https://api.github.com/repos/HubTurbo/addressbook/statuses/b643cd0e63b860a849e350faf7f7be0e68db7373"}}}}
{"actor":{"display_login":"YijinL"}}