use of org.eclipse.epp.internal.mpc.ui.catalog.MarketplaceNodeInstallableUnitItem in project epp.mpc by eclipse.
the class MarketplaceCatalogTest method setupCatalog.
protected void setupCatalog() throws MalformedURLException {
final SearchResult discoveryResult = new SearchResult();
discoveryResult.setNodes(discoveryNodes);
CatalogDescriptor catalogDescriptor = new CatalogDescriptor();
catalogDescriptor.setUrl(new URL("http://marketplace.eclipse.org"));
MarketplaceDiscoveryStrategy discoveryStrategy = new MarketplaceDiscoveryStrategy(catalogDescriptor) {
final MarketplaceCategory category = new MarketplaceCategory();
{
category.setId("<root>");
}
@Override
public void performDiscovery(IProgressMonitor monitor) throws CoreException {
if (!categories.contains(category)) {
categories.add(category);
}
handleSearchResult(category, discoveryResult, new NullProgressMonitor());
}
@Override
protected synchronized Map<String, IInstallableUnit> computeInstalledIUs(IProgressMonitor monitor) {
Map<String, IInstallableUnit> installedIus = new HashMap<String, IInstallableUnit>();
for (INode node : installedNodes) {
IIus ius = node.getIus();
if (ius != null) {
for (IIu iu : ius.getIuElements()) {
String featureId = iu.getId() + ".feature.group";
InstallableUnit installableUnit = new InstallableUnit();
installableUnit.setId(featureId);
installedIus.put(featureId, installableUnit);
}
}
}
return installedIus;
}
@Override
protected MarketplaceCategory findMarketplaceCategory(IProgressMonitor monitor) throws CoreException {
return category;
}
};
catalog = new MarketplaceCatalog() {
@Override
protected IStatus checkForUpdates(List<MarketplaceNodeCatalogItem> updateCheckNeeded, final Map<String, IInstallableUnit> installedIUs, final IProgressMonitor monitor) {
for (MarketplaceNodeCatalogItem item : updateCheckNeeded) {
checkedForUpdate.add(item.getData());
List<MarketplaceNodeInstallableUnitItem> installableUnitItems = item.getInstallableUnitItems();
boolean hasUpdate = updateAvailable.contains(item.getData());
for (MarketplaceNodeInstallableUnitItem iuItem : installableUnitItems) {
iuItem.setUpdateAvailable(hasUpdate);
}
}
return Status.OK_STATUS;
}
};
catalog.getDiscoveryStrategies().add(discoveryStrategy);
}
use of org.eclipse.epp.internal.mpc.ui.catalog.MarketplaceNodeInstallableUnitItem in project epp.mpc by eclipse.
the class SelectionModel method computeChildren.
private void computeChildren(CatalogItemEntry itemEntry) {
List<FeatureEntry> children = new ArrayList<FeatureEntry>();
List<MarketplaceNodeInstallableUnitItem> iuItems = ((MarketplaceNodeCatalogItem) itemEntry.getItem()).getInstallableUnitItems();
if (iuItems != null) {
for (MarketplaceNodeInstallableUnitItem iuItem : iuItems) {
FeatureEntry featureEntry = new FeatureEntry(itemEntry, iuItem);
featureEntry.setInstalled(computeInstalled(featureEntry));
featureEntry.setChecked(computeInitiallyChecked(featureEntry));
children.add(featureEntry);
}
}
itemEntry.children = children;
}
Aggregations