mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
FUS: report common action places
This commit is contained in:
@@ -138,6 +138,17 @@ public abstract class ActionPlaces {
|
||||
return MAIN_MENU.equals(place) || ACTION_SEARCH.equals(place);
|
||||
}
|
||||
|
||||
private static final Set<String> ourCommonPlaces = ContainerUtil.newHashSet(
|
||||
UNKNOWN, MAIN_MENU, MAIN_TOOLBAR, EDITOR_TOOLBAR, EDITOR_TAB, COMMANDER_TOOLBAR, CONTEXT_TOOLBAR, TOOLWINDOW_TITLE,
|
||||
PROJECT_VIEW_TOOLBAR, STATUS_BAR_PLACE, ACTION_SEARCH, TESTTREE_VIEW_TOOLBAR, TYPE_HIERARCHY_VIEW_TOOLBAR,
|
||||
METHOD_HIERARCHY_VIEW_TOOLBAR, CALL_HIERARCHY_VIEW_TOOLBAR, RUNNER_TOOLBAR, DEBUGGER_TOOLBAR, USAGE_VIEW_TOOLBAR,
|
||||
STRUCTURE_VIEW_TOOLBAR, NAVIGATION_BAR_TOOLBAR, TODO_VIEW_TOOLBAR, COMPILER_MESSAGES_TOOLBAR,
|
||||
ANT_MESSAGES_TOOLBAR, ANT_EXPLORER_TOOLBAR, CODE_INSPECTION, JAVADOC_TOOLBAR, JAVADOC_INPLACE_SETTINGS,
|
||||
FILEHISTORY_VIEW_TOOLBAR, RUN_CONFIGURATIONS_COMBOBOX, WELCOME_SCREEN, CHANGES_VIEW_TOOLBAR, DATABASE_VIEW_TOOLBAR,
|
||||
ACTION_PLACE_QUICK_LIST_POPUP_ACTION, PHING_EXPLORER_TOOLBAR, DOCK_MENU, PHING_MESSAGES_TOOLBAR, DIFF_TOOLBAR,
|
||||
ANALYZE_STACKTRACE_PANEL_TOOLBAR, TOUCHBAR_GENERAL
|
||||
);
|
||||
|
||||
private static final Set<String> ourPopupPlaces = ContainerUtil.newHashSet(
|
||||
POPUP, EDITOR_POPUP, EDITOR_TAB_POPUP, COMMANDER_POPUP,
|
||||
PROJECT_VIEW_POPUP, FAVORITES_VIEW_POPUP, SCOPE_VIEW_POPUP, TESTTREE_VIEW_POPUP, TESTSTATISTICS_VIEW_POPUP, TYPE_HIERARCHY_VIEW_POPUP,
|
||||
@@ -156,6 +167,10 @@ public abstract class ActionPlaces {
|
||||
return ourPopupPlaces.contains(place) || place.startsWith(POPUP_PREFIX);
|
||||
}
|
||||
|
||||
public static boolean isCommonPlace(@NotNull String place) {
|
||||
return ourPopupPlaces.contains(place) || ourCommonPlaces.contains(place);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String getActionGroupPopupPlace(@Nullable String actionId) {
|
||||
return actionId == null ? POPUP : POPUP_PREFIX + actionId;
|
||||
|
||||
+5
-12
@@ -34,7 +34,7 @@ import java.util.Set;
|
||||
value = UsageStatisticsPersistenceComponent.USAGE_STATISTICS_XML, roamingType = RoamingType.DISABLED, deprecated = true)
|
||||
)
|
||||
public class ActionsCollectorImpl extends ActionsCollector implements PersistentStateComponent<ActionsCollector.State> {
|
||||
private static final FeatureUsageGroup GROUP = new FeatureUsageGroup("actions", 2);
|
||||
private static final FeatureUsageGroup GROUP = new FeatureUsageGroup("actions", 3);
|
||||
private static final String DEFAULT_ID = "third.party";
|
||||
|
||||
private static final Set<String> ourCustomActionWhitelist = ContainerUtil.newHashSet(
|
||||
@@ -58,22 +58,15 @@ public class ActionsCollectorImpl extends ActionsCollector implements Persistent
|
||||
public void record(@Nullable AnAction action, @Nullable AnActionEvent event) {
|
||||
if (action == null) return;
|
||||
|
||||
boolean isContextMenu = event != null && event.isFromContextMenu();
|
||||
final String place = event != null ? event.getPlace() : "";
|
||||
|
||||
final PluginInfo info = PluginInfoDetectorKt.getPluginInfo(action.getClass());
|
||||
final FeatureUsageDataBuilder data = new FeatureUsageDataBuilder().
|
||||
addFeatureContext(FUSUsageContext.OS_CONTEXT).
|
||||
addPluginInfo(info).
|
||||
addData("context_menu", isContextMenu);
|
||||
addPluginInfo(info);
|
||||
|
||||
if (event != null) {
|
||||
data.addInputEvent(event);
|
||||
}
|
||||
|
||||
final boolean isDevelopedByJB = info.isDevelopedByJetBrains();
|
||||
if (isContextMenu && isDevelopedByJB) {
|
||||
data.addPlace(place);
|
||||
data.addInputEvent(event).
|
||||
addPlace(event.getPlace()).
|
||||
addData("context_menu", event.isFromContextMenu());
|
||||
}
|
||||
|
||||
FUSCounterUsageLogger.logEvent(GROUP, toReportedId(info, action), data);
|
||||
|
||||
+3
-6
@@ -30,7 +30,7 @@ import java.util.Map;
|
||||
}
|
||||
)
|
||||
public class ToolbarClicksCollector implements PersistentStateComponent<ToolbarClicksCollector.ClicksState> {
|
||||
private static final FeatureUsageGroup GROUP = new FeatureUsageGroup("toolbar", 2);
|
||||
private static final FeatureUsageGroup GROUP = new FeatureUsageGroup("toolbar", 3);
|
||||
|
||||
public final static class ClicksState {
|
||||
@Tag("counts")
|
||||
@@ -51,11 +51,8 @@ public class ToolbarClicksCollector implements PersistentStateComponent<ToolbarC
|
||||
|
||||
public static void record(@NotNull AnAction action, String place) {
|
||||
final PluginInfo info = PluginInfoDetectorKt.getPluginInfo(action.getClass());
|
||||
final FeatureUsageDataBuilder builder = new FeatureUsageDataBuilder().addPluginInfo(info);
|
||||
if (info.isDevelopedByJetBrains()) {
|
||||
builder.addPlace(place);
|
||||
}
|
||||
record(ActionsCollectorImpl.toReportedId(info, action), builder);
|
||||
final FeatureUsageDataBuilder data = new FeatureUsageDataBuilder().addPluginInfo(info).addPlace(place);
|
||||
record(ActionsCollectorImpl.toReportedId(info, action), data);
|
||||
}
|
||||
|
||||
public static void record(String actionId) {
|
||||
|
||||
+17
-2
@@ -7,8 +7,10 @@ import com.intellij.internal.statistic.utils.getPluginType
|
||||
import com.intellij.internal.statistic.utils.getProjectId
|
||||
import com.intellij.lang.Language
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.actionSystem.ActionPlaces
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import com.intellij.openapi.wm.impl.content.ToolWindowContentUi
|
||||
import com.intellij.util.containers.ContainerUtil
|
||||
import java.awt.event.KeyEvent
|
||||
import java.util.*
|
||||
@@ -62,11 +64,24 @@ class FeatureUsageDataBuilder {
|
||||
return this
|
||||
}
|
||||
|
||||
fun addPlace(place: String): FeatureUsageDataBuilder {
|
||||
data["place"] = place
|
||||
fun addPlace(place: String?): FeatureUsageDataBuilder {
|
||||
if (place == null) return this
|
||||
|
||||
var reported = ActionPlaces.UNKNOWN
|
||||
if (isCommonPlace(place)) {
|
||||
reported = place
|
||||
}
|
||||
else if (ActionPlaces.isPopupPlace(place)) {
|
||||
reported = ActionPlaces.POPUP
|
||||
}
|
||||
data["place"] = reported
|
||||
return this
|
||||
}
|
||||
|
||||
private fun isCommonPlace(place: String): Boolean {
|
||||
return ActionPlaces.isCommonPlace(place) || ToolWindowContentUi.POPUP_PLACE == place
|
||||
}
|
||||
|
||||
fun addData(key: String, value: Any): FeatureUsageDataBuilder {
|
||||
data[key] = value
|
||||
return this
|
||||
|
||||
Reference in New Issue
Block a user