FUS: delete legacy components

GitOrigin-RevId: a188712e08805c536c42fb0b1dc909b2441a0b3a
This commit is contained in:
Svetlana.Zemlyanskaya
2019-06-09 00:06:33 +03:00
committed by intellij-monorepo-bot
parent 8a63d28003
commit f5eae4a117
11 changed files with 8 additions and 322 deletions
@@ -6,14 +6,10 @@ import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.util.xmlb.annotations.MapAnnotation;
import com.intellij.util.xmlb.annotations.Tag;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.awt.event.InputEvent;
import java.util.HashMap;
import java.util.Map;
/**
* @author Konstantin Bulenkov
@@ -54,16 +50,4 @@ public abstract class ActionsCollector {
public abstract void record(@Nullable Project project, @Nullable AnAction action, @Nullable AnActionEvent event, @Nullable Language lang);
public abstract void onActionConfiguredByActionId(@NotNull AnAction action, @NotNull String actionId);
public abstract State getState();
public final static class State {
@Tag("counts")
@MapAnnotation(surroundWithTag = false, keyAttributeName = "action", valueAttributeName = "count")
public Map<String, Integer> myValues = new HashMap<>();
@Tag("contextMenuCounts")
@MapAnnotation(surroundWithTag = false, keyAttributeName = "action", valueAttributeName = "count")
public Map<String, Integer> myContextMenuValues = new HashMap<>();
}
}
@@ -38,10 +38,7 @@ import java.util.function.Consumer;
/**
* @author Konstantin Bulenkov
*/
@State(name = "ActionsCollector", storages = @Storage(
value = UsageStatisticsPersistenceComponent.USAGE_STATISTICS_XML, roamingType = RoamingType.DISABLED, deprecated = true)
)
public class ActionsCollectorImpl extends ActionsCollector implements PersistentStateComponent<ActionsCollector.State> {
public class ActionsCollectorImpl extends ActionsCollector {
private static final String GROUP = "actions";
public static final String DEFAULT_ID = "third.party";
@@ -142,18 +139,6 @@ public class ActionsCollectorImpl extends ActionsCollector implements Persistent
return myXmlActionIds.contains(actionId);
}
private final State myState = new State();
@Nullable
@Override
public State getState() {
return myState;
}
@Override
public void loadState(@NotNull State state) {
}
@Override
public void onActionConfiguredByActionId(@NotNull AnAction action, @NotNull String actionId) {
if (canReportActionId(actionId)) {
@@ -24,22 +24,7 @@ import java.util.Map;
/**
* @author Konstantin Bulenkov
*/
@State(name = "IntentionsCollector", storages = @Storage(
value = UsageStatisticsPersistenceComponent.USAGE_STATISTICS_XML, roamingType = RoamingType.DISABLED, deprecated = true)
)
public class IntentionsCollector implements PersistentStateComponent<IntentionsCollector.State> {
private final State myState = new State();
@Nullable
@Override
public State getState() {
return myState;
}
@Override
public void loadState(@NotNull State state) {
}
public class IntentionsCollector {
public void record(@NotNull IntentionAction action, @NotNull Language language) {
record(null, action, language);
@@ -28,27 +28,7 @@ import java.util.stream.Collectors;
/**
* @author Konstantin Bulenkov
*/
@State(
name = "MainMenuCollector",
storages = {
@Storage(value = UsageStatisticsPersistenceComponent.USAGE_STATISTICS_XML, roamingType = RoamingType.DISABLED, deprecated = true),
@Storage(value = "statistics.main_menu.xml", roamingType = RoamingType.DISABLED, deprecated = true)
}
)
public class MainMenuCollector implements PersistentStateComponent<MainMenuCollector.State> {
private final State myState = new State();
@Nullable
@Override
public State getState() {
return myState;
}
@Override
public void loadState(@NotNull State state) {
}
public class MainMenuCollector {
public void record(@NotNull AnAction action) {
try {
final PluginInfo info = PluginInfoDetectorKt.getPluginInfo(action.getClass());
@@ -2,12 +2,10 @@
package com.intellij.internal.statistic.collectors.fus.actions.persistence;
import com.intellij.facet.ui.FacetDependentToolWindow;
import com.intellij.internal.statistic.collectors.fus.ui.persistence.ShortcutsCollector;
import com.intellij.internal.statistic.eventLog.FeatureUsageData;
import com.intellij.internal.statistic.eventLog.validator.ValidationResultType;
import com.intellij.internal.statistic.eventLog.validator.rules.EventContext;
import com.intellij.internal.statistic.eventLog.validator.rules.impl.CustomWhiteListRule;
import com.intellij.internal.statistic.persistence.UsageStatisticsPersistenceComponent;
import com.intellij.internal.statistic.service.fus.collectors.FUCounterUsageLogger;
import com.intellij.internal.statistic.utils.PluginInfo;
import com.intellij.internal.statistic.utils.PluginInfoDetectorKt;
@@ -16,8 +14,6 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.wm.ToolWindowEP;
import com.intellij.openapi.wm.ToolWindowWhitelistEP;
import com.intellij.openapi.wm.ext.LibraryDependentToolWindow;
import com.intellij.util.xmlb.annotations.MapAnnotation;
import com.intellij.util.xmlb.annotations.Tag;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -33,13 +29,7 @@ import static com.intellij.openapi.wm.ToolWindowId.*;
/**
* @author Konstantin Bulenkov
*/
@State(
name = "ToolWindowsCollector",
storages = {
@Storage(value = UsageStatisticsPersistenceComponent.USAGE_STATISTICS_XML, roamingType = RoamingType.DISABLED, deprecated = true),
}
)
public class ToolWindowCollector implements PersistentStateComponent<ToolWindowCollector.State> {
public class ToolWindowCollector {
public static ToolWindowCollector getInstance() {
return ServiceManager.getService(ToolWindowCollector.class);
@@ -81,10 +71,6 @@ public class ToolWindowCollector implements PersistentStateComponent<ToolWindowC
ourToolwindowWhitelist.put(extension.id, info);
}
}
// initialize outdated collectors to clean up previously cached values
ShortcutsCollector.getInstance();
OutdatedToolWindowCollector.getInstance();
}
public void recordActivation(String toolWindowId) {
@@ -132,51 +118,10 @@ public class ToolWindowCollector implements PersistentStateComponent<ToolWindowC
return null;
}
private final State myState = new State();
@Nullable
@Override
public State getState() {
return myState;
}
@Override
public void loadState(@NotNull State state) {
}
enum ToolWindowActivationSource {
ACTIVATION, CLICK
}
public final static class State {
@Tag("counts")
@MapAnnotation(surroundWithTag = false, keyAttributeName = "toolWindow", valueAttributeName = "count")
public Map<String, Integer> myValues = new HashMap<>();
}
@com.intellij.openapi.components.State(
name = "ToolWindowCollector",
storages = {
@Storage(value = UsageStatisticsPersistenceComponent.USAGE_STATISTICS_XML, roamingType = RoamingType.DISABLED, deprecated = true),
}
)
public static class OutdatedToolWindowCollector implements PersistentStateComponent<ToolWindowCollector.State> {
public static OutdatedToolWindowCollector getInstance() {
return ServiceManager.getService(OutdatedToolWindowCollector.class);
}
@Nullable
@Override
public ToolWindowCollector.State getState() {
return new State();
}
@Override
public void loadState(@NotNull ToolWindowCollector.State state) {
}
}
public static class ToolWindowUtilValidator extends CustomWhiteListRule {
@Override
@@ -1,45 +0,0 @@
// 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.internal.statistic.collectors.fus.ui.persistence;
import com.intellij.internal.statistic.persistence.UsageStatisticsPersistenceComponent;
import com.intellij.openapi.components.*;
import com.intellij.util.xmlb.annotations.MapAnnotation;
import com.intellij.util.xmlb.annotations.Tag;
import org.jetbrains.annotations.NotNull;
import java.util.HashMap;
import java.util.Map;
/**
* @author Konstantin Bulenkov
*/
@State(
name = "ShortcutsCollector",
storages = {
@Storage(value = UsageStatisticsPersistenceComponent.USAGE_STATISTICS_XML, roamingType = RoamingType.DISABLED, deprecated = true),
@Storage(value = "statistics.shortcuts.xml", roamingType = RoamingType.DISABLED, deprecated = true)
}
)
public class ShortcutsCollector implements PersistentStateComponent<ShortcutsCollector.MyState> {
public final static class MyState {
@Tag("counts")
@MapAnnotation(surroundWithTag = false, keyAttributeName = "shortcut", valueAttributeName = "count")
public final Map<String, Integer> myValues = new HashMap<>();
}
private final MyState myState = new MyState();
@Override
@NotNull
public MyState getState() {
return myState;
}
@Override
public void loadState(@NotNull final MyState state) {
}
public static ShortcutsCollector getInstance() {
return ServiceManager.getService(ShortcutsCollector.class);
}
}
@@ -2,58 +2,21 @@
package com.intellij.internal.statistic.collectors.fus.ui.persistence;
import com.intellij.internal.statistic.collectors.fus.actions.persistence.ActionsCollectorImpl;
import com.intellij.internal.statistic.persistence.UsageStatisticsPersistenceComponent;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.components.*;
import com.intellij.util.xmlb.annotations.MapAnnotation;
import com.intellij.util.xmlb.annotations.Tag;
import org.jetbrains.annotations.NotNull;
import java.awt.event.InputEvent;
import java.util.HashMap;
import java.util.Map;
/**
* @author Konstantin Bulenkov
*/
@State(
name = "ToolbarClicksCollector",
storages = {
@Storage(value = UsageStatisticsPersistenceComponent.USAGE_STATISTICS_XML, roamingType = RoamingType.DISABLED, deprecated = true),
@Storage(value = "statistics.toolbar.clicks.xml", roamingType = RoamingType.DISABLED, deprecated = true)
}
)
public class ToolbarClicksCollector implements PersistentStateComponent<ToolbarClicksCollector.ClicksState> {
public final static class ClicksState {
@Tag("counts")
@MapAnnotation(surroundWithTag = false, keyAttributeName = "action", valueAttributeName = "count")
public Map<String, Integer> myValues = new HashMap<>();
}
private final ClicksState myState = new ClicksState();
@Override
public ClicksState getState() {
return myState;
}
@Override
public void loadState(@NotNull final ClicksState state) {
}
public class ToolbarClicksCollector {
public static void record(@NotNull AnAction action, String place, @NotNull InputEvent inputEvent, @NotNull DataContext dataContext) {
ToolbarClicksCollector collector = getInstance();
if (collector != null) {
AnActionEvent event = AnActionEvent.createFromInputEvent(
inputEvent, place, null, dataContext, false, true);
ActionsCollectorImpl.record("toolbar", event.getProject(), action, event, null);
}
}
public static ToolbarClicksCollector getInstance() {
return ServiceManager.getService(ToolbarClicksCollector.class);
AnActionEvent event = AnActionEvent.createFromInputEvent(
inputEvent, place, null, dataContext, false, true);
ActionsCollectorImpl.record("toolbar", event.getProject(), action, event, null);
}
}
@@ -1,66 +0,0 @@
// 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.internal.statistic.service.fus.collectors;
import com.intellij.internal.statistic.persistence.UsageStatisticsPersistenceComponent;
import com.intellij.openapi.components.*;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.xmlb.annotations.Property;
import com.intellij.util.xmlb.annotations.XCollection;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@State(name = "StatisticsApplicationUsages", storages = @Storage(
value = UsageStatisticsPersistenceComponent.USAGE_STATISTICS_XML, roamingType = RoamingType.DISABLED, deprecated = true)
)
public class LegacyApplicationUsageTriggers implements PersistentStateComponent<LegacyApplicationUsageTriggers.State> {
State myState = new State();
@Nullable
@Override
public State getState() {
return myState;
}
@Override
public void loadState(@NotNull State state) {
}
public static void cleanup() {
ServiceManager.getService(LegacyApplicationUsageTriggers.class);
ServiceManager.getService(LegacyUsageTrigger.class);
LegacyFUSApplicationUsageTrigger.cleanup();
}
public final static class State {
@Property(surroundWithTag = false)
@XCollection
List<String> groups = ContainerUtil.newSmartList();
}
public final static class CounterState {
@Property(surroundWithTag = false)
@XCollection
Map<String, Integer> counts = new HashMap<>();
}
@com.intellij.openapi.components.State(name = "UsageTrigger", storages = @Storage(
value = UsageStatisticsPersistenceComponent.USAGE_STATISTICS_XML, roamingType = RoamingType.DISABLED, deprecated = true)
)
private static class LegacyUsageTrigger implements PersistentStateComponent<LegacyApplicationUsageTriggers.CounterState> {
CounterState myState = new CounterState();
@Nullable
@Override
public CounterState getState() {
return myState;
}
@Override
public void loadState(@NotNull CounterState state) {
}
}
}
@@ -1,36 +0,0 @@
// 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.internal.statistic.service.fus.collectors;
import com.intellij.internal.statistic.persistence.UsageStatisticsPersistenceComponent;
import com.intellij.openapi.components.*;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.xmlb.annotations.Transient;
import org.jetbrains.annotations.NotNull;
import java.util.List;
@State(name = "FUSApplicationUsageTrigger",
storages = @Storage(value = UsageStatisticsPersistenceComponent.USAGE_STATISTICS_XML, roamingType = RoamingType.DISABLED, deprecated = true)
)
final public class LegacyFUSApplicationUsageTrigger implements PersistentStateComponent<LegacyFUSApplicationUsageTrigger.State> {
private final State myState = new State();
final static class State {
@Transient
List<String> sessions = ContainerUtil.newSmartList();
}
public static void cleanup() {
ServiceManager.getService(LegacyFUSApplicationUsageTrigger.class);
}
@Override
public State getState() {
return myState;
}
@Override
public void loadState(@NotNull final State state) {
}
}
@@ -11,7 +11,6 @@ import com.intellij.internal.statistic.eventLog.StatisticsEventLoggerProvider;
import com.intellij.internal.statistic.eventLog.validator.SensitiveDataValidator;
import com.intellij.internal.statistic.service.fus.collectors.FUStateUsagesLogger;
import com.intellij.internal.statistic.service.fus.collectors.FUStatisticsPersistence;
import com.intellij.internal.statistic.service.fus.collectors.LegacyApplicationUsageTriggers;
import com.intellij.internal.statistic.service.fus.collectors.LegacyFUSProjectUsageTrigger;
import com.intellij.internal.statistic.utils.StatisticsUploadAssistant;
import com.intellij.notification.impl.NotificationsConfigurationImpl;
@@ -129,7 +128,6 @@ public class StatisticsJobsScheduler implements ApplicationInitializedListener {
private static void runLegacyDataCleanupService() {
JobScheduler.getScheduler().schedule(() -> {
FUStatisticsPersistence.clearLegacyStates();
LegacyApplicationUsageTriggers.cleanup();
}, 1, TimeUnit.MINUTES);
}
@@ -220,18 +220,11 @@
serviceImplementation="com.intellij.openapi.roots.ui.FileAppearanceServiceImpl"/>
<projectService serviceImplementation="com.intellij.internal.statistic.service.fus.collectors.LegacyFUSProjectUsageTrigger"/>
<applicationService serviceImplementation="com.intellij.internal.statistic.service.fus.collectors.LegacyFUSApplicationUsageTrigger"/>
<applicationService serviceImplementation="com.intellij.internal.statistic.service.fus.collectors.LegacyApplicationUsageTriggers"/>
<applicationService serviceImplementation="com.intellij.internal.statistic.service.fus.collectors.LegacyApplicationUsageTriggers$LegacyUsageTrigger"/>
<applicationService serviceImplementation="com.intellij.internal.statistic.collectors.fus.ui.persistence.ToolbarClicksCollector"/>
<applicationService serviceImplementation="com.intellij.internal.statistic.collectors.fus.ui.persistence.ShortcutsCollector"/>
<applicationService serviceInterface="com.intellij.ide.actions.ActionsCollector"
serviceImplementation="com.intellij.internal.statistic.collectors.fus.actions.persistence.ActionsCollectorImpl"/>
<applicationService serviceImplementation="com.intellij.internal.statistic.collectors.fus.actions.persistence.MainMenuCollector"/>
<applicationService serviceImplementation="com.intellij.internal.statistic.collectors.fus.actions.persistence.IntentionsCollector"/>
<applicationService serviceImplementation="com.intellij.internal.statistic.collectors.fus.actions.persistence.ToolWindowCollector"/>
<applicationService serviceImplementation="com.intellij.internal.statistic.collectors.fus.actions.persistence.ToolWindowCollector$OutdatedToolWindowCollector"/>
<applicationService serviceInterface="com.intellij.internal.statistic.eventLog.FeatureUsageUiEvents"
serviceImplementation="com.intellij.internal.statistic.eventLog.fus.FeatureUsageUiEventsImpl"/>