use of org.eclipse.equinox.p2.ui.ProvisioningUI in project liferay-ide by liferay.
the class LiferayUIPlugin method _addRepository.
private void _addRepository() throws URISyntaxException {
ProvisioningUI provisioningUI = ProvisioningUI.getDefaultUI();
ProvisioningSession provisioningSession = provisioningUI.getSession();
RepositoryTracker repositoryTracker = provisioningUI.getRepositoryTracker();
URI[] knownRepositories = repositoryTracker.getKnownRepositories(provisioningSession);
URI liferayUri = new URI("https://releases.liferay.com/tools/ide/latest/stable/");
boolean containLifreayUri = Stream.of(knownRepositories).anyMatch(uri -> Objects.equals(uri, liferayUri));
if (!containLifreayUri) {
repositoryTracker.addRepository(liferayUri, "Liferay IDE Stable releases", provisioningSession);
}
}
use of org.eclipse.equinox.p2.ui.ProvisioningUI 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