mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
FUS-418 extract dynamic part from RA stats collectors
GitOrigin-RevId: 6dd24d6db3612b0a7a62578880c47659b3bfd93f
This commit is contained in:
committed by
intellij-monorepo-bot
parent
edbbeb6fe7
commit
33c59dd4f7
@@ -222,12 +222,10 @@ public class RunAnythingPopupUI extends BigPopupUI {
|
||||
}
|
||||
|
||||
if (model != null) {
|
||||
RunAnythingUsageCollector.Companion.triggerExecCategoryStatistics(project, model.getGroups(), model.getClass(), index);
|
||||
RunAnythingUsageCollector.Companion.triggerExecCategoryStatistics(project, model.getGroups(), model.getClass(), index,
|
||||
SHIFT_IS_PRESSED.get(), ALT_IS_PRESSED.get());
|
||||
}
|
||||
DataContext dataContext = createDataContext(myDataContext, ALT_IS_PRESSED.get());
|
||||
if (SHIFT_IS_PRESSED.get()) {
|
||||
RunAnythingUtil.triggerShiftStatistics(dataContext);
|
||||
}
|
||||
RunAnythingUtil.executeMatched(dataContext, pattern);
|
||||
|
||||
searchFinishedHandler.run();
|
||||
|
||||
+15
-16
@@ -1,8 +1,8 @@
|
||||
// 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.ide.actions.runAnything
|
||||
|
||||
import com.intellij.ide.actions.runAnything.RunAnythingAction.RUN_ANYTHING
|
||||
import com.intellij.ide.actions.runAnything.groups.RunAnythingGroup
|
||||
import com.intellij.internal.statistic.eventLog.FeatureUsageData
|
||||
import com.intellij.internal.statistic.service.fus.collectors.FUCounterUsageLogger
|
||||
import com.intellij.internal.statistic.utils.getPluginInfo
|
||||
import com.intellij.openapi.project.Project
|
||||
@@ -11,27 +11,24 @@ private const val GROUP_ID = "actions.runAnything"
|
||||
|
||||
class RunAnythingUsageCollector {
|
||||
companion object {
|
||||
private val allowedCompletionGroupTitles: Array<String> = arrayOf("Bundler", "rails generators", "Gradle tasks", "npm scripts",
|
||||
"Maven goals",
|
||||
"rvm use", "rake", "rbenv shell", "General", "Recent projects",
|
||||
"Run configurations")
|
||||
|
||||
private val allowedHelpGroupTitles: Array<String> = arrayOf("Gradle", "Maven", "npm", "Python", "Recent projects", "ruby", "General",
|
||||
"Recent")
|
||||
|
||||
fun trigger(project: Project, featureId: String) {
|
||||
FUCounterUsageLogger.getInstance().logEvent(project, GROUP_ID, featureId)
|
||||
}
|
||||
|
||||
fun triggerExecCategoryStatistics(project: Project,
|
||||
groups: Collection<RunAnythingGroup>,
|
||||
groups: MutableCollection<out RunAnythingGroup>,
|
||||
clazz: Class<out RunAnythingSearchListModel>,
|
||||
index: Int) {
|
||||
index: Int,
|
||||
shiftPressed: Boolean,
|
||||
altPressed: Boolean) {
|
||||
for (i in index downTo 0) {
|
||||
val group = RunAnythingGroup.findGroup(groups, i)
|
||||
if (group != null) {
|
||||
RunAnythingUsageCollector.trigger(project, getSafeToReportClazzName(clazz) + ": " +
|
||||
RUN_ANYTHING + " - execution - " + getSafeToReportTitle(group))
|
||||
FUCounterUsageLogger.getInstance().logEvent(project, GROUP_ID, "execute", FeatureUsageData()
|
||||
.addData("list", getSafeToReportClazzName(clazz))
|
||||
.addData("group", getSafeToReportTitle(group))
|
||||
.addData("with_shift", shiftPressed)
|
||||
.addData("with_alt", altPressed))
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -40,17 +37,19 @@ class RunAnythingUsageCollector {
|
||||
fun triggerMoreStatistics(project: Project,
|
||||
group: RunAnythingGroup,
|
||||
clazz: Class<out RunAnythingSearchListModel>) {
|
||||
RunAnythingUsageCollector.trigger(project, getSafeToReportClazzName(clazz) + ": " +
|
||||
RUN_ANYTHING + " - more - " + getSafeToReportTitle(group))
|
||||
FUCounterUsageLogger.getInstance().logEvent(project, GROUP_ID, "click.more", FeatureUsageData()
|
||||
.addData("list", getSafeToReportClazzName(clazz))
|
||||
.addData("group", getSafeToReportTitle(group)))
|
||||
}
|
||||
|
||||
|
||||
private fun getSafeToReportClazzName(clazz: Class<*>): String {
|
||||
return if (getPluginInfo(clazz).isSafeToReport()) clazz.simpleName else "third.party"
|
||||
}
|
||||
|
||||
private fun getSafeToReportTitle(group: RunAnythingGroup): String {
|
||||
return if (!getPluginInfo(group.javaClass).isSafeToReport()) "third.party"
|
||||
else return if (group.title in allowedCompletionGroupTitles || group.title in allowedHelpGroupTitles) group.title else "run.anything.group.unknown.title"
|
||||
else return group.title
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
// Copyright 2000-2019 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.ide.actions.runAnything;
|
||||
|
||||
import com.intellij.execution.Executor;
|
||||
import com.intellij.execution.ExecutorRegistry;
|
||||
import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.ide.actions.runAnything.activity.RunAnythingProvider;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
@@ -16,7 +14,6 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.wm.ToolWindowId;
|
||||
import com.intellij.ui.Gray;
|
||||
import com.intellij.ui.JBColor;
|
||||
import com.intellij.ui.ScrollingUtil;
|
||||
@@ -33,9 +30,6 @@ import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.intellij.ide.actions.runAnything.RunAnythingAction.EXECUTOR_KEY;
|
||||
|
||||
public class RunAnythingUtil {
|
||||
public static final Logger LOG = Logger.getInstance(RunAnythingUtil.class);
|
||||
@@ -44,7 +38,6 @@ public class RunAnythingUtil {
|
||||
public static final String AD_CONTEXT_TEXT =
|
||||
IdeBundle.message("run.anything.ad.run.in.context", KeymapUtil.getShortcutText(KeyboardShortcut.fromString("pressed ALT")));
|
||||
private static final Key<Collection<Pair<String, String>>> RUN_ANYTHING_WRAPPED_COMMANDS = Key.create("RUN_ANYTHING_WRAPPED_COMMANDS");
|
||||
private static final String SHIFT_HOLD_USAGE = RunAnythingAction.RUN_ANYTHING + " - " + "SHIFT_HOLD";
|
||||
|
||||
static Font getTitleFont() {
|
||||
return UIUtil.getLabelFont().deriveFont(UIUtil.getFontSize(UIUtil.FontSize.SMALL));
|
||||
@@ -83,15 +76,6 @@ public class RunAnythingUtil {
|
||||
}
|
||||
}
|
||||
|
||||
static void triggerShiftStatistics(@NotNull DataContext dataContext) {
|
||||
Project project = Objects.requireNonNull(CommonDataKeys.PROJECT.getData(dataContext));
|
||||
Executor executor = Objects.requireNonNull(EXECUTOR_KEY.getData(dataContext));
|
||||
|
||||
if (ExecutorRegistry.getInstance().getExecutorById(ToolWindowId.DEBUG) == executor) {
|
||||
RunAnythingUsageCollector.Companion.trigger(project, SHIFT_HOLD_USAGE);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Collection<Pair<String, String>> getOrCreateWrappedCommands(@NotNull Project project) {
|
||||
Collection<Pair<String, String>> list = project.getUserData(RUN_ANYTHING_WRAPPED_COMMANDS);
|
||||
|
||||
Reference in New Issue
Block a user