diff --git a/plugins/com.gwtplugins.gdt.eclipse.core/src/com/google/gdt/eclipse/core/update/internal/core/FeatureUpdateChecker.java b/plugins/com.gwtplugins.gdt.eclipse.core/src/com/google/gdt/eclipse/core/update/internal/core/FeatureUpdateChecker.java index eeb70b14..c3c2a658 100644 --- a/plugins/com.gwtplugins.gdt.eclipse.core/src/com/google/gdt/eclipse/core/update/internal/core/FeatureUpdateChecker.java +++ b/plugins/com.gwtplugins.gdt.eclipse.core/src/com/google/gdt/eclipse/core/update/internal/core/FeatureUpdateChecker.java @@ -16,7 +16,7 @@ import com.google.gdt.eclipse.core.CorePluginLog; -import org.eclipse.core.runtime.PluginVersionIdentifier; +import org.osgi.framework.Version; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; @@ -30,7 +30,6 @@ * available. The UpdateComputers are given the root element of a * site.xml file as input. */ -@SuppressWarnings("deprecation") public class FeatureUpdateChecker { /** @@ -68,8 +67,8 @@ public abstract static class UpdateComputer { * . */ protected UpdateInfo doCheckSiteXMLForUpdates(String featureId, - PluginVersionIdentifier featureVersion, - PluginVersionIdentifier lastAcknowledgedVersionForFeatureUpdate, + Version featureVersion, + Version lastAcknowledgedVersionForFeatureUpdate, Element siteXMLRootElement, boolean compareQualifiers) { FeatureUpdateChecker.UpdateInfo context = new FeatureUpdateChecker.UpdateInfo( @@ -84,7 +83,7 @@ protected UpdateInfo doCheckSiteXMLForUpdates(String featureId, * the feature id of the installedFeature, and find the one with the * highest version number. */ - PluginVersionIdentifier maxFeatureVersion = null; + Version maxFeatureVersion = null; NodeList list = siteXMLRootElement.getChildNodes(); int length = list.getLength(); @@ -108,18 +107,18 @@ protected UpdateInfo doCheckSiteXMLForUpdates(String featureId, continue; } - PluginVersionIdentifier siteXMLFeatureVersion = new PluginVersionIdentifier( + Version siteXMLFeatureVersion = new Version( versionStr); if (!compareQualifiers) { - siteXMLFeatureVersion = new PluginVersionIdentifier( - siteXMLFeatureVersion.getMajorComponent(), - siteXMLFeatureVersion.getMinorComponent(), - siteXMLFeatureVersion.getServiceComponent()); + siteXMLFeatureVersion = new Version( + siteXMLFeatureVersion.getMajor(), + siteXMLFeatureVersion.getMinor(), + siteXMLFeatureVersion.getMicro()); } if (maxFeatureVersion == null - || siteXMLFeatureVersion.isGreaterThan(maxFeatureVersion)) { + || siteXMLFeatureVersion.compareTo(maxFeatureVersion) > 0) { maxFeatureVersion = siteXMLFeatureVersion; } } @@ -145,8 +144,8 @@ protected UpdateInfo doCheckSiteXMLForUpdates(String featureId, * update that has a higher version than anything the user has been * notified about beforehand. */ - if (maxFeatureVersion.isGreaterThan(featureVersion) - && maxFeatureVersion.isGreaterThan(lastAcknowledgedVersionForFeatureUpdate)) { + if (maxFeatureVersion.compareTo(featureVersion) > 0 + && maxFeatureVersion.compareTo(lastAcknowledgedVersionForFeatureUpdate) > 0) { context.setUpdateAvailable(true); context.setUpdatedFeatureVersion(maxFeatureVersion); } @@ -160,16 +159,16 @@ protected UpdateInfo doCheckSiteXMLForUpdates(String featureId, */ public static class UpdateInfo { - private static final PluginVersionIdentifier NO_VERSION = new PluginVersionIdentifier( + private static final Version NO_VERSION = new Version( "0.0.0.0"); private boolean isUpdateAvailable = false; private String featureId = null; - private PluginVersionIdentifier updatedFeatureVersion = NO_VERSION; + private Version updatedFeatureVersion = NO_VERSION; /** * Constructs an object to hold update information for the given feature. - * + * * @param featureId the id of the feature */ public UpdateInfo(String featureId) { @@ -184,7 +183,7 @@ public String getFeatureId() { * If an update is available, returns the updated version that is available * for the feature. Otherwise, returns a version of 0.0.0.0. */ - public PluginVersionIdentifier getUpdatedFeatureVersion() { + public Version getUpdatedFeatureVersion() { return updatedFeatureVersion; } @@ -200,7 +199,7 @@ public void setUpdateAvailable(boolean isUpdateAvailable) { } public void setUpdatedFeatureVersion( - PluginVersionIdentifier updatedFeatureVersion) { + Version updatedFeatureVersion) { if (updatedFeatureVersion == null) { this.updatedFeatureVersion = NO_VERSION; } else { @@ -215,7 +214,7 @@ public void setUpdatedFeatureVersion( * Constructs an instance with a set of {@link UpdateComputer}s. The * UpdateComputers are used to determine if updates are available based on the * contents of the site.xml file. - * + * * @param updateComputers used to determine if updates are available based on * the contents of the site.xml file */ diff --git a/plugins/com.gwtplugins.gdt.eclipse.suite.update/src/com/google/gdt/eclipse/suite/update/GdtExtPlugin.java b/plugins/com.gwtplugins.gdt.eclipse.suite.update/src/com/google/gdt/eclipse/suite/update/GdtExtPlugin.java index 760abb12..d20ab382 100644 --- a/plugins/com.gwtplugins.gdt.eclipse.suite.update/src/com/google/gdt/eclipse/suite/update/GdtExtPlugin.java +++ b/plugins/com.gwtplugins.gdt.eclipse.suite.update/src/com/google/gdt/eclipse/suite/update/GdtExtPlugin.java @@ -30,17 +30,16 @@ import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.PluginVersionIdentifier; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.JavaModelException; import org.osgi.framework.BundleContext; +import org.osgi.framework.Version; import org.w3c.dom.Element; /** * Activator class for the plugin. */ -@SuppressWarnings("deprecation") public class GdtExtPlugin extends AbstractGwtPlugin { /** @@ -57,7 +56,7 @@ public Sdk doFindSdk(IJavaProject project) throws JavaModelException { public static final String FEATURE_ID; public static final String FEATURE_UPDATE_SITE_URL; - public static final PluginVersionIdentifier FEATURE_VERSION; + public static final Version FEATURE_VERSION; public static final String PLUGIN_ID = "com.gwtplugins.gdt.eclipse.suite.update"; public static final String GWT_SDK_BUNDLE_FEATURE_ID = "com.gwtplugins.gwt.eclipse.sdkbundle.gwt211.feature"; @@ -70,7 +69,7 @@ public Sdk doFindSdk(IJavaProject project) throws JavaModelException { static { PluginProperties props = new PluginProperties(GdtExtPlugin.class); FEATURE_ID = props.getProperty("featureId", "com.gwtplugins.eclipse.suite.v3.feature"); - FEATURE_VERSION = new PluginVersionIdentifier(props.getProperty("featureVersion", "0.0.0.0")); + FEATURE_VERSION = new Version(props.getProperty("featureVersion", "0.0.0.0")); FEATURE_UPDATE_SITE_URL = props.getProperty("featureUpdateSiteURL", "http://localhost/update"); } @@ -153,7 +152,7 @@ public UpdateInfo checkSiteXMLForUpdates(Element siteXMLRootElem) { return doCheckSiteXMLForUpdates( GWT_SDK_BUNDLE_FEATURE_ID, - new PluginVersionIdentifier(maxGwtSdkVersion), + new Version(maxGwtSdkVersion), GdtPreferences.getVersionForLastAcknowledgedUpdateNotification(GWT_SDK_BUNDLE_FEATURE_ID), siteXMLRootElem, false); } diff --git a/plugins/com.gwtplugins.gdt.eclipse.suite.update/src/com/google/gdt/eclipse/suite/update/UpdateSiteURLGenerator.java b/plugins/com.gwtplugins.gdt.eclipse.suite.update/src/com/google/gdt/eclipse/suite/update/UpdateSiteURLGenerator.java index 638a4a98..b24ad988 100644 --- a/plugins/com.gwtplugins.gdt.eclipse.suite.update/src/com/google/gdt/eclipse/suite/update/UpdateSiteURLGenerator.java +++ b/plugins/com.gwtplugins.gdt.eclipse.suite.update/src/com/google/gdt/eclipse/suite/update/UpdateSiteURLGenerator.java @@ -87,7 +87,6 @@ public URL generateURL(String baseUrl) throws MalformedURLException { * api add action. May be null * @param extra if not null, then is appended at the end of the URL */ - @SuppressWarnings("deprecation") // PluginVersionIdentifier.toString() private static URL computeCompositeUpdateSiteURL(String baseUrl, String action, IProject project, String apiName, String apiPlatform, String extra) throws MalformedURLException { diff --git a/plugins/com.gwtplugins.gdt.eclipse.suite.update/src/com/google/gdt/eclipse/suite/update/usage/AnalyticsPingManager.java b/plugins/com.gwtplugins.gdt.eclipse.suite.update/src/com/google/gdt/eclipse/suite/update/usage/AnalyticsPingManager.java index f35490c5..2b5dbfda 100644 --- a/plugins/com.gwtplugins.gdt.eclipse.suite.update/src/com/google/gdt/eclipse/suite/update/usage/AnalyticsPingManager.java +++ b/plugins/com.gwtplugins.gdt.eclipse.suite.update/src/com/google/gdt/eclipse/suite/update/usage/AnalyticsPingManager.java @@ -89,7 +89,6 @@ private static void sendPing( parametersMap.put("ev", value.toString()); } setCustomDimension(parametersMap, CustomDimensionName.ANONYMIZED_CLIENT_ID, anonymizedClientId); - @SuppressWarnings("deprecation") // PluginVersionIdentifier.toString() String gwtVersion = new VersionedIdentifier( GdtExtPlugin.FEATURE_ID, GdtExtPlugin.FEATURE_VERSION.toString()).toString(); diff --git a/plugins/com.gwtplugins.gdt.eclipse.suite/src/com/google/gdt/eclipse/suite/preferences/GdtPreferences.java b/plugins/com.gwtplugins.gdt.eclipse.suite/src/com/google/gdt/eclipse/suite/preferences/GdtPreferences.java index 4cff1c92..fb3376a1 100644 --- a/plugins/com.gwtplugins.gdt.eclipse.suite/src/com/google/gdt/eclipse/suite/preferences/GdtPreferences.java +++ b/plugins/com.gwtplugins.gdt.eclipse.suite/src/com/google/gdt/eclipse/suite/preferences/GdtPreferences.java @@ -27,7 +27,6 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.PluginVersionIdentifier; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.preferences.ConfigurationScope; import org.eclipse.core.runtime.preferences.IEclipsePreferences; @@ -181,9 +180,8 @@ public static int getProjectMigratorVersion(IProject project) { return instancePrefs.getInt(PROJECT_MIGRATOR_VERSION + project.getName(), 0); } - @SuppressWarnings("deprecation") - public static PluginVersionIdentifier getVersionForLastAcknowledgedUpdateNotification(String featureId) { - return new PluginVersionIdentifier( + public static Version getVersionForLastAcknowledgedUpdateNotification(String featureId) { + return new Version( getConfigurationPreferences().get(getLastAckFeatureUpdateVersionKey(featureId), "0.0.0.0")); } @@ -297,8 +295,7 @@ public static void setAnalytics(boolean capture) { flushPreferences(configurationPreferences); } - @SuppressWarnings("deprecation") - public static void setVersionForLastAcknowlegedUpdateNotification(String featureId, PluginVersionIdentifier version) { + public static void setVersionForLastAcknowlegedUpdateNotification(String featureId, Version version) { IEclipsePreferences configurationPreferences = getConfigurationPreferences(); configurationPreferences.put(getLastAckFeatureUpdateVersionKey(featureId), version.toString()); flushPreferences(configurationPreferences);