diff options
author | Xavier Ducrohet <xav@android.com> | 2009-04-27 14:58:09 -0700 |
---|---|---|
committer | Xavier Ducrohet <xav@android.com> | 2009-04-27 15:05:06 -0700 |
commit | ff9c21ab084afbe147b0f7fff71cfb90f250e966 (patch) | |
tree | 512b9a03f425ceac3f6b258a5e4250697a490ac1 /eclipse | |
parent | 43793c7bfa1589ea9c174c205e3dcf6f4e9b1704 (diff) | |
download | sdk-ff9c21ab084afbe147b0f7fff71cfb90f250e966.zip sdk-ff9c21ab084afbe147b0f7fff71cfb90f250e966.tar.gz sdk-ff9c21ab084afbe147b0f7fff71cfb90f250e966.tar.bz2 |
Fix the opt-in window for usage stat so that it works when running from ADT.
Diffstat (limited to 'eclipse')
3 files changed, 21 insertions, 48 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/.classpath b/eclipse/plugins/com.android.ide.eclipse.adt/.classpath index a24fc87..9898b97 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/.classpath +++ b/eclipse/plugins/com.android.ide.eclipse.adt/.classpath @@ -5,7 +5,7 @@ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="lib" path="jarutils.jar"/> <classpathentry kind="lib" path="androidprefs.jar"/> - <classpathentry kind="lib" path="sdkstats.jar"/> + <classpathentry kind="lib" path="sdkstats.jar" sourcepath="/SdkStatsService"/> <classpathentry kind="lib" path="kxml2-2.3.0.jar"/> <classpathentry kind="lib" path="layoutlib_api.jar"/> <classpathentry kind="lib" path="layoutlib_utils.jar"/> diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java index b5cee81..8ef0f2c 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java @@ -31,7 +31,6 @@ import com.android.ide.eclipse.adt.sdk.Sdk; import com.android.ide.eclipse.adt.sdk.Sdk.ITargetChangeListener; import com.android.ide.eclipse.adt.ui.EclipseUiHelper; import com.android.ide.eclipse.common.AndroidConstants; -import com.android.ide.eclipse.common.SdkStatsHelper; import com.android.ide.eclipse.common.StreamHelper; import com.android.ide.eclipse.common.project.BaseProjectHelper; import com.android.ide.eclipse.common.project.ExportHelper; @@ -51,6 +50,7 @@ import com.android.ide.eclipse.editors.resources.manager.ResourceMonitor.IFileLi import com.android.ide.eclipse.editors.xml.XmlEditor; import com.android.sdklib.IAndroidTarget; import com.android.sdklib.SdkConstants; +import com.android.sdkstats.SdkStatsService; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFolder; @@ -983,13 +983,7 @@ public class AdtPlugin extends AbstractUIPlugin { @Override protected IStatus run(IProgressMonitor monitor) { try { - - // get the version of the plugin - String versionString = (String) getBundle().getHeaders().get( - Constants.BUNDLE_VERSION); - Version version = new Version(versionString); - - SdkStatsHelper.pingUsageServer("adt", version); //$NON-NLS-1$ + pingUsageServer(); //$NON-NLS-1$ return Status.OK_STATUS; } catch (Throwable t) { @@ -1389,4 +1383,22 @@ public class AdtPlugin extends AbstractUIPlugin { public static synchronized OutputStream getErrorStream() { return sPlugin.mAndroidConsoleErrorStream; } + + /** + * Pings the usage start server. + * @param pluginName the name of the plugin to appear in the stats + * @param pluginVersion the {@link Version} of the plugin. + */ + private void pingUsageServer() { + // get the version of the plugin + String versionString = (String) getBundle().getHeaders().get( + Constants.BUNDLE_VERSION); + Version version = new Version(versionString); + + versionString = String.format("%1$d.%2$d.%3$d", version.getMajor(), //$NON-NLS-1$ + version.getMinor(), version.getMicro()); + + SdkStatsService.ping("adt", versionString, getDisplay()); //$NON-NLS-1$ + } + } diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/common/SdkStatsHelper.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/common/SdkStatsHelper.java deleted file mode 100644 index 345c663..0000000 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/common/SdkStatsHelper.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2008 The Android Open Source Project - * - * Licensed under the Eclipse Public License, Version 1.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.eclipse.org/org/documents/epl-v10.php - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.ide.eclipse.common; - -import com.android.sdkstats.SdkStatsService; - -import org.osgi.framework.Version; - -/** - * Helper class to access the ping usage stat server. - */ -public class SdkStatsHelper { - - /** - * Pings the usage start server. - * @param pluginName the name of the plugin to appear in the stats - * @param pluginVersion the {@link Version} of the plugin. - */ - public static void pingUsageServer(String pluginName, Version pluginVersion) { - String versionString = String.format("%1$d.%2$d.%3$d", pluginVersion.getMajor(), - pluginVersion.getMinor(), pluginVersion.getMicro()); - - SdkStatsService.ping(pluginName, versionString); - } -} |