diff options
Diffstat (limited to 'plugins/git4idea/src/git4idea/config/GitVcsSettings.java')
-rw-r--r-- | plugins/git4idea/src/git4idea/config/GitVcsSettings.java | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/plugins/git4idea/src/git4idea/config/GitVcsSettings.java b/plugins/git4idea/src/git4idea/config/GitVcsSettings.java index 1b5860631e59..7dd7f9b1004b 100644 --- a/plugins/git4idea/src/git4idea/config/GitVcsSettings.java +++ b/plugins/git4idea/src/git4idea/config/GitVcsSettings.java @@ -15,12 +15,16 @@ */ package git4idea.config; +import com.intellij.dvcs.branch.DvcsBranchSync; +import com.intellij.dvcs.branch.DvcsSyncBranchSettings; import com.intellij.lifecycle.PeriodicalTasksCloser; -import com.intellij.openapi.components.*; +import com.intellij.openapi.components.PersistentStateComponent; +import com.intellij.openapi.components.State; +import com.intellij.openapi.components.Storage; +import com.intellij.openapi.components.StoragePathMacros; import com.intellij.openapi.project.Project; import com.intellij.util.ArrayUtil; import git4idea.reset.GitResetMode; -import git4idea.ui.branch.GitBranchSyncSetting; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -32,8 +36,8 @@ import java.util.Map; /** * Git VCS settings */ -@State(name = "Git.Settings", roamingType = RoamingType.DISABLED, storages = {@Storage(file = StoragePathMacros.WORKSPACE_FILE)}) -public class GitVcsSettings implements PersistentStateComponent<GitVcsSettings.State> { +@State(name = "Git.Settings", storages = {@Storage(file = StoragePathMacros.WORKSPACE_FILE)}) +public class GitVcsSettings implements PersistentStateComponent<GitVcsSettings.State>, DvcsSyncBranchSettings { private static final int PREVIOUS_COMMIT_AUTHORS_LIMIT = 16; // Limit for previous commit authors @@ -56,12 +60,13 @@ public class GitVcsSettings implements PersistentStateComponent<GitVcsSettings.S public UpdateChangesPolicy UPDATE_CHANGES_POLICY = UpdateChangesPolicy.STASH; public UpdateMethod UPDATE_TYPE = UpdateMethod.BRANCH_DEFAULT; public boolean PUSH_AUTO_UPDATE = false; - public GitBranchSyncSetting SYNC_SETTING = GitBranchSyncSetting.NOT_DECIDED; + public DvcsBranchSync SYNC_SETTING = DvcsBranchSync.NOT_DECIDED; public String RECENT_GIT_ROOT_PATH = null; public Map<String, String> RECENT_BRANCH_BY_REPOSITORY = new HashMap<String, String>(); public String RECENT_COMMON_BRANCH = null; public boolean AUTO_COMMIT_ON_CHERRY_PICK = false; public boolean WARN_ABOUT_CRLF = true; + public boolean WARN_ABOUT_DETACHED_HEAD = true; public GitResetMode RESET_MODE = null; } @@ -72,7 +77,7 @@ public class GitVcsSettings implements PersistentStateComponent<GitVcsSettings.S public GitVcsApplicationSettings getAppSettings() { return myAppSettings; } - + public static GitVcsSettings getInstance(Project project) { return PeriodicalTasksCloser.getInstance().safeGetService(project, GitVcsSettings.class); } @@ -128,11 +133,11 @@ public class GitVcsSettings implements PersistentStateComponent<GitVcsSettings.S } @NotNull - public GitBranchSyncSetting getSyncSetting() { + public DvcsBranchSync getSyncSetting() { return myState.SYNC_SETTING; } - public void setSyncSetting(@NotNull GitBranchSyncSetting syncSetting) { + public void setSyncSetting(@NotNull DvcsBranchSync syncSetting) { myState.SYNC_SETTING = syncSetting; } @@ -179,6 +184,14 @@ public class GitVcsSettings implements PersistentStateComponent<GitVcsSettings.S myState.WARN_ABOUT_CRLF = warn; } + public boolean warnAboutDetachedHead() { + return myState.WARN_ABOUT_DETACHED_HEAD; + } + + public void setWarnAboutDetachedHead(boolean warn) { + myState.WARN_ABOUT_DETACHED_HEAD = warn; + } + @Nullable public GitResetMode getResetMode() { return myState.RESET_MODE; |