diff --git a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionMenuItemUpdateCollector.java b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionMenuItemUpdateCollector.java deleted file mode 100644 index f3554f58d91c..000000000000 --- a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionMenuItemUpdateCollector.java +++ /dev/null @@ -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 { - private State state = new State(); - private final Map> myLocalState = new HashMap<>(); - - public ActionMenuItemUpdateCollector() { - } - - public 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 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 myValues = new HashMap<>(); - } -} diff --git a/platform/platform-resources/src/META-INF/PlatformExtensions.xml b/platform/platform-resources/src/META-INF/PlatformExtensions.xml index 483ae81c5d7f..d5fb8b0c6b5e 100644 --- a/platform/platform-resources/src/META-INF/PlatformExtensions.xml +++ b/platform/platform-resources/src/META-INF/PlatformExtensions.xml @@ -649,6 +649,11 @@ + + + ActionMenuItemUpdateCollector + + ToolbarClicksCollector