/** * Compares v1 <-> v2, if v1 is greater than v2, then result will be > 0 if v2 is greater than v1 * the result will be < 0 * * @param v1 * @param v2 * @return */ public static int compareVersions(Version v1, Version v2) { if (v2 == v1) { // quicktest return 0; } int result = v1.getMajor() - v2.getMajor(); if (result != 0) { return result; } result = v1.getMinor() - v2.getMinor(); if (result != 0) { return result; } result = v1.getMicro() - v2.getMicro(); if (result != 0) { return result; } return v1.getQualifier().compareTo(v2.getQualifier()); }
/** * 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); }
public long getLastModifiedTime(String file) { if (fBundleVersion == -1) { Version v = SVCorePlugin.getDefault().getBundle().getVersion(); // Ensure the version is always really big to work around the temporary // current problem of having existing versions out in the wild fBundleVersion = v.getMicro(); fBundleVersion |= v.getMinor() << 16; fBundleVersion |= v.getMajor() << 24; fBundleVersion |= (8L << 48L); } if (fBundleVersion < fBundle.getLastModified()) { System.out.println( "computed bundle version older than BundleVersion: " + fBundleVersion + " " + fBundle.getLastModified()); } return fBundleVersion; }