Feature event log: log navigation in settings

(cherry picked from commit 4104ac0)
This commit is contained in:
Svetlana.Zemlyanskaya
2018-02-27 14:26:00 +01:00
parent cc9262ab10
commit f2e4fad229
2 changed files with 40 additions and 1 deletions
@@ -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<String, Any>()
private val APPLY_CONFIGURABLE_DATA = HashMap<String, Any>()
private val RESET_CONFIGURABLE_DATA = HashMap<String, Any>()
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)
}
}
@@ -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());
}
}