use of org.eclipse.epp.mpc.core.model.IMarket in project epp.mpc by eclipse.
the class MarketplaceDiscoveryStrategy method resolveCategory.
private static ICategory resolveCategory(ICategory category, List<? extends IMarket> markets) throws IllegalArgumentException, NoSuchElementException {
if (category != null && category.getId() == null) {
// need to resolve
if (category.getUrl() == null && category.getName() == null) {
throw new IllegalArgumentException(NLS.bind(Messages.MarketplaceDiscoveryStrategy_unidentifiableItem, category));
}
for (IMarket market : markets) {
List<? extends ICategory> categories = market.getCategory();
ICategory resolved = resolve(category, categories);
if (resolved != null) {
return resolved;
}
}
if (category.getUrl() != null) {
throw new NoSuchElementException(NLS.bind(Messages.MarketplaceDiscoveryStrategy_noUrlMatch, category.getUrl()));
} else {
throw new NoSuchElementException(NLS.bind(Messages.MarketplaceDiscoveryStrategy_noNameMatch, category.getName()));
}
}
return category;
}
Aggregations