From acd46054ed0a063992f50169dca07870d37a2f55 Mon Sep 17 00:00:00 2001 From: Konstantin Hudyakov Date: Mon, 22 Aug 2022 15:16:14 +0300 Subject: [PATCH] IDEA-299725 Extract VCS features to VCS plugin and add applicability filter GitOrigin-RevId: 5f8975b798d70ec15d35ead4d714ad1cc52e5230 --- .../ProductivityFeaturesRegistry.xml | 10 -------- .../VcsProductivityFeatures.properties | 3 +++ .../resources/VcsProductivityFeatures.xml | 17 +++++++++++++ platform/dvcs-impl/src/META-INF/dvcs.xml | 3 +++ .../VcsProductivityFeaturesProvider.kt | 24 +++++++++++++++++++ .../FeatureStatisticsBundle.properties | 4 ---- 6 files changed, 47 insertions(+), 14 deletions(-) create mode 100644 platform/dvcs-api/resources/messages/VcsProductivityFeatures.properties create mode 100644 platform/dvcs-impl/resources/VcsProductivityFeatures.xml create mode 100644 platform/dvcs-impl/src/com/intellij/dvcs/featureStatistics/VcsProductivityFeaturesProvider.kt diff --git a/java/ide-resources/resources/ProductivityFeaturesRegistry.xml b/java/ide-resources/resources/ProductivityFeaturesRegistry.xml index 8798d7ad7af0..60c34d9b92a8 100644 --- a/java/ide-resources/resources/ProductivityFeaturesRegistry.xml +++ b/java/ide-resources/resources/ProductivityFeaturesRegistry.xml @@ -622,16 +622,6 @@ show-in-guide="false"> - - - - - - diff --git a/platform/dvcs-api/resources/messages/VcsProductivityFeatures.properties b/platform/dvcs-api/resources/messages/VcsProductivityFeatures.properties new file mode 100644 index 000000000000..8b5bd7a58f6f --- /dev/null +++ b/platform/dvcs-api/resources/messages/VcsProductivityFeatures.properties @@ -0,0 +1,3 @@ +# suppress inspection "UnusedProperty" +vcs.show.quick.list=Show VCS quick list +vcs.pull.requests=Show pull requests \ No newline at end of file diff --git a/platform/dvcs-impl/resources/VcsProductivityFeatures.xml b/platform/dvcs-impl/resources/VcsProductivityFeatures.xml new file mode 100644 index 000000000000..405678759c7d --- /dev/null +++ b/platform/dvcs-impl/resources/VcsProductivityFeatures.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/platform/dvcs-impl/src/META-INF/dvcs.xml b/platform/dvcs-impl/src/META-INF/dvcs.xml index d72d9217105d..7c08df773a30 100644 --- a/platform/dvcs-impl/src/META-INF/dvcs.xml +++ b/platform/dvcs-impl/src/META-INF/dvcs.xml @@ -83,6 +83,9 @@ + + + diff --git a/platform/dvcs-impl/src/com/intellij/dvcs/featureStatistics/VcsProductivityFeaturesProvider.kt b/platform/dvcs-impl/src/com/intellij/dvcs/featureStatistics/VcsProductivityFeaturesProvider.kt new file mode 100644 index 000000000000..a0857c2acb47 --- /dev/null +++ b/platform/dvcs-impl/src/com/intellij/dvcs/featureStatistics/VcsProductivityFeaturesProvider.kt @@ -0,0 +1,24 @@ +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +package com.intellij.dvcs.featureStatistics + +import com.intellij.dvcs.repo.VcsRepositoryManager +import com.intellij.featureStatistics.ApplicabilityFilter +import com.intellij.featureStatistics.ProductivityFeaturesProvider +import com.intellij.openapi.project.Project + +internal class VcsProductivityFeaturesProvider : ProductivityFeaturesProvider() { + override fun getXmlFilesUrls() = listOf("VcsProductivityFeatures.xml") + + override fun getApplicabilityFilters(): Array { + return arrayOf(VcsFeaturesApplicabilityFilter()) + } +} + +private class VcsFeaturesApplicabilityFilter : ApplicabilityFilter { + override fun isApplicable(featureId: String, project: Project?): Boolean { + if (project == null) return false + return VcsRepositoryManager.getInstance(project).repositories.isNotEmpty() + } + + override fun getPrefix() = "vcs" +} \ No newline at end of file diff --git a/platform/platform-api/resources/messages/FeatureStatisticsBundle.properties b/platform/platform-api/resources/messages/FeatureStatisticsBundle.properties index 5a4e32461b06..f9c63439574d 100644 --- a/platform/platform-api/resources/messages/FeatureStatisticsBundle.properties +++ b/platform/platform-api/resources/messages/FeatureStatisticsBundle.properties @@ -163,10 +163,6 @@ ui.close.all.editors=Close all editor tabs # suppress inspection "UnusedProperty" vcs.show.local.history=Show local history of file # suppress inspection "UnusedProperty" -vcs.show.quick.list=Show VCS quick list -# suppress inspection "UnusedProperty" -vcs.pull.requests=Show pull requests -# suppress inspection "UnusedProperty" intentions.fix.javadoc=Fix JavaDoc # suppress inspection "UnusedProperty" refactoring.show.quick.list=Show Refactoring quick list