Skip to content

Commit

Permalink
Fix compatibility with plugin version update notification
Browse files Browse the repository at this point in the history
  • Loading branch information
breedloj committed Jan 24, 2025
1 parent ba28fdc commit 46503d7
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
import java.net.http.HttpResponse;
import java.time.Duration;

import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.eclipse.mylyn.commons.ui.dialogs.AbstractNotificationPopup;
import org.eclipse.swt.widgets.Display;
import org.osgi.framework.Version;

import org.tukaani.xz.XZInputStream;

Expand All @@ -26,17 +26,17 @@

public final class UpdateUtils {
private static final String REQUEST_URL = "https://amazonq.eclipsetoolkit.amazonwebservices.com/artifacts.xml.xz";
private static Version mostRecentNotificationVersion;
private static Version remoteVersion;
private static Version localVersion;
private static ArtifactVersion mostRecentNotificationVersion;
private static ArtifactVersion remoteVersion;
private static ArtifactVersion localVersion;
private static final UpdateUtils INSTANCE = new UpdateUtils();

public static UpdateUtils getInstance() {
return INSTANCE;
}

private UpdateUtils() {
mostRecentNotificationVersion = Activator.getPluginStore().getObject(Constants.DO_NOT_SHOW_UPDATE_KEY, Version.class);
mostRecentNotificationVersion = Activator.getPluginStore().getObject(Constants.DO_NOT_SHOW_UPDATE_KEY, ArtifactVersion.class);
String localString = PluginClientMetadata.getInstance().getPluginVersion();
localVersion = ArtifactUtils.parseVersion(localString.substring(0, localString.lastIndexOf(".")));
}
Expand All @@ -62,7 +62,7 @@ public void checkForUpdate() {
}
}

private Version fetchRemoteArtifactVersion(final String repositoryUrl) {
private ArtifactVersion fetchRemoteArtifactVersion(final String repositoryUrl) {
HttpClient connection = HttpClientFactory.getInstance();
try {
HttpRequest request = HttpRequest.newBuilder()
Expand Down Expand Up @@ -117,7 +117,7 @@ private void showNotification() {
});
}

private static boolean remoteVersionIsGreater(final Version remote, final Version local) {
private static boolean remoteVersionIsGreater(final ArtifactVersion remote, final ArtifactVersion local) {
return remote.compareTo(local) > 0;
}
}

0 comments on commit 46503d7

Please sign in to comment.