use of org.eclipse.ui.internal.ProductProperties in project azure-tools-for-java by Microsoft.
the class PluginUtil method getEclipseP2Repository.
private static URI getEclipseP2Repository() {
String repoPrefix = "download.eclipse.org/releases/";
ProvisioningUI provisioningUI = ProvisioningUI.getDefaultUI();
if (provisioningUI != null) {
RepositoryTracker tracker = provisioningUI.getRepositoryTracker();
if (tracker != null) {
URI[] sites = tracker.getKnownRepositories(provisioningUI.getSession());
for (URI site : sites) {
if (site.toString().contains(repoPrefix)) {
return site;
}
}
}
}
String start = "Version: ";
String end = " (";
URI repoSite = null;
ProductProperties productProperties = new ProductProperties(Platform.getProduct());
if (productProperties != null) {
String aboutText = productProperties.getAboutText();
int startIndex = aboutText.indexOf(start);
int endIndex = aboutText.indexOf(end);
String eclipseSimutaneousReleaseVersion = "";
if (startIndex >= 0 && endIndex >= 0 && endIndex > startIndex) {
eclipseSimutaneousReleaseVersion = aboutText.substring(startIndex + start.length(), endIndex);
try {
repoSite = new URI("http://" + repoPrefix + eclipseSimutaneousReleaseVersion.toLowerCase());
} catch (Exception e) {
repoSite = null;
}
}
}
return repoSite;
}
Aggregations