Delete obsolete persistent component - MenuItemUpdateCollector

GitOrigin-RevId: 61f628aff2e1aa72f17150879182f82221baf5ff
This commit is contained in:
Svetlana.Zemlyanskaya
2019-08-02 15:03:24 +03:00
committed by intellij-monorepo-bot
parent 222e83e923
commit c47d883ba3
2 changed files with 5 additions and 70 deletions
@@ -1,70 +0,0 @@
// 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.openapi.actionSystem.impl;
import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.AnAction;
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 org.jetbrains.annotations.Nullable;
import java.util.HashMap;
import java.util.Map;
@State(
name = "ActionMenuItemUpdateCollector",
storages = {
@Storage(value = "menu.item.text.update.xml", roamingType = RoamingType.DISABLED)
}
)
public class ActionMenuItemUpdateCollector implements PersistentStateComponent<ActionMenuItemUpdateCollector.State> {
private State state = new State();
private final Map<String, Map<String, Integer>> myLocalState = new HashMap<>();
public ActionMenuItemUpdateCollector() {
}
public <T> void record(@NotNull AnAction action, @NotNull String place, @NotNull String sourceKey) {
String actionId = ActionManager.getInstance().getId(action);
State state = getState();
if (state == null) return;
String key = place + "@" + (actionId != null ? actionId : action.toString());
Map<String, Integer> sourceIntegerMap = myLocalState.computeIfAbsent(sourceKey, k -> new HashMap<>());
final Integer count = sourceIntegerMap.get(key);
int value = count == null ? 1 : count + 1;
sourceIntegerMap.put(key, value);
final Integer stateCount = state.myValues.get(key);
if (stateCount == null || stateCount < value) {
state.myValues.put(key, value);
}
}
@Nullable
@Override
public State getState() {
return state;
}
@Override
public void loadState(@NotNull State state) {
this.state = state;
}
public static ActionMenuItemUpdateCollector getInstance() {
return ServiceManager.getService(ActionMenuItemUpdateCollector.class);
}
public final static class State {
@Tag("counts")
@MapAnnotation(surroundWithTag = false, keyAttributeName = "actionItem", valueAttributeName = "count")
public Map<String, Integer> myValues = new HashMap<>();
}
}
@@ -649,6 +649,11 @@
<postStartupActivity implementation="com.intellij.diagnostic.AnalyzePendingSnapshotActivity"/>
<obsoleteStorage file="menu.item.text.update.xml">
<components>
<component>ActionMenuItemUpdateCollector</component>
</components>
</obsoleteStorage>
<obsoleteStorage file="statistics.toolbar.clicks.xml">
<components>
<component>ToolbarClicksCollector</component>