diff --git a/platform/platform-api/src/com/intellij/internal/statistic/eventLog/FeatureUsageUiEvents.kt b/platform/platform-api/src/com/intellij/internal/statistic/eventLog/FeatureUsageUiEvents.kt new file mode 100644 index 000000000000..aa0dfbc459f2 --- /dev/null +++ b/platform/platform-api/src/com/intellij/internal/statistic/eventLog/FeatureUsageUiEvents.kt @@ -0,0 +1,28 @@ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +package com.intellij.internal.statistic.eventLog + +object FeatureUsageUiEvents { + private const val UI_RECORDER_ID = "ui-recorder" + + private val SELECT_CONFIGURABLE_DATA = HashMap() + private val APPLY_CONFIGURABLE_DATA = HashMap() + private val RESET_CONFIGURABLE_DATA = HashMap() + + init { + SELECT_CONFIGURABLE_DATA["type"] = "select" + APPLY_CONFIGURABLE_DATA["type"] = "apply" + RESET_CONFIGURABLE_DATA["type"] = "reset" + } + + fun logSelectConfigurable(name: String) { + FeatureUsageLogger.log(UI_RECORDER_ID, name, SELECT_CONFIGURABLE_DATA) + } + + fun logApplyConfigurable(name: String) { + FeatureUsageLogger.log(UI_RECORDER_ID, name, APPLY_CONFIGURABLE_DATA) + } + + fun logResetConfigurable(name: String) { + FeatureUsageLogger.log(UI_RECORDER_ID, name, RESET_CONFIGURABLE_DATA) + } +} diff --git a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/ConfigurableEditor.java b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/ConfigurableEditor.java index 0401de6bba7f..a4db0d1408e3 100644 --- a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/ConfigurableEditor.java +++ b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/ConfigurableEditor.java @@ -18,6 +18,7 @@ package com.intellij.openapi.options.newEditor; import com.intellij.CommonBundle; import com.intellij.internal.statistic.UsageTrigger; import com.intellij.internal.statistic.beans.ConvertUsagesUtil; +import com.intellij.internal.statistic.eventLog.FeatureUsageUiEvents; import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.ActionManager; import com.intellij.openapi.actionSystem.AnAction; @@ -42,6 +43,7 @@ import com.intellij.util.ui.JBUI; import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.update.MergingUpdateQueue; import com.intellij.util.ui.update.Update; +import org.jetbrains.annotations.NotNull; import javax.swing.*; import java.awt.*; @@ -84,6 +86,7 @@ class ConfigurableEditor extends AbstractEditor implements AnActionListener, AWT if (myConfigurable != null) { ConfigurableCardPanel.reset(myConfigurable); updateCurrent(myConfigurable, true); + FeatureUsageUiEvents.INSTANCE.logResetConfigurable(getConfigurableEventId(myConfigurable)); } } }; @@ -257,6 +260,7 @@ class ConfigurableEditor extends AbstractEditor implements AnActionListener, AWT myConfigurable = configurable; updateCurrent(configurable, false); postUpdateCurrent(configurable); + FeatureUsageUiEvents.INSTANCE.logSelectConfigurable(getConfigurableEventId(configurable)); }); return callback; } @@ -326,7 +330,9 @@ class ConfigurableEditor extends AbstractEditor implements AnActionListener, AWT if (configurable != null) { try { configurable.apply(); - UsageTrigger.trigger("ide.settings." + ConvertUsagesUtil.escapeDescriptorName(configurable.getDisplayName())); + final String key = getConfigurableEventId(configurable); + FeatureUsageUiEvents.INSTANCE.logApplyConfigurable(key); + UsageTrigger.trigger(key); } catch (ConfigurationException exception) { return exception; @@ -334,4 +340,9 @@ class ConfigurableEditor extends AbstractEditor implements AnActionListener, AWT } return null; } + + @NotNull + private static String getConfigurableEventId(Configurable configurable) { + return "ide.settings." + ConvertUsagesUtil.escapeDescriptorName(configurable.getDisplayName()); + } }