diff --git a/plugins/com.google.cloud.tools.eclipse.appengine.deploy.test/src/com/google/cloud/tools/eclipse/appengine/deploy/standard/StandardDeployPreferencesTest.java b/plugins/com.google.cloud.tools.eclipse.appengine.deploy.test/src/com/google/cloud/tools/eclipse/appengine/deploy/standard/StandardDeployPreferencesTest.java index cea970514f..386aca56d4 100644 --- a/plugins/com.google.cloud.tools.eclipse.appengine.deploy.test/src/com/google/cloud/tools/eclipse/appengine/deploy/standard/StandardDeployPreferencesTest.java +++ b/plugins/com.google.cloud.tools.eclipse.appengine.deploy.test/src/com/google/cloud/tools/eclipse/appengine/deploy/standard/StandardDeployPreferencesTest.java @@ -30,10 +30,11 @@ public class StandardDeployPreferencesTest { @Rule public final TestProjectCreator projectCreator = new TestProjectCreator(); - + private final StandardDeployPreferences defaultPreferences = StandardDeployPreferences.getDefaultPreferences(); + @Test public void testDefaultProjectId() { - assertThat(StandardDeployPreferences.DEFAULT.getProjectId(), isEmptyString()); + assertThat(defaultPreferences.getProjectId(), isEmptyString()); } @Test @@ -49,22 +50,22 @@ public void testSetProjectId() { @Test public void testDefaultVersion() { - assertThat(StandardDeployPreferences.DEFAULT.getVersion(), isEmptyString()); + assertThat(defaultPreferences.getVersion(), isEmptyString()); } @Test public void testDefaultAutoPromote() { - assertTrue(StandardDeployPreferences.DEFAULT.isAutoPromote()); + assertTrue(defaultPreferences.isAutoPromote()); } @Test public void testDefaultBucket() { - assertThat(StandardDeployPreferences.DEFAULT.getBucket(), isEmptyString()); + assertThat(defaultPreferences.getBucket(), isEmptyString()); } @Test public void testDefaultStopPreviousVersion() { - assertTrue(StandardDeployPreferences.DEFAULT.isStopPreviousVersion()); + assertTrue(defaultPreferences.isStopPreviousVersion()); } } diff --git a/plugins/com.google.cloud.tools.eclipse.appengine.deploy.ui/src/com/google/cloud/tools/eclipse/appengine/deploy/ui/DeployPreferencesModel.java b/plugins/com.google.cloud.tools.eclipse.appengine.deploy.ui/src/com/google/cloud/tools/eclipse/appengine/deploy/ui/DeployPreferencesModel.java index de4c7f8a4f..22e62a0019 100644 --- a/plugins/com.google.cloud.tools.eclipse.appengine.deploy.ui/src/com/google/cloud/tools/eclipse/appengine/deploy/ui/DeployPreferencesModel.java +++ b/plugins/com.google.cloud.tools.eclipse.appengine.deploy.ui/src/com/google/cloud/tools/eclipse/appengine/deploy/ui/DeployPreferencesModel.java @@ -45,8 +45,8 @@ private void applyPreferences(StandardDeployPreferences preferences) { setBucket(preferences.getBucket()); } - public void resetToDefaults() { - applyPreferences(StandardDeployPreferences.DEFAULT); + void resetToDefaults() { + applyPreferences(StandardDeployPreferences.getDefaultPreferences()); } public void savePreferences() throws BackingStoreException { diff --git a/plugins/com.google.cloud.tools.eclipse.appengine.deploy/src/com/google/cloud/tools/eclipse/appengine/deploy/standard/StandardDeployPreferences.java b/plugins/com.google.cloud.tools.eclipse.appengine.deploy/src/com/google/cloud/tools/eclipse/appengine/deploy/standard/StandardDeployPreferences.java index 5c50a3156e..85f09909f8 100644 --- a/plugins/com.google.cloud.tools.eclipse.appengine.deploy/src/com/google/cloud/tools/eclipse/appengine/deploy/standard/StandardDeployPreferences.java +++ b/plugins/com.google.cloud.tools.eclipse.appengine.deploy/src/com/google/cloud/tools/eclipse/appengine/deploy/standard/StandardDeployPreferences.java @@ -27,7 +27,7 @@ public class StandardDeployPreferences { public static final String PREFERENCE_STORE_QUALIFIER = - "com.google.cloud.tools.eclipse.appengine.deploy"; + "com.google.cloud.tools.eclipse.appengine.deploy"; static final String PREF_ACCOUNT_EMAIL = "account.email"; static final String PREF_PROJECT_ID = "project.id"; @@ -37,11 +37,9 @@ public class StandardDeployPreferences { static final String PREF_STOP_PREVIOUS_VERSION = "project.previousVersion.stop"; private IEclipsePreferences preferenceStore; - // todo since this is mutable it shouldn;t be in all caps - public static final StandardDeployPreferences DEFAULT; - static { - DEFAULT = new StandardDeployPreferences(DeployPreferenceInitializer.getDefaultPreferences()); + public static StandardDeployPreferences getDefaultPreferences() { + return new StandardDeployPreferences(DeployPreferenceInitializer.getDefaultPreferences()); } public StandardDeployPreferences(IProject project) {