Search in sources :

Example 1 with UsageDescriptor

use of com.intellij.internal.statistic.beans.UsageDescriptor in project intellij-community by JetBrains.

the class PyInterpreterUsagesCollector method getProjectUsages.

@NotNull
@Override
public Set<UsageDescriptor> getProjectUsages(@NotNull Project project) throws CollectUsagesException {
    Set<UsageDescriptor> 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.isCondaVirtualEnv(pythonSdk)) {
                versionString += " [condavenv]";
            }
            result.add(new UsageDescriptor(versionString, 1));
        }
    }
    return result;
}
Also used : Sdk(com.intellij.openapi.projectRoots.Sdk) UsageDescriptor(com.intellij.internal.statistic.beans.UsageDescriptor) Module(com.intellij.openapi.module.Module) HashSet(java.util.HashSet) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with UsageDescriptor

use of com.intellij.internal.statistic.beans.UsageDescriptor in project intellij-community by JetBrains.

the class BackgroundImagesUsageCollector method getUsages.

@NotNull
@Override
public Set<UsageDescriptor> getUsages() throws CollectUsagesException {
    // join usages from all projects
    HashMap<String, UsageDescriptor> map = ContainerUtil.newHashMap();
    for (UsageDescriptor descriptor : super.getUsages()) {
        String key = descriptor.getKey();
        int idx = key.indexOf(' ');
        key = idx > 0 ? key.substring(0, idx) : key;
        UsageDescriptor existing = map.get(key);
        if (existing == null || existing.getValue() == 0) {
            map.put(key, new UsageDescriptor(key, descriptor.getValue()));
        }
    }
    return ContainerUtil.newHashSet(map.values());
}
Also used : UsageDescriptor(com.intellij.internal.statistic.beans.UsageDescriptor) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with UsageDescriptor

use of com.intellij.internal.statistic.beans.UsageDescriptor in project intellij-community by JetBrains.

the class CompilerSettingsUsageCollector method getProjectUsages.

@NotNull
@Override
public Set<UsageDescriptor> getProjectUsages(@Nullable Project project) throws CollectUsagesException {
    final CompilerWorkspaceConfiguration wsConfig = CompilerWorkspaceConfiguration.getInstance(project);
    final Set<UsageDescriptor> 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;
}
Also used : UsageDescriptor(com.intellij.internal.statistic.beans.UsageDescriptor) HashSet(java.util.HashSet) NotNull(org.jetbrains.annotations.NotNull)

Example 4 with UsageDescriptor

use of com.intellij.internal.statistic.beans.UsageDescriptor in project intellij-community by JetBrains.

the class NonBundledPluginsUsagesCollector method getUsages.

@NotNull
public Set<UsageDescriptor> getUsages() {
    final IdeaPluginDescriptor[] plugins = PluginManagerCore.getPlugins();
    final List<IdeaPluginDescriptor> nonBundledEnabledPlugins = ContainerUtil.filter(plugins, d -> d.isEnabled() && !d.isBundled() && d.getPluginId() != null);
    return ContainerUtil.map2Set(nonBundledEnabledPlugins, descriptor -> new UsageDescriptor(descriptor.getPluginId().getIdString(), 1));
}
Also used : UsageDescriptor(com.intellij.internal.statistic.beans.UsageDescriptor) NotNull(org.jetbrains.annotations.NotNull)

Example 5 with UsageDescriptor

use of com.intellij.internal.statistic.beans.UsageDescriptor in project intellij-community by JetBrains.

the class VcsLogFeaturesCollector method getProjectUsages.

@NotNull
@Override
public Set<UsageDescriptor> getProjectUsages(@NotNull Project project) throws CollectUsagesException {
    VcsProjectLog projectLog = VcsProjectLog.getInstance(project);
    if (projectLog != null) {
        VcsLogUiImpl ui = projectLog.getMainLogUi();
        if (ui != null) {
            MainVcsLogUiProperties properties = ui.getProperties();
            Set<UsageDescriptor> 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.isMultipleRoots()) {
                usages.add(StatisticsUtilKt.getBooleanUsage("ui.roots", properties.get(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();
}
Also used : MainVcsLogUiProperties(com.intellij.vcs.log.impl.MainVcsLogUiProperties) VcsLogHighlighterFactory(com.intellij.vcs.log.ui.highlighters.VcsLogHighlighterFactory) VcsProjectLog(com.intellij.vcs.log.impl.VcsProjectLog) VcsLogUiImpl(com.intellij.vcs.log.ui.VcsLogUiImpl) UsageDescriptor(com.intellij.internal.statistic.beans.UsageDescriptor) PermanentGraph(com.intellij.vcs.log.graph.PermanentGraph) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

UsageDescriptor (com.intellij.internal.statistic.beans.UsageDescriptor)23 NotNull (org.jetbrains.annotations.NotNull)19 HashSet (com.intellij.util.containers.HashSet)4 HashSet (java.util.HashSet)4 GroupDescriptor (com.intellij.internal.statistic.beans.GroupDescriptor)3 Module (com.intellij.openapi.module.Module)3 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 HashSet (com.intellij.util.containers.hash.HashSet)2 VcsProjectLog (com.intellij.vcs.log.impl.VcsProjectLog)2 THashSet (gnu.trove.THashSet)2 Set (java.util.Set)2 CodeInsightSettings (com.intellij.codeInsight.CodeInsightSettings)1 RunManager (com.intellij.execution.RunManager)1 RunnerAndConfigurationSettings (com.intellij.execution.RunnerAndConfigurationSettings)1 ConfigurationFactory (com.intellij.execution.configurations.ConfigurationFactory)1 ConfigurationType (com.intellij.execution.configurations.ConfigurationType)1 RunConfiguration (com.intellij.execution.configurations.RunConfiguration)1 AbstractApplicationUsagesCollector (com.intellij.internal.statistic.AbstractApplicationUsagesCollector)1 CollectedUsages (com.intellij.internal.statistic.persistence.CollectedUsages)1 EditorColorsScheme (com.intellij.openapi.editor.colors.EditorColorsScheme)1