Skip to content

Commit

Permalink
allow customizing the URL where statistics are submitted through Appl…
Browse files Browse the repository at this point in the history
…icationInfo.xml
  • Loading branch information
yole committed Jan 15, 2013
1 parent cb6f331 commit bd55d79
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 5 deletions.
2 changes: 2 additions & 0 deletions community-resources/src/idea/IdeaApplicationInfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@

<plugins-page category="VCS Integration" title="Select VCS Integration Plugins"/>
<plugins-page title="Select Other Plugins"/>

<statistics settings="http://jetbrains.com/idea/statistics/stat-assistant.xml" service="http://jetbrains.com/idea/statistics/index.jsp"/>
</component>
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package com.intellij.internal.statistic.connect;

import com.intellij.facet.frameworks.SettingsConnectionService;
import com.intellij.openapi.application.impl.ApplicationInfoImpl;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.ArrayUtil;
import com.intellij.util.Function;
Expand All @@ -28,15 +29,12 @@
import java.util.Set;

public class StatisticsConnectionService extends SettingsConnectionService {

private static final String SETTINGS_URL = "http://jetbrains.com/idea/statistics/stat-assistant.xml";
private static final String DEFAULT_SERVICE_URL = "http://jetbrains.com/idea/statistics/index.jsp";

private static final String PERMISSION_ATTR_NAME = "permitted";
private static final String DISABLED = "disabled";

public StatisticsConnectionService() {
this(SETTINGS_URL, DEFAULT_SERVICE_URL);
this(((ApplicationInfoImpl)ApplicationInfoImpl.getShadowInstance()).getStatisticsSettingsUrl(),
((ApplicationInfoImpl)ApplicationInfoImpl.getShadowInstance()).getStatisticsServiceUrl());
}

public StatisticsConnectionService(@NotNull String settingsUrl, @Nullable String defaultServiceUrl) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
@NonNls private String myWebHelpUrl = "http://www.jetbrains.com/idea/webhelp/";
private List<PluginChooserPage> myPluginChooserPages = new ArrayList<PluginChooserPage>();
private String[] myEssentialPluginsIds;
private String myStatisticsSettingsUrl;
private String myStatisticsServiceUrl;

@NonNls private static final String IDEA_PATH = "/idea/";
@NonNls private static final String ELEMENT_VERSION = "version";
Expand Down Expand Up @@ -149,6 +151,11 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
@NonNls private static final String DEFAULT_PLUGINS_HOST = "http://plugins.intellij.net";
@NonNls private static final String ESSENTIAL_PLUGIN = "essential-plugin";

@NonNls private static final String ELEMENT_STATISTICS = "statistics";
@NonNls private static final String ATTRIBUTE_STATISTICS_SETTINGS = "settings";
@NonNls private static final String ATTRIBUTE_STATISTICS_SERVICE = "service";


public void initComponent() { }

public void disposeComponent() { }
Expand Down Expand Up @@ -362,6 +369,14 @@ public boolean showLicenseeInfo() {
return myShowLicensee;
}

public String getStatisticsSettingsUrl() {
return myStatisticsSettingsUrl;
}

public String getStatisticsServiceUrl() {
return myStatisticsServiceUrl;
}

private static ApplicationInfoImpl ourShadowInstance;

public boolean isBetaOrRC() {
Expand Down Expand Up @@ -584,6 +599,16 @@ public String fun(Element element) {
}
});
myEssentialPluginsIds = ArrayUtil.toStringArray(essentialPluginsIds);

Element statisticsElement = parentNode.getChild(ELEMENT_STATISTICS);
if (statisticsElement != null) {
myStatisticsSettingsUrl = statisticsElement.getAttributeValue(ATTRIBUTE_STATISTICS_SETTINGS);
myStatisticsServiceUrl = statisticsElement.getAttributeValue(ATTRIBUTE_STATISTICS_SERVICE);
}
else {
myStatisticsSettingsUrl = "http://jetbrains.com/idea/statistics/stat-assistant.xml";
myStatisticsServiceUrl = "http://jetbrains.com/idea/statistics/index.jsp";
}
}

private static GregorianCalendar parseDate(final String dateString) {
Expand Down

0 comments on commit bd55d79

Please sign in to comment.