mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
vcs: expose in UI the option to disable mapping detection for a Project
GitOrigin-RevId: 8b0ead193f003c5756c9e936b56b98a7495c8b0f
This commit is contained in:
committed by
intellij-monorepo-bot
parent
7f634ead77
commit
c7ceb740cd
@@ -3,10 +3,12 @@ package com.intellij.openapi.vcs
|
||||
|
||||
import com.intellij.openapi.components.*
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
|
||||
@Service(Service.Level.PROJECT)
|
||||
@State(name = "VcsProjectSettings", storages = [Storage("vcs.xml")])
|
||||
internal class VcsSharedProjectSettings : BaseState(), PersistentStateComponent<VcsSharedProjectSettings> {
|
||||
@ApiStatus.Internal
|
||||
class VcsSharedProjectSettings : BaseState(), PersistentStateComponent<VcsSharedProjectSettings> {
|
||||
var isDetectVcsMappingsAutomatically: Boolean by property(true)
|
||||
|
||||
override fun getState(): VcsSharedProjectSettings {
|
||||
|
||||
@@ -529,6 +529,8 @@ composite.change.provider.include.vcs.checkbox=Include changes from {0}
|
||||
shelf.tab=Shelf
|
||||
directory.mapping.remove.title=Edit VCS Directory Mapping
|
||||
directory.mapping.add.title=Add VCS Directory Mapping
|
||||
directory.mapping.checkbox.detect.vcs.mappings.automatically=Enable automatic mapping detection
|
||||
directory.mapping.checkbox.detect.vcs.mappings.automatically.hint=Add and remove mapping on project structure changes. Detect newly created VCS roots.
|
||||
settings.vcs.mapping.browser.select.directory.title=Select Directory
|
||||
settings.vcs.mapping.browser.select.directory.description=Select directory to map to a VCS
|
||||
settings.vcs.mapping.status.looking.for.vcs.administrative.area=Looking for VCS Administrative Area
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.openapi.vcs.configurable
|
||||
|
||||
import com.intellij.icons.AllIcons
|
||||
import com.intellij.ide.impl.isTrusted
|
||||
import com.intellij.ide.util.treeView.FileNameComparator
|
||||
import com.intellij.openapi.Disposable
|
||||
@@ -37,9 +38,7 @@ import java.awt.Component
|
||||
import java.awt.GridBagConstraints
|
||||
import java.awt.GridBagLayout
|
||||
import java.io.File
|
||||
import javax.swing.JComponent
|
||||
import javax.swing.JPanel
|
||||
import javax.swing.JTable
|
||||
import javax.swing.*
|
||||
import javax.swing.table.TableCellEditor
|
||||
import javax.swing.table.TableCellRenderer
|
||||
import kotlin.Throws
|
||||
@@ -51,6 +50,7 @@ class VcsDirectoryConfigurationPanel(private val project: Project) : JPanel(), D
|
||||
|
||||
private val vcsManager: ProjectLevelVcsManager = ProjectLevelVcsManager.getInstance(project)
|
||||
private val vcsConfiguration: VcsConfiguration = VcsConfiguration.getInstance(project)
|
||||
private val sharedProjectSettings: VcsSharedProjectSettings = VcsSharedProjectSettings.getInstance(project)
|
||||
|
||||
private val allSupportedVcss: List<AbstractVcs> = vcsManager.allSupportedVcss.asList()
|
||||
private val vcsRootCheckers: Map<String, VcsRootChecker> =
|
||||
@@ -63,6 +63,8 @@ class VcsDirectoryConfigurationPanel(private val project: Project) : JPanel(), D
|
||||
|
||||
private val vcsComboBox: ComboBox<AbstractVcs?>
|
||||
|
||||
private val detectVcsMappingsCheckBox: JCheckBox
|
||||
|
||||
private val scopeFilterConfigurable: VcsUpdateInfoScopeFilterConfigurable
|
||||
|
||||
private var rootDetectionIndicator: ProgressIndicator? = null
|
||||
@@ -141,6 +143,8 @@ class VcsDirectoryConfigurationPanel(private val project: Project) : JPanel(), D
|
||||
// don't start loading automatically
|
||||
tableLoadingPanel = JBLoadingPanel(BorderLayout(), this, POSTPONE_MAPPINGS_LOADING_PANEL * 2)
|
||||
|
||||
detectVcsMappingsCheckBox = JCheckBox(VcsBundle.message("directory.mapping.checkbox.detect.vcs.mappings.automatically"))
|
||||
|
||||
layout = BorderLayout()
|
||||
add(createMainComponent())
|
||||
|
||||
@@ -176,6 +180,8 @@ class VcsDirectoryConfigurationPanel(private val project: Project) : JPanel(), D
|
||||
items.addAll(vcsManager.directoryMappings.map { createRegisteredInfo(it) })
|
||||
setDisplayedMappings(items)
|
||||
|
||||
detectVcsMappingsCheckBox.isSelected = sharedProjectSettings.isDetectVcsMappingsAutomatically
|
||||
|
||||
scheduleUnregisteredRootsLoading()
|
||||
}
|
||||
|
||||
@@ -303,6 +309,14 @@ class VcsDirectoryConfigurationPanel(private val project: Project) : JPanel(), D
|
||||
panel.add(tableLoadingPanel, gb.nextLine().next().fillCell().weighty(1.0))
|
||||
|
||||
panel.add(createProjectMappingDescription(), gb.nextLine().next())
|
||||
|
||||
val detectVcsMappingsHintLabel = JLabel(AllIcons.General.ContextHelp).apply {
|
||||
border = JBUI.Borders.emptyLeft(4)
|
||||
toolTipText = VcsBundle.message("directory.mapping.checkbox.detect.vcs.mappings.automatically.hint")
|
||||
}
|
||||
panel.add(JBUI.Panels.simplePanel(detectVcsMappingsCheckBox).addToRight(detectVcsMappingsHintLabel),
|
||||
gb.nextLine().next().fillCellNone().anchor(GridBagConstraints.WEST))
|
||||
|
||||
if (!AbstractCommonUpdateAction.showsCustomNotification(vcsManager.allActiveVcss.asList())) {
|
||||
panel.add(scopeFilterConfigurable.createComponent(), gb.nextLine().next())
|
||||
}
|
||||
@@ -383,6 +397,7 @@ class VcsDirectoryConfigurationPanel(private val project: Project) : JPanel(), D
|
||||
adjustIgnoredRootsSettings()
|
||||
vcsManager.directoryMappings = getModelMappings()
|
||||
scopeFilterConfigurable.apply()
|
||||
sharedProjectSettings.isDetectVcsMappingsAutomatically = detectVcsMappingsCheckBox.isSelected
|
||||
initializeModel()
|
||||
}
|
||||
|
||||
@@ -397,7 +412,8 @@ class VcsDirectoryConfigurationPanel(private val project: Project) : JPanel(), D
|
||||
|
||||
fun isModified(): Boolean {
|
||||
if (scopeFilterConfigurable.isModified) return true
|
||||
return getModelMappings() != vcsManager.directoryMappings
|
||||
return getModelMappings() != vcsManager.directoryMappings ||
|
||||
detectVcsMappingsCheckBox.isSelected != sharedProjectSettings.isDetectVcsMappingsAutomatically
|
||||
}
|
||||
|
||||
private fun getModelMappings(): List<VcsDirectoryMapping> {
|
||||
|
||||
Reference in New Issue
Block a user