本文整理汇总了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());
}
});
}
示例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;
}
示例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);
}
}
示例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);
}
示例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());
}
示例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));
}
示例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);
}
}
示例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);
}
示例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());
}
示例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));
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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));
}
示例15: MyNotificationListener
import com.intellij.internal.statistic.connect.StatisticsService; //导入依赖的package包/类
public MyNotificationListener(@NotNull StatisticsService statisticsService,
@NotNull UsageStatisticsPersistenceComponent settings) {
myStatisticsService = statisticsService;
mySettings = settings;
}