当前位置: 首页>>代码示例>>Java>>正文


Java StatisticsService类代码示例

本文整理汇总了Java中com.intellij.internal.statistic.connect.StatisticsService的典型用法代码示例。如果您正苦于以下问题:Java StatisticsService类的具体用法?Java StatisticsService怎么用?Java StatisticsService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


StatisticsService类属于com.intellij.internal.statistic.connect包,在下文中一共展示了StatisticsService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: actionPerformed

import com.intellij.internal.statistic.connect.StatisticsService; //导入依赖的package包/类
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
  final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
  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(new Runnable() {
        @Override
        public void run() {
          Messages.showMultilineInputDialog(project, "Result: " + result.getCode(), "Statistics Result",
                                            StringUtil.replace(result.getDescription(), ";", "\n"),
                                            null, null);
        }
      }, ModalityState.NON_MODAL, project.getDisposed());
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:SendStatisticsAction.java

示例2: getStatisticsConfigurationLabels

import com.intellij.internal.statistic.connect.StatisticsService; //导入依赖的package包/类
@Nullable
@Override
public Map<String, String> getStatisticsConfigurationLabels() {
  Map<String, String> labels = new HashMap<String, String>();

  final String fullProductName = ApplicationNamesInfo.getInstance().getFullProductName();
  final String companyName = ApplicationInfo.getInstance().getCompanyName();

  labels.put(StatisticsService.TITLE,
             "Help improve " +  fullProductName + " by sending usage statistics to " + companyName);
  labels.put(StatisticsService.ALLOW_CHECKBOX,
             "Send usage statistics to " + companyName);
  labels.put(StatisticsService.DETAILS,
             "<html>This allows " + companyName + " to collect usage information, such as data about your feature usage," +
             "<br>resource usage and plugin configuration.</html>");

  // Note: we inline the constants corresponding to the following keys since the corresponding change in IJ
  // may not be in upstream as yet.
  labels.put("linkUrl", "http://www.google.com/policies/privacy/");
  labels.put("linkBeforeText", "This data is collected in accordance with " + companyName + "'s ");
  labels.put("linkText", "privacy policy");
  labels.put("linkAfterText", ".");

  return labels;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:AndroidStatisticsService.java

示例3: runStatisticsService

import com.intellij.internal.statistic.connect.StatisticsService; //导入依赖的package包/类
private void runStatisticsService() {
  final StatisticsService statisticsService = StatisticsUploadAssistant.getStatisticsService();

  if (StatisticsUploadAssistant.isShouldShowNotification()) {
    myFrameStateManager.addListener(new FrameStateListener.Adapter() {
      @Override
      public void onFrameActivated() {
        if (((WindowManagerEx)WindowManager.getInstance()).getMostRecentFocusedWindow() instanceof IdeFrameImpl) {
          ApplicationManager.getApplication().invokeLater(new Runnable() {
            @Override
            public void run() {
              StatisticsNotificationManager.showNotification(statisticsService);
            }
          });
          myFrameStateManager.removeListener(this);
        }
      }
    });
  }
  else if (StatisticsUploadAssistant.isSendAllowed() && StatisticsUploadAssistant.isTimeToSend()) {
    StatisticsService serviceToUse = null;
    StatisticsServiceEP[] extensions = StatisticsService.EP_NAME.getExtensions();
    if (extensions.length > 1) {
      LOG.warn(String.format("More than one stats service detected (%s). Falling back to the built-in one", Arrays.toString(extensions)));
    }
    else if (extensions.length == 1) {
      serviceToUse = extensions[0].getInstance();
    }
    if (serviceToUse == null) {
      serviceToUse = statisticsService;
    }
    runWithDelay(serviceToUse);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:SendStatisticsComponent.java

示例4: runWithDelay

import com.intellij.internal.statistic.connect.StatisticsService; //导入依赖的package包/类
private void runWithDelay(final @NotNull StatisticsService statisticsService) {
  myAlarm.addRequest(new Runnable() {
    @Override
    public void run() {
      statisticsService.send();
    }
  }, DELAY_IN_MIN * 60 * 1000);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:SendStatisticsComponent.java

示例5: getStatisticsService

import com.intellij.internal.statistic.connect.StatisticsService; //导入依赖的package包/类
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());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:StatisticsUploadAssistant.java

示例6: StatisticsConfigurationComponent

import com.intellij.internal.statistic.connect.StatisticsService; //导入依赖的package包/类
public StatisticsConfigurationComponent() {
  String product = ApplicationNamesInfo.getInstance().getFullProductName();
  String company = ApplicationInfo.getInstance().getCompanyName();
  myTitle.setText(StatisticsBundle.message("stats.title", product, company));
  myLabel.setText(StatisticsBundle.message("stats.config.details", company));
  RelativeFont.SMALL.install(myLabel);

  myAllowToSendUsagesCheckBox.setText(StatisticsBundle.message("stats.config.allow.send.stats.text", company));
  myAllowToSendUsagesCheckBox.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      setRadioButtonsEnabled();
    }
  });

  // Let current statistics service override labels
  StatisticsService service = StatisticsUploadAssistant.getStatisticsService();
  if (service != null) {
    Map<String, String> overrides = service.getStatisticsConfigurationLabels();
    if (overrides != null) {
      String s = overrides.get(StatisticsService.TITLE);
      if (s != null) {
        myTitle.setText(s);
      }
      s = overrides.get(StatisticsService.DETAILS);
      if (s != null) {
        myLabel.setText(s);
      }
      s = overrides.get(StatisticsService.ALLOW_CHECKBOX);
      if (s != null) {
        myAllowToSendUsagesCheckBox.setText(s);
      }
    }
  }

  myTitle.setText(myTitle.getText().replace("%company%", company));
  myLabel.setText(myLabel.getText().replace("%company%", company));
  myAllowToSendUsagesCheckBox.setText(myAllowToSendUsagesCheckBox.getText().replace("%company%", company));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:40,代码来源:StatisticsConfigurationComponent.java

示例7: runStatisticsService

import com.intellij.internal.statistic.connect.StatisticsService; //导入依赖的package包/类
private void runStatisticsService() {
  StatisticsService statisticsService = StatisticsUploadAssistant.getStatisticsService();

  if (StatisticsUploadAssistant.showNotification()) {
    StatisticsNotificationManager.showNotification(statisticsService, myProject);
  }
  else if (StatisticsUploadAssistant.isSendAllowed() && StatisticsUploadAssistant.isTimeToSend()) {
    runWithDelay(statisticsService);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:11,代码来源:SendStatisticsProjectComponent.java

示例8: runWithDelay

import com.intellij.internal.statistic.connect.StatisticsService; //导入依赖的package包/类
private void runWithDelay(final @NotNull StatisticsService statisticsService) {
  myAlarm.addRequest(new Runnable() {
    @Override
    public void run() {
      if (DumbService.isDumb(myProject)) {
        runWithDelay(statisticsService);
      }
      else {
        statisticsService.send();
      }
    }
  }, DELAY_IN_MIN * 60 * 1000);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:14,代码来源:SendStatisticsProjectComponent.java

示例9: getStatisticsService

import com.intellij.internal.statistic.connect.StatisticsService; //导入依赖的package包/类
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());
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:14,代码来源:StatisticsUploadAssistant.java

示例10: StatisticsConfigurationComponent

import com.intellij.internal.statistic.connect.StatisticsService; //导入依赖的package包/类
public StatisticsConfigurationComponent() {
  String product = ApplicationNamesInfo.getInstance().getFullProductName();
  String company = ApplicationInfo.getInstance().getCompanyName();
  myTitle.setText(StatisticsBundle.message("stats.title", product, company));
  myLabel.setText(StatisticsBundle.message("stats.config.details", company));
  myLabel.setFont(UIUtil.getLabelFont(UIUtil.FontSize.SMALL));

  myAllowToSendUsagesCheckBox.setText(StatisticsBundle.message("stats.config.allow.send.stats.text", company));
  myAllowToSendUsagesCheckBox.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      setRadioButtonsEnabled();
    }
  });

  // Let current statistics service override labels
  StatisticsService service = StatisticsUploadAssistant.getStatisticsService();
  if (service != null) {
    Map<String, String> overrides = service.getStatisticsConfigurationLabels();
    if (overrides != null) {
      String s = overrides.get(StatisticsService.TITLE);
      if (s != null) {
        myTitle.setText(s);
      }
      s = overrides.get(StatisticsService.DETAILS);
      if (s != null) {
        myLabel.setText(s);
      }
      s = overrides.get(StatisticsService.ALLOW_CHECKBOX);
      if (s != null) {
        myAllowToSendUsagesCheckBox.setText(s);
      }
    }
  }

  myTitle.setText(myTitle.getText().replace("%company%", company));
  myLabel.setText(myLabel.getText().replace("%company%", company));
  myAllowToSendUsagesCheckBox.setText(myAllowToSendUsagesCheckBox.getText().replace("%company%", company));
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:40,代码来源:StatisticsConfigurationComponent.java

示例11: actionPerformed

import com.intellij.internal.statistic.connect.StatisticsService; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
  final Project project = e.getData(CommonDataKeys.PROJECT);
  if (project != null) {
    StatisticsService service = StatisticsUploadAssistant.getStatisticsService();
    StatisticsResult result = service.send();
    Messages.showMessageDialog(result.getDescription(), "Result", AllIcons.FileTypes.Custom);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:10,代码来源:SendStatisticsAction.java

示例12: runStatisticsService

import com.intellij.internal.statistic.connect.StatisticsService; //导入依赖的package包/类
private void runStatisticsService() {
  StatisticsService statisticsService = StatisticsUploadAssistant.getStatisticsService();

  if (System.currentTimeMillis() - Time.DAY > ((FeatureUsageTrackerImpl)FeatureUsageTracker.getInstance()).getFirstRunTime()) {
    return;
  }

  if (StatisticsUploadAssistant.isSendAllowed() && StatisticsUploadAssistant.isTimeToSend()) {
    runWithDelay(statisticsService);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:12,代码来源:SendStatisticsProjectComponent.java

示例13: runWithDelay

import com.intellij.internal.statistic.connect.StatisticsService; //导入依赖的package包/类
private void runWithDelay(final @Nonnull StatisticsService statisticsService) {
  myAlarm.addRequest(new Runnable() {
    @Override
    public void run() {
      if (DumbService.isDumb(myProject)) {
        runWithDelay(statisticsService);
      }
      else {
        statisticsService.send();
      }
    }
  }, DELAY_IN_MIN * 60 * 1000);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:14,代码来源:SendStatisticsProjectComponent.java

示例14: showNotification

import com.intellij.internal.statistic.connect.StatisticsService; //导入依赖的package包/类
public static void showNotification(@NotNull StatisticsService statisticsService) {
  MyNotificationListener listener =
    new MyNotificationListener(statisticsService, UsageStatisticsPersistenceComponent.getInstance());

  Notifications.Bus.notify(statisticsService.createNotification(GROUP_DISPLAY_ID, listener));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:StatisticsNotificationManager.java

示例15: MyNotificationListener

import com.intellij.internal.statistic.connect.StatisticsService; //导入依赖的package包/类
public MyNotificationListener(@NotNull StatisticsService statisticsService,
                              @NotNull UsageStatisticsPersistenceComponent settings) {
  myStatisticsService = statisticsService;
  mySettings = settings;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:StatisticsNotificationManager.java


注:本文中的com.intellij.internal.statistic.connect.StatisticsService类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。