Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -30,7 +30,6 @@
* available. The UpdateComputers are given the root element of a
* <code>site.xml</code> file as input.
*/
@SuppressWarnings("deprecation")
public class FeatureUpdateChecker {

/**
Expand Down Expand Up @@ -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(
Expand All @@ -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();
Expand All @@ -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;
}
}
Expand All @@ -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);
}
Expand All @@ -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) {
Expand All @@ -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 <code>0.0.0.0</code>.
*/
public PluginVersionIdentifier getUpdatedFeatureVersion() {
public Version getUpdatedFeatureVersion() {
return updatedFeatureVersion;
}

Expand All @@ -200,7 +199,7 @@ public void setUpdateAvailable(boolean isUpdateAvailable) {
}

public void setUpdatedFeatureVersion(
PluginVersionIdentifier updatedFeatureVersion) {
Version updatedFeatureVersion) {
if (updatedFeatureVersion == null) {
this.updatedFeatureVersion = NO_VERSION;
} else {
Expand All @@ -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 <code>site.xml</code> file.
*
*
* @param updateComputers used to determine if updates are available based on
* the contents of the <code>site.xml</code> file
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

/**
Expand All @@ -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";

Expand All @@ -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");
}

Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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"));
}

Expand Down Expand Up @@ -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);
Expand Down
Loading