From 61ab197b0997f3ea9fc341516b6eea5e22e51922 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Thu, 2 Jul 2015 13:09:45 +0300 Subject: [PATCH] [git] Inline method: choose the GitStashChangesSaver in all cases when not shelve. --- .../src/git4idea/stash/GitChangesSaver.java | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/plugins/git4idea/src/git4idea/stash/GitChangesSaver.java b/plugins/git4idea/src/git4idea/stash/GitChangesSaver.java index d4849e5065eb..45f1a089c957 100644 --- a/plugins/git4idea/src/git4idea/stash/GitChangesSaver.java +++ b/plugins/git4idea/src/git4idea/stash/GitChangesSaver.java @@ -59,7 +59,7 @@ public abstract class GitChangesSaver { public abstract void refresh(); /** - * Returns an instance of the proper GitChangesSaver depending on the chosen save changes policy. + * Returns an instance of the proper GitChangesSaver depending on the given save changes policy. * @return {@link GitStashChangesSaver} or {@link GitShelveChangesSaver}. */ @NotNull @@ -69,16 +69,9 @@ public abstract class GitChangesSaver { @NotNull ProgressIndicator progressIndicator, @NotNull String stashMessage, @NotNull GitVcsSettings.UpdateChangesPolicy saveMethod) { - switch (saveMethod) { - case STASH: return new GitStashChangesSaver(project, platformFacade, git, progressIndicator, stashMessage); - case SHELVE: return new GitShelveChangesSaver(project, platformFacade, git, progressIndicator, stashMessage); + if (saveMethod == GitVcsSettings.UpdateChangesPolicy.SHELVE) { + return new GitShelveChangesSaver(project, platformFacade, git, progressIndicator, stashMessage); } - return getDefaultSaver(project, platformFacade, git, progressIndicator, stashMessage); - } - - // In the case of illegal value in the settings or impossibility to get the settings. - private static GitChangesSaver getDefaultSaver(@NotNull Project project, @NotNull GitPlatformFacade platformFacade, @NotNull Git git, - @NotNull ProgressIndicator progressIndicator, @NotNull String stashMessage) { return new GitStashChangesSaver(project, platformFacade, git, progressIndicator, stashMessage); }