Search in sources :

Example 1 with StatisticsService

use of com.intellij.internal.statistic.connect.StatisticsService in project intellij-community by JetBrains.

the class SendStatisticsAction method actionPerformed.

@Override
public void actionPerformed(@NotNull AnActionEvent e) {
    final Project project = e.getProject();
    if (project == null) {
        return;
    }
    ProgressManager.getInstance().run(new Task.Backgroundable(project, "Sending Statistics", false) {

        @Override
        public void run(@NotNull ProgressIndicator indicator) {
            StatisticsService service = StatisticsUploadAssistant.getStatisticsService();
            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());
        }
    });
}
Also used : Project(com.intellij.openapi.project.Project) StatisticsService(com.intellij.internal.statistic.connect.StatisticsService) Task(com.intellij.openapi.progress.Task) StatisticsResult(com.intellij.internal.statistic.connect.StatisticsResult) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator)

Example 2 with StatisticsService

use of com.intellij.internal.statistic.connect.StatisticsService in project intellij-community by JetBrains.

the class StatisticsUploadAssistant method getStatisticsService.

public static StatisticsService getStatisticsService() {
    String key = ((ApplicationInfoImpl) ApplicationInfoImpl.getShadowInstance()).getStatisticsServiceKey();
    StatisticsService service = key == null ? null : COLLECTOR.findSingle(key);
    if (service != null) {
        return service;
    }
    return new RemotelyConfigurableStatisticsService(new StatisticsConnectionService(), new StatisticsHttpClientSender(), new StatisticsUploadAssistant());
}
Also used : RemotelyConfigurableStatisticsService(com.intellij.internal.statistic.connect.RemotelyConfigurableStatisticsService) StatisticsService(com.intellij.internal.statistic.connect.StatisticsService) StatisticsConnectionService(com.intellij.internal.statistic.connect.StatisticsConnectionService) ApplicationInfoImpl(com.intellij.openapi.application.impl.ApplicationInfoImpl) StatisticsHttpClientSender(com.intellij.internal.statistic.connect.StatisticsHttpClientSender) RemotelyConfigurableStatisticsService(com.intellij.internal.statistic.connect.RemotelyConfigurableStatisticsService)

Aggregations

StatisticsService (com.intellij.internal.statistic.connect.StatisticsService)2 RemotelyConfigurableStatisticsService (com.intellij.internal.statistic.connect.RemotelyConfigurableStatisticsService)1 StatisticsConnectionService (com.intellij.internal.statistic.connect.StatisticsConnectionService)1 StatisticsHttpClientSender (com.intellij.internal.statistic.connect.StatisticsHttpClientSender)1 StatisticsResult (com.intellij.internal.statistic.connect.StatisticsResult)1 ApplicationInfoImpl (com.intellij.openapi.application.impl.ApplicationInfoImpl)1 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 Task (com.intellij.openapi.progress.Task)1 Project (com.intellij.openapi.project.Project)1