use of org.eclipse.equinox.p2.operations.RepositoryTracker 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;
}
use of org.eclipse.equinox.p2.operations.RepositoryTracker in project gemoc-studio by eclipse.
the class PrepareInstallProfileJob method addRepositories.
private List<IMetadataRepository> addRepositories(SubMonitor monitor) throws MalformedURLException, URISyntaxException, ProvisionException {
// tell p2 that it's okay to use these repositories
ProvisioningSession session = ProvisioningUI.getDefaultUI().getSession();
RepositoryTracker repositoryTracker = ProvisioningUI.getDefaultUI().getRepositoryTracker();
repositoryLocations = new HashSet<URI>();
monitor.setWorkRemaining(installableConnectors.size() * 5);
for (InstallableComponent descriptor : installableConnectors) {
for (String url : descriptor.getSitesURLS()) {
addASiteURL(monitor, session, repositoryTracker, url);
}
}
// fetch meta-data for these repositories
ArrayList<IMetadataRepository> repositories = new ArrayList<IMetadataRepository>();
monitor.setWorkRemaining(repositories.size());
IMetadataRepositoryManager manager = (IMetadataRepositoryManager) session.getProvisioningAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
for (URI uri : repositoryLocations) {
checkCancelled(monitor);
IMetadataRepository repository = manager.loadRepository(uri, monitor.newChild(1));
repositories.add(repository);
}
return repositories;
}
Aggregations