Search in sources :

Example 11 with UsageDescriptor

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

the class LibraryUsageCollector method getProjectUsages.

@NotNull
@Override
public Set<UsageDescriptor> getProjectUsages(@NotNull Project project) {
    final Set<LibraryKind> usedKinds = new HashSet<>();
    final Processor<Library> 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<UsageDescriptor> usageDescriptors = new HashSet<>();
    for (LibraryKind kind : usedKinds) {
        usageDescriptors.add(new UsageDescriptor(kind.getKindId(), 1));
    }
    return usageDescriptors;
}
Also used : GroupDescriptor(com.intellij.internal.statistic.beans.GroupDescriptor) ModuleManager(com.intellij.openapi.module.ModuleManager) UsageDescriptor(com.intellij.internal.statistic.beans.UsageDescriptor) AbstractApplicationUsagesCollector(com.intellij.internal.statistic.AbstractApplicationUsagesCollector) NonNls(org.jetbrains.annotations.NonNls) Set(java.util.Set) LibraryKind(com.intellij.openapi.roots.libraries.LibraryKind) HashSet(java.util.HashSet) Library(com.intellij.openapi.roots.libraries.Library) ModuleRootManager(com.intellij.openapi.roots.ModuleRootManager) Processor(com.intellij.util.Processor) Project(com.intellij.openapi.project.Project) Module(com.intellij.openapi.module.Module) NotNull(org.jetbrains.annotations.NotNull) LibraryKind(com.intellij.openapi.roots.libraries.LibraryKind) Library(com.intellij.openapi.roots.libraries.Library) Module(com.intellij.openapi.module.Module) UsageDescriptor(com.intellij.internal.statistic.beans.UsageDescriptor) HashSet(java.util.HashSet) NotNull(org.jetbrains.annotations.NotNull)

Example 12 with UsageDescriptor

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

the class EditorSettingsStatisticsCollector method getUsages.

@NotNull
@Override
public Set<UsageDescriptor> getUsages() throws CollectUsagesException {
    Set<UsageDescriptor> set = new HashSet<>();
    EditorSettingsExternalizable es = EditorSettingsExternalizable.getInstance();
    addIfDiffers(set, es.isVirtualSpace(), false, "caretAfterLineEnd");
    addIfDiffers(set, es.isCaretInsideTabs(), false, "caretInsideTabs");
    addIfDiffers(set, es.isAdditionalPageAtBottom(), false, "virtualSpaceAtFileBottom");
    addIfDiffers(set, es.isUseSoftWraps(SoftWrapAppliancePlaces.MAIN_EDITOR), false, "softWraps");
    addIfDiffers(set, es.isUseSoftWraps(SoftWrapAppliancePlaces.CONSOLE), false, "softWraps.console");
    addIfDiffers(set, es.isUseSoftWraps(SoftWrapAppliancePlaces.PREVIEW), false, "softWraps.preview");
    addIfDiffers(set, es.isUseCustomSoftWrapIndent(), false, "softWraps.relativeIndent");
    addIfDiffers(set, es.isAllSoftWrapsShown(), false, "softWraps.showAll");
    addIfDiffers(set, es.getStripTrailingSpaces(), EditorSettingsExternalizable.STRIP_TRAILING_SPACES_CHANGED, "stripTrailingSpaces");
    addIfDiffers(set, es.isEnsureNewLineAtEOF(), false, "ensureNewlineAtEOF");
    addIfDiffers(set, es.isShowQuickDocOnMouseOverElement(), false, "quickDocOnMouseHover");
    addIfDiffers(set, es.isBlinkCaret(), true, "blinkingCaret");
    addIfDiffers(set, es.isBlockCursor(), false, "blockCaret");
    addIfDiffers(set, es.isRightMarginShown(), true, "rightMargin");
    addIfDiffers(set, es.isLineNumbersShown(), true, "lineNumbers");
    addIfDiffers(set, es.areGutterIconsShown(), true, "gutterIcons");
    addIfDiffers(set, es.isFoldingOutlineShown(), true, "foldingOutline");
    addIfDiffers(set, es.isWhitespacesShown() && es.isLeadingWhitespacesShown(), false, "showLeadingWhitespace");
    addIfDiffers(set, es.isWhitespacesShown() && es.isInnerWhitespacesShown(), false, "showInnerWhitespace");
    addIfDiffers(set, es.isWhitespacesShown() && es.isTrailingWhitespacesShown(), false, "showTrailingWhitespace");
    addIfDiffers(set, es.isIndentGuidesShown(), true, "indentGuides");
    addIfDiffers(set, es.isSmoothScrolling(), true, "animatedScroll");
    addIfDiffers(set, es.isDndEnabled(), true, "dragNDrop");
    addIfDiffers(set, es.isWheelFontChangeEnabled(), false, "wheelZoom");
    addIfDiffers(set, es.isMouseClickSelectionHonorsCamelWords(), true, "mouseCamel");
    addIfDiffers(set, es.isVariableInplaceRenameEnabled(), true, "inplaceRename");
    addIfDiffers(set, es.isPreselectRename(), true, "preselectOnRename");
    addIfDiffers(set, es.isShowInlineLocalDialog(), true, "inlineDialog");
    addIfDiffers(set, es.isRefrainFromScrolling(), false, "minimizeScrolling");
    addIfDiffers(set, es.getOptions().SHOW_NOTIFICATION_AFTER_REFORMAT_CODE_ACTION, true, "afterReformatNotification");
    addIfDiffers(set, es.getOptions().SHOW_NOTIFICATION_AFTER_OPTIMIZE_IMPORTS_ACTION, true, "afterOptimizeNotification");
    addIfDiffers(set, es.isSmartHome(), true, "smartHome");
    addIfDiffers(set, es.isCamelWords(), false, "camelWords");
    addIfDiffers(set, es.isShowParameterNameHints(), true, "editor.inlay.parameter.hints");
    RichCopySettings rcs = RichCopySettings.getInstance();
    addIfDiffers(set, rcs.isEnabled(), true, "richCopy");
    CodeInsightSettings cis = CodeInsightSettings.getInstance();
    addIfDiffers(set, cis.AUTO_POPUP_PARAMETER_INFO, true, "parameterAutoPopup");
    addIfDiffers(set, cis.AUTO_POPUP_JAVADOC_INFO, false, "javadocAutoPopup");
    addIfDiffers(set, cis.AUTO_POPUP_COMPLETION_LOOKUP, true, "completionAutoPopup");
    addIfDiffers(set, cis.COMPLETION_CASE_SENSITIVE, CodeInsightSettings.FIRST_LETTER, "completionCaseSensitivity");
    addIfDiffers(set, cis.SELECT_AUTOPOPUP_SUGGESTIONS_BY_CHARS, false, "autoPopupCharComplete");
    addIfDiffers(set, cis.AUTOCOMPLETE_ON_CODE_COMPLETION, true, "autoCompleteBasic");
    addIfDiffers(set, cis.AUTOCOMPLETE_ON_SMART_TYPE_COMPLETION, true, "autoCompleteSmart");
    addIfDiffers(set, cis.SHOW_FULL_SIGNATURES_IN_PARAMETER_INFO, false, "parameterInfoFullSignature");
    addIfDiffers(set, cis.getBackspaceMode(), SmartBackspaceMode.AUTOINDENT, "smartBackspace");
    addIfDiffers(set, cis.SMART_INDENT_ON_ENTER, true, "indentOnEnter");
    addIfDiffers(set, cis.INSERT_BRACE_ON_ENTER, true, "braceOnEnter");
    addIfDiffers(set, cis.JAVADOC_STUB_ON_ENTER, true, "javadocOnEnter");
    addIfDiffers(set, cis.SMART_END_ACTION, true, "smartEnd");
    addIfDiffers(set, cis.JAVADOC_GENERATE_CLOSING_TAG, true, "autoCloseJavadocTags");
    addIfDiffers(set, cis.SURROUND_SELECTION_ON_QUOTE_TYPED, false, "surroundByQuoteOrBrace");
    addIfDiffers(set, cis.AUTOINSERT_PAIR_BRACKET, true, "pairBracketAutoInsert");
    addIfDiffers(set, cis.AUTOINSERT_PAIR_QUOTE, true, "pairQuoteAutoInsert");
    addIfDiffers(set, cis.REFORMAT_BLOCK_ON_RBRACE, true, "reformatOnRBrace");
    addIfDiffers(set, cis.REFORMAT_ON_PASTE, CodeInsightSettings.INDENT_EACH_LINE, "reformatOnPaste");
    addIfDiffers(set, cis.ADD_IMPORTS_ON_PASTE, CodeInsightSettings.ASK, "importsOnPaste");
    addIfDiffers(set, cis.HIGHLIGHT_BRACES, true, "bracesHighlight");
    addIfDiffers(set, cis.HIGHLIGHT_SCOPE, false, "scopeHighlight");
    addIfDiffers(set, cis.HIGHLIGHT_IDENTIFIER_UNDER_CARET, true, "identifierUnderCaretHighlight");
    addIfDiffers(set, cis.ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY, false, "autoAddImports");
    return set;
}
Also used : CodeInsightSettings(com.intellij.codeInsight.CodeInsightSettings) RichCopySettings(com.intellij.openapi.editor.richcopy.settings.RichCopySettings) UsageDescriptor(com.intellij.internal.statistic.beans.UsageDescriptor) HashSet(java.util.HashSet) EditorSettingsExternalizable(com.intellij.openapi.editor.ex.EditorSettingsExternalizable) NotNull(org.jetbrains.annotations.NotNull)

Example 13 with UsageDescriptor

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

the class BackgroundImagesUsageCollector method getProjectUsages.

@NotNull
@Override
public Set<UsageDescriptor> getProjectUsages(@NotNull Project project) throws CollectUsagesException {
    boolean editor = StringUtil.isNotEmpty(getBackgroundSpec(project, EDITOR_PROP));
    boolean frame = StringUtil.isNotEmpty(getBackgroundSpec(project, FRAME_PROP));
    return ContainerUtil.newHashSet(new UsageDescriptor("editor", editor ? 1 : 0), new UsageDescriptor("frame", frame ? 1 : 0));
}
Also used : UsageDescriptor(com.intellij.internal.statistic.beans.UsageDescriptor) NotNull(org.jetbrains.annotations.NotNull)

Example 14 with UsageDescriptor

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

the class EditorColorSchemesUsagesCollector method getUsages.

@NotNull
@Override
public Set<UsageDescriptor> getUsages() throws CollectUsagesException {
    EditorColorsScheme currentScheme = EditorColorsManager.getInstance().getGlobalScheme();
    Set<UsageDescriptor> usages = ContainerUtil.newHashSet();
    String schemeName = SCHEME_NAME_OTHER;
    if (currentScheme instanceof AbstractColorsScheme) {
        String name = currentScheme.getName();
        if (name.startsWith(SchemeManager.EDITABLE_COPY_PREFIX)) {
            EditorColorsScheme original = ((AbstractColorsScheme) currentScheme).getOriginal();
            if (original != null) {
                schemeName = original.getName();
            }
        }
        usages.add(new UsageDescriptor(schemeName, 1));
    }
    return usages;
}
Also used : EditorColorsScheme(com.intellij.openapi.editor.colors.EditorColorsScheme) UsageDescriptor(com.intellij.internal.statistic.beans.UsageDescriptor) NotNull(org.jetbrains.annotations.NotNull)

Example 15 with UsageDescriptor

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

the class ApplicationStatisticsPersistenceComponent method loadState.

@Override
public void loadState(Element element) {
    for (Element groupElement : element.getChildren(GROUP_TAG)) {
        GroupDescriptor groupDescriptor = GroupDescriptor.create(groupElement.getAttributeValue(GROUP_NAME_ATTR));
        List<Element> 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<UsageDescriptor> 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));
            }
        }
    }
}
Also used : Element(org.jdom.Element) UsageDescriptor(com.intellij.internal.statistic.beans.UsageDescriptor) GroupDescriptor(com.intellij.internal.statistic.beans.GroupDescriptor) THashSet(gnu.trove.THashSet)

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