git: allow to change the path filter in the Update Info tab: IDEA-218028

If the Paths filter is not set (as it is initially), take the value from the Settings. Specifically handle the case when it is reset to All (when the filter is null).

Don't persist filters: store them only for the current Update Info tab.

GitOrigin-RevId: 40528c73aa62c3396606c368c7069b629c8bfae6
This commit is contained in:
Kirill Likhodedov
2019-07-13 17:03:42 +03:00
committed by intellij-monorepo-bot
parent 6916fd7384
commit d43b10514b
@@ -197,15 +197,31 @@ class GitUpdateInfoAsLog(private val project: Project,
private class MyPropertiesForRange(val rangeFilter: VcsLogRangeFilter,
val mainProperties: GitUpdateProjectInfoLogProperties) : MainVcsLogUiProperties by mainProperties {
private val filters: MutableMap<String, List<String>> = TreeMap()
private var explicitlyRemovedPathsFilter = false
override fun getFilterValues(filterName: String): List<String>? {
when (filterName) {
RANGE_FILTER.name -> return ArrayList(rangeFilter.getTextPresentation())
STRUCTURE_FILTER.name, ROOT_FILTER.name -> return mainProperties.getFilterValues(filterName)
else -> return null
STRUCTURE_FILTER.name, ROOT_FILTER.name -> {
if (explicitlyRemovedPathsFilter) return null
return filters[filterName] ?: mainProperties.getFilterValues(filterName)
}
else -> return filters[filterName]
}
}
override fun saveFilterValues(filterName: String, values: List<String>?) {
if (values != null) {
filters[filterName] = values
}
else {
filters.remove(filterName)
}
if (filterName == STRUCTURE_FILTER.name || filterName == ROOT_FILTER.name) {
explicitlyRemovedPathsFilter = values == null
}
}
}