use of org.eclipse.equinox.internal.p2.discovery.AbstractDiscoveryStrategy in project epp.mpc by eclipse.
the class MarketplaceViewer method catalogUpdated.
@Override
protected void catalogUpdated(final boolean wasCancelled, final boolean wasError) {
MarketplaceCatalog catalog = getCatalog();
List<AbstractDiscoveryStrategy> discoveryStrategies = catalog.getDiscoveryStrategies();
for (AbstractDiscoveryStrategy discoveryStrategy : discoveryStrategies) {
if (discoveryStrategy instanceof MarketplaceDiscoveryStrategy) {
MarketplaceDiscoveryStrategy marketplaceDiscoveryStrategy = (MarketplaceDiscoveryStrategy) discoveryStrategy;
marketplaceDiscoveryStrategy.addLoginListener(loginListener);
for (CatalogCategory catalogCategory : catalog.getCategories()) {
if (catalogCategory instanceof MarketplaceCategory) {
MarketplaceCategory marketplaceCategory = (MarketplaceCategory) catalogCategory;
if (marketplaceCategory.getContents() == Contents.FEATURED && getWizard().shouldShowOpenFavoritesBanner()) {
marketplaceDiscoveryStrategy.addOpenFavoritesItem(marketplaceCategory);
}
}
}
}
}
runUpdate(new Runnable() {
public void run() {
MarketplaceViewer.super.catalogUpdated(wasCancelled, wasError);
for (CatalogFilter filter : getConfiguration().getFilters()) {
if (filter instanceof MarketplaceFilter) {
((MarketplaceFilter) filter).catalogUpdated(wasCancelled);
}
}
setFilters(queryData);
}
});
}
use of org.eclipse.equinox.internal.p2.discovery.AbstractDiscoveryStrategy in project epp.mpc by eclipse.
the class FavoritesViewer method findFavoritesStrategy.
private FavoritesDiscoveryStrategy findFavoritesStrategy() {
FavoritesDiscoveryStrategy favoritesStrategy = null;
List<AbstractDiscoveryStrategy> discoveryStrategies = getCatalog().getDiscoveryStrategies();
for (AbstractDiscoveryStrategy strategy : discoveryStrategies) {
if (strategy instanceof FavoritesDiscoveryStrategy) {
favoritesStrategy = (FavoritesDiscoveryStrategy) strategy;
break;
}
}
return favoritesStrategy;
}
use of org.eclipse.equinox.internal.p2.discovery.AbstractDiscoveryStrategy in project epp.mpc by eclipse.
the class MarketplaceCatalog method performNewsDiscovery.
public IStatus performNewsDiscovery(IProgressMonitor monitor) {
if (getDiscoveryStrategies().isEmpty()) {
throw new IllegalStateException();
}
INews news = null;
MultiStatus status = new MultiStatus(MarketplaceClientUi.BUNDLE_ID, 0, Messages.MarketplaceCatalog_queryFailed, null);
final int totalTicks = 100000;
final SubMonitor progress = SubMonitor.convert(monitor, Messages.MarketplaceCatalog_Checking_News, totalTicks);
try {
int strategyTicks = totalTicks / getDiscoveryStrategies().size();
for (AbstractDiscoveryStrategy discoveryStrategy : getDiscoveryStrategies()) {
if (monitor.isCanceled()) {
status.add(Status.CANCEL_STATUS);
break;
}
if (discoveryStrategy instanceof MarketplaceDiscoveryStrategy) {
try {
MarketplaceDiscoveryStrategy marketplaceStrategy = (MarketplaceDiscoveryStrategy) discoveryStrategy;
news = marketplaceStrategy.performNewsDiscovery(progress.newChild(strategyTicks));
if (news != null) {
break;
}
} catch (CoreException e) {
status.add(new Status(e.getStatus().getSeverity(), DiscoveryCore.ID_PLUGIN, NLS.bind(Messages.MarketplaceCatalog_failedWithError, discoveryStrategy.getClass().getSimpleName()), e));
}
}
}
} finally {
monitor.done();
}
if (status.isOK()) {
setNews(news);
}
return status;
}
use of org.eclipse.equinox.internal.p2.discovery.AbstractDiscoveryStrategy in project epp.mpc by eclipse.
the class MarketplaceWizard method initializeCatalog.
void initializeCatalog() {
final MarketplaceCatalog catalog = getCatalog();
synchronized (catalog) {
List<AbstractDiscoveryStrategy> discoveryStrategies = catalog.getDiscoveryStrategies();
for (AbstractDiscoveryStrategy strategy : discoveryStrategies) {
strategy.dispose();
}
discoveryStrategies.clear();
if (getConfiguration().getCatalogDescriptor() != null) {
MarketplaceDiscoveryStrategy discoveryStrategy = new MarketplaceDiscoveryStrategy(getConfiguration().getCatalogDescriptor());
discoveryStrategy.setShellProvider(this);
discoveryStrategies.add(discoveryStrategy);
}
}
}
use of org.eclipse.equinox.internal.p2.discovery.AbstractDiscoveryStrategy in project epp.mpc by eclipse.
the class MarketplaceWizard method findMarketplaceDiscoveryStrategy.
protected MarketplaceDiscoveryStrategy findMarketplaceDiscoveryStrategy() {
MarketplaceDiscoveryStrategy marketplaceStrategy = null;
List<AbstractDiscoveryStrategy> discoveryStrategies = getCatalog().getDiscoveryStrategies();
for (AbstractDiscoveryStrategy strategy : discoveryStrategies) {
if (strategy instanceof MarketplaceDiscoveryStrategy) {
marketplaceStrategy = (MarketplaceDiscoveryStrategy) strategy;
break;
}
}
return marketplaceStrategy;
}
Aggregations