mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-03-01 13:46:02 +01:00
Add ActionTracker statistic
This commit is contained in:
parent
1343c7603b
commit
b17bc1bb3e
src/main/java/com/maddyhome/idea/vim
@ -42,6 +42,7 @@ import com.maddyhome.idea.vim.VimPlugin
|
||||
import com.maddyhome.idea.vim.helper.MessageHelper
|
||||
import com.maddyhome.idea.vim.key.ShortcutOwner
|
||||
import com.maddyhome.idea.vim.key.ShortcutOwnerInfo
|
||||
import com.maddyhome.idea.vim.statistic.ActionTracker
|
||||
import com.maddyhome.idea.vim.ui.VimEmulationConfigurable
|
||||
import com.maddyhome.idea.vim.vimscript.services.OptionConstants
|
||||
import com.maddyhome.idea.vim.vimscript.services.OptionService
|
||||
@ -211,11 +212,18 @@ class NotificationService(private val project: Project?) {
|
||||
|
||||
it.notify(project)
|
||||
}
|
||||
|
||||
if (id != null) {
|
||||
ActionTracker.logTrackedAction(id)
|
||||
}
|
||||
}
|
||||
|
||||
class CopyActionId(val id: String?, val project: Project?) : DumbAwareAction(MessageHelper.message("action.copy.action.id.text")) {
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
CopyPasteManager.getInstance().setContents(StringSelection(id ?: ""))
|
||||
if (id != null) {
|
||||
ActionTracker.logCopiedAction(id)
|
||||
}
|
||||
notification?.expire()
|
||||
|
||||
val content = if (id == null) "No action id" else "Action id copied: $id"
|
||||
|
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.maddyhome.idea.vim.statistic
|
||||
|
||||
import com.intellij.internal.statistic.eventLog.EventLogGroup
|
||||
import com.intellij.internal.statistic.eventLog.events.EventFields
|
||||
import com.intellij.internal.statistic.service.fus.collectors.CounterUsagesCollector
|
||||
import com.intellij.openapi.actionSystem.ActionManager
|
||||
|
||||
internal class ActionTracker : CounterUsagesCollector() {
|
||||
companion object {
|
||||
private val actions = ActionManager.getInstance().getActionIdList("")
|
||||
|
||||
private val GROUP = EventLogGroup("vim.actions", 1)
|
||||
private val TRACKED_ACTIONS = GROUP.registerEvent("tracked", EventFields.String("action_id", actions))
|
||||
private val COPIED_ACTIONS = GROUP.registerEvent("copied", EventFields.String("action_id", actions))
|
||||
|
||||
fun logTrackedAction(actionId: String) {
|
||||
TRACKED_ACTIONS.log(actionId)
|
||||
}
|
||||
|
||||
fun logCopiedAction(actionId: String) {
|
||||
COPIED_ACTIONS.log(actionId)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getGroup(): EventLogGroup = GROUP
|
||||
}
|
Loading…
Reference in New Issue
Block a user