use of com.intellij.internal.statistic.beans.UsageDescriptor in project intellij-community by JetBrains.
the class AbstractApplicationUsagesCollector method getApplicationUsages.
@NotNull
public Set<UsageDescriptor> getApplicationUsages(@NotNull ApplicationStatisticsPersistence persistence) {
ObjectIntHashMap<String> 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());
}
}
}
if (result.isEmpty()) {
return Collections.emptySet();
} else {
final THashSet<UsageDescriptor> descriptors = new THashSet<>(result.size());
result.forEachEntry(new TObjectIntProcedure<String>() {
@Override
public boolean execute(String key, int value) {
descriptors.add(new UsageDescriptor(key, value));
return true;
}
});
return descriptors;
}
}
use of com.intellij.internal.statistic.beans.UsageDescriptor in project intellij-community by JetBrains.
the class ScaleInfoUsageCollector method getUsages.
@NotNull
@Override
public Set<UsageDescriptor> getUsages() throws CollectUsagesException {
float scale = JBUI.sysScale();
int scaleBase = (int) Math.floor(scale);
float scaleFract = scale - scaleBase;
if (// count integer scale on a precise match only
scaleFract == 0.0f)
// count integer scale on a precise match only
scaleFract = 0.0f;
else if (scaleFract < 0.375f)
scaleFract = 0.25f;
else if (scaleFract < 0.625f)
scaleFract = 0.5f;
else
scaleFract = 0.75f;
scale = scaleBase + scaleFract;
String os = OS.isWindows() ? "Windows" : OS.isLinux() ? "Linux" : OS.isMacOSX() ? "Mac" : "Unknown OS";
return Collections.singleton(new UsageDescriptor(os + " " + scale, 1));
}
use of com.intellij.internal.statistic.beans.UsageDescriptor in project intellij-community by JetBrains.
the class LanguageLevelUsagesCollector method getProjectUsages.
@NotNull
public Set<UsageDescriptor> getProjectUsages(@NotNull Project project) {
final Set<String> 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));
}
use of com.intellij.internal.statistic.beans.UsageDescriptor in project intellij-community by JetBrains.
the class AbstractRunConfigurationTypeUsagesCollector method getProjectUsages.
@NotNull
@Override
public final Set<UsageDescriptor> getProjectUsages(@NotNull final Project project) {
final Set<String> runConfigurationTypes = new HashSet<>();
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
@Override
public void run() {
if (project.isDisposed())
return;
final RunManager runManager = RunManager.getInstance(project);
for (RunnerAndConfigurationSettings settings : runManager.getAllSettings()) {
RunConfiguration runConfiguration = settings.getConfiguration();
if (runConfiguration != null && isApplicable(runManager, settings)) {
final ConfigurationFactory configurationFactory = runConfiguration.getFactory();
final ConfigurationType configurationType = configurationFactory.getType();
final StringBuilder keyBuilder = new StringBuilder();
keyBuilder.append(configurationType.getId());
if (configurationType.getConfigurationFactories().length > 1) {
keyBuilder.append(".").append(configurationFactory.getName());
}
runConfigurationTypes.add(keyBuilder.toString());
}
}
}
});
return ContainerUtil.map2Set(runConfigurationTypes, runConfigurationType -> new UsageDescriptor(runConfigurationType, 1));
}
use of com.intellij.internal.statistic.beans.UsageDescriptor in project intellij-community by JetBrains.
the class VcsOptionsUsagesCollector method getProjectUsages.
@NotNull
public Set<UsageDescriptor> getProjectUsages(@NotNull Project project) {
VcsConfiguration configuration = VcsConfiguration.getInstance(project);
Set<UsageDescriptor> usages = new HashSet<>();
usages.add(getBooleanUsage("offer.move.partially.committed", configuration.OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT));
usages.add(getEnumUsage("offer.move.failed.committed", configuration.MOVE_TO_FAILED_COMMIT_CHANGELIST));
usages.add(getEnumUsage("offer.remove.empty.changelist", configuration.REMOVE_EMPTY_INACTIVE_CHANGELISTS));
usages.add(getBooleanUsage("changelist.make.new.active", configuration.MAKE_NEW_CHANGELIST_ACTIVE));
usages.add(getBooleanUsage("changelist.preselect.existing", configuration.PRESELECT_EXISTING_CHANGELIST));
usages.add(getBooleanUsage("perform.update.in.background", configuration.PERFORM_UPDATE_IN_BACKGROUND));
usages.add(getBooleanUsage("perform.commit.in.background", configuration.PERFORM_COMMIT_IN_BACKGROUND));
usages.add(getBooleanUsage("perform.edit.in.background", configuration.PERFORM_EDIT_IN_BACKGROUND));
usages.add(getBooleanUsage("perform.checkout.in.background", configuration.PERFORM_CHECKOUT_IN_BACKGROUND));
usages.add(getBooleanUsage("perform.add_remove.in.background", configuration.PERFORM_ADD_REMOVE_IN_BACKGROUND));
usages.add(getBooleanUsage("perform.rollback.in.background", configuration.PERFORM_ROLLBACK_IN_BACKGROUND));
usages.add(getBooleanUsage("commit.before.check.code.smell", configuration.CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT));
usages.add(getBooleanUsage("commit.before.check.code.cleanup", configuration.CHECK_CODE_CLEANUP_BEFORE_PROJECT_COMMIT));
usages.add(getBooleanUsage("commit.before.check.todo", configuration.CHECK_NEW_TODO));
usages.add(getBooleanUsage("commit.before.check.non.empty.comment", configuration.FORCE_NON_EMPTY_COMMENT));
usages.add(getBooleanUsage("commit.before.optimize.imports", configuration.OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT));
usages.add(getBooleanUsage("commit.before.check.files.up.to.date", configuration.CHECK_FILES_UP_TO_DATE_BEFORE_COMMIT));
usages.add(getBooleanUsage("commit.before.reformat.project", configuration.REFORMAT_BEFORE_PROJECT_COMMIT));
usages.add(getBooleanUsage("commit.before.reformat.file", configuration.REFORMAT_BEFORE_FILE_COMMIT));
usages.add(getBooleanUsage("commit.before.rearrange", configuration.REARRANGE_BEFORE_PROJECT_COMMIT));
usages.add(getBooleanUsage("commit.clear.initial.comment", configuration.CLEAR_INITIAL_COMMIT_MESSAGE));
usages.add(getBooleanUsage("commit.use.right.margin", configuration.USE_COMMIT_MESSAGE_MARGIN));
usages.add(getBooleanUsage("commit.show.unversioned", configuration.SHOW_UNVERSIONED_FILES_WHILE_COMMIT));
usages.add(getBooleanUsage("show.changes.preview", configuration.LOCAL_CHANGES_DETAILS_PREVIEW_SHOWN));
usages.add(getBooleanUsage("include.text.into.shelf", configuration.INCLUDE_TEXT_INTO_SHELF));
usages.add(getBooleanUsage("check.conflicts.in.background", configuration.CHECK_LOCALLY_CHANGED_CONFLICTS_IN_BACKGROUND));
return usages;
}
Aggregations