diff --git a/images/src/META-INF/ImagesPlugin.xml b/images/src/META-INF/ImagesPlugin.xml index 6e1da5317999..35020fd46be4 100644 --- a/images/src/META-INF/ImagesPlugin.xml +++ b/images/src/META-INF/ImagesPlugin.xml @@ -24,7 +24,6 @@ - diff --git a/images/src/org/intellij/images/statistics/BackgroundImagesUsageCollector.java b/images/src/org/intellij/images/statistics/BackgroundImagesUsageCollector.java deleted file mode 100644 index 08b55151189b..000000000000 --- a/images/src/org/intellij/images/statistics/BackgroundImagesUsageCollector.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2000-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.intellij.images.statistics; - -import com.intellij.internal.statistic.AbstractProjectsUsagesCollector; -import com.intellij.internal.statistic.CollectUsagesException; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.text.StringUtil; -import com.intellij.util.containers.ContainerUtil; -import com.intellij.util.containers.JBIterable; -import org.jetbrains.annotations.NotNull; - -import java.util.Collections; -import java.util.Set; - -import static com.intellij.openapi.wm.impl.IdeBackgroundUtil.*; - -/** - * @author gregsh - */ -public class BackgroundImagesUsageCollector extends AbstractProjectsUsagesCollector { - private static final UsageDescriptor EDITOR = new UsageDescriptor("editor"); - private static final UsageDescriptor FRAME = new UsageDescriptor("frame"); - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GroupDescriptor.create("images.ide.background"); - } - - @NotNull - @Override - protected Set mergeUsagesPostProcess(@NotNull Set usagesFromAllProjects) { - JBIterable itt = JBIterable.from(usagesFromAllProjects); - return usageSet(itt.find(o -> EDITOR.getKey().equals(o.getKey())) != null, - itt.find(o -> FRAME.getKey().equals(o.getKey())) != null); - } - - @NotNull - @Override - public Set getProjectUsages(@NotNull Project project) throws CollectUsagesException { - return usageSet(StringUtil.isNotEmpty(getBackgroundSpec(project, EDITOR_PROP)), - StringUtil.isNotEmpty(getBackgroundSpec(project, FRAME_PROP))); - } - - @NotNull - private static Set usageSet(boolean editor, boolean frame) { - if (!editor && !frame) return Collections.emptySet(); - if (editor && frame) return ContainerUtil.newHashSet(EDITOR, FRAME); - return Collections.singleton(editor ? EDITOR : FRAME); - } -} diff --git a/java/compiler/impl/src/com/intellij/compiler/CompilerSettingsUsageCollector.java b/java/compiler/impl/src/com/intellij/compiler/CompilerSettingsUsageCollector.java deleted file mode 100644 index 814e1a716de4..000000000000 --- a/java/compiler/impl/src/com/intellij/compiler/CompilerSettingsUsageCollector.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2000-2013 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.compiler; - -import com.intellij.internal.statistic.AbstractProjectsUsagesCollector; -import com.intellij.internal.statistic.CollectUsagesException; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.openapi.project.Project; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.HashSet; -import java.util.Set; - -/** - * @author Eugene Zhuravlev - */ -public class CompilerSettingsUsageCollector extends AbstractProjectsUsagesCollector { - public static final String GROUP_ID = "compiler"; - - @NotNull - @Override - public Set getProjectUsages(@Nullable Project project) throws CollectUsagesException { - final CompilerWorkspaceConfiguration wsConfig = CompilerWorkspaceConfiguration.getInstance(project); - - final Set result = new HashSet<>(); - if (wsConfig.MAKE_PROJECT_ON_SAVE) { - result.add(new UsageDescriptor("auto_make", 1)); - } - if (wsConfig.PARALLEL_COMPILATION) { - result.add(new UsageDescriptor("compile_parallel", 1)); - } - - return result; - } - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GroupDescriptor.create(GROUP_ID); - } -} diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/HotSwapUIImpl.java b/java/debugger/impl/src/com/intellij/debugger/ui/HotSwapUIImpl.java index f8694573a4e0..84ea1e2049b0 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/HotSwapUIImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/HotSwapUIImpl.java @@ -12,7 +12,6 @@ import com.intellij.debugger.impl.DebuggerSession; import com.intellij.debugger.impl.HotSwapFile; import com.intellij.debugger.impl.HotSwapManager; import com.intellij.debugger.settings.DebuggerSettings; -import com.intellij.internal.statistic.UsageTrigger; import com.intellij.notification.NotificationType; import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; @@ -267,7 +266,6 @@ public class HotSwapUIImpl extends HotSwapUI { private static void reloadModifiedClasses(final Map> modifiedClasses, final HotSwapProgressImpl progress) { - UsageTrigger.trigger("debugger.reload.classes"); ProgressManager.getInstance().runProcess(() -> { HotSwapManager.reloadModifiedClasses(modifiedClasses, progress); progress.finished(); diff --git a/java/execution/impl/src/com/intellij/testIntegration/ShowRecentTests.java b/java/execution/impl/src/com/intellij/testIntegration/ShowRecentTests.java index ba825b0fac65..c9d04557074d 100644 --- a/java/execution/impl/src/com/intellij/testIntegration/ShowRecentTests.java +++ b/java/execution/impl/src/com/intellij/testIntegration/ShowRecentTests.java @@ -16,7 +16,6 @@ package com.intellij.testIntegration; import com.intellij.execution.TestStateStorage; -import com.intellij.internal.statistic.UsageTrigger; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.application.ApplicationManager; @@ -46,8 +45,6 @@ public class ShowRecentTests extends AnAction { final Project project = e.getProject(); if (project == null) return; - UsageTrigger.trigger(ID); - final TestStateStorage testStorage = TestStateStorage.getInstance(project); final TestLocator testLocator = new TestLocator(project); final RecentTestRunnerImpl testRunner = new RecentTestRunnerImpl(testLocator); diff --git a/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectCategoryUsagesCollector.java b/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectCategoryUsagesCollector.java deleted file mode 100644 index c65f6852282b..000000000000 --- a/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectCategoryUsagesCollector.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2000-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.ide.projectWizard; - -import com.intellij.internal.statistic.CollectUsagesException; -import com.intellij.internal.statistic.UsagesCollector; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.openapi.components.ServiceManager; -import com.intellij.util.containers.ContainerUtil; -import com.intellij.util.containers.hash.HashSet; -import org.jetbrains.annotations.NotNull; - -import java.util.Map; -import java.util.Set; - -/** - * @author Dmitry Avdeev - */ -public class ProjectCategoryUsagesCollector extends UsagesCollector { - - private final Map myUsageDescriptors = ContainerUtil.newHashMap(); - - public static void projectTypeUsed(@NotNull String projectTypeId) { - String key = "project.category." + projectTypeId; - UsageDescriptor descriptor = getUsageDescriptors().get(key); - - getUsageDescriptors().put(key, new UsageDescriptor(key, descriptor == null? 1: descriptor.getValue()+1)); - } - - @NotNull - @Override - public Set getUsages() throws CollectUsagesException { - HashSet descriptors = new HashSet<>(); - descriptors.addAll(getUsageDescriptors().values()); - getUsageDescriptors().clear(); - return descriptors; - } - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GroupDescriptor.create("Project Category"); - } - - private static Map getUsageDescriptors() { - return ServiceManager.getService(ProjectCategoryUsagesCollector.class).myUsageDescriptors; - } -} diff --git a/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectTypeStep.java b/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectTypeStep.java index ee5801d880af..e034d9616052 100644 --- a/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectTypeStep.java +++ b/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectTypeStep.java @@ -510,10 +510,6 @@ public class ProjectTypeStep extends ModuleWizardStep implements SettingsStep, D throw new CommitStepException(null); } } - TemplatesGroup group = getSelectedGroup(); - if (group != null) { - ProjectCategoryUsagesCollector.projectTypeUsed(group.getId()); - } } @Override diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraries/impl/LibraryUsageCollector.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraries/impl/LibraryUsageCollector.java deleted file mode 100644 index 7ed67f592fb9..000000000000 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraries/impl/LibraryUsageCollector.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2000-2012 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.openapi.roots.ui.configuration.libraries.impl; - -import com.intellij.internal.statistic.AbstractProjectsUsagesCollector; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.openapi.module.Module; -import com.intellij.openapi.module.ModuleManager; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.roots.ModuleRootManager; -import com.intellij.openapi.roots.libraries.Library; -import com.intellij.openapi.roots.libraries.LibraryKind; -import com.intellij.util.Processor; -import org.jetbrains.annotations.NonNls; -import org.jetbrains.annotations.NotNull; - -import java.util.HashSet; -import java.util.Set; - -/** - * @author nik - */ -public class LibraryUsageCollector extends AbstractProjectsUsagesCollector { - - @NonNls private static final String GROUP_ID = "libraries"; - - @NotNull - @Override - public Set getProjectUsages(@NotNull Project project) { - final Set usedKinds = new HashSet<>(); - final Processor processor = library -> { - usedKinds.addAll(LibraryPresentationManagerImpl.getLibraryKinds(library, null)); - return true; - }; - for (Module module : ModuleManager.getInstance(project).getModules()) { - ModuleRootManager.getInstance(module).orderEntries().librariesOnly().forEachLibrary(processor); - } - - final HashSet usageDescriptors = new HashSet<>(); - for (LibraryKind kind : usedKinds) { - usageDescriptors.add(new UsageDescriptor(kind.getKindId(), 1)); - } - return usageDescriptors; - } - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GroupDescriptor.create(GROUP_ID); } -} diff --git a/java/java-impl/src/META-INF/JavaPlugin.xml b/java/java-impl/src/META-INF/JavaPlugin.xml index 3be6bbb41ad7..022602f2f592 100644 --- a/java/java-impl/src/META-INF/JavaPlugin.xml +++ b/java/java-impl/src/META-INF/JavaPlugin.xml @@ -327,7 +327,6 @@ - diff --git a/java/java-impl/src/META-INF/libraryJarUsage.xml b/java/java-impl/src/META-INF/libraryJarUsage.xml index 105d6f37303b..0192efe1b571 100644 --- a/java/java-impl/src/META-INF/libraryJarUsage.xml +++ b/java/java-impl/src/META-INF/libraryJarUsage.xml @@ -1,6 +1,5 @@ - diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/JavaMethodOverloadSwitchHandler.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/JavaMethodOverloadSwitchHandler.java index 94fb628dc7d8..12267a30323b 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/JavaMethodOverloadSwitchHandler.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/JavaMethodOverloadSwitchHandler.java @@ -6,7 +6,6 @@ import com.intellij.codeInsight.completion.CompletionMemory; import com.intellij.codeInsight.completion.JavaMethodCallElement; import com.intellij.codeInsight.hint.ParameterInfoController; import com.intellij.codeInsight.hints.ParameterHintsPass; -import com.intellij.internal.statistic.UsageTrigger; import com.intellij.openapi.actionSystem.CommonDataKeys; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.application.WriteAction; @@ -114,8 +113,6 @@ class JavaMethodOverloadSwitchHandler extends EditorActionHandler { } } - UsageTrigger.trigger("method.overload.switch"); - final PsiMethod targetMethod = (PsiMethod)((CandidateInfo)objects[(currentIndex + (mySwitchUp ? -1 : 1) + objects.length) % objects.length]).getElement(); PsiParameterList parameterList = targetMethod.getParameterList(); diff --git a/java/java-impl/src/com/intellij/internal/statistic/libraryJar/LibraryJarUsagesCollector.java b/java/java-impl/src/com/intellij/internal/statistic/libraryJar/LibraryJarUsagesCollector.java deleted file mode 100644 index d539c6aa9543..000000000000 --- a/java/java-impl/src/com/intellij/internal/statistic/libraryJar/LibraryJarUsagesCollector.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.internal.statistic.libraryJar; - -import com.intellij.internal.statistic.AbstractProjectsUsagesCollector; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.io.JarUtil; -import com.intellij.openapi.util.text.StringUtil; -import com.intellij.openapi.vfs.JarFileSystem; -import com.intellij.openapi.vfs.VfsUtilCore; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.psi.JavaPsiFacade; -import com.intellij.psi.PsiClass; -import com.intellij.psi.search.ProjectScope; -import com.intellij.util.containers.hash.HashSet; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.Set; -import java.util.jar.Attributes; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * @author Ivan Chirkov - * @Deprecated // To be removed in 2018.1. See {@link FUSLibraryJarUsagesCollector} - */ -public class LibraryJarUsagesCollector extends AbstractProjectsUsagesCollector { - private static final GroupDescriptor GROUP = GroupDescriptor.create("Libraries by jars", GroupDescriptor.LOWER_PRIORITY); - - private static final String DIGIT_VERSION_PATTERN_PART = "(\\d+.\\d+|\\d+)"; - private static final Pattern JAR_FILE_NAME_PATTERN = Pattern.compile("[\\w|\\-|\\.]+-(" + DIGIT_VERSION_PATTERN_PART + "[\\w|\\.]*)jar"); - - @NotNull - @Override - public Set getProjectUsages(@NotNull Project project) { - LibraryJarDescriptor[] descriptors = LibraryJarStatisticsService.getInstance().getTechnologyDescriptors(); - Set result = new HashSet<>(descriptors.length); - - ApplicationManager.getApplication().runReadAction(() -> { - for (LibraryJarDescriptor descriptor : descriptors) { - String className = descriptor.myClass; - if (className == null) continue; - - PsiClass[] psiClasses = JavaPsiFacade.getInstance(project).findClasses(className, ProjectScope.getLibrariesScope(project)); - for (PsiClass psiClass : psiClasses) { - VirtualFile jarFile = JarFileSystem.getInstance().getVirtualFileForJar(psiClass.getContainingFile().getVirtualFile()); - if (jarFile != null) { - String version = getVersionByJarManifest(jarFile); - if (version == null) { - version = getVersionByJarFileName(jarFile.getName()); - } - if (version != null && StringUtil.containsChar(version, '.')) { - result.add(new UsageDescriptor(descriptor.myName + "_" + version, 1)); - } - } - } - } - }); - - return result; - } - - @Nullable - private static String getVersionByJarManifest(@NotNull VirtualFile file) { - return JarUtil.getJarAttribute(VfsUtilCore.virtualToIoFile(file), Attributes.Name.IMPLEMENTATION_VERSION); - } - - @Nullable - private static String getVersionByJarFileName(@NotNull String fileName) { - Matcher fileNameMatcher = JAR_FILE_NAME_PATTERN.matcher(fileName); - if (!fileNameMatcher.matches()) return null; - - return StringUtil.trimTrailing(fileNameMatcher.group(1), '.'); - } - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GROUP; - } -} \ No newline at end of file diff --git a/java/java-impl/src/com/intellij/openapi/roots/impl/LanguageLevelUsagesCollector.java b/java/java-impl/src/com/intellij/openapi/roots/impl/LanguageLevelUsagesCollector.java deleted file mode 100644 index 3060a280ba9c..000000000000 --- a/java/java-impl/src/com/intellij/openapi/roots/impl/LanguageLevelUsagesCollector.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2000-2012 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.openapi.roots.impl; - -import com.intellij.internal.statistic.AbstractProjectsUsagesCollector; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.openapi.module.Module; -import com.intellij.openapi.module.ModuleManager; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.roots.LanguageLevelModuleExtension; -import com.intellij.openapi.roots.LanguageLevelModuleExtensionImpl; -import com.intellij.openapi.roots.LanguageLevelProjectExtension; -import com.intellij.pom.java.LanguageLevel; -import com.intellij.util.containers.ContainerUtil; -import org.jetbrains.annotations.NotNull; - -import java.util.HashSet; -import java.util.Set; - -public class LanguageLevelUsagesCollector extends AbstractProjectsUsagesCollector { - public static final String GROUP_ID = "module-language-level"; - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GroupDescriptor.create(GROUP_ID, GroupDescriptor.HIGHER_PRIORITY); - } - - @NotNull - public Set getProjectUsages(@NotNull Project project) { - final Set languageLevels = new HashSet<>(); - for (Module module : ModuleManager.getInstance(project).getModules()) { - final LanguageLevelModuleExtension instance = LanguageLevelModuleExtensionImpl.getInstance(module); - final LanguageLevel languageLevel = instance.getLanguageLevel(); - if (languageLevel != null) { - languageLevels.add(languageLevel.toString()); - } - else { - languageLevels.add(LanguageLevelProjectExtension.getInstance(project).getLanguageLevel().toString()); - } - } - - return ContainerUtil.map2Set(languageLevels, languageLevel -> new UsageDescriptor(languageLevel, 1)); - } -} diff --git a/platform/diff-impl/src/com/intellij/diff/actions/impl/OpenInEditorWithMouseAction.java b/platform/diff-impl/src/com/intellij/diff/actions/impl/OpenInEditorWithMouseAction.java index 7c8d4582642a..186a8f80bf01 100644 --- a/platform/diff-impl/src/com/intellij/diff/actions/impl/OpenInEditorWithMouseAction.java +++ b/platform/diff-impl/src/com/intellij/diff/actions/impl/OpenInEditorWithMouseAction.java @@ -15,7 +15,6 @@ */ package com.intellij.diff.actions.impl; -import com.intellij.internal.statistic.UsageTrigger; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.event.EditorMouseEventArea; @@ -99,7 +98,6 @@ public abstract class OpenInEditorWithMouseAction extends AnAction implements Du @Override public void actionPerformed(@NotNull AnActionEvent e) { - UsageTrigger.trigger("diff.OpenInEditor.Mouse"); MouseEvent inputEvent = (MouseEvent)e.getInputEvent(); OpenInEditorAction openInEditorAction = e.getRequiredData(OpenInEditorAction.KEY); diff --git a/platform/diff-impl/src/com/intellij/diff/impl/DiffRequestProcessor.java b/platform/diff-impl/src/com/intellij/diff/impl/DiffRequestProcessor.java index 5a7159623626..79bdc660c4d8 100644 --- a/platform/diff-impl/src/com/intellij/diff/impl/DiffRequestProcessor.java +++ b/platform/diff-impl/src/com/intellij/diff/impl/DiffRequestProcessor.java @@ -33,8 +33,6 @@ import com.intellij.diff.util.DiffUserDataKeysEx.ScrollToPolicy; import com.intellij.diff.util.DiffUtil; import com.intellij.diff.util.LineRange; import com.intellij.ide.impl.DataManagerImpl; -import com.intellij.internal.statistic.UsageTrigger; -import com.intellij.internal.statistic.beans.ConvertUsagesUtil; import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.actionSystem.ex.ActionUtil; @@ -601,7 +599,6 @@ public abstract class DiffRequestProcessor implements Disposable { public void actionPerformed(@NotNull AnActionEvent e) { if (myState.getActiveTool() == myDiffTool) return; - UsageTrigger.trigger("diff.DiffSettings.Tool." + ConvertUsagesUtil.ensureProperKey(myDiffTool.getName())); moveToolOnTop(myDiffTool); updateRequest(true); diff --git a/platform/diff-impl/src/com/intellij/diff/tools/dir/DirDiffTool.java b/platform/diff-impl/src/com/intellij/diff/tools/dir/DirDiffTool.java index c7df8680e6cc..26753937089e 100644 --- a/platform/diff-impl/src/com/intellij/diff/tools/dir/DirDiffTool.java +++ b/platform/diff-impl/src/com/intellij/diff/tools/dir/DirDiffTool.java @@ -24,7 +24,6 @@ import com.intellij.diff.requests.DiffRequest; import com.intellij.diff.tools.binary.BinaryDiffTool; import com.intellij.ide.diff.DiffElement; import com.intellij.ide.diff.DirDiffSettings; -import com.intellij.internal.statistic.UsageTrigger; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -37,7 +36,6 @@ public class DirDiffTool implements FrameDiffTool, SuppressiveDiffTool { @NotNull @Override public DiffViewer createComponent(@NotNull DiffContext context, @NotNull DiffRequest request) { - UsageTrigger.trigger("diff.DirDiffViewer"); return createViewer(context, (ContentDiffRequest)request); } diff --git a/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffChange.java b/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffChange.java index 14c27f78a898..c5337172b4c9 100644 --- a/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffChange.java +++ b/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffChange.java @@ -18,7 +18,6 @@ package com.intellij.diff.tools.simple; import com.intellij.diff.fragments.DiffFragment; import com.intellij.diff.fragments.LineFragment; import com.intellij.diff.util.*; -import com.intellij.internal.statistic.UsageTrigger; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; @@ -317,7 +316,6 @@ public class SimpleDiffChange { @Nullable private GutterIconRenderer createAppendRenderer(@NotNull final Side side) { return createIconRenderer(side, "Append", DiffUtil.getArrowDownIcon(side), () -> { - UsageTrigger.trigger("diff.SimpleDiffChange.Append"); myViewer.appendChange(this, side); }); } diff --git a/platform/diff-impl/src/com/intellij/diff/tools/util/base/TextDiffViewerUtil.java b/platform/diff-impl/src/com/intellij/diff/tools/util/base/TextDiffViewerUtil.java index 70860fbb06eb..a6c5173b2167 100644 --- a/platform/diff-impl/src/com/intellij/diff/tools/util/base/TextDiffViewerUtil.java +++ b/platform/diff-impl/src/com/intellij/diff/tools/util/base/TextDiffViewerUtil.java @@ -26,7 +26,6 @@ import com.intellij.diff.util.DiffUserDataKeys; import com.intellij.diff.util.DiffUserDataKeysEx; import com.intellij.diff.util.DiffUtil; import com.intellij.icons.AllIcons; -import com.intellij.internal.statistic.UsageTrigger; import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.actionSystem.ex.ComboBoxAction; @@ -270,7 +269,6 @@ public class TextDiffViewerUtil { @Override protected void setValue(@NotNull HighlightPolicy option) { if (getValue() == option) return; - UsageTrigger.trigger("diff.TextDiffSettings.HighlightPolicy." + option.name()); mySettings.setHighlightPolicy(option); } @@ -311,7 +309,6 @@ public class TextDiffViewerUtil { @Override protected void setValue(@NotNull IgnorePolicy option) { if (getValue() == option) return; - UsageTrigger.trigger("diff.TextDiffSettings.IgnorePolicy." + option.name()); mySettings.setIgnorePolicy(option); } diff --git a/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/DirDiffTableModel.java b/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/DirDiffTableModel.java index 553b0f13796a..3b00f2341627 100644 --- a/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/DirDiffTableModel.java +++ b/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/DirDiffTableModel.java @@ -7,7 +7,6 @@ import com.intellij.CommonBundle; import com.intellij.diff.DiffRequestFactory; import com.intellij.ide.IdeBundle; import com.intellij.ide.diff.*; -import com.intellij.internal.statistic.UsageTrigger; import com.intellij.openapi.Disposable; import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; @@ -84,7 +83,6 @@ public class DirDiffTableModel extends AbstractTableModel implements DirDiffMode private volatile boolean myDisposed; public DirDiffTableModel(@Nullable Project project, DiffElement source, DiffElement target, DirDiffSettings settings) { - UsageTrigger.trigger("diff.DirDiffTableModel"); myProject = project; mySettings = settings; mySource = source; diff --git a/platform/lang-impl/src/com/intellij/execution/ProgramRunnerUtil.java b/platform/lang-impl/src/com/intellij/execution/ProgramRunnerUtil.java index 85e852e59027..a8fc2ef31aa4 100644 --- a/platform/lang-impl/src/com/intellij/execution/ProgramRunnerUtil.java +++ b/platform/lang-impl/src/com/intellij/execution/ProgramRunnerUtil.java @@ -11,8 +11,6 @@ import com.intellij.execution.runners.ExecutionEnvironmentBuilder; import com.intellij.execution.runners.ExecutionUtil; import com.intellij.execution.runners.ProgramRunner; import com.intellij.icons.AllIcons; -import com.intellij.internal.statistic.UsageTrigger; -import com.intellij.internal.statistic.beans.ConvertUsagesUtil; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.options.ex.SingleConfigurableEditor; import com.intellij.openapi.project.DumbService; @@ -81,8 +79,6 @@ public class ProgramRunnerUtil { } } } - - UsageTrigger.trigger("execute." + ConvertUsagesUtil.ensureProperKey(runnerAndConfigurationSettings.getType().getId()) + "." + environment.getExecutor().getId()); } try { diff --git a/platform/lang-impl/src/com/intellij/facet/impl/statistics/FrameworkUsagesCollector.java b/platform/lang-impl/src/com/intellij/facet/impl/statistics/FrameworkUsagesCollector.java deleted file mode 100644 index 87ccca136cd0..000000000000 --- a/platform/lang-impl/src/com/intellij/facet/impl/statistics/FrameworkUsagesCollector.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2000-2010 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.facet.impl.statistics; - -import com.intellij.facet.Facet; -import com.intellij.facet.FacetManager; -import com.intellij.internal.statistic.AbstractProjectsUsagesCollector; -import com.intellij.openapi.module.Module; -import com.intellij.openapi.module.ModuleManager; -import com.intellij.openapi.project.Project; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.util.containers.ContainerUtil; -import org.jetbrains.annotations.NotNull; - -import java.util.HashSet; -import java.util.Set; - -public class FrameworkUsagesCollector extends AbstractProjectsUsagesCollector { - public static final String GROUP_ID = "frameworks"; - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GroupDescriptor.create(GROUP_ID, GroupDescriptor.HIGHER_PRIORITY); - } - - - @Override - @NotNull - public Set getProjectUsages(@NotNull Project project) { - final Set facets = new HashSet<>(); - for (Module module : ModuleManager.getInstance(project).getModules()) { - for (Facet facet : FacetManager.getInstance(module).getAllFacets()) { - facets.add(facet.getType().getStringId()); - } - } - - return ContainerUtil.map2Set(facets, facet -> new UsageDescriptor(facet, 1)); - } -} diff --git a/platform/lang-impl/src/com/intellij/facet/impl/statistics/ModuleTypeUsagesCollector.java b/platform/lang-impl/src/com/intellij/facet/impl/statistics/ModuleTypeUsagesCollector.java deleted file mode 100644 index 5828aae24a3a..000000000000 --- a/platform/lang-impl/src/com/intellij/facet/impl/statistics/ModuleTypeUsagesCollector.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2000-2010 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.facet.impl.statistics; - -import com.intellij.internal.statistic.AbstractProjectsUsagesCollector; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.openapi.module.Module; -import com.intellij.openapi.module.ModuleManager; -import com.intellij.openapi.module.ModuleType; -import com.intellij.openapi.project.Project; -import com.intellij.util.containers.ContainerUtil; -import org.jetbrains.annotations.NotNull; - -import java.util.HashSet; -import java.util.Set; - -public class ModuleTypeUsagesCollector extends AbstractProjectsUsagesCollector { - public static final String GROUP_ID = "module type"; - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GroupDescriptor.create(GROUP_ID, GroupDescriptor.HIGHER_PRIORITY); - } - - - @Override - @NotNull - public Set getProjectUsages(@NotNull Project project) { - Set modulesTypes = new HashSet<>(); - for (Module module : ModuleManager.getInstance(project).getModules()) { - modulesTypes.add(ModuleType.get(module).getId()); - } - return ContainerUtil.map2Set(modulesTypes, moduleType -> new UsageDescriptor(moduleType, 1)); - } -} diff --git a/platform/lang-impl/src/com/intellij/formatting/contextConfiguration/ConfigureCodeStyleOnSelectedFragment.java b/platform/lang-impl/src/com/intellij/formatting/contextConfiguration/ConfigureCodeStyleOnSelectedFragment.java index 82cf5f319700..a3ae79e09cd3 100644 --- a/platform/lang-impl/src/com/intellij/formatting/contextConfiguration/ConfigureCodeStyleOnSelectedFragment.java +++ b/platform/lang-impl/src/com/intellij/formatting/contextConfiguration/ConfigureCodeStyleOnSelectedFragment.java @@ -18,7 +18,6 @@ package com.intellij.formatting.contextConfiguration; import com.intellij.application.options.CodeStyle; import com.intellij.codeInsight.CodeInsightBundle; import com.intellij.codeInsight.intention.IntentionAction; -import com.intellij.internal.statistic.UsageTrigger; import com.intellij.lang.Language; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Document; @@ -81,7 +80,6 @@ public class ConfigureCodeStyleOnSelectedFragment implements IntentionAction { @Override public void invoke(@NotNull final Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException { - UsageTrigger.trigger(ID); SelectedTextFormatter textFormatter = new SelectedTextFormatter(project, editor, file); CodeStyleSettingsToShow settingsToShow = calculateAffectingSettings(editor, file); CodeStyleSettings settings = CodeStyle.getSettings(file); diff --git a/platform/lang-impl/src/com/intellij/ide/actions/CreateFileAction.java b/platform/lang-impl/src/com/intellij/ide/actions/CreateFileAction.java index b5f1932e7ae2..804f04f66494 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/CreateFileAction.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/CreateFileAction.java @@ -18,7 +18,6 @@ package com.intellij.ide.actions; import com.intellij.icons.AllIcons; import com.intellij.ide.IdeBundle; -import com.intellij.internal.statistic.UsageTrigger; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.WriteAction; import com.intellij.openapi.fileTypes.FileTypeManager; @@ -219,7 +218,6 @@ public class CreateFileAction extends CreateElementActionBase implements DumbAwa @Override public PsiElement[] create(String newName) throws Exception { - UsageTrigger.trigger("CreateFile." + CreateFileAction.this.getClass().getSimpleName()); return super.create(newName); } diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java index 610ab09aaf5e..f497c2ac51c0 100644 --- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java +++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java @@ -549,9 +549,6 @@ public class ProjectViewImpl extends ProjectView implements PersistentStateCompo if (newPane == null) return; newPane.setSubId(subId); showPane(newPane); - if (fromContentManager) { - ProjectViewStatistics.recordProjectViewPaneUsage(myCurrentViewId, myCurrentViewSubId); - } ProjectViewSelectInTarget target = getProjectViewSelectInTarget(newPane); if (target != null) target.setSubId(subId); if (isAutoscrollFromSource(id)) { diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/statistics.kt b/platform/lang-impl/src/com/intellij/ide/projectView/impl/statistics.kt deleted file mode 100644 index 16699f60b2cc..000000000000 --- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/statistics.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -@file:JvmName("ProjectViewStatistics") - -package com.intellij.ide.projectView.impl - -import com.intellij.internal.statistic.UsageTrigger -import com.intellij.internal.statistic.beans.ConvertUsagesUtil.ensureProperKey - -private val prefix = "project.view.pane" - -internal fun recordProjectViewPaneUsage(id: String?, subId: String?) { - if (id == null) return - val featureString = if (subId == null) "$prefix.$id" else "$prefix.$id.$subId" - val key = ensureProperKey(featureString) - UsageTrigger.trigger(key) -} diff --git a/platform/lang-impl/src/com/intellij/ide/util/projectWizard/AbstractNewProjectStep.java b/platform/lang-impl/src/com/intellij/ide/util/projectWizard/AbstractNewProjectStep.java index 7b661963c998..92d0f7e9f821 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/projectWizard/AbstractNewProjectStep.java +++ b/platform/lang-impl/src/com/intellij/ide/util/projectWizard/AbstractNewProjectStep.java @@ -18,7 +18,6 @@ package com.intellij.ide.util.projectWizard; import com.intellij.ide.RecentProjectsManager; import com.intellij.ide.util.projectWizard.actions.ProjectSpecificAction; import com.intellij.idea.ActionsBundle; -import com.intellij.internal.statistic.UsageTrigger; import com.intellij.internal.statistic.beans.ConvertUsagesUtil; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.DefaultActionGroup; @@ -202,7 +201,6 @@ public class AbstractNewProjectStep extends DefaultActionGroup implements Dum } String generatorName = generator == null ? "empty" : ConvertUsagesUtil.ensureProperKey(generator.getName()); - UsageTrigger.trigger("AbstractNewProjectStep." + generatorName); RecentProjectsManager.getInstance().setLastProjectCreationLocation(PathUtil.toSystemIndependentName(location.getParent())); diff --git a/platform/lang-impl/src/com/intellij/internal/statistic/editor/LegacyEditorSettingsStatisticsCollector.java b/platform/lang-impl/src/com/intellij/internal/statistic/editor/LegacyEditorSettingsStatisticsCollector.java deleted file mode 100644 index 6fe70ef9af53..000000000000 --- a/platform/lang-impl/src/com/intellij/internal/statistic/editor/LegacyEditorSettingsStatisticsCollector.java +++ /dev/null @@ -1,157 +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.internal.statistic.editor; - -import com.intellij.codeInsight.CodeInsightSettings; -import com.intellij.codeInsight.CodeInsightWorkspaceSettings; -import com.intellij.internal.statistic.AbstractProjectsUsagesCollector; -import com.intellij.internal.statistic.CollectUsagesException; -import com.intellij.internal.statistic.UsagesCollector; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.openapi.editor.ex.EditorSettingsExternalizable; -import com.intellij.openapi.editor.impl.softwrap.SoftWrapAppliancePlaces; -import com.intellij.openapi.editor.richcopy.settings.RichCopySettings; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.Comparing; -import com.intellij.openapi.util.text.StringUtil; -import com.intellij.util.BooleanFunction; -import org.jetbrains.annotations.NotNull; - -import java.util.HashSet; -import java.util.Set; -import java.util.function.Function; - -/** - * @deprecated To be removed in 2018.3 (replaced by EditorSettingsStatisticsCollector) - */ -class LegacyEditorSettingsStatisticsCollector extends UsagesCollector { - private static final GroupDescriptor GROUP_DESCRIPTOR = GroupDescriptor.create("Editor"); - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GROUP_DESCRIPTOR; - } - - @NotNull - @Override - public Set getUsages() { - Set set = new HashSet<>(); - - EditorSettingsExternalizable es = EditorSettingsExternalizable.getInstance(); - EditorSettingsExternalizable esDefault = new EditorSettingsExternalizable(); - addBoolIfDiffers(set, es, esDefault, s -> s.isVirtualSpace(), "caretAfterLineEnd"); - addBoolIfDiffers(set, es, esDefault, s -> s.isCaretInsideTabs(), "caretInsideTabs"); - addBoolIfDiffers(set, es, esDefault, s -> s.isAdditionalPageAtBottom(), "virtualSpaceAtFileBottom"); - addBoolIfDiffers(set, es, esDefault, s -> s.isUseSoftWraps(SoftWrapAppliancePlaces.MAIN_EDITOR), "softWraps"); - addBoolIfDiffers(set, es, esDefault, s -> s.isUseSoftWraps(SoftWrapAppliancePlaces.CONSOLE), "softWraps.console"); - addBoolIfDiffers(set, es, esDefault, s -> s.isUseSoftWraps(SoftWrapAppliancePlaces.PREVIEW), "softWraps.preview"); - addBoolIfDiffers(set, es, esDefault, s -> s.isUseCustomSoftWrapIndent(), "softWraps.relativeIndent"); - addBoolIfDiffers(set, es, esDefault, s -> s.isAllSoftWrapsShown(), "softWraps.showAll"); - addIfDiffers(set, es, esDefault, s -> s.getStripTrailingSpaces(), "stripTrailingSpaces"); - addBoolIfDiffers(set, es, esDefault, s -> s.isEnsureNewLineAtEOF(), "ensureNewlineAtEOF"); - addBoolIfDiffers(set, es, esDefault, s -> s.isShowQuickDocOnMouseOverElement(), "quickDocOnMouseHover"); - addBoolIfDiffers(set, es, esDefault, s -> s.isBlinkCaret(), "blinkingCaret"); - addBoolIfDiffers(set, es, esDefault, s -> s.isBlockCursor(), "blockCaret"); - addBoolIfDiffers(set, es, esDefault, s -> s.isRightMarginShown(), "rightMargin"); - addBoolIfDiffers(set, es, esDefault, s -> s.isLineNumbersShown(), "lineNumbers"); - addBoolIfDiffers(set, es, esDefault, s -> s.areGutterIconsShown(), "gutterIcons"); - addBoolIfDiffers(set, es, esDefault, s -> s.isFoldingOutlineShown(), "foldingOutline"); - addBoolIfDiffers(set, es, esDefault, s -> s.isWhitespacesShown() && s.isLeadingWhitespacesShown(), "showLeadingWhitespace"); - addBoolIfDiffers(set, es, esDefault, s -> s.isWhitespacesShown() && s.isInnerWhitespacesShown(), "showInnerWhitespace"); - addBoolIfDiffers(set, es, esDefault, s -> s.isWhitespacesShown() && s.isTrailingWhitespacesShown(), "showTrailingWhitespace"); - addBoolIfDiffers(set, es, esDefault, s -> s.isIndentGuidesShown(), "indentGuides"); - addBoolIfDiffers(set, es, esDefault, s -> s.isSmoothScrolling(), "animatedScroll"); - addBoolIfDiffers(set, es, esDefault, s -> s.isDndEnabled(), "dragNDrop"); - addBoolIfDiffers(set, es, esDefault, s -> s.isWheelFontChangeEnabled(), "wheelZoom"); - addBoolIfDiffers(set, es, esDefault, s -> s.isMouseClickSelectionHonorsCamelWords(), "mouseCamel"); - addBoolIfDiffers(set, es, esDefault, s -> s.isVariableInplaceRenameEnabled(), "inplaceRename"); - addBoolIfDiffers(set, es, esDefault, s -> s.isPreselectRename(), "preselectOnRename"); - addBoolIfDiffers(set, es, esDefault, s -> s.isShowInlineLocalDialog(), "inlineDialog"); - addBoolIfDiffers(set, es, esDefault, s -> s.isRefrainFromScrolling(), "minimizeScrolling"); - addBoolIfDiffers(set, es, esDefault, s -> s.getOptions().SHOW_NOTIFICATION_AFTER_REFORMAT_CODE_ACTION, "afterReformatNotification"); - addBoolIfDiffers(set, es, esDefault, s -> s.getOptions().SHOW_NOTIFICATION_AFTER_OPTIMIZE_IMPORTS_ACTION, "afterOptimizeNotification"); - addBoolIfDiffers(set, es, esDefault, s -> s.isSmartHome(), "smartHome"); - addBoolIfDiffers(set, es, esDefault, s -> s.isCamelWords(), "camelWords"); - addBoolIfDiffers(set, es, esDefault, s -> s.isShowParameterNameHints(), "editor.inlay.parameter.hints"); - addBoolIfDiffers(set, es, esDefault, s -> s.isBreadcrumbsAbove(), "noBreadcrumbsBelow"); - addBoolIfDiffers(set, es, esDefault, s -> s.isBreadcrumbsShown(), "breadcrumbs"); - for (String language : es.getOptions().getLanguageBreadcrumbsMap().keySet()) { - addBoolIfDiffers(set, es, esDefault, s -> s.isBreadcrumbsShownFor(language), "breadcrumbsFor" + language); - } - - RichCopySettings rcs = RichCopySettings.getInstance(); - RichCopySettings rcsDefault = new RichCopySettings(); - addBoolIfDiffers(set, rcs, rcsDefault, s -> s.isEnabled(), "richCopy"); - - CodeInsightSettings cis = CodeInsightSettings.getInstance(); - CodeInsightSettings cisDefault = new CodeInsightSettings(); - addBoolIfDiffers(set, cis, cisDefault, s -> s.AUTO_POPUP_PARAMETER_INFO, "parameterAutoPopup"); - addBoolIfDiffers(set, cis, cisDefault, s -> s.AUTO_POPUP_JAVADOC_INFO, "javadocAutoPopup"); - addBoolIfDiffers(set, cis, cisDefault, s -> s.AUTO_POPUP_COMPLETION_LOOKUP, "completionAutoPopup"); - addIfDiffers(set, cis, cisDefault, s -> s.COMPLETION_CASE_SENSITIVE, "completionCaseSensitivity"); - addBoolIfDiffers(set, cis, cisDefault, s -> s.SELECT_AUTOPOPUP_SUGGESTIONS_BY_CHARS, "autoPopupCharComplete"); - addBoolIfDiffers(set, cis, cisDefault, s -> s.AUTOCOMPLETE_ON_CODE_COMPLETION, "autoCompleteBasic"); - addBoolIfDiffers(set, cis, cisDefault, s -> s.AUTOCOMPLETE_ON_SMART_TYPE_COMPLETION, "autoCompleteSmart"); - addBoolIfDiffers(set, cis, cisDefault, s -> s.SHOW_FULL_SIGNATURES_IN_PARAMETER_INFO, "parameterInfoFullSignature"); - addIfDiffers(set, cis, cisDefault, s -> s.getBackspaceMode(), "smartBackspace"); - addBoolIfDiffers(set, cis, cisDefault, s -> s.SMART_INDENT_ON_ENTER, "indentOnEnter"); - addBoolIfDiffers(set, cis, cisDefault, s -> s.INSERT_BRACE_ON_ENTER, "braceOnEnter"); - addBoolIfDiffers(set, cis, cisDefault, s -> s.JAVADOC_STUB_ON_ENTER, "javadocOnEnter"); - addBoolIfDiffers(set, cis, cisDefault, s -> s.SMART_END_ACTION, "smartEnd"); - addBoolIfDiffers(set, cis, cisDefault, s -> s.JAVADOC_GENERATE_CLOSING_TAG, "autoCloseJavadocTags"); - addBoolIfDiffers(set, cis, cisDefault, s -> s.SURROUND_SELECTION_ON_QUOTE_TYPED, "surroundByQuoteOrBrace"); - addBoolIfDiffers(set, cis, cisDefault, s -> s.AUTOINSERT_PAIR_BRACKET, "pairBracketAutoInsert"); - addBoolIfDiffers(set, cis, cisDefault, s -> s.AUTOINSERT_PAIR_QUOTE, "pairQuoteAutoInsert"); - addBoolIfDiffers(set, cis, cisDefault, s -> s.REFORMAT_BLOCK_ON_RBRACE, "reformatOnRBrace"); - addIfDiffers(set, cis, cisDefault, s -> s.REFORMAT_ON_PASTE, "reformatOnPaste"); - addIfDiffers(set, cis, cisDefault, s -> s.ADD_IMPORTS_ON_PASTE, "importsOnPaste"); - addBoolIfDiffers(set, cis, cisDefault, s -> s.HIGHLIGHT_BRACES, "bracesHighlight"); - addBoolIfDiffers(set, cis, cisDefault, s -> s.HIGHLIGHT_SCOPE, "scopeHighlight"); - addBoolIfDiffers(set, cis, cisDefault, s -> s.HIGHLIGHT_IDENTIFIER_UNDER_CARET, "identifierUnderCaretHighlight"); - addBoolIfDiffers(set, cis, cisDefault, s -> s.ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY, "autoAddImports"); - addBoolIfDiffers(set, cis, cisDefault, s -> s.SHOW_PARAMETER_NAME_HINTS_ON_COMPLETION, "completionHints"); - addBoolIfDiffers(set, cis, cisDefault, s -> s.SHOW_EXTERNAL_ANNOTATIONS_INLINE, "externalAnnotationsInline"); - addBoolIfDiffers(set, cis, cisDefault, s -> s.SHOW_INFERRED_ANNOTATIONS_INLINE, "inferredAnnotationsInline"); - addBoolIfDiffers(set, cis, cisDefault, s -> s.TAB_EXITS_BRACKETS_AND_QUOTES, "tabExitsBracketsAndQuotes"); - - return set; - } - - private static void addBoolIfDiffers(Set set, - T settingsBean, T defaultSettingsBean, BooleanFunction valueFunction, String featureId) { - boolean value = valueFunction.fun(settingsBean); - boolean defaultValue = valueFunction.fun(defaultSettingsBean); - if (value != defaultValue) { - set.add(new UsageDescriptor(defaultValue ? "no" + StringUtil.capitalize(featureId) : featureId, 1)); - } - } - - private static void addIfDiffers(Set set, - T settingsBean, T defaultSettingsBean, Function valueFunction, String featureIdPrefix) { - Object value = valueFunction.apply(settingsBean); - Object defaultValue = valueFunction.apply(defaultSettingsBean); - if (!Comparing.equal(value, defaultValue)) { - set.add(new UsageDescriptor(featureIdPrefix + "." + value, 1)); - } - } - - public static class ProjectUsages extends AbstractProjectsUsagesCollector { - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GROUP_DESCRIPTOR; - } - - @NotNull - @Override - public Set getProjectUsages(@NotNull Project project) throws CollectUsagesException { - Set set = new HashSet<>(); - CodeInsightWorkspaceSettings ciws = CodeInsightWorkspaceSettings.getInstance(project); - CodeInsightWorkspaceSettings ciwsDefault = new CodeInsightWorkspaceSettings(); - addBoolIfDiffers(set, ciws, ciwsDefault, s -> s.optimizeImportsOnTheFly, "autoOptimizeImports"); - return set; - } - } - -} diff --git a/platform/lang-impl/src/com/intellij/internal/statistic/tools/AbstractToolsUsagesCollector.java b/platform/lang-impl/src/com/intellij/internal/statistic/tools/AbstractToolsUsagesCollector.java deleted file mode 100644 index 3a3fe2043886..000000000000 --- a/platform/lang-impl/src/com/intellij/internal/statistic/tools/AbstractToolsUsagesCollector.java +++ /dev/null @@ -1,229 +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.internal.statistic.tools; - -import com.intellij.codeInspection.InspectionEP; -import com.intellij.codeInspection.ex.ScopeToolState; -import com.intellij.ide.plugins.IdeaPluginDescriptor; -import com.intellij.ide.plugins.RepositoryHelper; -import com.intellij.internal.statistic.AbstractProjectsUsagesCollector; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.application.PathManager; -import com.intellij.openapi.extensions.PluginDescriptor; -import com.intellij.openapi.extensions.PluginId; -import com.intellij.openapi.project.DefaultProjectFactory; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.ModificationTracker; -import com.intellij.profile.codeInspection.InspectionProjectProfileManager; -import com.intellij.psi.util.CachedValueProvider; -import com.intellij.psi.util.CachedValuesManager; -import com.intellij.util.ObjectUtils; -import one.util.streamex.StreamEx; -import org.jetbrains.annotations.NotNull; - -import java.io.IOException; -import java.util.Collections; -import java.util.List; -import java.util.Set; -import java.util.concurrent.TimeUnit; -import java.util.function.Predicate; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -public abstract class AbstractToolsUsagesCollector extends AbstractProjectsUsagesCollector { - - private static final Predicate BUNDLED = state -> { - final IdeaPluginDescriptor descriptor = getIdeaPluginDescriptor(state); - return descriptor != null && descriptor.isBundled(); - }; - - private static final Predicate LISTED = state -> { - final IdeaPluginDescriptor descriptor = getIdeaPluginDescriptor(state); - if (descriptor != null) { - String path; - try { - //to avoid paths like this /home/kb/IDEA/bin/../config/plugins/APlugin - path = descriptor.getPath().getCanonicalPath(); - } - catch (final IOException e) { - path = descriptor.getPath().getAbsolutePath(); - } - if (path.startsWith(PathManager.getPluginsPath())) { - final PluginId id = descriptor.getPluginId(); - if (id != null && getRepositoryPluginIds().contains(id.getIdString())) { - return true; - } - } - } - return false; - }; - - private static IdeaPluginDescriptor getIdeaPluginDescriptor(final ScopeToolState state) { - final InspectionEP extension = state.getTool().getExtension(); - return extension != null ? ObjectUtils.tryCast(extension.getPluginDescriptor(), IdeaPluginDescriptor.class) : null; - } - - private static final Predicate ENABLED = state -> !state.getTool().isEnabledByDefault() && state.isEnabled(); - - private static final Predicate DISABLED = state -> state.getTool().isEnabledByDefault() && !state.isEnabled(); - - @NotNull - @Override - public Set getProjectUsages(@NotNull final Project project) { - final List tools = InspectionProjectProfileManager.getInstance(project).getCurrentProfile().getAllTools(); - return filter(tools.stream()) - .map(ScopeToolState::getTool) - .map(tool -> tool.getLanguage() + "." + tool.getID()) - .map(UsageDescriptor::new) - .collect(Collectors.toSet()); - } - - @NotNull - protected abstract Stream filter(@NotNull final Stream tools); - - public static class AllBundledToolsUsagesCollector extends AbstractToolsUsagesCollector { - - private static final GroupDescriptor GROUP_ID = GroupDescriptor.create("all-bundled-tools"); - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GROUP_ID; - } - - @NotNull - @Override - protected Stream filter(@NotNull final Stream tools) { - return tools.filter(BUNDLED); - } - } - - public static class AllListedToolsUsagesCollector extends AbstractToolsUsagesCollector { - - private static final GroupDescriptor GROUP_ID = GroupDescriptor.create("all-listed-tools"); - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GROUP_ID; - } - - @NotNull - @Override - protected Stream filter(@NotNull final Stream tools) { - return tools.filter(LISTED); - } - } - - public static class EnabledBundledToolsUsagesCollector extends AbstractToolsUsagesCollector { - - private static final GroupDescriptor GROUP_ID = GroupDescriptor.create("enabled-bundled-tools"); - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GROUP_ID; - } - - @NotNull - @Override - protected Stream filter(@NotNull final Stream tools) { - return tools.filter(ENABLED).filter(BUNDLED); - } - } - - public static class EnabledListedToolsUsagesCollector extends AbstractToolsUsagesCollector { - - private static final GroupDescriptor GROUP_ID = GroupDescriptor.create("enabled-listed-tools"); - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GROUP_ID; - } - - @NotNull - @Override - protected Stream filter(@NotNull final Stream tools) { - return tools.filter(ENABLED).filter(LISTED); - } - } - - public static class DisabledBundledToolsUsagesCollector extends AbstractToolsUsagesCollector { - - private static final GroupDescriptor GROUP_ID = GroupDescriptor.create("disabled-bundled-tools"); - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GROUP_ID; - } - - @NotNull - @Override - protected Stream filter(@NotNull final Stream tools) { - return tools.filter(DISABLED).filter(BUNDLED); - } - } - - public static class DisabledListedToolsUsagesCollector extends AbstractToolsUsagesCollector { - - private static final GroupDescriptor GROUP_ID = GroupDescriptor.create("disabled-listed-tools"); - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GROUP_ID; - } - - @NotNull - @Override - protected Stream filter(@NotNull final Stream tools) { - return tools.filter(DISABLED).filter(LISTED); - } - } - - private static Set getRepositoryPluginIds() { - final Project project = DefaultProjectFactory.getInstance().getDefaultProject(); - return CachedValuesManager.getManager(project).getCachedValue(project, () -> { - List plugins = Collections.emptyList(); - try { - final List cached = RepositoryHelper.loadCachedPlugins(); - if (cached != null) { - plugins = cached; - } - else { - // schedule plugins loading, will take them the next time - ApplicationManager.getApplication().executeOnPooledThread(() -> { - try { - RepositoryHelper.loadPlugins(null); - } - catch (final IOException ignored) { - } - }); - } - } - catch (final IOException ignored) { - } - final Set ids = StreamEx.of(plugins).map(PluginDescriptor::getPluginId).nonNull().map(PluginId::getIdString).toSet(); - return CachedValueProvider.Result.create(ids, new DelayModificationTracker(1, TimeUnit.HOURS)); - }); - } - - private static class DelayModificationTracker implements ModificationTracker { - - private final long myStamp = System.currentTimeMillis(); - private final long myDelay; - - private DelayModificationTracker(final long delay, @NotNull final TimeUnit unit) { - myDelay = TimeUnit.MILLISECONDS.convert(delay, unit); - } - - @Override - public long getModificationCount() { - final long diff = System.currentTimeMillis() - (myStamp + myDelay); - return diff > 0 ? diff : 0; - } - } -} \ No newline at end of file diff --git a/platform/platform-impl/src/com/intellij/help/impl/HelpManagerImpl.java b/platform/platform-impl/src/com/intellij/help/impl/HelpManagerImpl.java index 7a68ec1304b1..07a19f4ebc65 100644 --- a/platform/platform-impl/src/com/intellij/help/impl/HelpManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/help/impl/HelpManagerImpl.java @@ -21,7 +21,6 @@ import com.intellij.ide.IdeBundle; import com.intellij.ide.plugins.HelpSetPath; import com.intellij.ide.plugins.IdeaPluginDescriptor; import com.intellij.ide.plugins.PluginManagerCore; -import com.intellij.internal.statistic.UsageTrigger; import com.intellij.openapi.application.ApplicationInfo; import com.intellij.openapi.application.IdeUrlTrackingParametersProvider; import com.intellij.openapi.application.ex.ApplicationInfoEx; @@ -52,8 +51,6 @@ public class HelpManagerImpl extends HelpManager { public void invokeHelp(@Nullable String id) { id = StringUtil.notNullize(id, "top"); - - UsageTrigger.trigger("ide.help." + id); for (WebHelpProvider provider : WEB_HELP_PROVIDER_EP_NAME.getExtensions()) { if (id.startsWith(provider.getHelpTopicPrefix())) { diff --git a/platform/platform-impl/src/com/intellij/ide/actions/InvalidateCachesAction.java b/platform/platform-impl/src/com/intellij/ide/actions/InvalidateCachesAction.java index a905abb827f2..b6c62e068872 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/InvalidateCachesAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/InvalidateCachesAction.java @@ -16,13 +16,11 @@ package com.intellij.ide.actions; import com.intellij.ide.caches.CachesInvalidator; -import com.intellij.internal.statistic.UsageTrigger; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.CommonDataKeys; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ex.ApplicationEx; -import com.intellij.openapi.application.ex.ApplicationManagerEx; import com.intellij.openapi.project.DumbAware; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.util.registry.Registry; @@ -94,7 +92,6 @@ public class InvalidateCachesAction extends AnAction implements DumbAware { return; } - UsageTrigger.trigger(ApplicationManagerEx.getApplicationEx().getName() + ".caches.invalidated"); if (invalidateCachesInvalidatesVfs) FSRecords.invalidateCaches(); else FileBasedIndex.getInstance().invalidateCaches(); diff --git a/platform/platform-impl/src/com/intellij/ide/customize/CustomizeFeaturedPluginsStepPanel.java b/platform/platform-impl/src/com/intellij/ide/customize/CustomizeFeaturedPluginsStepPanel.java index 7c991641e2bb..b8304520f4d0 100644 --- a/platform/platform-impl/src/com/intellij/ide/customize/CustomizeFeaturedPluginsStepPanel.java +++ b/platform/platform-impl/src/com/intellij/ide/customize/CustomizeFeaturedPluginsStepPanel.java @@ -20,7 +20,6 @@ import com.intellij.icons.AllIcons; import com.intellij.ide.plugins.IdeaPluginDescriptor; import com.intellij.ide.plugins.PluginManagerCore; import com.intellij.ide.plugins.PluginNode; -import com.intellij.internal.statistic.collectors.legacy.ideSettings.IdeInitialConfigButtonUsages; import com.intellij.openapi.extensions.PluginId; import com.intellij.openapi.progress.util.AbstractProgressIndicatorExBase; import com.intellij.openapi.ui.VerticalFlowLayout; @@ -205,7 +204,6 @@ public class CustomizeFeaturedPluginsStepPanel extends AbstractCustomizeWizardSt public void run() { try { indicator.start(); - IdeInitialConfigButtonUsages.addDownloadedPlugin(descriptor.getPluginId().getIdString()); PluginDownloader downloader = PluginDownloader.createDownloader(descriptor); downloader.prepareToInstall(indicator); downloader.install(); diff --git a/platform/platform-impl/src/com/intellij/ide/customize/CustomizeIDEWizardDialog.java b/platform/platform-impl/src/com/intellij/ide/customize/CustomizeIDEWizardDialog.java index 90abf858ecec..87fdca7b177c 100644 --- a/platform/platform-impl/src/com/intellij/ide/customize/CustomizeIDEWizardDialog.java +++ b/platform/platform-impl/src/com/intellij/ide/customize/CustomizeIDEWizardDialog.java @@ -17,7 +17,6 @@ package com.intellij.ide.customize; import com.intellij.ide.cloudConfig.CloudConfigProvider; import com.intellij.ide.startup.StartupActionScriptManager; -import com.intellij.internal.statistic.collectors.legacy.ideSettings.IdeInitialConfigButtonUsages; import com.intellij.openapi.application.ApplicationNamesInfo; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.util.text.StringUtil; @@ -178,7 +177,6 @@ public class CustomizeIDEWizardDialog extends DialogWrapper implements ActionLis return; } } - IdeInitialConfigButtonUsages.setSkipRemainingPressedScreen(mySteps.get(myIndex).getClass().getName()); super.doOKAction(); } diff --git a/platform/platform-impl/src/com/intellij/ide/customize/CustomizePluginsStepPanel.java b/platform/platform-impl/src/com/intellij/ide/customize/CustomizePluginsStepPanel.java index 6f9b5ef7acee..7b87b47aa277 100644 --- a/platform/platform-impl/src/com/intellij/ide/customize/CustomizePluginsStepPanel.java +++ b/platform/platform-impl/src/com/intellij/ide/customize/CustomizePluginsStepPanel.java @@ -16,7 +16,6 @@ package com.intellij.ide.customize; import com.intellij.ide.plugins.PluginManager; -import com.intellij.internal.statistic.collectors.legacy.ideSettings.IdeInitialConfigButtonUsages; import com.intellij.openapi.application.ApplicationNamesInfo; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.ui.VerticalFlowLayout; @@ -36,7 +35,6 @@ import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; -import java.util.HashSet; import java.util.List; import java.util.Map; @@ -234,7 +232,6 @@ public class CustomizePluginsStepPanel extends AbstractCustomizeWizardStep imple public boolean beforeOkAction() { try { PluginManager.saveDisabledPlugins(myPluginGroups.getDisabledPluginIds(), false); - IdeInitialConfigButtonUsages.setPredefinedDisabledPlugins(new HashSet<>(myPluginGroups.getDisabledPluginIds())); } catch (IOException ignored) { } diff --git a/platform/platform-impl/src/com/intellij/ide/util/TipDialog.java b/platform/platform-impl/src/com/intellij/ide/util/TipDialog.java index 359ed2c42b1e..22149909076c 100644 --- a/platform/platform-impl/src/com/intellij/ide/util/TipDialog.java +++ b/platform/platform-impl/src/com/intellij/ide/util/TipDialog.java @@ -17,7 +17,6 @@ package com.intellij.ide.util; import com.intellij.CommonBundle; import com.intellij.ide.IdeBundle; -import com.intellij.internal.statistic.UsageTrigger; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.wm.ex.WindowManagerEx; @@ -98,7 +97,6 @@ public class TipDialog extends DialogWrapper{ public void actionPerformed(ActionEvent e){ myTipPanel.prevTip(); - UsageTrigger.trigger("tips.of.the.day.prev"); } } @@ -111,7 +109,6 @@ public class TipDialog extends DialogWrapper{ public void actionPerformed(ActionEvent e){ myTipPanel.nextTip(); - UsageTrigger.trigger("tips.of.the.day.next"); } } diff --git a/platform/platform-impl/src/com/intellij/idea/IdeaApplication.java b/platform/platform-impl/src/com/intellij/idea/IdeaApplication.java index 6938bdc1ecdd..aeff085c4ac9 100644 --- a/platform/platform-impl/src/com/intellij/idea/IdeaApplication.java +++ b/platform/platform-impl/src/com/intellij/idea/IdeaApplication.java @@ -7,7 +7,6 @@ import com.intellij.concurrency.IdeaForkJoinWorkerThreadFactory; import com.intellij.ide.*; import com.intellij.ide.plugins.PluginManager; import com.intellij.ide.plugins.PluginManagerCore; -import com.intellij.internal.statistic.UsageTrigger; import com.intellij.openapi.application.*; import com.intellij.openapi.application.ex.ApplicationEx; import com.intellij.openapi.application.ex.ApplicationInfoEx; @@ -362,9 +361,6 @@ public class IdeaApplication { //noinspection SSBasedInspection SwingUtilities.invokeLater(PluginManager::reportPluginError); - - //safe for headless and unit test modes - UsageTrigger.trigger("lifecycle", app.getName() + "app.started"); }); } diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/AbstractProjectsUsagesCollector.java b/platform/platform-impl/src/com/intellij/internal/statistic/AbstractProjectsUsagesCollector.java index 52dfa633a47e..069b5d2db0b6 100644 --- a/platform/platform-impl/src/com/intellij/internal/statistic/AbstractProjectsUsagesCollector.java +++ b/platform/platform-impl/src/com/intellij/internal/statistic/AbstractProjectsUsagesCollector.java @@ -16,90 +16,21 @@ package com.intellij.internal.statistic; import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.internal.statistic.persistence.ApplicationStatisticsPersistence; -import com.intellij.internal.statistic.persistence.CollectedUsages; -import com.intellij.internal.statistic.persistence.UsageStatisticsPersistenceComponent; -import com.intellij.internal.statistic.utils.StatisticsUtilKt; -import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; -import com.intellij.util.containers.ObjectIntHashMap; import org.jetbrains.annotations.NotNull; +import java.util.Collections; import java.util.Set; -// Collects(summarizes) project-level usages. -// Statistics is regularly sent with some period of time (see com.intellij.internal.statistic.configurable.SendPeriod). -// In this period the user can open/close N projects which are not available at the "special send statistics" time. -// AbstractProjectsUsagesCollector persists the statistics data from opened/closed projects -// and summarizes collected results when data are requested. -// -// Example for groupId="my-team-lead-wants-something": -// 1. project A: key_1= a1, key_2=b1, key_3=c1 // this project was opened and closed (not available just now) -// 2. project B: key_1= a2, key_2=b2 // this project was opened and closed (not available just now) -// 3. project C: key_1= a3, key_4=c3 // this project is open just now -// if "send statistics" action is invoked this UsageCollector returns : -// groupId="my-team-lead-wants-something": key_1=(a1+a2+a3), key_2=(b1+b2), key_3=c1, key_4=c3 -// +@Deprecated // to be removed in 2018.2 public abstract class AbstractProjectsUsagesCollector extends UsagesCollector { @NotNull public abstract Set getProjectUsages(@NotNull Project project) throws CollectUsagesException; - private static final Logger LOG = Logger.getInstance(AbstractProjectsUsagesCollector.class); - - // Achtung!!! don't invoke this method directly even you can. - void persistProjectUsages(@NotNull Project project) { - try { - persistProjectUsages(project, new CollectedUsages(getProjectUsages(project), System.currentTimeMillis())); - } - catch (Exception e) { - LOG.info(e); - } - } - - private void persistProjectUsages(@NotNull Project project, @NotNull CollectedUsages usages) { - persistProjectUsages(project, usages, ApplicationStatisticsPersistenceComponent.getInstance()); - } - - private void persistProjectUsages(@NotNull Project project, - @NotNull CollectedUsages usages, - @NotNull ApplicationStatisticsPersistence persistence) { - persistence.persistUsages(getGroupId(), project, usages); - } - - @NotNull - private Set getApplicationUsages() { - return mergeUsagesPostProcess(getApplicationUsages(ApplicationStatisticsPersistenceComponent.getInstance())); - } - - @NotNull - @Deprecated - // this method should be overridden only in exceptional cases. - // you have summarized usages from all opened/closed projects here. - // do you want to add/merge something? Don't do it!!! - protected Set mergeUsagesPostProcess(@NotNull Set usagesFromAllProjects) { - return usagesFromAllProjects; - } - - @NotNull - private Set getApplicationUsages(@NotNull ApplicationStatisticsPersistence persistence) { - ObjectIntHashMap result = new ObjectIntHashMap<>(); - long lastTimeSent = UsageStatisticsPersistenceComponent.getInstance().getLastTimeSent(); - for (CollectedUsages usageDescriptors : persistence.getApplicationData(getGroupId()).values()) { - if (!usageDescriptors.usages.isEmpty() && usageDescriptors.collectionTime > lastTimeSent) { - result.ensureCapacity(usageDescriptors.usages.size()); - for (UsageDescriptor usageDescriptor : usageDescriptors.usages) { - String key = usageDescriptor.getKey(); - result.put(key, result.get(key, 0) + usageDescriptor.getValue()); - } - } - } - return StatisticsUtilKt.toUsageDescriptors(result); - } - @Override @NotNull public final Set getUsages() throws CollectUsagesException { - return getApplicationUsages(); + return Collections.emptySet(); } } diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/ApplicationStatisticsPersistenceComponent.java b/platform/platform-impl/src/com/intellij/internal/statistic/ApplicationStatisticsPersistenceComponent.java deleted file mode 100644 index 2e8f9b356cc5..000000000000 --- a/platform/platform-impl/src/com/intellij/internal/statistic/ApplicationStatisticsPersistenceComponent.java +++ /dev/null @@ -1,206 +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.internal.statistic; - -import com.intellij.concurrency.JobScheduler; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.internal.statistic.persistence.ApplicationStatisticsPersistence; -import com.intellij.internal.statistic.persistence.CollectedUsages; -import com.intellij.internal.statistic.persistence.UsageStatisticsPersistenceComponent; -import com.intellij.internal.statistic.utils.StatisticsUploadAssistant; -import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.components.*; -import com.intellij.openapi.project.DumbService; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.project.ProjectManager; -import com.intellij.openapi.project.ProjectManagerListener; -import com.intellij.openapi.util.text.StringUtil; -import com.intellij.util.messages.MessageBusConnection; -import gnu.trove.THashSet; -import org.jdom.Element; -import org.jetbrains.annotations.NonNls; -import org.jetbrains.annotations.NotNull; - -import java.util.*; -import java.util.concurrent.Future; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.TimeUnit; - -@State( - name = "StatisticsApplicationUsages", - storages = { - @Storage(value = UsageStatisticsPersistenceComponent.USAGE_STATISTICS_XML, roamingType = RoamingType.DISABLED), - @Storage(value = "statistics.application.usages.xml", roamingType = RoamingType.DISABLED, deprecated = true) - } -) -public class ApplicationStatisticsPersistenceComponent extends ApplicationStatisticsPersistence implements - PersistentStateComponent, - BaseComponent { - // 30 minutes considered enough for project indexing and other tasks - private static final int DELAY_IN_MIN = 30; - private static final Map persistProjectStatisticsTasks = Collections.synchronizedMap(new HashMap<>()); - - private static final String TOKENIZER = ","; - - @NonNls - private static final String GROUP_TAG = "group"; - @NonNls - private static final String GROUP_NAME_ATTR = "name"; - - @NonNls - private static final String PROJECT_TAG = "project"; - @NonNls - private static final String COLLECTION_TIME_TAG = "collectionTime"; - @NonNls - private static final String PROJECT_ID_ATTR = "id"; - @NonNls - private static final String VALUES_ATTR = "values"; - - public static ApplicationStatisticsPersistenceComponent getInstance() { - return ApplicationManager.getApplication().getComponent(ApplicationStatisticsPersistenceComponent.class); - } - - @Override - public void loadState(@NotNull Element element) { - for (Element groupElement : element.getChildren(GROUP_TAG)) { - GroupDescriptor groupDescriptor = GroupDescriptor.create(groupElement.getAttributeValue(GROUP_NAME_ATTR)); - List projectsList = groupElement.getChildren(PROJECT_TAG); - for (Element projectElement : projectsList) { - String projectId = projectElement.getAttributeValue(PROJECT_ID_ATTR); - String frameworks = projectElement.getAttributeValue(VALUES_ATTR); - if (!StringUtil.isEmptyOrSpaces(projectId) && !StringUtil.isEmptyOrSpaces(frameworks)) { - Set frameworkDescriptors = new THashSet<>(); - for (String key : StringUtil.split(frameworks, TOKENIZER)) { - UsageDescriptor descriptor = getUsageDescriptor(key); - if (descriptor != null) { - frameworkDescriptors.add(descriptor); - } - } - long collectionTime; - try { - collectionTime = Long.valueOf(projectElement.getAttributeValue(COLLECTION_TIME_TAG)); - } catch (NumberFormatException ignored) { - collectionTime = 0; - } - getApplicationData(groupDescriptor).put(projectId, new CollectedUsages(frameworkDescriptors, collectionTime)); - } - } - } - } - - @Override - public Element getState() { - Element element = new Element("state"); - - for (Map.Entry> appData : getApplicationData().entrySet()) { - Element groupElement = new Element(GROUP_TAG); - groupElement.setAttribute(GROUP_NAME_ATTR, appData.getKey().getId()); - boolean isEmptyGroup = true; - - for (Map.Entry projectData : appData.getValue().entrySet()) { - Element projectElement = new Element(PROJECT_TAG); - projectElement.setAttribute(PROJECT_ID_ATTR, projectData.getKey()); - final CollectedUsages projectDataValue = projectData.getValue(); - if (!projectDataValue.usages.isEmpty()) { - projectElement.setAttribute(VALUES_ATTR, joinUsages(projectDataValue.usages)); - projectElement.setAttribute(COLLECTION_TIME_TAG, String.valueOf(projectDataValue.collectionTime)); - groupElement.addContent(projectElement); - isEmptyGroup = false; - } - } - - if (!isEmptyGroup) { - element.addContent(groupElement); - } - } - - return element; - } - - private static UsageDescriptor getUsageDescriptor(String usage) { - // for instance, usage can be: "_foo"(equals "_foo=1") or "_foo=2" - try { - final int i = usage.indexOf('='); - if (i > 0 && i < usage.length() - 1) { - String key = usage.substring(0, i).trim(); - String value = usage.substring(i + 1).trim(); - if (!StringUtil.isEmptyOrSpaces(key) && !StringUtil.isEmptyOrSpaces(value)) { - try { - final int count = Integer.parseInt(value); - if (count > 0) { - return new UsageDescriptor(key, count); - } - } - catch (NumberFormatException ignored) { - } - } - } - return new UsageDescriptor(usage, 1); - } - catch (AssertionError e) { - //escape loading of invalid usages - } - return null; - } - - private static String joinUsages(@NotNull Set usages) { - // for instance, usage can be: "_foo"(equals "_foo=1") or "_foo=2" - return StringUtil.join(usages, usageDescriptor -> { - final String key = usageDescriptor.getKey(); - final int value = usageDescriptor.getValue(); - return value != 1 ? key + "=" + value : key; - }, TOKENIZER); - } - - @Override - public void initComponent() { - MessageBusConnection connection = ApplicationManager.getApplication().getMessageBus().connect(); - - connection.subscribe(ProjectManager.TOPIC, new ProjectManagerListener() { - @Override - public void projectOpened(Project project) { - ScheduledFuture future = - JobScheduler.getScheduler().schedule(() -> doPersistProjectUsages(project), DELAY_IN_MIN, TimeUnit.MINUTES); - persistProjectStatisticsTasks.put(project, future); - } - - public void projectClosed(Project project) { - Future future = persistProjectStatisticsTasks.remove(project); - if (future != null) { - future.cancel(true); - } - } - }); - - persistPeriodically(); - } - - private static void persistPeriodically() { - JobScheduler.getScheduler().scheduleWithFixedDelay(ApplicationStatisticsPersistenceComponent::persistOpenedProjects, 1, 1, TimeUnit.DAYS); - } - - /** - * Collects statistics from all opened projects and persists it - */ - public static void persistOpenedProjects() { - for (Project project : ProjectManager.getInstance().getOpenProjects()) { - doPersistProjectUsages(project); - } - } - - private static void doPersistProjectUsages(@NotNull Project project) { - if (StatisticsUploadAssistant.isSendAllowed()) { - synchronized (StatisticsUploadAssistant.LOCK) { - if (!project.isInitialized() || DumbService.isDumb(project)) { - return; - } - - for (UsagesCollector usagesCollector : UsagesCollector.EP_NAME.getExtensions()) { - if (usagesCollector instanceof AbstractProjectsUsagesCollector) { - ((AbstractProjectsUsagesCollector)usagesCollector).persistProjectUsages(project); - } - } - } - } - } -} diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/UsageTrigger.java b/platform/platform-impl/src/com/intellij/internal/statistic/UsageTrigger.java index 928eb494ca21..fe2a6ea7e816 100644 --- a/platform/platform-impl/src/com/intellij/internal/statistic/UsageTrigger.java +++ b/platform/platform-impl/src/com/intellij/internal/statistic/UsageTrigger.java @@ -1,91 +1,15 @@ // 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.internal.statistic; -import com.intellij.internal.statistic.beans.ConvertUsagesUtil; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.internal.statistic.eventLog.FeatureUsageLogger; -import com.intellij.internal.statistic.persistence.UsageStatisticsPersistenceComponent; -import com.intellij.openapi.components.*; -import com.intellij.util.containers.ContainerUtil; -import com.intellij.util.xmlb.annotations.MapAnnotation; -import com.intellij.util.xmlb.annotations.Tag; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -@State( - name = "UsageTrigger", - storages = { - @Storage(value = UsageStatisticsPersistenceComponent.USAGE_STATISTICS_XML, roamingType = RoamingType.DISABLED), - @Storage(value = "statistics.application.usages.xml", roamingType = RoamingType.DISABLED, deprecated = true) - } -) @Deprecated // to be removed in 2018.2 -public class UsageTrigger implements PersistentStateComponent { - final static class State { - @Tag("counts") - @MapAnnotation(surroundWithTag = false, keyAttributeName = "feature", valueAttributeName = "count") - public Map myValues = new HashMap<>(); - } +public class UsageTrigger { - private State myState = new State(); + public static void trigger(@NotNull @NonNls String feature) {} - public static void trigger(@NotNull @NonNls String feature) { - FeatureUsageLogger.INSTANCE.log("trigger", feature); - getInstance().doTrigger(feature); - } + public static void trigger(@NotNull @NonNls String groupId, @NotNull @NonNls String feature) {} - public static void trigger(@NotNull @NonNls String groupId, @NotNull @NonNls String feature) { - FeatureUsageLogger.INSTANCE.log(groupId, feature); - getInstance().doTrigger(feature); - } - - public static void triggerOnce(@NotNull @NonNls String feature) { - if (!getInstance().myState.myValues.containsKey(feature)) { - getInstance().doTrigger(feature); - } - } - - private static UsageTrigger getInstance() { - return ServiceManager.getService(UsageTrigger.class); - } - - private void doTrigger(String feature) { - ConvertUsagesUtil.assertDescriptorName(feature); - final Integer count = myState.myValues.get(feature); - if (count == null) { - myState.myValues.put(feature, 1); - } - else { - myState.myValues.put(feature, count + 1); - } - } - - public State getState() { - return myState; - } - - public void loadState(@NotNull final State state) { - myState = state; - } - - final static class MyCollector extends UsagesCollector { - private static final GroupDescriptor GROUP = GroupDescriptor.create("features counts", GroupDescriptor.HIGHER_PRIORITY); - - @NotNull - public Set getUsages() { - State state = getInstance().getState(); - assert state != null; - return ContainerUtil.map2Set(state.myValues.entrySet(), e -> new UsageDescriptor(e.getKey(), e.getValue())); - } - - @NotNull - public GroupDescriptor getGroupId() { - return GROUP; - } - } + public static void triggerOnce(@NotNull @NonNls String feature) {} } diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/UsagesCollector.java b/platform/platform-impl/src/com/intellij/internal/statistic/UsagesCollector.java index cad9202290e4..2c2ff9d7f9aa 100644 --- a/platform/platform-impl/src/com/intellij/internal/statistic/UsagesCollector.java +++ b/platform/platform-impl/src/com/intellij/internal/statistic/UsagesCollector.java @@ -1,18 +1,12 @@ // Copyright 2000-2017 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; -import com.intellij.ide.plugins.IdeaPluginDescriptor; -import com.intellij.ide.plugins.PluginManager; -import com.intellij.ide.plugins.cl.PluginClassLoader; import com.intellij.internal.statistic.beans.GroupDescriptor; import com.intellij.internal.statistic.beans.UsageDescriptor; import com.intellij.openapi.extensions.ExtensionPointName; -import com.intellij.openapi.extensions.PluginId; -import com.intellij.openapi.util.Pair; import org.jetbrains.annotations.NotNull; import java.util.Set; -import java.util.function.Function; @Deprecated // to be removed in 2018.2 public abstract class UsagesCollector { @@ -25,53 +19,4 @@ public abstract class UsagesCollector { @NotNull public abstract GroupDescriptor getGroupId(); - private static Pair findBucket(double value, double... ranges) { - if (ranges.length == 0) throw new IllegalArgumentException("Constrains are empty"); - if (value < ranges[0]) return Pair.create(null, ranges[0]); - for (int i = 1; i < ranges.length; i++) { - if (ranges[i] <= ranges[i - 1]) - throw new IllegalArgumentException("Constrains are unsorted"); - - if (value < ranges[i]) { - return Pair.create(ranges[i - 1], ranges[i]); - } - } - - return Pair.create(ranges[ranges.length - 1], null); - } - - public static boolean isNotBundledPluginClass(@NotNull Class clazz) { - ClassLoader loader = clazz.getClassLoader(); - if (loader instanceof PluginClassLoader) { - PluginId id = ((PluginClassLoader)loader).getPluginId(); - if (id != null) { - IdeaPluginDescriptor plugin = PluginManager.getPlugin(id); - if (plugin != null && !plugin.isBundled()) { - return true; - } - } - } - return false; - } - - protected static String findBucket(long value, Function valueConverter, long...ranges) { - double[] dRanges = new double[ranges.length]; - for (int i = 0; i < dRanges.length; i++) { - dRanges[i] = ranges[i]; - } - return findBucket((double)value, (d) -> valueConverter.apply(d.longValue()), dRanges); - } - - protected static String findBucket(double value, Function valueConverter, double...ranges) { - for (double range : ranges) { - if (range == value) { - return valueConverter.apply(value); - } - } - - Pair bucket = findBucket(value, ranges); - if (bucket.first == null) return "(*, " + valueConverter.apply(bucket.second) + ")"; - if (bucket.second == null) return "(" + valueConverter.apply(bucket.first) + ", *)"; - return "(" + valueConverter.apply(bucket.first) + ", " + valueConverter.apply(bucket.second) + ")"; - } } diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/actions/SendFUStatisticsAction.java b/platform/platform-impl/src/com/intellij/internal/statistic/actions/SendFUStatisticsAction.java index c904d0db6424..b2bbac0bf81f 100755 --- a/platform/platform-impl/src/com/intellij/internal/statistic/actions/SendFUStatisticsAction.java +++ b/platform/platform-impl/src/com/intellij/internal/statistic/actions/SendFUStatisticsAction.java @@ -25,7 +25,7 @@ public class SendFUStatisticsAction extends AnAction { return; } - ProgressManager.getInstance().run(new Task.Backgroundable(project, "Collecting And Sending _NEW_ Statistics", false) { + ProgressManager.getInstance().run(new Task.Backgroundable(project, "Collecting And Sending Statistics", false) { @Override public void run(@NotNull ProgressIndicator indicator) { StatisticsService service = StatisticsUploadAssistant.getApprovedGroupsStatisticsService(); diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/actions/SendStatisticsAction.java b/platform/platform-impl/src/com/intellij/internal/statistic/actions/SendStatisticsAction.java deleted file mode 100755 index 7b1a405ed6e1..000000000000 --- a/platform/platform-impl/src/com/intellij/internal/statistic/actions/SendStatisticsAction.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.internal.statistic.actions; - -import com.intellij.internal.statistic.ApplicationStatisticsPersistenceComponent; -import com.intellij.internal.statistic.connect.StatisticsResult; -import com.intellij.internal.statistic.connect.StatisticsService; -import com.intellij.internal.statistic.persistence.UsageStatisticsPersistenceComponent; -import com.intellij.internal.statistic.utils.StatisticsUploadAssistant; -import com.intellij.openapi.actionSystem.AnAction; -import com.intellij.openapi.actionSystem.AnActionEvent; -import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.application.ModalityState; -import com.intellij.openapi.progress.ProgressIndicator; -import com.intellij.openapi.progress.ProgressManager; -import com.intellij.openapi.progress.Task; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.ui.Messages; -import com.intellij.openapi.util.text.StringUtil; -import org.jetbrains.annotations.NotNull; - -public class SendStatisticsAction extends AnAction { - - @Override - public void actionPerformed(@NotNull AnActionEvent e) { - final Project project = e.getProject(); - if (project == null) { - return; - } - - ProgressManager.getInstance().run(new Task.Backgroundable(project, "Collecting And Sending _OLD_ Statistics", false) { - @Override - public void run(@NotNull ProgressIndicator indicator) { - UsageStatisticsPersistenceComponent statisticsPersistenceComponent = UsageStatisticsPersistenceComponent.getInstance(); - final boolean sendAllowed = statisticsPersistenceComponent.isAllowed(); - try { - statisticsPersistenceComponent.setAllowed(true); - ApplicationStatisticsPersistenceComponent.getInstance().persistOpenedProjects(); - } - finally { - statisticsPersistenceComponent.setAllowed(sendAllowed); - } - StatisticsService service = StatisticsUploadAssistant.getOldStatisticsService(); - final StatisticsResult result = service.send(); - - ApplicationManager.getApplication().invokeLater( - () -> Messages.showMultilineInputDialog(project, "Result: " + result.getCode(), "Statistics Result", - StringUtil.replace(result.getDescription(), ";", "\n"), - null, null), ModalityState.NON_MODAL, project.getDisposed()); - } - }); - } -} diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/beans/ConvertUsagesUtil.java b/platform/platform-impl/src/com/intellij/internal/statistic/beans/ConvertUsagesUtil.java index e336a098a331..ae8940b40bb7 100644 --- a/platform/platform-impl/src/com/intellij/internal/statistic/beans/ConvertUsagesUtil.java +++ b/platform/platform-impl/src/com/intellij/internal/statistic/beans/ConvertUsagesUtil.java @@ -18,13 +18,14 @@ package com.intellij.internal.statistic.beans; import com.intellij.openapi.util.text.StringUtil; import org.jetbrains.annotations.NotNull; -import java.util.*; +import java.util.Map; +import java.util.Set; /** * ATTENTION! DO NOT IMPORT @NotNull AND @Nullable ANNOTATIONS * This class is also used on jetbrains web site */ - +@Deprecated // to be removed in 2018.2 public class ConvertUsagesUtil { static final char GROUP_SEPARATOR = ':'; static final char GROUPS_SEPARATOR = ';'; @@ -83,50 +84,6 @@ public class ConvertUsagesUtil { return ""; } - //@NotNull - public static Map> convertString(String usages) { - assert usages != null; - Map> descriptors = new HashMap<>(); - for (String groupStr : usages.split(Character.toString(GROUPS_SEPARATOR))) { - if (!isEmptyOrSpaces(groupStr)) { - final StringPair group = getPair(groupStr, Character.toString(GROUP_SEPARATOR)); - if (group != null) { - final String groupId = group.first; - assert groupId != null; - descriptors.putAll(convertValueString(GroupDescriptor.create(groupId), group.second)); - } - } - } - return descriptors; - } - - //@NotNull - public static Map> convertValueString(GroupDescriptor groupId, String valueData) { - assert groupId != null; - final Map> descriptors = new HashMap<>(); - for (String value : valueData.split(Character.toString(GROUP_VALUE_SEPARATOR))) { - if (!isEmptyOrSpaces(value)) { - final StringPair pair = getPair(value, "="); - if (pair != null) { - final String count = pair.second; - if (!isEmptyOrSpaces(count)) { - try { - final int i = Integer.parseInt(count); - if (!descriptors.containsKey(groupId)) { - descriptors.put(groupId, new LinkedHashSet<>()); - } - descriptors.get(groupId).add(new UsageDescriptor(pair.first, i)); - } - catch (NumberFormatException ignored) { - } - } - } - } - } - - return descriptors; - } - //@Nullable public static StringPair getPair(String str, String separator) { assert str != null; @@ -142,19 +99,6 @@ public class ConvertUsagesUtil { return null; } - //@NotNull - public static Map> sortDescriptorsByPriority(Map> descriptors) { - assert descriptors != null; - final SortedMap> map = new TreeMap<>((g1, g2) -> { - final int priority = (int)(g2.getPriority() - g1.getPriority()); - return priority == 0 ? g1.getId().compareTo(g2.getId()) : priority; - }); - - map.putAll(descriptors); - - return map; - } - /** * Escapes descriptor name so it could be used in {@link #assertDescriptorName(String)} * diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/beans/GroupDescriptor.java b/platform/platform-impl/src/com/intellij/internal/statistic/beans/GroupDescriptor.java index 92c2dcc2fc52..61ffd985a725 100644 --- a/platform/platform-impl/src/com/intellij/internal/statistic/beans/GroupDescriptor.java +++ b/platform/platform-impl/src/com/intellij/internal/statistic/beans/GroupDescriptor.java @@ -15,16 +15,12 @@ */ package com.intellij.internal.statistic.beans; -import com.intellij.openapi.diagnostic.Logger; -import com.intellij.openapi.util.text.StringUtil; - +@Deprecated // to be removed in 2018.2 public class GroupDescriptor { public static final double DEFAULT_PRIORITY = 0.0; public static final double HIGHER_PRIORITY = 100.0; public static final double LOWER_PRIORITY = -100.0; - private static final int MAX_ID_LENGTH = 30; - private final String myId; private final double myPriority; @@ -37,26 +33,9 @@ public class GroupDescriptor { } private GroupDescriptor(String id, double priority) { - if (StringUtil.isEmptyOrSpaces(id)) throw new IllegalArgumentException("Invalid ID: '" + id + "'"); - checkSeparator(id, ConvertUsagesUtil.GROUP_SEPARATOR); - checkSeparator(id, ConvertUsagesUtil.GROUPS_SEPARATOR); - checkSeparator(id, ConvertUsagesUtil.GROUP_VALUE_SEPARATOR); - if (id.length() > MAX_ID_LENGTH) { - Logger.getInstance(GroupDescriptor.class).error("ID too long: '" + id + "', truncated"); - id = id.substring(0, MAX_ID_LENGTH); - } - myId = ConvertUsagesUtil.ensureProperKey(id); myPriority = priority; } - - private static void checkSeparator(String id, char separator) { - if (id.contains(Character.toString(separator))) { - Logger.getInstance(GroupDescriptor.class). - error("ID should not contain separator \'" + ConvertUsagesUtil.GROUP_SEPARATOR + "\'. Please fix ID \"" + id + "\""); - } - } - public String getId() { return myId; } diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/fus/actions/persistence/BaseUICollector.java b/platform/platform-impl/src/com/intellij/internal/statistic/collectors/fus/actions/persistence/BaseUICollector.java new file mode 100644 index 000000000000..ac9b3353bbbf --- /dev/null +++ b/platform/platform-impl/src/com/intellij/internal/statistic/collectors/fus/actions/persistence/BaseUICollector.java @@ -0,0 +1,24 @@ +// 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.internal.statistic.collectors.fus.actions.persistence; + +import com.intellij.ide.plugins.IdeaPluginDescriptor; +import com.intellij.ide.plugins.PluginManager; +import com.intellij.ide.plugins.cl.PluginClassLoader; +import com.intellij.openapi.extensions.PluginId; +import org.jetbrains.annotations.NotNull; + +public class BaseUICollector { + protected boolean isNotBundledPluginClass(@NotNull Class clazz) { + ClassLoader loader = clazz.getClassLoader(); + if (loader instanceof PluginClassLoader) { + PluginId id = ((PluginClassLoader)loader).getPluginId(); + if (id != null) { + IdeaPluginDescriptor plugin = PluginManager.getPlugin(id); + if (plugin != null && !plugin.isBundled()) { + return true; + } + } + } + return false; + } +} diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/fus/actions/persistence/IntentionsCollector.java b/platform/platform-impl/src/com/intellij/internal/statistic/collectors/fus/actions/persistence/IntentionsCollector.java index 57c96561533a..8b8650f64371 100644 --- a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/fus/actions/persistence/IntentionsCollector.java +++ b/platform/platform-impl/src/com/intellij/internal/statistic/collectors/fus/actions/persistence/IntentionsCollector.java @@ -5,7 +5,6 @@ import com.intellij.codeInsight.intention.IntentionAction; import com.intellij.codeInsight.intention.IntentionActionDelegate; import com.intellij.codeInspection.LocalQuickFix; import com.intellij.codeInspection.ex.QuickFixWrapper; -import com.intellij.internal.statistic.UsagesCollector; import com.intellij.internal.statistic.persistence.UsageStatisticsPersistenceComponent; import com.intellij.lang.Language; import com.intellij.openapi.components.*; @@ -15,7 +14,10 @@ import com.intellij.util.xmlb.annotations.Tag; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.*; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** * @author Konstantin Bulenkov @@ -27,7 +29,7 @@ import java.util.*; @Storage(value = "statistics.intentions.xml", roamingType = RoamingType.DISABLED, deprecated = true) } ) -public class IntentionsCollector implements PersistentStateComponent { +public class IntentionsCollector extends BaseUICollector implements PersistentStateComponent { private State myState = new State(); @Nullable @@ -56,7 +58,7 @@ public class IntentionsCollector implements PersistentStateComponent { +public class MainMenuCollector extends BaseUICollector implements PersistentStateComponent { private State myState = new State(); @Nullable @Override @@ -46,7 +47,7 @@ public class MainMenuCollector implements PersistentStateComponent findBucket(double value, double... ranges) { + if (ranges.length == 0) throw new IllegalArgumentException("Constrains are empty"); + if (value < ranges[0]) return Pair.create(null, ranges[0]); + for (int i = 1; i < ranges.length; i++) { + if (ranges[i] <= ranges[i - 1]) + throw new IllegalArgumentException("Constrains are unsorted"); + + if (value < ranges[i]) { + return Pair.create(ranges[i - 1], ranges[i]); + } + } + + return Pair.create(ranges[ranges.length - 1], null); + } + + + + protected static String findBucket(long value, Function valueConverter, long...ranges) { + double[] dRanges = new double[ranges.length]; + for (int i = 0; i < dRanges.length; i++) { + dRanges[i] = ranges[i]; + } + return findBucket((double)value, (d) -> valueConverter.apply(d.longValue()), dRanges); + } + + protected static String findBucket(double value, Function valueConverter, double...ranges) { + for (double range : ranges) { + if (range == value) { + return valueConverter.apply(value); + } + } + + Pair bucket = findBucket(value, ranges); + if (bucket.first == null) return "(*, " + valueConverter.apply(bucket.second) + ")"; + if (bucket.second == null) return "(" + valueConverter.apply(bucket.first) + ", *)"; + return "(" + valueConverter.apply(bucket.first) + ", " + valueConverter.apply(bucket.second) + ")"; + } + protected String getPathFromMenuSelectionManager(@NotNull AnAction action) { List groups = Arrays.stream(MenuSelectionManager.defaultManager().getSelectedPath()) .filter(o -> o instanceof ActionMenu) diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ExperimentalFeaturesUsageCollector.java b/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ExperimentalFeaturesUsageCollector.java deleted file mode 100644 index 48086cb59dad..000000000000 --- a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ExperimentalFeaturesUsageCollector.java +++ /dev/null @@ -1,35 +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.internal.statistic.collectors.legacy; - -import com.intellij.internal.statistic.UsagesCollector; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.openapi.application.Experiments; -import org.jetbrains.annotations.NotNull; - -import java.util.Arrays; -import java.util.Set; -import java.util.stream.Collectors; - -/** - * @author Konstantin Bulenkov - */ -@Deprecated // to be removed in 2018.2 -public class ExperimentalFeaturesUsageCollector extends UsagesCollector { - private static final GroupDescriptor GROUP_ID = GroupDescriptor.create("Experimental Features"); - - @NotNull - @Override - public Set getUsages() { - return Arrays.stream(Experiments.EP_NAME.getExtensions()) - .filter(f -> Experiments.isFeatureEnabled(f.id)) - .map(f -> new UsageDescriptor(f.id)) - .collect(Collectors.toSet()); - } - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GROUP_ID; - } -} diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/LegacyRegistryUsagesCollector.java b/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/LegacyRegistryUsagesCollector.java deleted file mode 100644 index 12eb3c0d2c67..000000000000 --- a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/LegacyRegistryUsagesCollector.java +++ /dev/null @@ -1,34 +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.internal.statistic.collectors.legacy; - -import com.intellij.internal.statistic.UsagesCollector; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.openapi.util.registry.Registry; -import org.jetbrains.annotations.NotNull; - -import java.util.Set; -import java.util.stream.Collectors; - -/** - * @author Konstantin Bulenkov - */ -@Deprecated // to be removed in 2018.2 -public class LegacyRegistryUsagesCollector extends UsagesCollector { - private static final GroupDescriptor GROUP_ID = GroupDescriptor.create("Registry"); - - @NotNull - @Override - public Set getUsages() { - return Registry.getAll().stream() - .filter(key -> key.isChangedFromDefault()) - .map(key -> new UsageDescriptor(key.getKey())) - .collect(Collectors.toSet()); - } - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GROUP_ID; - } -} diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/actions/LegacyActionUsagesCollector.java b/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/actions/LegacyActionUsagesCollector.java deleted file mode 100644 index 279181c432f5..000000000000 --- a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/actions/LegacyActionUsagesCollector.java +++ /dev/null @@ -1,28 +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.internal.statistic.collectors.legacy.actions; - -import com.intellij.ide.actions.ActionsCollector; -import com.intellij.internal.statistic.UsagesCollector; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.util.containers.ContainerUtil; -import org.jetbrains.annotations.NotNull; - -import java.util.Set; - -@Deprecated // old statistics service format -public final class LegacyActionUsagesCollector extends UsagesCollector { - private static final GroupDescriptor GROUP = GroupDescriptor.create("Actions", GroupDescriptor.HIGHER_PRIORITY); - - @NotNull - public Set getUsages() { - ActionsCollector.State state = ActionsCollector.getInstance().getState(); - assert state != null; - return ContainerUtil.map2Set(state.myValues.entrySet(), e -> new UsageDescriptor(e.getKey(), e.getValue())); - } - - @NotNull - public GroupDescriptor getGroupId() { - return GROUP; - } -} diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/actions/LegacyIntentionUsagesCollector.java b/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/actions/LegacyIntentionUsagesCollector.java deleted file mode 100644 index a5d3c10be3c8..000000000000 --- a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/actions/LegacyIntentionUsagesCollector.java +++ /dev/null @@ -1,28 +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.internal.statistic.collectors.legacy.actions; - -import com.intellij.internal.statistic.UsagesCollector; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.internal.statistic.collectors.fus.actions.persistence.IntentionsCollector; -import com.intellij.util.containers.ContainerUtil; -import org.jetbrains.annotations.NotNull; - -import java.util.Set; - -@Deprecated // to be removed in 2018.2 -public final class LegacyIntentionUsagesCollector extends UsagesCollector { - private static final GroupDescriptor GROUP = GroupDescriptor.create("Intentions"); - - @NotNull - public Set getUsages() { - IntentionsCollector.State state = IntentionsCollector.getInstance().getState(); - assert state != null; - return ContainerUtil.map2Set(state.myIntentions.entrySet(), e -> new UsageDescriptor(e.getKey(), e.getValue())); - } - - @NotNull - public GroupDescriptor getGroupId() { - return GROUP; - } -} diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/actions/LegacyMainMenuUsagesCollector.java b/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/actions/LegacyMainMenuUsagesCollector.java deleted file mode 100644 index 33c33fd6c367..000000000000 --- a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/actions/LegacyMainMenuUsagesCollector.java +++ /dev/null @@ -1,28 +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.internal.statistic.collectors.legacy.actions; - -import com.intellij.internal.statistic.UsagesCollector; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.internal.statistic.collectors.fus.actions.persistence.MainMenuCollector; -import com.intellij.util.containers.ContainerUtil; -import org.jetbrains.annotations.NotNull; - -import java.util.Set; - -@Deprecated // to be removed in 2018.2 -public final class LegacyMainMenuUsagesCollector extends UsagesCollector { - private static final GroupDescriptor GROUP = GroupDescriptor.create("Main Menu", GroupDescriptor.HIGHER_PRIORITY); - - @NotNull - public Set getUsages() { - MainMenuCollector.State state = MainMenuCollector.getInstance().getState(); - assert state != null; - return ContainerUtil.map2Set(state.myValues.entrySet(), e -> new UsageDescriptor(e.getKey(), e.getValue())); - } - - @NotNull - public GroupDescriptor getGroupId() { - return GROUP; - } -} diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/actions/LegacyToolWindowUsagesCollector.java b/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/actions/LegacyToolWindowUsagesCollector.java deleted file mode 100644 index 79fa67b5b722..000000000000 --- a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/actions/LegacyToolWindowUsagesCollector.java +++ /dev/null @@ -1,30 +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.internal.statistic.collectors.legacy.actions; - -import com.intellij.internal.statistic.UsagesCollector; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.internal.statistic.collectors.fus.actions.persistence.ToolWindowCollector; -import com.intellij.util.containers.ContainerUtil; -import org.jetbrains.annotations.NotNull; - -import java.util.Set; - -/** - * @author Konstantin Bulenkov - */ -public class LegacyToolWindowUsagesCollector extends UsagesCollector { - private static final GroupDescriptor GROUP = GroupDescriptor.create("Tool Windows", GroupDescriptor.HIGHER_PRIORITY); - - @NotNull - public Set getUsages() { - ToolWindowCollector.State state = ToolWindowCollector.getInstance().getState(); - assert state != null; - return ContainerUtil.map2Set(state.myValues.entrySet(), e -> new UsageDescriptor(e.getKey(), e.getValue())); - } - - @NotNull - public GroupDescriptor getGroupId() { - return GROUP; - } -} diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/build/BuildNumberUsageCollector.java b/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/build/BuildNumberUsageCollector.java deleted file mode 100644 index f950a54cca15..000000000000 --- a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/build/BuildNumberUsageCollector.java +++ /dev/null @@ -1,30 +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.internal.statistic.collectors.legacy.build; - -import com.intellij.internal.statistic.CollectUsagesException; -import com.intellij.internal.statistic.UsagesCollector; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.openapi.application.impl.ApplicationInfoImpl; -import org.jetbrains.annotations.NotNull; - -import java.util.Collections; -import java.util.Set; - -/** - * @author Ivan Chirkov - */ -@Deprecated // to be removed in 2018.2 -public class BuildNumberUsageCollector extends UsagesCollector { - @NotNull - @Override - public Set getUsages() throws CollectUsagesException { - return Collections.singleton(new UsageDescriptor(ApplicationInfoImpl.getShadowInstance().getBuild().asString(), 1)); - } - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GroupDescriptor.create("application.build"); - } -} diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/fileTypes/LegacyFileTypeUsagesCollector.java b/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/fileTypes/LegacyFileTypeUsagesCollector.java deleted file mode 100644 index 6979dc29f3ad..000000000000 --- a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/fileTypes/LegacyFileTypeUsagesCollector.java +++ /dev/null @@ -1,31 +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.internal.statistic.collectors.legacy.fileTypes; - -import com.intellij.internal.statistic.AbstractProjectsUsagesCollector; -import com.intellij.internal.statistic.CollectUsagesException; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.internal.statistic.collectors.fus.fileTypes.FileTypeUsagesCollector; -import com.intellij.openapi.project.Project; -import org.jetbrains.annotations.NotNull; - -import java.util.Set; - -/** - * @author Nikolay Matveev - */ -public class LegacyFileTypeUsagesCollector extends AbstractProjectsUsagesCollector { - private static final String GROUP_ID = "file-type"; - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GroupDescriptor.create(GROUP_ID); - } - - @NotNull - @Override - public Set getProjectUsages(@NotNull final Project project) throws CollectUsagesException { - return FileTypeUsagesCollector.getDescriptors(project); - } -} diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ideSettings/IdeInitialConfigButtonUsages.java b/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ideSettings/IdeInitialConfigButtonUsages.java deleted file mode 100644 index 228b3668e8a1..000000000000 --- a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ideSettings/IdeInitialConfigButtonUsages.java +++ /dev/null @@ -1,80 +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.internal.statistic.collectors.legacy.ideSettings; - -import javax.swing.*; -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -public final class IdeInitialConfigButtonUsages { - - public static final Set ALL_PLUGINS_SELECTED = Collections.unmodifiableSet(Collections.emptySet()); - - private static volatile ConfigImport ourConfigImport = ConfigImport.NO_INIT; - - private static volatile String ourSkipRemainingPressedScreen = ""; - - private static volatile Set ourPredefinedDisabledPlugins = ALL_PLUGINS_SELECTED; - - private static Set ourDownloadedPlugins = Collections.emptySet(); - - public static ConfigImport getConfigImport() { - return ourConfigImport; - } - - public static void setConfigImport(JRadioButton myRbDoNotImport, - JRadioButton myRbImport, - JRadioButton myRbImportAuto, - JRadioButton myCustomButton) { - if (myRbDoNotImport != null && myRbDoNotImport.isSelected()) { - ourConfigImport = ConfigImport.DO_NOT_IMPORT; - } - else if (myRbImport != null && myRbImport.isSelected()) { - ourConfigImport = ConfigImport.IMPORT_PATH; - } - else if (myRbImportAuto != null && myRbImportAuto.isSelected()) { - ourConfigImport = ConfigImport.IMPORT_AUTO; - } - else if (myCustomButton != null && myCustomButton.isSelected()) { - ourConfigImport = ConfigImport.IMPORT_CUSTOM; - } - } - - public static String getSkipRemainingPressedScreen() { - return ourSkipRemainingPressedScreen; - } - - public static void setSkipRemainingPressedScreen(String skipRemainingPressedScreen) { - ourSkipRemainingPressedScreen = skipRemainingPressedScreen; - } - - public static Set getPredefinedDisabledPlugins() { - return ourPredefinedDisabledPlugins; - } - - public static void setPredefinedDisabledPlugins(Set predefinedDisabledPlugins) { - if (predefinedDisabledPlugins.isEmpty()) { - return; - } - ourPredefinedDisabledPlugins = predefinedDisabledPlugins; - } - - public synchronized static Set getDownloadedPlugins() { - return ourDownloadedPlugins; - } - - public synchronized static void addDownloadedPlugin(String pluginId) { - if (ourDownloadedPlugins.isEmpty()) { - ourDownloadedPlugins = new HashSet<>(); - } - ourDownloadedPlugins.add(pluginId); - } - - public enum ConfigImport { - DO_NOT_IMPORT, - IMPORT_PATH, - IMPORT_AUTO, - IMPORT_CUSTOM, - NO_INIT - } -} diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ideSettings/IdeInitialConfigUsageCollectors.java b/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ideSettings/IdeInitialConfigUsageCollectors.java deleted file mode 100644 index 9bd1b78576af..000000000000 --- a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ideSettings/IdeInitialConfigUsageCollectors.java +++ /dev/null @@ -1,140 +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.internal.statistic.collectors.legacy.ideSettings; - -import com.intellij.ide.WelcomeWizardUtil; -import com.intellij.internal.statistic.CollectUsagesException; -import com.intellij.internal.statistic.UsagesCollector; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.internal.statistic.utils.StatisticsUtilKt; -import com.intellij.openapi.util.text.StringUtil; -import org.jetbrains.annotations.NotNull; - -import java.util.Collections; -import java.util.Set; -import java.util.stream.Collectors; - -import static com.intellij.internal.statistic.collectors.legacy.ideSettings.IdeInitialConfigButtonUsages.*; - -public final class IdeInitialConfigUsageCollectors { - public static class ConfigImport extends Base { - - @NotNull - @Override - public Set doGetUsages() { - return Collections.singleton(StatisticsUtilKt.getEnumUsage("import", getConfigImport())); - } - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GroupDescriptor.create("Import settings"); - } - } - - public static class SkipSteps extends Base { - - @NotNull - @Override - public Set doGetUsages() { - return Collections.singleton(new UsageDescriptor(getSkipRemainingPressedScreen(), 1)); - } - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GroupDescriptor.create("Wizard_Skip remaining pressed"); - } - } - - public static class DisabledPlugins extends Base { - - @NotNull - @Override - public Set doGetUsages() { - return getPredefinedDisabledPlugins().stream() - .map(pluginDescriptor -> new UsageDescriptor(pluginDescriptor, 1)) - .collect(Collectors.toSet()); - } - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GroupDescriptor.create("Wizard_Disabled plugins"); - } - } - - public static class DownloadedPlugins extends Base { - - @NotNull - @Override - public Set doGetUsages() { - return getDownloadedPlugins().stream() - .map(pluginId -> new UsageDescriptor(pluginId, 1)) - .collect(Collectors.toSet()); - } - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GroupDescriptor.create("Wizard_Downloaded plugins"); - } - } - - public static class SelectedKeymap extends Base { - - @Override - protected Set doGetUsages() { - final String keymapName = WelcomeWizardUtil.getWizardMacKeymap(); - if (StringUtil.isEmpty(keymapName)) { - return Collections.emptySet(); - } - else { - return Collections.singleton(new UsageDescriptor(keymapName, 1)); - } - } - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GroupDescriptor.create("Wizard_Selected keymap"); - } - } - - public static class SelectedLAF extends Base { - - @Override - protected Set doGetUsages() { - final String laf = WelcomeWizardUtil.getWizardLAF(); - if (StringUtil.isEmpty(laf)) { - return Collections.emptySet(); - } - else { - return Collections.singleton(new UsageDescriptor(laf, 1)); - } - } - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GroupDescriptor.create("Wizard_Selected LAF"); - } - } - - private abstract static class Base extends UsagesCollector { - protected abstract Set doGetUsages() throws CollectUsagesException; - - private static boolean shouldCount() { - return getConfigImport() != IdeInitialConfigButtonUsages.ConfigImport.NO_INIT; - } - - @NotNull - @Override - public Set getUsages() throws CollectUsagesException { - if (!shouldCount()) { - return Collections.emptySet(); - } - return doGetUsages(); - } - } -} diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/jdk/JdkSettingsUsageCollector.kt b/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/jdk/JdkSettingsUsageCollector.kt deleted file mode 100644 index 484dba6943dd..000000000000 --- a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/jdk/JdkSettingsUsageCollector.kt +++ /dev/null @@ -1,85 +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.internal.statistic.collectors.legacy.jdk - -import com.intellij.internal.statistic.UsagesCollector -import com.intellij.internal.statistic.beans.GroupDescriptor -import com.intellij.internal.statistic.beans.UsageDescriptor -import java.lang.management.ManagementFactory -import java.util.function.Function - -/** - * @author Konstantin Bulenkov - */ -@Deprecated("") // to be removed in 2018.2 -class JdkSettingsUsageCollector : UsagesCollector() { - override fun getUsages(): Set { - return ManagementFactory.getRuntimeMXBean().inputArguments - .filter { accept(it) } - .map { convertToBucket(it) } - .filter { !it.isEmpty() } - .map { UsageDescriptor(it) } - .toSet() - } - - val prefixes: List = listOf("-Xms", - "-Xmx", - "-XX:SoftRefLRUPolicyMSPerMB", - "-XX:ReservedCodeCacheSize") - - fun accept(key: String?): Boolean { - if (key == null) return false - - prefixes.forEach { - if (key.startsWith(it)) return true - } - - return false - } - - private fun convertToBucket(key: String): String { - val sizeMb = getMegabytes(key).toLong() - val converter = Function { it.toString() + "Mb" } - - if (key.startsWith("-Xms")) - return "-Xmx " + findBucket(sizeMb, converter, 512, 750, 1000, 1024, 1500, 2000, 2048, 3000, 4000, 4096, 6000, 8000) - - if (key.startsWith("-Xmx")) - return "-Xms " + findBucket(sizeMb, converter, 64, 128, 256, 512) - - if (key.startsWith("-XX:SoftRefLRUPolicyMSPerMB")) - return "-XX:SoftRefLRUPolicyMSPerMB " + findBucket(sizeMb, converter, 50, 100) - - if (key.startsWith("-XX:ReservedCodeCacheSize")) - return "-XX:ReservedCodeCacheSize " + findBucket(sizeMb, converter, 240, 300, 400, 500) - - return "" - } - - private fun getMegabytes(s: String): Int { - var num = prefixes.firstOrNull { s.startsWith(it) } - ?.let { s.substring(it.length).toUpperCase().trim() } - - if (num == null) return -1 - if (num.startsWith("=")) num = num.substring(1) - - if (num.last().isDigit()) { - return try { Integer.parseInt(num) } catch (e: Exception) { -1 } - } - - try { - val size = Integer.parseInt(num.substring(0, num.length - 1)) - when(num.last()) { - 'B' -> return size / (1024 * 1024) - 'K' -> return size / 1024 - 'M' -> return size - 'G' -> return size * 1024 - } - } catch (e: Exception) { return -1 } - - return -1 - } - - override fun getGroupId(): GroupDescriptor { - return GroupDescriptor.create("JVM options") - } -} \ No newline at end of file diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/jdk/LegacyJdkInfoUsageCollector.java b/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/jdk/LegacyJdkInfoUsageCollector.java deleted file mode 100644 index 1d6f1e0b068b..000000000000 --- a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/jdk/LegacyJdkInfoUsageCollector.java +++ /dev/null @@ -1,31 +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.internal.statistic.collectors.legacy.jdk; - -import com.intellij.internal.statistic.UsagesCollector; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.util.lang.JavaVersion; -import org.jetbrains.annotations.NotNull; - -import java.util.Collections; -import java.util.Set; - -/** - * @author Konstantin Bulenkov - */ -@Deprecated // to be removed in 2018.2 -class LegacyJdkInfoUsageCollector extends UsagesCollector { - @NotNull - @Override - public Set getUsages() { - final String vendor = System.getProperty("java.vendor", "Unknown"); - final String version = "1." + JavaVersion.current().feature; - return Collections.singleton(new UsageDescriptor(vendor + " " + version, 1)); - } - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GroupDescriptor.create("user.jdk"); - } -} \ No newline at end of file diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/os/LegacyOsNameUsageCollector.java b/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/os/LegacyOsNameUsageCollector.java deleted file mode 100644 index 7e41227d6b12..000000000000 --- a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/os/LegacyOsNameUsageCollector.java +++ /dev/null @@ -1,31 +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.internal.statistic.collectors.legacy.os; - -import com.intellij.internal.statistic.CollectUsagesException; -import com.intellij.internal.statistic.UsagesCollector; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.openapi.util.SystemInfo; -import org.jetbrains.annotations.NotNull; - -import java.util.Collections; -import java.util.Set; - -/** - * @author peter - */ -@Deprecated // to be removed in 2018.2 -class LegacyOsNameUsageCollector extends UsagesCollector { - @NotNull - @Override - public Set getUsages() throws CollectUsagesException { - String osName = SystemInfo.isLinux ? "Linux" : SystemInfo.isMac ? "Mac OS X" : SystemInfo.isWindows ? "Windows" : SystemInfo.OS_NAME; - return Collections.singleton(new UsageDescriptor(osName, 1)); - } - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GroupDescriptor.create("user.os.name"); - } -} diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/os/LegacyOsVersionUsageCollector.java b/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/os/LegacyOsVersionUsageCollector.java deleted file mode 100644 index b91e8fdf4d52..000000000000 --- a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/os/LegacyOsVersionUsageCollector.java +++ /dev/null @@ -1,29 +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.internal.statistic.collectors.legacy.os; - -import com.intellij.internal.statistic.UsagesCollector; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.internal.statistic.collectors.fus.os.OsVersionUsageCollector; -import org.jetbrains.annotations.NotNull; - -import java.util.Set; - -/** - * @author peter - */ -@Deprecated - // to be removed in 2018.2 -class LegacyOsVersionUsageCollector extends UsagesCollector { - @NotNull - @Override - public Set getUsages() { - return OsVersionUsageCollector.getDescriptors(); - } - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GroupDescriptor.create("user.os.version"); - } -} \ No newline at end of file diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/plugins/LegacyDisabledPluginsUsagesCollector.java b/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/plugins/LegacyDisabledPluginsUsagesCollector.java deleted file mode 100644 index 52fe70f34148..000000000000 --- a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/plugins/LegacyDisabledPluginsUsagesCollector.java +++ /dev/null @@ -1,26 +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.internal.statistic.collectors.legacy.plugins; - -import com.intellij.ide.plugins.PluginManagerCore; -import com.intellij.internal.statistic.UsagesCollector; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.util.containers.ContainerUtil; -import org.jetbrains.annotations.NotNull; - -import java.util.Set; - -@Deprecated // to be removed in 2018.2 -public class LegacyDisabledPluginsUsagesCollector extends UsagesCollector { - private static final String GROUP_ID = "disabled-plugins"; - - @NotNull - public GroupDescriptor getGroupId() { - return GroupDescriptor.create(GROUP_ID, GroupDescriptor.HIGHER_PRIORITY); - } - - @NotNull - public Set getUsages() { - return ContainerUtil.map2Set(PluginManagerCore.getDisabledPlugins(), descriptor -> new UsageDescriptor(descriptor, 1)); - } -} diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/plugins/LegacyNonBundledPluginsUsagesCollector.java b/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/plugins/LegacyNonBundledPluginsUsagesCollector.java deleted file mode 100644 index fd772f8e4f6e..000000000000 --- a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/plugins/LegacyNonBundledPluginsUsagesCollector.java +++ /dev/null @@ -1,32 +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.internal.statistic.collectors.legacy.plugins; - -import com.intellij.ide.plugins.IdeaPluginDescriptor; -import com.intellij.ide.plugins.PluginManagerCore; -import com.intellij.internal.statistic.UsagesCollector; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.util.containers.ContainerUtil; -import org.jetbrains.annotations.NotNull; - -import java.util.List; -import java.util.Set; - -@Deprecated // to be removed in 2018.2 -public class LegacyNonBundledPluginsUsagesCollector extends UsagesCollector { - private static final String GROUP_ID = "non-bundled-plugins"; - - @NotNull - public GroupDescriptor getGroupId() { - return GroupDescriptor.create(GROUP_ID, GroupDescriptor.HIGHER_PRIORITY); - } - - @NotNull - public Set getUsages() { - final IdeaPluginDescriptor[] plugins = PluginManagerCore.getPlugins(); - final List nonBundledEnabledPlugins = ContainerUtil.filter(plugins, d -> d.isEnabled() && !d.isBundled() && d.getPluginId() != null); - - return ContainerUtil.map2Set(nonBundledEnabledPlugins, descriptor -> new UsageDescriptor(descriptor.getPluginId().getIdString(), 1)); - } - -} diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/productivity/LegacyProductivityFeaturesUsageCollector.java b/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/productivity/LegacyProductivityFeaturesUsageCollector.java deleted file mode 100644 index e7f3ccebd16f..000000000000 --- a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/productivity/LegacyProductivityFeaturesUsageCollector.java +++ /dev/null @@ -1,38 +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.internal.statistic.collectors.legacy.productivity; - -import com.intellij.featureStatistics.FeatureDescriptor; -import com.intellij.featureStatistics.ProductivityFeaturesRegistry; -import com.intellij.internal.statistic.UsagesCollector; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import org.jetbrains.annotations.NotNull; - -import java.util.HashSet; -import java.util.Set; - -@Deprecated // to be removed in 2018.2 -public class LegacyProductivityFeaturesUsageCollector extends UsagesCollector { - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GroupDescriptor.create("productivity", GroupDescriptor.LOWER_PRIORITY); - } - - @NotNull - @Override - public Set getUsages() { - Set usages = new HashSet<>(); - - final ProductivityFeaturesRegistry registry = ProductivityFeaturesRegistry.getInstance(); - for (String featureId : registry.getFeatureIds()) { - final FeatureDescriptor featureDescriptor = registry.getFeatureDescriptor(featureId); - if (featureDescriptor != null) { - usages.add(new UsageDescriptor(featureId, featureDescriptor.getUsageCount())); - } - } - - return usages; - } -} diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ui/LegacyA11YUsagesCollector.java b/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ui/LegacyA11YUsagesCollector.java deleted file mode 100644 index 59bd776bb720..000000000000 --- a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ui/LegacyA11YUsagesCollector.java +++ /dev/null @@ -1,33 +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.internal.statistic.collectors.legacy.ui; - -import com.intellij.internal.statistic.UsagesCollector; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.openapi.util.SystemInfo; -import com.intellij.util.ui.accessibility.ScreenReader; -import org.jetbrains.annotations.NotNull; - -import java.util.Collections; -import java.util.Set; - -/** - * @author tav - */ -@Deprecated // to be removed in 2018.2 -public class LegacyA11YUsagesCollector extends UsagesCollector { - @NotNull - @Override - public Set getUsages() { - String activity = ScreenReader.isActive() ? "ENABLED" : "DISABLED"; - String os = SystemInfo.isWindows ? "Windows" : SystemInfo.isLinux ? "Linux" : SystemInfo.isMac ? "Mac" : "Unknown OS"; - return Collections.singleton(new UsageDescriptor(os + " screen reader " + activity, 1)); - } - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GroupDescriptor.create("user.ui.a11y.screenreader"); - } -} - diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ui/LegacyEditorColorSchemesUsagesCollector.java b/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ui/LegacyEditorColorSchemesUsagesCollector.java deleted file mode 100644 index 623267cb7c99..000000000000 --- a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ui/LegacyEditorColorSchemesUsagesCollector.java +++ /dev/null @@ -1,29 +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.internal.statistic.collectors.legacy.ui; - -import com.intellij.internal.statistic.UsagesCollector; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.internal.statistic.collectors.fus.ui.EditorColorSchemesUsagesCollector; -import org.jetbrains.annotations.NotNull; - -import java.util.Set; - -@Deprecated // to be removed in 2018.2 -public class LegacyEditorColorSchemesUsagesCollector extends UsagesCollector { - - public static final String GROUP_ID = "Color Schemes"; - - @NotNull - @Override - public Set getUsages() { - return EditorColorSchemesUsagesCollector.getDescriptors(); - } - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GroupDescriptor.create(GROUP_ID); - } - -} diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ui/LegacyFontSizeInfoUsageCollector.kt b/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ui/LegacyFontSizeInfoUsageCollector.kt deleted file mode 100644 index b67d482aba33..000000000000 --- a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ui/LegacyFontSizeInfoUsageCollector.kt +++ /dev/null @@ -1,57 +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.internal.statistic.collectors.legacy.ui - -import com.intellij.ide.ui.UISettings -import com.intellij.ide.util.PropertiesComponent -import com.intellij.internal.statistic.CollectUsagesException -import com.intellij.internal.statistic.UsagesCollector -import com.intellij.internal.statistic.beans.GroupDescriptor -import com.intellij.internal.statistic.beans.UsageDescriptor -import com.intellij.openapi.editor.colors.EditorColorsManager -import com.intellij.openapi.editor.colors.impl.AppEditorFontOptions - -/** - * @author Konstantin Bulenkov - */ -class LegacyFontSizeInfoUsageCollector : UsagesCollector() { - @Throws(CollectUsagesException::class) - override fun getUsages(): Set { - val scheme = EditorColorsManager.getInstance().globalScheme - val ui = UISettings.shadowInstance - var usages = setOf( - UsageDescriptor("UI font size: ${ui.fontSize}"), - UsageDescriptor("UI font name: ${ui.fontFace}"), - UsageDescriptor("Presentation mode font size: ${ui.presentationModeFontSize}") - ) - if (!scheme.isUseAppFontPreferencesInEditor) { - usages += setOf( - UsageDescriptor("Editor font size: ${scheme.editorFontSize}"), - UsageDescriptor("Editor font name: ${scheme.editorFontName}") - ) - } - else { - val appPrefs = AppEditorFontOptions.getInstance().fontPreferences - usages += setOf( - UsageDescriptor("IDE editor font size: ${appPrefs.getSize(appPrefs.fontFamily)}"), - UsageDescriptor("IDE editor font name: ${appPrefs.fontFamily}") - ) - } - if (!scheme.isUseEditorFontPreferencesInConsole) { - usages += setOf( - UsageDescriptor("Console font size: ${scheme.consoleFontSize}"), - UsageDescriptor("Console font name: ${scheme.consoleFontName}") - ) - } - val quickDocFontSize = PropertiesComponent.getInstance().getValue("quick.doc.font.size") - if (quickDocFontSize != null) { - usages += setOf( - UsageDescriptor("QuickDoc font size:" + quickDocFontSize) - ) - } - return usages - } - - override fun getGroupId(): GroupDescriptor { - return GroupDescriptor.create("Fonts") - } -} diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ui/LegacyHiDPIModeUsagesCollector.java b/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ui/LegacyHiDPIModeUsagesCollector.java deleted file mode 100644 index 1cf29d54ac1f..000000000000 --- a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ui/LegacyHiDPIModeUsagesCollector.java +++ /dev/null @@ -1,32 +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.internal.statistic.collectors.legacy.ui; - -import com.intellij.internal.statistic.UsagesCollector; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.openapi.util.SystemInfo; -import com.intellij.util.ui.UIUtil; -import org.jetbrains.annotations.NotNull; - -import java.util.Collections; -import java.util.Set; - -/** - * @author tav - */ -@Deprecated // to be removed in 2018.2 -public class LegacyHiDPIModeUsagesCollector extends UsagesCollector { - @NotNull - @Override - public Set getUsages() { - String mode = UIUtil.isJreHiDPIEnabled() ? "per-monitor-dpi" : "system-dpi"; - String os = SystemInfo.isWindows ? "Windows" : SystemInfo.isLinux ? "Linux" : SystemInfo.isMac ? "Mac" : "Unknown OS"; - return Collections.singleton(new UsageDescriptor(os + " " + mode, 1)); - } - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GroupDescriptor.create("user.ui.hidpi.mode"); - } -} diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ui/LegacyLaFUsagesCollector.java b/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ui/LegacyLaFUsagesCollector.java deleted file mode 100644 index 041d91e29f3a..000000000000 --- a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ui/LegacyLaFUsagesCollector.java +++ /dev/null @@ -1,35 +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.internal.statistic.collectors.legacy.ui; - -import com.intellij.ide.ui.LafManager; -import com.intellij.internal.statistic.UsagesCollector; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.openapi.util.SystemInfo; -import com.intellij.openapi.util.text.StringUtil; -import org.jetbrains.annotations.NotNull; - -import javax.swing.*; -import java.util.Collections; -import java.util.Set; - -@Deprecated // to be removed in 2018.2 -public class LegacyLaFUsagesCollector extends UsagesCollector { - @NotNull - @Override - public Set getUsages() { - UIManager.LookAndFeelInfo laf = LafManager.getInstance().getCurrentLookAndFeel(); - String key = SystemInfo.OS_NAME + " - "; - if (!StringUtil.isEmptyOrSpaces(SystemInfo.SUN_DESKTOP)) { - key += SystemInfo.SUN_DESKTOP + " - "; - } - return laf != null ? Collections.singleton(new UsageDescriptor(key + laf.getName(), 1)) - : Collections.emptySet(); - } - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GroupDescriptor.create("Look and Feel"); - } -} diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ui/LegacyScaleInfoUsageCollector.java b/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ui/LegacyScaleInfoUsageCollector.java deleted file mode 100644 index 8d772b074ac3..000000000000 --- a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ui/LegacyScaleInfoUsageCollector.java +++ /dev/null @@ -1,28 +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.internal.statistic.collectors.legacy.ui; - -import com.intellij.internal.statistic.UsagesCollector; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.internal.statistic.collectors.fus.ui.ScaleInfoUsageCollector; -import org.jetbrains.annotations.NotNull; - -import java.util.Set; - -/** - * @author tav - */ -@Deprecated // to be removed in 2018.2 -public class LegacyScaleInfoUsageCollector extends UsagesCollector { - @NotNull - @Override - public Set getUsages() { - return ScaleInfoUsageCollector.getDescriptors(); - } - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GroupDescriptor.create("user.ui.screen.scale"); - } -} diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ui/LegacyShortcutUsagesCollector.java b/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ui/LegacyShortcutUsagesCollector.java deleted file mode 100644 index 4719fee92054..000000000000 --- a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ui/LegacyShortcutUsagesCollector.java +++ /dev/null @@ -1,35 +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.internal.statistic.collectors.legacy.ui; - -import com.intellij.internal.statistic.UsagesCollector; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.internal.statistic.collectors.fus.ui.persistence.ShortcutsCollector; -import com.intellij.openapi.util.SystemInfo; -import com.intellij.util.containers.ContainerUtil; -import org.jetbrains.annotations.NotNull; - -import java.util.Set; - -@Deprecated // to be removed in 2018.2 -public final class LegacyShortcutUsagesCollector extends UsagesCollector { - private static final GroupDescriptor GROUP = GroupDescriptor.create(getGroupName(), GroupDescriptor.HIGHER_PRIORITY); - - private static String getGroupName() { - if (SystemInfo.isMac) return "Shortcuts on Mac"; - if (SystemInfo.isWindows) return "Shortcuts on Windows"; - if (SystemInfo.isLinux) return "Shortcuts on Linux"; - return "Shortcuts on OtherOs"; - } - - @NotNull - public Set getUsages() { - ShortcutsCollector.MyState state = ShortcutsCollector.getInstance().getState(); - return ContainerUtil.map2Set(state.myValues.entrySet(), e -> new UsageDescriptor(e.getKey(), e.getValue())); - } - - @NotNull - public GroupDescriptor getGroupId() { - return GROUP; - } -} diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ui/LegacyToolbarClicksUsagesCollector.java b/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ui/LegacyToolbarClicksUsagesCollector.java deleted file mode 100644 index 164088368031..000000000000 --- a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ui/LegacyToolbarClicksUsagesCollector.java +++ /dev/null @@ -1,28 +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.internal.statistic.collectors.legacy.ui; - -import com.intellij.internal.statistic.UsagesCollector; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.internal.statistic.collectors.fus.ui.persistence.ToolbarClicksCollector; -import com.intellij.util.containers.ContainerUtil; -import org.jetbrains.annotations.NotNull; - -import java.util.Set; - -@Deprecated // to be removed in 2018.2 -public final class LegacyToolbarClicksUsagesCollector extends UsagesCollector { - private static final GroupDescriptor GROUP = GroupDescriptor.create("Toolbar Clicks", GroupDescriptor.HIGHER_PRIORITY); - - @NotNull - public Set getUsages() { - ToolbarClicksCollector.ClicksState state = ToolbarClicksCollector.getInstance().getState(); - assert state != null; - return ContainerUtil.map2Set(state.myValues.entrySet(), e -> new UsageDescriptor(e.getKey(), e.getValue())); - } - - @NotNull - public GroupDescriptor getGroupId() { - return GROUP; - } -} diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ui/LegacyUiInfoUsageCollector.java b/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ui/LegacyUiInfoUsageCollector.java deleted file mode 100644 index 09d1156e8c28..000000000000 --- a/platform/platform-impl/src/com/intellij/internal/statistic/collectors/legacy/ui/LegacyUiInfoUsageCollector.java +++ /dev/null @@ -1,28 +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.internal.statistic.collectors.legacy.ui; - -import com.intellij.internal.statistic.UsagesCollector; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.internal.statistic.collectors.fus.ui.UiInfoUsageCollector; -import org.jetbrains.annotations.NotNull; - -import java.util.Set; - -/** - * @author Konstantin Bulenkov - */ -@Deprecated // to be removed in 2018.2 -class LegacyUiInfoUsageCollector extends UsagesCollector { - @NotNull - @Override - public Set getUsages() { - return UiInfoUsageCollector.getDescriptors(); - } - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GroupDescriptor.create("UI Features"); - } -} diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/connect/StatServiceException.java b/platform/platform-impl/src/com/intellij/internal/statistic/connect/StatServiceException.java index 2964db2021ce..7b8d1c36a91c 100644 --- a/platform/platform-impl/src/com/intellij/internal/statistic/connect/StatServiceException.java +++ b/platform/platform-impl/src/com/intellij/internal/statistic/connect/StatServiceException.java @@ -18,10 +18,6 @@ package com.intellij.internal.statistic.connect; public class StatServiceException extends RuntimeException { - public StatServiceException() { - super(); - } - public StatServiceException(String s) { super(s); } @@ -29,8 +25,4 @@ public class StatServiceException extends RuntimeException { public StatServiceException(String s, Throwable throwable) { super(s, throwable); } - - public StatServiceException(Throwable throwable) { - super(throwable); - } } diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/connect/StatisticsConnectionService.java b/platform/platform-impl/src/com/intellij/internal/statistic/connect/StatisticsConnectionService.java index 3d4c33aba41c..dd7252c6f2de 100644 --- a/platform/platform-impl/src/com/intellij/internal/statistic/connect/StatisticsConnectionService.java +++ b/platform/platform-impl/src/com/intellij/internal/statistic/connect/StatisticsConnectionService.java @@ -27,7 +27,6 @@ import org.jetbrains.annotations.Nullable; // 2. permitted: true/false. statistics could be stopped remotely. if false UsageCollectors won't be started public class StatisticsConnectionService extends SettingsConnectionService { private static final String PERMISSION_ATTR_NAME = "permitted"; - private static final String DISABLED = "disabled"; public StatisticsConnectionService() { this("localhost", null); diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/connect/StatisticsDataSender.java b/platform/platform-impl/src/com/intellij/internal/statistic/connect/StatisticsDataSender.java deleted file mode 100644 index c4c4bf70a10b..000000000000 --- a/platform/platform-impl/src/com/intellij/internal/statistic/connect/StatisticsDataSender.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2000-2011 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.internal.statistic.connect; - - -import org.jetbrains.annotations.NotNull; - -public interface StatisticsDataSender { - - void send(@NotNull String url) throws StatServiceException; -} diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/connect/StatisticsService.java b/platform/platform-impl/src/com/intellij/internal/statistic/connect/StatisticsService.java index 56e2da798980..c09e83203e6a 100644 --- a/platform/platform-impl/src/com/intellij/internal/statistic/connect/StatisticsService.java +++ b/platform/platform-impl/src/com/intellij/internal/statistic/connect/StatisticsService.java @@ -22,10 +22,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public interface StatisticsService { - - @Deprecated // to be removed in 2018.1 - ExtensionPointName EP_NAME = ExtensionPointName.create("com.intellij.statisticsService"); - StatisticsResult send(); Notification createNotification(@NotNull String groupDisplayId, @Nullable NotificationListener listener); diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/connect/StatisticsServiceEP.java b/platform/platform-impl/src/com/intellij/internal/statistic/connect/StatisticsServiceEP.java deleted file mode 100755 index 391c60ff4cbe..000000000000 --- a/platform/platform-impl/src/com/intellij/internal/statistic/connect/StatisticsServiceEP.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2000-2014 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.internal.statistic.connect; - - -import com.intellij.openapi.extensions.AbstractExtensionPointBean; -import com.intellij.openapi.util.LazyInstance; -import com.intellij.util.KeyedLazyInstance; -import com.intellij.util.xmlb.annotations.Attribute; -import org.jetbrains.annotations.NotNull; - -@Deprecated // to be removed in 2018.1x -public class StatisticsServiceEP extends AbstractExtensionPointBean implements KeyedLazyInstance { - @Attribute("key") - public String key; - - @Attribute("implementationClass") - public String implementationClass; - - private final LazyInstance myHandler = new LazyInstance() { - @Override - protected Class getInstanceClass() throws ClassNotFoundException { - return findClass(implementationClass); - } - }; - - @NotNull - @Override - public StatisticsService getInstance() { - return myHandler.getValue(); - } - - @Override - public String getKey() { - return key; - } -} diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/persistence/ApplicationStatisticsPersistence.java b/platform/platform-impl/src/com/intellij/internal/statistic/persistence/ApplicationStatisticsPersistence.java deleted file mode 100644 index 43654bf99f1e..000000000000 --- a/platform/platform-impl/src/com/intellij/internal/statistic/persistence/ApplicationStatisticsPersistence.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.intellij.internal.statistic.persistence; - -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.openapi.project.Project; -import gnu.trove.THashMap; -import org.jetbrains.annotations.NotNull; - -import java.util.Map; - -public abstract class ApplicationStatisticsPersistence { - private final Map> myApplicationData = new THashMap<>(); - - public void persistUsages(@NotNull GroupDescriptor groupDescriptor, @NotNull Project project, @NotNull CollectedUsages usageDescriptors) { - if (!myApplicationData.containsKey(groupDescriptor)) { - myApplicationData.put(groupDescriptor, new THashMap<>()); - } - myApplicationData.get(groupDescriptor).put(project.getName(), usageDescriptors); - } - - @NotNull - public Map getApplicationData(@NotNull GroupDescriptor groupDescriptor) { - if (!myApplicationData.containsKey(groupDescriptor)) { - myApplicationData.put(groupDescriptor, new THashMap<>()); - } - return myApplicationData.get(groupDescriptor); - } - - @NotNull - public Map> getApplicationData() { - return myApplicationData; - } -} diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/persistence/BasicSentUsagesPersistenceComponent.java b/platform/platform-impl/src/com/intellij/internal/statistic/persistence/BasicSentUsagesPersistenceComponent.java index 9cb86d3738b2..0155abf8c881 100644 --- a/platform/platform-impl/src/com/intellij/internal/statistic/persistence/BasicSentUsagesPersistenceComponent.java +++ b/platform/platform-impl/src/com/intellij/internal/statistic/persistence/BasicSentUsagesPersistenceComponent.java @@ -16,55 +16,42 @@ package com.intellij.internal.statistic.persistence; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.util.containers.hash.HashMap; import org.jetbrains.annotations.NonNls; -import org.jetbrains.annotations.NotNull; - -import java.util.Map; -import java.util.Set; public class BasicSentUsagesPersistenceComponent extends SentUsagesPersistence { - public BasicSentUsagesPersistenceComponent() { - } + public BasicSentUsagesPersistenceComponent() { + } - protected Map> mySentDescriptors = new HashMap<>(); - @NonNls - private long mySentTime = 0; - @NonNls - private long myEventLogSentTime = 0; + @NonNls + private long mySentTime = 0; + @NonNls + private long myEventLogSentTime = 0; - @Override - public boolean isAllowed() { - return true; - } + @Override + public boolean isAllowed() { + return true; + } - @Override - public boolean isShowNotification() { - return false; - } + @Override + public boolean isShowNotification() { + return false; + } - @Override - public long getLastTimeSent() { - return mySentTime; - } + @Override + public long getLastTimeSent() { + return mySentTime; + } - public void setSentTime(long time) { - mySentTime = time; - } + public void setSentTime(long time) { + mySentTime = time; + } - public long getEventLogLastTimeSent() { - return myEventLogSentTime; - } + public long getEventLogLastTimeSent() { + return myEventLogSentTime; + } - public void setEventLogSentTime(long time) { - myEventLogSentTime = time; - } - - @NotNull - public Map> getSentUsages () { - return mySentDescriptors; - } + public void setEventLogSentTime(long time) { + myEventLogSentTime = time; + } } diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/persistence/CollectedUsages.java b/platform/platform-impl/src/com/intellij/internal/statistic/persistence/CollectedUsages.java deleted file mode 100644 index 17d73ae9fa0a..000000000000 --- a/platform/platform-impl/src/com/intellij/internal/statistic/persistence/CollectedUsages.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2000-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.internal.statistic.persistence; - -import com.intellij.internal.statistic.beans.UsageDescriptor; -import org.jetbrains.annotations.NotNull; - -import java.util.Set; - -/** - * @author Ivan Chirkov - */ -public class CollectedUsages { - @NotNull - public final Set usages; - public final long collectionTime; - - public CollectedUsages(@NotNull Set usages, long time) { - this.usages = usages; - collectionTime = time; - } -} diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/persistence/SentUsagesPersistence.java b/platform/platform-impl/src/com/intellij/internal/statistic/persistence/SentUsagesPersistence.java index 61cf7994012f..d417c135d929 100644 --- a/platform/platform-impl/src/com/intellij/internal/statistic/persistence/SentUsagesPersistence.java +++ b/platform/platform-impl/src/com/intellij/internal/statistic/persistence/SentUsagesPersistence.java @@ -16,18 +16,8 @@ package com.intellij.internal.statistic.persistence; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import org.jetbrains.annotations.NotNull; - -import java.util.Map; -import java.util.Set; - public abstract class SentUsagesPersistence { - @NotNull - public abstract Map> getSentUsages(); - public abstract boolean isAllowed(); public abstract boolean isShowNotification(); diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/persistence/UsageStatisticsPersistenceComponent.java b/platform/platform-impl/src/com/intellij/internal/statistic/persistence/UsageStatisticsPersistenceComponent.java index 926164874256..617b615aae9e 100644 --- a/platform/platform-impl/src/com/intellij/internal/statistic/persistence/UsageStatisticsPersistenceComponent.java +++ b/platform/platform-impl/src/com/intellij/internal/statistic/persistence/UsageStatisticsPersistenceComponent.java @@ -3,9 +3,6 @@ package com.intellij.internal.statistic.persistence; import com.intellij.ide.gdpr.ConsentOptions; -import com.intellij.internal.statistic.beans.ConvertUsagesUtil; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; import com.intellij.internal.statistic.configurable.SendPeriod; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ex.ApplicationManagerEx; @@ -16,9 +13,6 @@ import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.Map; -import java.util.Set; - @State( name = "UsagesStatistic", storages = @Storage(value = UsageStatisticsPersistenceComponent.USAGE_STATISTICS_XML, roamingType = RoamingType.DISABLED) @@ -30,15 +24,9 @@ public class UsageStatisticsPersistenceComponent extends BasicSentUsagesPersiste @NonNls private boolean isShowNotification = true; @NotNull private SendPeriod myPeriod = SendPeriod.DAILY; - @NonNls private static final String DATA_ATTR = "data"; - @NonNls private static final String GROUP_TAG = "group"; - @NonNls private static final String GROUP_ID_ATTR = "id"; - @NonNls private static final String GROUP_PRIORITY_ATTR = "priority"; - @NonNls private static final String LAST_TIME_ATTR = "time"; @NonNls private static final String EVENT_LOG_LAST_TIME_ATTR = "event-log-time"; @NonNls private static final String IS_ALLOWED_ATTR = "allowed"; - @NonNls private static final String PERIOD_ATTR = "period"; @NonNls private static final String SHOW_NOTIFICATION_ATTR = "show-notification"; public static UsageStatisticsPersistenceComponent getInstance() { @@ -53,21 +41,6 @@ public class UsageStatisticsPersistenceComponent extends BasicSentUsagesPersiste @Override public void loadState(@NotNull final Element element) { - for (Element groupElement : element.getChildren(GROUP_TAG)) { - String groupId = groupElement.getAttributeValue(GROUP_ID_ATTR); - double groupPriority = getPriority(groupElement.getAttributeValue(GROUP_PRIORITY_ATTR)); - - String valueData = groupElement.getAttributeValue(DATA_ATTR); - if (!StringUtil.isEmptyOrSpaces(groupId) && !StringUtil.isEmptyOrSpaces(valueData)) { - try { - getSentUsages().putAll(ConvertUsagesUtil.convertValueString(GroupDescriptor.create(groupId, groupPriority), valueData)); - } - catch (AssertionError e) { - //don't load incorrect groups - } - } - } - try { setSentTime(Long.parseLong(element.getAttributeValue(LAST_TIME_ATTR, "0"))); } @@ -90,23 +63,12 @@ public class UsageStatisticsPersistenceComponent extends BasicSentUsagesPersiste final String isShowNotificationValue = element.getAttributeValue(SHOW_NOTIFICATION_ATTR); setShowNotification(StringUtil.isEmptyOrSpaces(isShowNotificationValue) || Boolean.parseBoolean(isShowNotificationValue)); - - //setPeriod(parsePeriod(element.getAttributeValue(PERIOD_ATTR))); } @Override public Element getState() { Element element = new Element("state"); - for (Map.Entry> entry : ConvertUsagesUtil.sortDescriptorsByPriority(getSentUsages()).entrySet()) { - Element projectElement = new Element(GROUP_TAG); - projectElement.setAttribute(GROUP_ID_ATTR, entry.getKey().getId()); - projectElement.setAttribute(GROUP_PRIORITY_ATTR, Double.toString(entry.getKey().getPriority())); - projectElement.setAttribute(DATA_ATTR, ConvertUsagesUtil.convertValueMap(entry.getValue())); - - element.addContent(projectElement); - } - long lastTimeSent = getLastTimeSent(); if (lastTimeSent > 0) { element.setAttribute(LAST_TIME_ATTR, String.valueOf(lastTimeSent)); @@ -116,17 +78,9 @@ public class UsageStatisticsPersistenceComponent extends BasicSentUsagesPersiste if (lastEventLogTimeSent > 0) { element.setAttribute(EVENT_LOG_LAST_TIME_ATTR, String.valueOf(lastEventLogTimeSent)); } - - //if (isAllowed()) { - // element.setAttribute(IS_ALLOWED_ATTR, "true"); - //} if (!isShowNotification()) { element.setAttribute(SHOW_NOTIFICATION_ATTR, "false"); } - //if (myPeriod != SendPeriod.WEEKLY) { - // element.setAttribute(PERIOD_ATTR, myPeriod.getName()); - //} - return element; } @@ -165,12 +119,6 @@ public class UsageStatisticsPersistenceComponent extends BasicSentUsagesPersiste return isShowNotification; } - private static double getPriority(String priority) { - if (StringUtil.isEmptyOrSpaces(priority)) return GroupDescriptor.DEFAULT_PRIORITY; - - return Double.parseDouble(priority); - } - @Override @NonNls @NotNull diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/service/old/OldConfigurableStatisticsService.java b/platform/platform-impl/src/com/intellij/internal/statistic/service/old/OldConfigurableStatisticsService.java deleted file mode 100755 index 9fc5c2872230..000000000000 --- a/platform/platform-impl/src/com/intellij/internal/statistic/service/old/OldConfigurableStatisticsService.java +++ /dev/null @@ -1,97 +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.internal.statistic.service.old; - -import com.intellij.internal.statistic.CollectUsagesException; -import com.intellij.internal.statistic.UsagesCollector; -import com.intellij.internal.statistic.beans.ConvertUsagesUtil; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.internal.statistic.connect.StatServiceException; -import com.intellij.internal.statistic.connect.StatisticsConnectionService; -import com.intellij.internal.statistic.service.ConfigurableStatisticsService; -import com.intellij.openapi.application.ApplicationNamesInfo; -import com.intellij.openapi.application.PermanentInstallationID; -import com.intellij.openapi.diagnostic.Logger; -import com.intellij.openapi.util.text.StringUtil; -import com.intellij.util.containers.ContainerUtil; -import com.intellij.util.net.HttpConfigurable; -import org.apache.http.Consts; -import org.apache.http.Header; -import org.apache.http.HttpResponse; -import org.apache.http.HttpStatus; -import org.apache.http.client.fluent.Form; -import org.apache.http.client.fluent.Request; -import org.apache.http.client.fluent.Response; -import org.jetbrains.annotations.NotNull; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Set; - -import static com.intellij.internal.statistic.utils.StatisticsUploadAssistant.LOCK; - -@Deprecated // to be removed in 2018.1x -public class OldConfigurableStatisticsService extends - ConfigurableStatisticsService { - - private static final Logger LOG = Logger.getInstance(OldConfigurableStatisticsService.class); - private final StatisticsConnectionService connectionService = new OldStatisticsConnectionService(); - - @NotNull - @Override - public String sendData() { - String url = connectionService.getServiceUrl(); - Map> content = getContentToSend(); - - try { - HttpConfigurable.getInstance().prepareURL(url); - String usages = ConvertUsagesUtil.convertUsages(content); - Response response = Request.Post(url).bodyForm(Form.form(). - add("content", usages). - add("uuid", PermanentInstallationID.get()). - add("patch", String.valueOf(false)). - add("ide", ApplicationNamesInfo.getInstance().getProductName()).build(), - Consts.UTF_8).execute(); - - final HttpResponse httpResponse = response.returnResponse(); - if (httpResponse.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { - throw new StatServiceException("Error during data sending... Code: " + httpResponse.getStatusLine().getStatusCode()); - } - - final Header errors = httpResponse.getFirstHeader("errors"); - if (errors != null) { - String value = errors.getValue(); - throw new StatServiceException("Error during updating statistics " + (!StringUtil.isEmptyOrSpaces(value) ? " : " + value : "")); - } - return usages; - } - catch (StatServiceException e) { - throw e; - } - catch (Exception e) { - throw new StatServiceException("Error during data sending...", e); - } - } - - @NotNull - public Map> getContentToSend() { - synchronized (LOCK) { - Map> usageDescriptors = new LinkedHashMap<>(); - for (UsagesCollector usagesCollector : UsagesCollector.EP_NAME.getExtensions()) { - String groupDescriptor = usagesCollector.getGroupId().getId(); - try { - usageDescriptors.merge(groupDescriptor, usagesCollector.getUsages(), ContainerUtil::union); - } - catch (CollectUsagesException e) { - LOG.info(e); - } - } - - return usageDescriptors; - } - } - - @Override - public StatisticsConnectionService getConnectionService() { - return connectionService; - } -} diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/service/old/OldStatisticsConnectionService.java b/platform/platform-impl/src/com/intellij/internal/statistic/service/old/OldStatisticsConnectionService.java deleted file mode 100644 index 376cd51d9012..000000000000 --- a/platform/platform-impl/src/com/intellij/internal/statistic/service/old/OldStatisticsConnectionService.java +++ /dev/null @@ -1,15 +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.internal.statistic.service.old; - -import com.intellij.internal.statistic.connect.StatisticsConnectionService; -import com.intellij.openapi.application.impl.ApplicationInfoImpl; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -@Deprecated // to be removed in 2018.1x -public class OldStatisticsConnectionService extends StatisticsConnectionService { - public OldStatisticsConnectionService() { - super(((ApplicationInfoImpl)ApplicationInfoImpl.getShadowInstance()).getStatisticsSettingsUrl(), - ((ApplicationInfoImpl)ApplicationInfoImpl.getShadowInstance()).getStatisticsServiceUrl()); - } -} diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/updater/StatisticsJobsScheduler.java b/platform/platform-impl/src/com/intellij/internal/statistic/updater/StatisticsJobsScheduler.java index bd66d9d93fa1..b2ff493acf44 100644 --- a/platform/platform-impl/src/com/intellij/internal/statistic/updater/StatisticsJobsScheduler.java +++ b/platform/platform-impl/src/com/intellij/internal/statistic/updater/StatisticsJobsScheduler.java @@ -84,11 +84,7 @@ public class StatisticsJobsScheduler implements ApplicationComponent { final StatisticsService statisticsService = StatisticsUploadAssistant.getApprovedGroupsStatisticsService(); if (StatisticsUploadAssistant.isSendAllowed() && StatisticsUploadAssistant.isTimeToSend()) { runStatisticsServiceWithDelay(statisticsService, SEND_STATISTICS_DELAY_IN_MIN); - - // TODO: to be removed in 2018.1 - runStatisticsServiceWithDelay(StatisticsUploadAssistant.getOldStatisticsService(), 2 * SEND_STATISTICS_DELAY_IN_MIN); } - if (FeatureUsageLogger.INSTANCE.isEnabled() && StatisticsUploadAssistant.isTimeToSendEventLog()) { runStatisticsServiceWithDelay(StatisticsUploadAssistant.getEventLogStatisticsService(), 3 * SEND_STATISTICS_DELAY_IN_MIN); } diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/utils/StatisticsUploadAssistant.java b/platform/platform-impl/src/com/intellij/internal/statistic/utils/StatisticsUploadAssistant.java index 788aa0a0aa27..9f72eb6ed914 100755 --- a/platform/platform-impl/src/com/intellij/internal/statistic/utils/StatisticsUploadAssistant.java +++ b/platform/platform-impl/src/com/intellij/internal/statistic/utils/StatisticsUploadAssistant.java @@ -22,7 +22,6 @@ import com.intellij.internal.statistic.eventLog.EventLogStatisticsService; import com.intellij.internal.statistic.persistence.SentUsagesPersistence; import com.intellij.internal.statistic.persistence.UsageStatisticsPersistenceComponent; import com.intellij.internal.statistic.service.fus.FUStatisticsService; -import com.intellij.internal.statistic.service.old.OldConfigurableStatisticsService; import com.intellij.util.Time; public class StatisticsUploadAssistant { @@ -66,11 +65,6 @@ public class StatisticsUploadAssistant { UsageStatisticsPersistenceComponent.getInstance().setSentTime(System.currentTimeMillis()); } - @Deprecated // to be removed in 2018.1x - public static StatisticsService getOldStatisticsService() { - return new OldConfigurableStatisticsService(); - } - public static StatisticsService getApprovedGroupsStatisticsService() { return new FUStatisticsService(); } diff --git a/platform/platform-impl/src/com/intellij/openapi/application/ImportOldConfigsPanel.java b/platform/platform-impl/src/com/intellij/openapi/application/ImportOldConfigsPanel.java index 439e0c3bb7d6..afa9de8f95cb 100644 --- a/platform/platform-impl/src/com/intellij/openapi/application/ImportOldConfigsPanel.java +++ b/platform/platform-impl/src/com/intellij/openapi/application/ImportOldConfigsPanel.java @@ -2,7 +2,6 @@ package com.intellij.openapi.application; import com.intellij.ide.cloudConfig.CloudConfigProvider; -import com.intellij.internal.statistic.collectors.legacy.ideSettings.IdeInitialConfigButtonUsages; import com.intellij.openapi.MnemonicHelper; import com.intellij.openapi.ui.TextFieldWithBrowseButton; import com.intellij.openapi.util.Pair; @@ -118,8 +117,6 @@ class ImportOldConfigsPanel extends JDialog { } private void close() { - IdeInitialConfigButtonUsages.setConfigImport(myRbDoNotImport, myRbImport, myRbImportAuto, myCustomButton); - if (myRbImport.isSelected()) { String text = myPrevInstallation.getText(); if (StringUtil.isEmptyOrSpaces(text)) { diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java index d0c1f9506171..919ad8bef7bb 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java @@ -18,7 +18,6 @@ package com.intellij.openapi.diff.impl; import com.intellij.icons.AllIcons; import com.intellij.ide.actions.EditSourceAction; import com.intellij.idea.ActionsBundle; -import com.intellij.internal.statistic.UsageTrigger; import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.application.Application; @@ -152,7 +151,6 @@ public class DiffPanelImpl implements DiffPanelEx, ContentChangeListener, TwoSid boolean horizontal, int diffDividerPolygonsOffset, DiffTool parentTool) { - UsageTrigger.trigger("diff.DiffPanelImpl"); myProject = project; myIsHorizontal = horizontal; diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ui/MergePanel2.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ui/MergePanel2.java index f92f1d06e168..8848ceb5e709 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ui/MergePanel2.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ui/MergePanel2.java @@ -16,7 +16,6 @@ package com.intellij.openapi.diff.impl.incrementalMerge.ui; import com.intellij.icons.AllIcons; -import com.intellij.internal.statistic.UsageTrigger; import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.PlatformDataKeys; @@ -89,7 +88,6 @@ public class MergePanel2 implements DiffViewer { private final MyDataProvider myProvider; public MergePanel2(DialogBuilder builder, @NotNull Disposable parent) { - UsageTrigger.trigger("diff.MergePanel2"); ArrayList editorPlaces = new ArrayList<>(); EditorPlace.EditorListener placeListener = new EditorPlace.EditorListener() { diff --git a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/ConfigurableEditor.java b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/ConfigurableEditor.java index 6c0babad472b..eba50a16d62f 100644 --- a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/ConfigurableEditor.java +++ b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/ConfigurableEditor.java @@ -2,7 +2,6 @@ package com.intellij.openapi.options.newEditor; import com.intellij.CommonBundle; -import com.intellij.internal.statistic.UsageTrigger; import com.intellij.internal.statistic.beans.ConvertUsagesUtil; import com.intellij.internal.statistic.eventLog.FeatureUsageUiEvents; import com.intellij.openapi.Disposable; @@ -317,7 +316,6 @@ class ConfigurableEditor extends AbstractEditor implements AnActionListener, AWT configurable.apply(); final String key = getConfigurableEventId(configurable); FeatureUsageUiEvents.INSTANCE.logApplyConfigurable(key); - UsageTrigger.trigger(key); } catch (ConfigurationException exception) { return exception; diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.java index 4671ce25f0d9..526374a4d03e 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.java @@ -5,8 +5,6 @@ import com.intellij.ide.FrameStateManager; import com.intellij.ide.IdeEventQueue; import com.intellij.ide.actions.ActivateToolWindowAction; import com.intellij.ide.actions.MaximizeActiveDialogAction; -import com.intellij.internal.statistic.UsageTrigger; -import com.intellij.internal.statistic.beans.ConvertUsagesUtil; import com.intellij.internal.statistic.collectors.fus.actions.persistence.ToolWindowCollector; import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.ActionManager; @@ -2304,6 +2302,5 @@ public class ToolWindowManagerImpl extends ToolWindowManagerEx implements Persis private static void triggerUsage(@NotNull String feature) { //noinspection deprecation - UsageTrigger.trigger(ConvertUsagesUtil.escapeDescriptorName(feature)); } } \ No newline at end of file diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java index 62b48423184a..90925652651b 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java @@ -6,7 +6,6 @@ import com.intellij.diagnostic.MessagePool; import com.intellij.icons.AllIcons; import com.intellij.ide.DataManager; import com.intellij.ide.RecentProjectsManager; -import com.intellij.internal.statistic.UsageTrigger; import com.intellij.notification.NotificationType; import com.intellij.notification.impl.IdeNotificationArea; import com.intellij.openapi.Disposable; @@ -368,7 +367,6 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame, Disposable, Ac .createActionGroupPopup(null, new IconsFreeActionGroup(configureGroup), e.getDataContext(), JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false, ActionPlaces.WELCOME_SCREEN); popup.showUnderneathOfLabel(ref.get()); - UsageTrigger.trigger("welcome.screen." + groupId); } }; JComponent panel = createActionLink(text, icon, ref, action); @@ -707,7 +705,6 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame, Disposable, Ac @Override public void actionPerformed(@NotNull AnActionEvent e) { child.actionPerformed(e); - UsageTrigger.trigger("welcome.screen." + e.getActionManager().getId(child)); } @Override @@ -730,7 +727,8 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame, Disposable, Ac } private static Runnable createUsageTracker(final AnAction action) { - return () -> UsageTrigger.trigger("welcome.screen." + ActionManager.getInstance().getId(action)); + return () -> { + }; } private static JLabel createArrow(final ActionLink link) { diff --git a/platform/platform-resources/src/META-INF/LangExtensions.xml b/platform/platform-resources/src/META-INF/LangExtensions.xml index 00cda3a9c822..415f4c2b8c82 100644 --- a/platform/platform-resources/src/META-INF/LangExtensions.xml +++ b/platform/platform-resources/src/META-INF/LangExtensions.xml @@ -914,7 +914,6 @@ - @@ -924,20 +923,10 @@ - - - - - - - - - - diff --git a/platform/platform-resources/src/META-INF/PlatformExtensionPoints.xml b/platform/platform-resources/src/META-INF/PlatformExtensionPoints.xml index 449301ae339e..5cc8694d9673 100644 --- a/platform/platform-resources/src/META-INF/PlatformExtensionPoints.xml +++ b/platform/platform-resources/src/META-INF/PlatformExtensionPoints.xml @@ -160,10 +160,6 @@ - - - - diff --git a/platform/platform-resources/src/META-INF/PlatformExtensions.xml b/platform/platform-resources/src/META-INF/PlatformExtensions.xml index c6a7e0ccd437..d9d7c2d98076 100644 --- a/platform/platform-resources/src/META-INF/PlatformExtensions.xml +++ b/platform/platform-resources/src/META-INF/PlatformExtensions.xml @@ -207,8 +207,6 @@ - - @@ -425,50 +423,11 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/platform/platform-resources/src/componentSets/Platform.xml b/platform/platform-resources/src/componentSets/Platform.xml index 07290e6bc1ee..ad06eee5a402 100644 --- a/platform/platform-resources/src/componentSets/Platform.xml +++ b/platform/platform-resources/src/componentSets/Platform.xml @@ -92,11 +92,6 @@ com.intellij.internal.statistic.persistence.UsageStatisticsPersistenceComponent - - com.intellij.internal.statistic.ApplicationStatisticsPersistenceComponent - com.intellij.internal.statistic.ApplicationStatisticsPersistenceComponent - - com.intellij.ide.ClipboardSynchronizer com.intellij.ide.ClipboardSynchronizer diff --git a/platform/platform-resources/src/idea/PlatformActions.xml b/platform/platform-resources/src/idea/PlatformActions.xml index 436c0e133b91..1fd4d3b6aeb8 100644 --- a/platform/platform-resources/src/idea/PlatformActions.xml +++ b/platform/platform-resources/src/idea/PlatformActions.xml @@ -830,8 +830,7 @@ - - + fileTypes) throws CollectUsagesException { - final Set usages = new LegacyFileTypeUsagesCollector().getProjectUsages(getProject()); - for (UsageDescriptor usage : usages) { - assertEquals(1, usage.getValue()); - } - assertEquals( - ContainerUtil.map2Set(fileTypes, (NotNullFunction)fileType -> fileType.getName()), - ContainerUtil.map2Set(usages, (NotNullFunction)usageDescriptor -> usageDescriptor.getKey()) - ); - } - - public void testEmptyProject() throws CollectUsagesException { - doTest(Arrays.asList()); - } - - public void testSingleFileProject() throws CollectUsagesException { - myFixture.configureByText("a.txt", ""); - doTest(Arrays.asList(PlainTextFileType.INSTANCE)); - } - - public void testSeveralSameFilesProject() throws CollectUsagesException { - myFixture.configureByText("a.txt", ""); - myFixture.configureByText("b.txt", ""); - doTest(Arrays.asList(PlainTextFileType.INSTANCE)); - } -} diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/util/ssh/SshKeyChecker.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/util/ssh/SshKeyChecker.java index 994f926b5a23..88375694c11e 100644 --- a/platform/remote-servers/impl/src/com/intellij/remoteServer/util/ssh/SshKeyChecker.java +++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/util/ssh/SshKeyChecker.java @@ -16,7 +16,6 @@ package com.intellij.remoteServer.util.ssh; import com.intellij.execution.filters.HyperlinkInfo; -import com.intellij.internal.statistic.UsageTrigger; import com.intellij.notification.Notification; import com.intellij.notification.NotificationListener; import com.intellij.openapi.options.ConfigurationException; @@ -246,7 +245,6 @@ public class SshKeyChecker { @Override protected void uploadKey(final File sskKey) { - UsageTrigger.trigger(CloudsTriggerKeys.UPLOAD_SSH_KEY); try { myServerConfigurable.apply(); } diff --git a/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/StructuralReplaceAction.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/StructuralReplaceAction.java index 71c2d85a4537..ed5ddc1e0138 100644 --- a/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/StructuralReplaceAction.java +++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/StructuralReplaceAction.java @@ -1,6 +1,5 @@ package com.intellij.structuralsearch.plugin; -import com.intellij.internal.statistic.UsageTrigger; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.project.Project; import com.intellij.psi.PsiDocumentManager; @@ -21,7 +20,6 @@ public class StructuralReplaceAction extends AnAction { } public static void triggerAction(Configuration config, SearchContext searchContext) { - UsageTrigger.trigger("structural.replace"); final Project project = searchContext.getProject(); if (project == null) { return; diff --git a/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/StructuralSearchAction.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/StructuralSearchAction.java index b37ae831497a..abf14cf4e9a1 100644 --- a/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/StructuralSearchAction.java +++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/StructuralSearchAction.java @@ -1,7 +1,6 @@ // 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.structuralsearch.plugin; -import com.intellij.internal.statistic.UsageTrigger; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.registry.Registry; @@ -21,7 +20,6 @@ public class StructuralSearchAction extends AnAction { } public static void triggerAction(Configuration config, SearchContext searchContext) { - UsageTrigger.trigger("structural.search"); final Project project = searchContext.getProject(); if (project == null) { return; diff --git a/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/CharsetEP.java b/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/CharsetEP.java index 0422ac9c4d86..83ecac7859b6 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/CharsetEP.java +++ b/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/CharsetEP.java @@ -1,7 +1,6 @@ // 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.diff.impl.patch; -import com.intellij.internal.statistic.UsageTrigger; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Key; import com.intellij.openapi.vcs.changes.CommitContext; @@ -35,7 +34,6 @@ public class CharsetEP implements PatchEP { final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file); if (vf == null) return null; CharSequence charsetName = vf.getCharset().name(); - UsageTrigger.trigger("Patch.CharsetEP." + charsetName); return charsetName; } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/statistics/LegacyVcsOptionsUsagesCollector.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/statistics/LegacyVcsOptionsUsagesCollector.java deleted file mode 100644 index 8f07d6081779..000000000000 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/statistics/LegacyVcsOptionsUsagesCollector.java +++ /dev/null @@ -1,25 +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.vcs.statistics; - -import com.intellij.internal.statistic.AbstractProjectsUsagesCollector; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.openapi.project.Project; -import org.jetbrains.annotations.NotNull; - -import java.util.Set; - -@Deprecated // to be removed in 2018.2 -public class LegacyVcsOptionsUsagesCollector extends AbstractProjectsUsagesCollector { - private static final String GROUP_ID = "vcs-options"; - - @NotNull - public GroupDescriptor getGroupId() { - return GroupDescriptor.create(GROUP_ID); - } - - @NotNull - public Set getProjectUsages(@NotNull Project project) { - return VcsOptionsUsagesCollector.getDescriptors(project); - } -} diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/statistics/LegacyVcsStatsUsagesCollector.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/statistics/LegacyVcsStatsUsagesCollector.java deleted file mode 100644 index a7a1f23c2572..000000000000 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/statistics/LegacyVcsStatsUsagesCollector.java +++ /dev/null @@ -1,25 +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.vcs.statistics; - -import com.intellij.internal.statistic.AbstractProjectsUsagesCollector; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.openapi.project.Project; -import org.jetbrains.annotations.NotNull; - -import java.util.Set; - -@Deprecated // to be removed in 2018.2 -public class LegacyVcsStatsUsagesCollector extends AbstractProjectsUsagesCollector { - private static final String GROUP_ID = "vcs-stats"; - - @NotNull - public GroupDescriptor getGroupId() { - return GroupDescriptor.create(GROUP_ID); - } - - @NotNull - public Set getProjectUsages(@NotNull Project project) { - return VcsStatsUsagesCollector.getDescriptors(project); - } -} diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/statistics/LegacyVcsUsagesCollector.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/statistics/LegacyVcsUsagesCollector.java deleted file mode 100644 index 38294390c383..000000000000 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/statistics/LegacyVcsUsagesCollector.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2000-2010 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.openapi.vcs.statistics; - -import com.intellij.internal.statistic.AbstractProjectsUsagesCollector; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.openapi.project.Project; -import org.jetbrains.annotations.NotNull; - -import java.util.Set; - -@Deprecated // to be removed in 2018.2 -public class LegacyVcsUsagesCollector extends AbstractProjectsUsagesCollector { - private static final String GROUP_ID = "vcs"; - - @NotNull - public GroupDescriptor getGroupId() { - return GroupDescriptor.create(GROUP_ID, GroupDescriptor.HIGHER_PRIORITY); - } - - @NotNull - public Set getProjectUsages(@NotNull Project project) { - return VcsNamesUsagesCollector.getDescriptors(project); - } -} diff --git a/platform/vcs-log/impl/src/META-INF/vcs-log.xml b/platform/vcs-log/impl/src/META-INF/vcs-log.xml index 074254d8362f..28d0c2df56f7 100644 --- a/platform/vcs-log/impl/src/META-INF/vcs-log.xml +++ b/platform/vcs-log/impl/src/META-INF/vcs-log.xml @@ -23,9 +23,6 @@ - - - diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/statistics/VcsLogFeaturesCollector.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/statistics/VcsLogFeaturesCollector.java deleted file mode 100644 index 2ca54a27a803..000000000000 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/statistics/VcsLogFeaturesCollector.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2000-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.vcs.log.statistics; - -import com.intellij.internal.statistic.AbstractProjectsUsagesCollector; -import com.intellij.internal.statistic.beans.ConvertUsagesUtil; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.internal.statistic.utils.StatisticsUtilKt; -import com.intellij.openapi.extensions.Extensions; -import com.intellij.openapi.project.Project; -import com.intellij.util.containers.ContainerUtil; -import com.intellij.vcs.log.graph.PermanentGraph; -import com.intellij.vcs.log.impl.CommonUiProperties; -import com.intellij.vcs.log.impl.MainVcsLogUiProperties; -import com.intellij.vcs.log.impl.VcsProjectLog; -import com.intellij.vcs.log.ui.VcsLogUiImpl; -import com.intellij.vcs.log.ui.highlighters.VcsLogHighlighterFactory; -import org.jetbrains.annotations.NotNull; - -import java.util.Collections; -import java.util.Set; - -import static com.intellij.vcs.log.impl.MainVcsLogUiProperties.*; -import static com.intellij.vcs.log.ui.VcsLogUiImpl.LOG_HIGHLIGHTER_FACTORY_EP; - -public class VcsLogFeaturesCollector extends AbstractProjectsUsagesCollector { - public static final GroupDescriptor ID = GroupDescriptor.create("VCS Log Ui Settings"); - - @NotNull - @Override - public Set getProjectUsages(@NotNull Project project) { - VcsProjectLog projectLog = VcsProjectLog.getInstance(project); - if (projectLog != null) { - VcsLogUiImpl ui = projectLog.getMainLogUi(); - if (ui != null) { - MainVcsLogUiProperties properties = ui.getProperties(); - - Set usages = ContainerUtil.newHashSet(); - usages.add(StatisticsUtilKt.getBooleanUsage("ui.details", properties.get(CommonUiProperties.SHOW_DETAILS))); - usages.add(StatisticsUtilKt.getBooleanUsage("ui.long.edges", properties.get(SHOW_LONG_EDGES))); - - PermanentGraph.SortType sortType = properties.get(BEK_SORT_TYPE); - usages.add(StatisticsUtilKt.getBooleanUsage("ui.sort.linear.bek", sortType.equals(PermanentGraph.SortType.LinearBek))); - usages.add(StatisticsUtilKt.getBooleanUsage("ui.sort.bek", sortType.equals(PermanentGraph.SortType.Bek))); - usages.add(StatisticsUtilKt.getBooleanUsage("ui.sort.normal", sortType.equals(PermanentGraph.SortType.Normal))); - - if (ui.getColorManager().isMultipleRoots()) { - usages.add(StatisticsUtilKt.getBooleanUsage("ui.roots", properties.get(CommonUiProperties.SHOW_ROOT_NAMES))); - } - - usages.add(StatisticsUtilKt.getBooleanUsage("ui.labels.compact", properties.get(COMPACT_REFERENCES_VIEW))); - usages.add(StatisticsUtilKt.getBooleanUsage("ui.labels.showTagNames", properties.get(SHOW_TAG_NAMES))); - - usages.add(StatisticsUtilKt.getBooleanUsage("ui.textFilter.regex", properties.get(TEXT_FILTER_REGEX))); - usages.add(StatisticsUtilKt.getBooleanUsage("ui.textFilter.matchCase", properties.get(TEXT_FILTER_MATCH_CASE))); - - for (VcsLogHighlighterFactory factory : Extensions.getExtensions(LOG_HIGHLIGHTER_FACTORY_EP, project)) { - if (factory.showMenuItem()) { - VcsLogHighlighterProperty property = VcsLogHighlighterProperty.get(factory.getId()); - usages.add(StatisticsUtilKt.getBooleanUsage("ui.highlighter." + ConvertUsagesUtil.ensureProperKey(factory.getId()), - properties.exists(property) && properties.get(property))); - } - } - - return usages; - } - } - return Collections.emptySet(); - } - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return ID; - } -} diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/statistics/VcsLogRepoSizeCollector.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/statistics/VcsLogRepoSizeCollector.java deleted file mode 100644 index 11993fa677d1..000000000000 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/statistics/VcsLogRepoSizeCollector.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2000-2014 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.vcs.log.statistics; - -import com.intellij.internal.statistic.AbstractProjectsUsagesCollector; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.internal.statistic.utils.StatisticsUtilKt; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.vcs.VcsKey; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.util.containers.ContainerUtil; -import com.intellij.util.containers.MultiMap; -import com.intellij.vcs.log.VcsLogProvider; -import com.intellij.vcs.log.data.DataPack; -import com.intellij.vcs.log.data.VcsLogData; -import com.intellij.vcs.log.graph.PermanentGraph; -import com.intellij.vcs.log.impl.VcsProjectLog; -import org.jetbrains.annotations.NotNull; - -import java.util.Collections; -import java.util.Map; -import java.util.Set; - -import static java.util.Arrays.asList; - -@SuppressWarnings("StringToUpperCaseOrToLowerCaseWithoutLocale") -public class VcsLogRepoSizeCollector extends AbstractProjectsUsagesCollector { - - public static final GroupDescriptor ID = GroupDescriptor.create("VCS Log 2"); - - @NotNull - @Override - public Set getProjectUsages(@NotNull Project project) { - VcsProjectLog projectLog = VcsProjectLog.getInstance(project); - VcsLogData logData = projectLog.getDataManager(); - if (logData != null) { - DataPack dataPack = logData.getDataPack(); - if (dataPack.isFull()) { - PermanentGraph permanentGraph = dataPack.getPermanentGraph(); - MultiMap groupedRoots = groupRootsByVcs(dataPack.getLogProviders()); - - Set usages = ContainerUtil.newHashSet(); - usages.add(StatisticsUtilKt.getCountingUsage("data.commit.count", permanentGraph.getAllCommits().size(), - asList(0, 1, 100, 1000, 10 * 1000, 100 * 1000, 500 * 1000, 1000 * 1000))); - usages.add(StatisticsUtilKt.getCountingUsage("data.branches.count", dataPack.getRefsModel().getBranches().size(), - asList(0, 1, 10, 50, 100, 500, 1000, 5 * 1000, 10 * 1000, 20 * 1000, 50 * 1000))); - usages.add(StatisticsUtilKt.getCountingUsage("data.users.count", logData.getAllUsers().size(), - asList(0, 1, 10, 50, 100, 500, 1000, 5 * 1000, 10 * 1000, 20 * 1000, 50 * 1000))); - - for (VcsKey vcs : groupedRoots.keySet()) { - usages.add(StatisticsUtilKt.getCountingUsage("data." + vcs.getName().toLowerCase() + ".root.count", groupedRoots.get(vcs).size(), - asList(0, 1, 2, 5, 8, 15, 30, 50, 100, 300, 500))); - } - return usages; - } - } - return Collections.emptySet(); - } - - @NotNull - private static MultiMap groupRootsByVcs(@NotNull Map providers) { - MultiMap result = MultiMap.create(); - for (Map.Entry entry : providers.entrySet()) { - VirtualFile root = entry.getKey(); - VcsKey vcs = entry.getValue().getSupportedVcs(); - result.putValue(vcs, root); - } - return result; - } - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return ID; - } -} diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/util/VcsLogUtil.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/util/VcsLogUtil.java index cdaa02c79a8c..9905153f684f 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/util/VcsLogUtil.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/util/VcsLogUtil.java @@ -1,8 +1,6 @@ // Copyright 2000-2017 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.vcs.log.util; -import com.intellij.internal.statistic.UsageTrigger; -import com.intellij.internal.statistic.beans.ConvertUsagesUtil; import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.project.Project; @@ -207,7 +205,6 @@ public class VcsLogUtil { } public static void triggerUsage(@NotNull String text, boolean isFromHistory) { - UsageTrigger.trigger(isFromHistory ? "vcs.history." : "vcs.log." + ConvertUsagesUtil.ensureProperKey(text).replace(" ", "")); } public static boolean maybeRegexp(@NotNull String text) { diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/AttachToProcessAction.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/AttachToProcessAction.java index 1e283f14a65b..96ad5a1e3574 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/AttachToProcessAction.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/AttachToProcessAction.java @@ -7,8 +7,6 @@ import com.intellij.execution.ExecutionException; import com.intellij.execution.process.ProcessInfo; import com.intellij.execution.runners.ExecutionUtil; import com.intellij.icons.AllIcons; -import com.intellij.internal.statistic.UsageTrigger; -import com.intellij.internal.statistic.beans.ConvertUsagesUtil; import com.intellij.notification.Notification; import com.intellij.notification.NotificationType; import com.intellij.notification.Notifications; @@ -569,8 +567,6 @@ public class AttachToProcessAction extends AnAction { public void startDebugSession(@NotNull Project project) { XAttachDebugger debugger = getSelectedDebugger(); - UsageTrigger.trigger(ConvertUsagesUtil.ensureProperKey("debugger.attach")); - UsageTrigger.trigger(ConvertUsagesUtil.ensureProperKey("debugger.attach." + debugger.getDebuggerDisplayName())); try { debugger.attachDebugSession(project, myHost, myInfo); diff --git a/plugins/git4idea/src/META-INF/plugin.xml b/plugins/git4idea/src/META-INF/plugin.xml index 4d1db2e15288..1282245b4db1 100644 --- a/plugins/git4idea/src/META-INF/plugin.xml +++ b/plugins/git4idea/src/META-INF/plugin.xml @@ -165,7 +165,6 @@ - diff --git a/plugins/git4idea/src/git4idea/GitStatisticsCollector.kt b/plugins/git4idea/src/git4idea/GitStatisticsCollector.kt deleted file mode 100644 index ef4ee714d5e4..000000000000 --- a/plugins/git4idea/src/git4idea/GitStatisticsCollector.kt +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2000-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package git4idea - -import com.google.common.collect.HashMultiset -import com.intellij.internal.statistic.AbstractProjectsUsagesCollector -import com.intellij.internal.statistic.UsageTrigger -import com.intellij.internal.statistic.beans.GroupDescriptor -import com.intellij.internal.statistic.beans.UsageDescriptor -import com.intellij.internal.statistic.utils.getBooleanUsage -import com.intellij.internal.statistic.utils.getCountingUsage -import com.intellij.openapi.project.Project -import com.intellij.util.io.URLUtil -import git4idea.config.GitVcsSettings -import git4idea.config.GitVersion -import git4idea.repo.GitRemote - -fun reportUsage(key: String) { - UsageTrigger.trigger(key) -} - -class GitStatisticsCollector : AbstractProjectsUsagesCollector() { - private val ID = GroupDescriptor.create("Git") - - override fun getProjectUsages(project: Project): Set { - val repositoryManager = GitUtil.getRepositoryManager(project) - val settings = GitVcsSettings.getInstance(project) - val repositories = repositoryManager.repositories - val usages = hashSetOf() - - usages.add(UsageDescriptor("config.repo.sync." + settings.syncSetting.name, 1)) - usages.add(UsageDescriptor("config.update.type." + settings.updateType.name, 1)) - usages.add(UsageDescriptor("config.save.policy." + settings.updateChangesPolicy().name, 1)) - usages.add(getBooleanUsage("config.ssh", settings.isIdeaSsh)) - - usages.add(getBooleanUsage("config.push.autoupdate", settings.autoUpdateIfPushRejected())) - usages.add(getBooleanUsage("config.push.update.all.roots", settings.shouldUpdateAllRootsIfPushRejected())) - usages.add(getBooleanUsage("config.cherry-pick.autocommit", settings.isAutoCommitOnCherryPick)) - usages.add(getBooleanUsage("config.warn.about.crlf", settings.warnAboutCrlf())) - usages.add(getBooleanUsage("config.warn.about.detached", settings.warnAboutDetachedHead())) - - usages.add(versionUsage(GitVcs.getInstance(project).version)) - - for (repository in repositories) { - val branches = repository.branches - usages.add(getCountingUsage("data.local.branches.count", branches.localBranches.size, listOf(0, 1, 2, 5, 8, 15, 30, 50))) - usages.add(getCountingUsage("data.remote.branches.count", branches.remoteBranches.size, listOf(0, 1, 2, 5, 8, 15, 30, 100))) - usages.add(getCountingUsage("data.remotes.in.project", repository.remotes.size, listOf(0, 1, 2, 5))) - - val servers = repository.remotes.mapNotNull(this::getRemoteServerType).toCollection(HashMultiset.create()) - for (serverName in servers) { - usages.add(getCountingUsage("data.remote.servers." + serverName, servers.count(serverName), listOf(0, 1, 2, 3, 5))) - } - } - - return usages - } - - private fun versionUsage(version: GitVersion) = UsageDescriptor("version.${version.semanticPresentation}") - - override fun getGroupId(): GroupDescriptor { - return ID - } - - private fun getRemoteServerType(remote: GitRemote): String? { - val hosts = remote.urls.map(URLUtil::parseHostFromSshUrl).distinct() - - if (hosts.contains("github.com")) return "github.com" - if (hosts.contains("gitlab.com")) return "gitlab.com" - if (hosts.contains("bitbucket.org")) return "bitbucket.org" - - if (remote.urls.any { it.contains("github") }) return "github.custom" - if (remote.urls.any { it.contains("gitlab") }) return "gitlab.custom" - if (remote.urls.any { it.contains("bitbucket") }) return "bitbucket.custom" - - return null - } -} diff --git a/plugins/git4idea/src/git4idea/ui/branch/GitBranchPopupActions.java b/plugins/git4idea/src/git4idea/ui/branch/GitBranchPopupActions.java index f1fc6db8e208..4019bcd97ad1 100644 --- a/plugins/git4idea/src/git4idea/ui/branch/GitBranchPopupActions.java +++ b/plugins/git4idea/src/git4idea/ui/branch/GitBranchPopupActions.java @@ -52,7 +52,6 @@ import static com.intellij.dvcs.ui.BranchActionUtil.FAVORITE_BRANCH_COMPARATOR; import static com.intellij.dvcs.ui.BranchActionUtil.getNumOfTopShownBranches; import static com.intellij.util.ObjectUtils.notNull; import static com.intellij.util.containers.ContainerUtil.*; -import static git4idea.GitStatisticsCollectorKt.reportUsage; import static git4idea.GitUtil.HEAD; import static git4idea.branch.GitBranchType.LOCAL; import static git4idea.branch.GitBranchType.REMOTE; @@ -172,11 +171,9 @@ class GitBranchPopupActions { if (options != null) { GitBrancher brancher = GitBrancher.getInstance(myProject); if (options.shouldCheckout()) { - reportUsage("git.branch.create.new"); brancher.checkoutNewBranch(options.getName(), myRepositories); } else { - reportUsage("git.branch.create.new.nocheckout"); brancher.createBranch(options.getName(), StreamEx.of(myRepositories).toMap(position -> HEAD)); } } @@ -206,7 +203,6 @@ class GitBranchPopupActions { String reference = dialog.getReference(); GitBrancher brancher = GitBrancher.getInstance(myProject); brancher.checkout(reference, true, myRepositories, null); - reportUsage("git.branch.checkout.revision"); } } @@ -324,7 +320,6 @@ class GitBranchPopupActions { public void actionPerformed(AnActionEvent e) { GitBrancher brancher = GitBrancher.getInstance(myProject); brancher.checkout(myBranchName, false, myRepositories, null); - reportUsage("git.branch.checkout.local"); } } @@ -349,7 +344,6 @@ class GitBranchPopupActions { GitBrancher brancher = GitBrancher.getInstance(myProject); brancher.checkoutNewBranchStartingFrom(name, myBranchName, myRepositories, null); } - reportUsage("git.checkout.as.new.branch"); } } @@ -373,7 +367,6 @@ class GitBranchPopupActions { if (newName != null) { GitBrancher brancher = GitBrancher.getInstance(myProject); brancher.renameBranch(myCurrentBranchName, newName, myRepositories); - reportUsage("git.branch.rename"); } } @@ -402,7 +395,6 @@ class GitBranchPopupActions { public void actionPerformed(AnActionEvent e) { GitBrancher brancher = GitBrancher.getInstance(myProject); brancher.deleteBranch(myBranchName, myRepositories); - reportUsage("git.branch.delete.local"); } } } @@ -488,7 +480,6 @@ class GitBranchPopupActions { if (name != null) { GitBrancher brancher = GitBrancher.getInstance(myProject); brancher.checkoutNewBranchStartingFrom(name, myRemoteBranchName, myRepositories, null); - reportUsage("git.branch.checkout.remote"); } } @@ -516,7 +507,6 @@ class GitBranchPopupActions { public void actionPerformed(AnActionEvent e) { GitBrancher brancher = GitBrancher.getInstance(myProject); brancher.deleteRemoteBranch(myBranchName, myRepositories); - reportUsage("git.branch.delete.remote"); } } } @@ -541,7 +531,6 @@ class GitBranchPopupActions { public void actionPerformed(AnActionEvent e) { GitBrancher brancher = GitBrancher.getInstance(myProject); brancher.compare(myBranchName, myRepositories, mySelectedRepository); - reportUsage("git.branch.compare"); } } @@ -566,7 +555,6 @@ class GitBranchPopupActions { public void actionPerformed(AnActionEvent e) { GitBrancher brancher = GitBrancher.getInstance(myProject); brancher.merge(myBranchName, deleteOnMerge(), myRepositories); - reportUsage("git.branch.merge"); } private GitBrancher.DeleteOnMergeOption deleteOnMerge() { @@ -594,7 +582,6 @@ class GitBranchPopupActions { public void actionPerformed(AnActionEvent e) { GitBrancher brancher = GitBrancher.getInstance(myProject); brancher.rebase(myRepositories, myBranchName); - reportUsage("git.branch.rebase"); } @Override @@ -631,7 +618,6 @@ class GitBranchPopupActions { public void actionPerformed(AnActionEvent e) { GitBrancher brancher = GitBrancher.getInstance(myProject); brancher.rebaseOnCurrent(myRepositories, myBranchName); - reportUsage("git.branch.checkout.with.rebase"); } } @@ -675,7 +661,6 @@ class GitBranchPopupActions { public void actionPerformed(AnActionEvent e) { GitBrancher brancher = GitBrancher.getInstance(myProject); brancher.deleteTag(myTagName, myRepositories); - reportUsage("git.tag.delete.local"); } } } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/console/actions/GrNewConsoleAction.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/console/actions/GrNewConsoleAction.java index 0dc86fea6d04..152c6b627082 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/console/actions/GrNewConsoleAction.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/console/actions/GrNewConsoleAction.java @@ -3,7 +3,6 @@ package org.jetbrains.plugins.groovy.console.actions; import com.intellij.execution.console.ConsoleHistoryController; import com.intellij.ide.scratch.ScratchFileService; -import com.intellij.internal.statistic.UsageTrigger; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.LangDataKeys; @@ -15,7 +14,6 @@ import org.jetbrains.annotations.Nullable; import org.jetbrains.plugins.groovy.config.GroovyFacetUtil; import org.jetbrains.plugins.groovy.console.GroovyConsole; import org.jetbrains.plugins.groovy.console.GroovyConsoleRootType; -import org.jetbrains.plugins.groovy.statictics.GroovyStatisticsIds; import static org.jetbrains.plugins.groovy.console.GroovyConsoleUtilKt.getAnyApplicableModule; @@ -31,7 +29,6 @@ public class GrNewConsoleAction extends AnAction { final Module module = getModule(e); if (project == null || module == null) return; - UsageTrigger.trigger(GroovyStatisticsIds.GROOVY_NEW_CONSOLE); final VirtualFile contentFile = ConsoleHistoryController.getContentFile( GroovyConsoleRootType.getInstance(), GroovyConsoleRootType.CONTENT_ID, diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/convertToJava/ConvertToJavaProcessor.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/convertToJava/ConvertToJavaProcessor.java index de4810f84014..4048bb87d26b 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/convertToJava/ConvertToJavaProcessor.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/convertToJava/ConvertToJavaProcessor.java @@ -16,7 +16,6 @@ package org.jetbrains.plugins.groovy.refactoring.convertToJava; import com.intellij.codeInsight.daemon.impl.quickfix.MoveClassToSeparateFileFix; -import com.intellij.internal.statistic.UsageTrigger; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Document; @@ -36,7 +35,6 @@ import com.intellij.util.containers.hash.HashSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.groovy.lang.psi.GroovyFile; import org.jetbrains.plugins.groovy.refactoring.GroovyRefactoringBundle; -import org.jetbrains.plugins.groovy.statictics.GroovyStatisticsIds; import java.util.Set; @@ -79,7 +77,6 @@ public class ConvertToJavaProcessor extends BaseRefactoringProcessor { //private static String @Override protected void performRefactoring(@NotNull UsageInfo[] usages) { - UsageTrigger.trigger(GroovyStatisticsIds.CONVERT_GROOVY_TO_JAVA_ID); final GeneratorClassNameProvider classNameProvider = new GeneratorClassNameProvider(); ExpressionContext context = new ExpressionContext(myProject, myFiles); diff --git a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/sceneBuilder/SceneBuilderImpl.java b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/sceneBuilder/SceneBuilderImpl.java index d7dca46a9754..4d9956634ee6 100644 --- a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/sceneBuilder/SceneBuilderImpl.java +++ b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/sceneBuilder/SceneBuilderImpl.java @@ -1,7 +1,6 @@ // 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 org.jetbrains.plugins.javaFX.sceneBuilder; -import com.intellij.internal.statistic.UsageTrigger; import com.intellij.openapi.application.ReadAction; import com.intellij.openapi.diagnostic.ControlFlowException; import com.intellij.openapi.diagnostic.Logger; @@ -137,7 +136,6 @@ public class SceneBuilderImpl implements SceneBuilder { if (myProject.isDisposed()) { return; } - UsageTrigger.trigger("scene-builder.open"); } private static void logUncaughtException(Thread t, Throwable e) { @@ -314,7 +312,6 @@ public class SceneBuilderImpl implements SceneBuilder { myListener = (observable, oldValue, newValue) -> { if (!mySkipChanges) { myEditorCallback.saveChanges(myEditorController.getFxmlText()); - UsageTrigger.trigger("scene-builder.edit"); } }; mySelectionListener = (observable, oldValue, newValue) -> { diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/action/TraceStreamAction.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/action/TraceStreamAction.java index 2ccd318f1b38..8e650f688c67 100644 --- a/plugins/stream-debugger/src/com/intellij/debugger/streams/action/TraceStreamAction.java +++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/action/TraceStreamAction.java @@ -15,7 +15,6 @@ import com.intellij.debugger.streams.ui.impl.ElementChooserImpl; import com.intellij.debugger.streams.ui.impl.EvaluationAwareTraceWindow; import com.intellij.debugger.streams.wrapper.StreamChain; import com.intellij.debugger.streams.wrapper.StreamChainBuilder; -import com.intellij.internal.statistic.UsageTrigger; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.Presentation; @@ -34,7 +33,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.List; -import java.util.Locale; import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -68,7 +66,6 @@ public class TraceStreamAction extends AnAction { presentation.setEnabled(chainExists); final int elementHash = System.identityHashCode(element); if (chainExists && myLastVisitedPsiElementHash != elementHash) { - UsageTrigger.trigger("debugger.streams." + languageId.toLowerCase(Locale.US) + ".activated"); myLastVisitedPsiElementHash = elementHash; } } @@ -125,7 +122,6 @@ public class TraceStreamAction extends AnAction { private static void runTrace(@NotNull StreamChain chain, @NotNull SupportedLibrary library, @NotNull XDebugSession session) { final EvaluationAwareTraceWindow window = new EvaluationAwareTraceWindow(session, chain); - UsageTrigger.trigger("debugger.streams." + library.languageId.toLowerCase(Locale.US) + ".used"); ApplicationManager.getApplication().invokeLater(window::show); final Project project = session.getProject(); final TraceExpressionBuilder expressionBuilder = library.createExpressionBuilder(project); diff --git a/plugins/svn4idea/src/META-INF/plugin.xml b/plugins/svn4idea/src/META-INF/plugin.xml index ea2dae756032..77468ba6dfa8 100644 --- a/plugins/svn4idea/src/META-INF/plugin.xml +++ b/plugins/svn4idea/src/META-INF/plugin.xml @@ -142,9 +142,6 @@ - - - diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/statistics/SvnWorkingCopyFormatUsagesCollector.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/statistics/SvnWorkingCopyFormatUsagesCollector.java deleted file mode 100644 index b54a9826bccc..000000000000 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/statistics/SvnWorkingCopyFormatUsagesCollector.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2000-2013 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jetbrains.idea.svn.statistics; - -import com.intellij.internal.statistic.AbstractProjectsUsagesCollector; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.openapi.project.Project; -import com.intellij.util.containers.ContainerUtil; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.idea.svn.NestedCopyType; -import org.jetbrains.idea.svn.RootUrlInfo; -import org.jetbrains.idea.svn.SvnVcs; - -import java.util.List; -import java.util.Set; - -/** - * @author Konstantin Kolosovsky. - */ -public class SvnWorkingCopyFormatUsagesCollector extends AbstractProjectsUsagesCollector { - - private static final String GROUP_ID = "svn working copy format"; - - @NotNull - public GroupDescriptor getGroupId() { - return GroupDescriptor.create(GROUP_ID, GroupDescriptor.HIGHER_PRIORITY); - } - - @NotNull - public Set getProjectUsages(@NotNull Project project) { - SvnVcs vcs = SvnVcs.getInstance(project); - - // do not track roots with errors (SvnFileUrlMapping.getErrorRoots()) as they are "not usable" until errors are resolved - // skip externals and switched directories as they will have the same format - List roots = ContainerUtil - .filter(vcs.getSvnFileUrlMapping().getAllWcInfos(), info -> info.getType() == null || NestedCopyType.inner.equals(info.getType())); - - return ContainerUtil.map2Set(roots, info -> new UsageDescriptor(info.getFormat().toString(), 1)); - } -} diff --git a/plugins/terminal/src/org/jetbrains/plugins/terminal/TerminalView.java b/plugins/terminal/src/org/jetbrains/plugins/terminal/TerminalView.java index ef2ae0711b2a..98554fee4d71 100644 --- a/plugins/terminal/src/org/jetbrains/plugins/terminal/TerminalView.java +++ b/plugins/terminal/src/org/jetbrains/plugins/terminal/TerminalView.java @@ -7,7 +7,6 @@ import com.intellij.ide.actions.ToggleToolbarAction; import com.intellij.ide.ui.UISettings; import com.intellij.ide.ui.UISettingsListener; import com.intellij.ide.util.PropertiesComponent; -import com.intellij.internal.statistic.UsageTrigger; import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.ActionManager; import com.intellij.openapi.actionSystem.ActionToolbar; @@ -17,7 +16,6 @@ import com.intellij.openapi.project.DumbAwareAction; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.SimpleToolWindowPanel; import com.intellij.openapi.util.Disposer; -import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.registry.Registry; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.wm.ToolWindow; @@ -199,9 +197,6 @@ public class TerminalView { } public static void recordUsage(@NotNull TtyConnector ttyConnector) { - UsageTrigger.trigger(TERMINAL_FEATURE + "." + - (ttyConnector.toString().contains("Jsch") ? "ssh" : - SystemInfo.isWindows ? "win" : SystemInfo.isMac ? "mac" : "linux")); } private static ActionToolbar createToolbar(@Nullable final AbstractTerminalRunner terminalRunner, diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/designSurface/GuiEditor.java b/plugins/ui-designer/src/com/intellij/uiDesigner/designSurface/GuiEditor.java index 6e7ee4b8878b..020678822ba5 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/designSurface/GuiEditor.java +++ b/plugins/ui-designer/src/com/intellij/uiDesigner/designSurface/GuiEditor.java @@ -21,7 +21,6 @@ import com.intellij.designer.LightFillLayout; import com.intellij.ide.DeleteProvider; import com.intellij.ide.highlighter.XmlFileHighlighter; import com.intellij.ide.palette.impl.PaletteToolWindowManager; -import com.intellij.internal.statistic.UsageTrigger; import com.intellij.lang.properties.psi.PropertiesFile; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.application.ApplicationManager; @@ -370,8 +369,6 @@ public final class GuiEditor extends JPanel implements DesignerEditorPanelFacade new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.SHIFT_MASK)), myGlassLayer); - UsageTrigger.trigger("swing-designer.open"); - UIUtil.invokeLaterIfNeeded(() -> { DesignerToolWindowManager.getInstance(myProject).bind(this); PaletteToolWindowManager.getInstance(myProject).bind(this); @@ -489,7 +486,6 @@ public final class GuiEditor extends JPanel implements DesignerEditorPanelFacade propertyInspector.synchWithTree(forceSync); } - UsageTrigger.trigger("swing-designer.edit"); refresh(); saveToFile(); // TODO[yole]: install appropriate listeners so that the captions repaint themselves at correct time diff --git a/python/src/META-INF/python-core-common.xml b/python/src/META-INF/python-core-common.xml index 9b3ad71c3301..014f93da5c0d 100644 --- a/python/src/META-INF/python-core-common.xml +++ b/python/src/META-INF/python-core-common.xml @@ -585,9 +585,6 @@ - - - diff --git a/python/src/com/jetbrains/python/console/PydevConsoleRunnerImpl.java b/python/src/com/jetbrains/python/console/PydevConsoleRunnerImpl.java index 66a4656e7adb..ae559f156131 100644 --- a/python/src/com/jetbrains/python/console/PydevConsoleRunnerImpl.java +++ b/python/src/com/jetbrains/python/console/PydevConsoleRunnerImpl.java @@ -25,7 +25,6 @@ import com.intellij.icons.AllIcons; import com.intellij.ide.CommonActionsManager; import com.intellij.ide.errorTreeView.NewErrorTreeViewPanel; import com.intellij.idea.ActionsBundle; -import com.intellij.internal.statistic.UsageTrigger; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ModalityState; @@ -116,7 +115,6 @@ public class PydevConsoleRunnerImpl implements PydevConsoleRunner { @SuppressWarnings("SpellCheckingInspection") public static final String PYDEV_PYDEVCONSOLE_PY = "pydev/pydevconsole.py"; public static final int PORTS_WAITING_TIMEOUT = 20000; - private static final String CONSOLE_FEATURE = "python.console"; private final Project myProject; private final String myTitle; @Nullable private final String myWorkingDir; @@ -406,7 +404,6 @@ public class PydevConsoleRunnerImpl implements PydevConsoleRunner { PyRemoteSdkAdditionalDataBase data = (PyRemoteSdkAdditionalDataBase)mySdk.getSdkAdditionalData(); final PyRemotePathMapper pathMapper = PydevConsoleRunner.getPathMapper(myProject, mySdk, myConsoleSettings); if (manager != null && data != null && pathMapper != null) { - UsageTrigger.trigger(CONSOLE_FEATURE + ".remote"); RemoteConsoleProcessData remoteConsoleProcessData = PythonConsoleRemoteProcessCreatorKt.createRemoteConsoleProcess(generalCommandLine, pathMapper, @@ -425,7 +422,6 @@ public class PydevConsoleRunnerImpl implements PydevConsoleRunner { Map envs = generalCommandLine.getEnvironment(); EncodingEnvironmentUtil.setLocaleEnvironmentIfMac(envs, generalCommandLine.getCharset()); - UsageTrigger.trigger(CONSOLE_FEATURE + ".local"); final Process server = generalCommandLine.createProcess(); try { diff --git a/python/src/com/jetbrains/python/statistics/PyInterpreterUsagesCollector.java b/python/src/com/jetbrains/python/statistics/PyInterpreterUsagesCollector.java deleted file mode 100644 index 1ce8ba55f6c0..000000000000 --- a/python/src/com/jetbrains/python/statistics/PyInterpreterUsagesCollector.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2000-2014 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.jetbrains.python.statistics; - -import com.intellij.internal.statistic.AbstractProjectsUsagesCollector; -import com.intellij.internal.statistic.CollectUsagesException; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.openapi.module.Module; -import com.intellij.openapi.module.ModuleManager; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.openapi.util.text.StringUtil; -import com.jetbrains.python.remote.PyRemoteSdkAdditionalDataBase; -import com.jetbrains.python.sdk.PythonSdkType; -import org.jetbrains.annotations.NotNull; - -import java.util.HashSet; -import java.util.Set; - -/** - * @author yole - */ -public class PyInterpreterUsagesCollector extends AbstractProjectsUsagesCollector { - private static final String GROUP_ID = "py-interpreter"; - - @NotNull - @Override - public Set getProjectUsages(@NotNull Project project) throws CollectUsagesException { - Set result = new HashSet<>(); - for (Module m : ModuleManager.getInstance(project).getModules()) { - Sdk pythonSdk = PythonSdkType.findPythonSdk(m); - if (pythonSdk != null) { - String versionString = pythonSdk.getVersionString(); - if (StringUtil.isEmpty(versionString)) { - versionString = "unknown version"; - } - if (PythonSdkType.isRemote(pythonSdk)) { - versionString = versionString + " (" + getRemoteSuffix(pythonSdk) + ")"; - } - - if (PythonSdkType.isVirtualEnv(pythonSdk)) { - versionString += " [virtualenv]"; - } - - if (PythonSdkType.isConda(pythonSdk)) { - versionString += " [condavenv]"; - } - result.add(new UsageDescriptor(versionString, 1)); - } - } - return result; - } - - @NotNull - private static String getRemoteSuffix(@NotNull Sdk pythonSdk) { - return pythonSdk.getSdkAdditionalData() instanceof PyRemoteSdkAdditionalDataBase - ? "Remote " + (((PyRemoteSdkAdditionalDataBase)pythonSdk.getSdkAdditionalData()).getRemoteConnectionType()).getName() - : ""; - } - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GroupDescriptor.create(GROUP_ID); - } -} diff --git a/python/src/com/jetbrains/python/statistics/PyPackageUsagesCollector.java b/python/src/com/jetbrains/python/statistics/PyPackageUsagesCollector.java deleted file mode 100644 index b0632236c703..000000000000 --- a/python/src/com/jetbrains/python/statistics/PyPackageUsagesCollector.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2000-2014 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.jetbrains.python.statistics; - -import com.intellij.internal.statistic.AbstractProjectsUsagesCollector; -import com.intellij.internal.statistic.CollectUsagesException; -import com.intellij.internal.statistic.beans.GroupDescriptor; -import com.intellij.internal.statistic.beans.UsageDescriptor; -import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.module.Module; -import com.intellij.openapi.module.ModuleManager; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.projectRoots.Sdk; -import com.jetbrains.python.packaging.PyPIPackageCache; -import com.jetbrains.python.packaging.PyPackageManager; -import com.jetbrains.python.packaging.PyRequirement; -import com.jetbrains.python.sdk.PythonSdkType; -import org.jetbrains.annotations.NotNull; - -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -/** - * @author yole - */ -public class PyPackageUsagesCollector extends AbstractProjectsUsagesCollector { - private static final String GROUP_ID = "py-packages"; - - @NotNull - @Override - public Set getProjectUsages(@NotNull Project project) throws CollectUsagesException { - final Set result = new HashSet<>(); - for(final Module m: ModuleManager.getInstance(project).getModules()) { - final Sdk pythonSdk = PythonSdkType.findPythonSdk(m); - if (pythonSdk != null) { - ApplicationManager.getApplication().runReadAction(() -> { - List requirements = PyPackageManager.getInstance(pythonSdk).getRequirements(m); - if (requirements != null) { - Collection packages = new HashSet<>(PyPIPackageCache.getInstance().getPackageNames()); - for (PyRequirement requirement : requirements) { - String name = requirement.getName(); - if (packages.contains(name)) { - result.add(new UsageDescriptor(name, 1)); - } - } - } - }); - } - } - return result; - } - - @NotNull - @Override - public GroupDescriptor getGroupId() { - return GroupDescriptor.create(GROUP_ID); - } -} diff --git a/resources/src/META-INF/JavaIdePlugin.xml b/resources/src/META-INF/JavaIdePlugin.xml index deda71c6e0d6..84a4117055ad 100644 --- a/resources/src/META-INF/JavaIdePlugin.xml +++ b/resources/src/META-INF/JavaIdePlugin.xml @@ -331,8 +331,6 @@ serviceImplementation="com.intellij.openapi.roots.ui.configuration.IdeaProjectSettingsService"/> - - diff --git a/resources/src/idea/RichPlatformPlugin.xml b/resources/src/idea/RichPlatformPlugin.xml index d1141cf3bbba..74447e0104db 100644 --- a/resources/src/idea/RichPlatformPlugin.xml +++ b/resources/src/idea/RichPlatformPlugin.xml @@ -300,8 +300,6 @@ - - diff --git a/xml/impl/src/com/intellij/ide/browsers/actions/BaseOpenInBrowserAction.kt b/xml/impl/src/com/intellij/ide/browsers/actions/BaseOpenInBrowserAction.kt index bb6f380704fa..5d31d70e5747 100644 --- a/xml/impl/src/com/intellij/ide/browsers/actions/BaseOpenInBrowserAction.kt +++ b/xml/impl/src/com/intellij/ide/browsers/actions/BaseOpenInBrowserAction.kt @@ -5,7 +5,6 @@ import com.intellij.icons.AllIcons import com.intellij.ide.IdeBundle import com.intellij.ide.browsers.* import com.intellij.ide.browsers.impl.WebBrowserServiceImpl -import com.intellij.internal.statistic.UsageTrigger import com.intellij.openapi.actionSystem.ActionPlaces import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.CommonDataKeys @@ -111,7 +110,6 @@ abstract class BaseOpenInBrowserAction : DumbAwareAction { override fun actionPerformed(e: AnActionEvent) { getBrowser(e)?.let { - UsageTrigger.trigger("OpenInBrowser.${it.name}") open(e, it) } } diff --git a/xml/impl/src/com/intellij/ide/browsers/actions/OpenFileInDefaultBrowserAction.kt b/xml/impl/src/com/intellij/ide/browsers/actions/OpenFileInDefaultBrowserAction.kt index dbcba9d897d9..0fec3efb8618 100644 --- a/xml/impl/src/com/intellij/ide/browsers/actions/OpenFileInDefaultBrowserAction.kt +++ b/xml/impl/src/com/intellij/ide/browsers/actions/OpenFileInDefaultBrowserAction.kt @@ -20,7 +20,6 @@ import com.intellij.ide.browsers.BrowserLauncherAppless import com.intellij.ide.browsers.DefaultBrowserPolicy import com.intellij.ide.browsers.WebBrowser import com.intellij.ide.browsers.WebBrowserManager -import com.intellij.internal.statistic.UsageTrigger import com.intellij.openapi.actionSystem.ActionPlaces import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.project.DumbAwareAction @@ -49,7 +48,6 @@ class OpenFileInDefaultBrowserAction : DumbAwareAction() { } override fun actionPerformed(e: AnActionEvent) { - UsageTrigger.trigger("OpenInBrowser.default") BaseOpenInBrowserAction.open(e, findUsingBrowser()) } }