use of org.eclipse.epp.mpc.core.model.INews in project epp.mpc by eclipse.
the class MarketplacePage method getNews.
private INews getNews() {
CatalogDescriptor descriptor = configuration.getCatalogDescriptor();
INews news = CatalogRegistry.getInstance().getCatalogNews(descriptor);
return news;
}
use of org.eclipse.epp.mpc.core.model.INews in project epp.mpc by eclipse.
the class MarketplacePage method updateNewsStatus.
private void updateNewsStatus() {
INews news = getNews();
Image tabImage = null;
if (news != null && newsViewer.isUpdated(news)) {
tabImage = MarketplaceClientUiPlugin.getInstance().getImageRegistry().get(MarketplaceClientUiPlugin.NEWS_ICON_UPDATE);
}
newsTabItem.setImage(tabImage);
newsTabItem.getParent().layout();
}
use of org.eclipse.epp.mpc.core.model.INews in project epp.mpc by eclipse.
the class MarketplaceWizard method updateNews.
protected void updateNews() {
CatalogDescriptor catalogDescriptor = getConfiguration().getCatalogDescriptor();
INews news = null;
if (Boolean.parseBoolean(Platform.getDebugOption(DEBUG_NEWS_FLAG))) {
// use debug override values
String debugNewsUrl = Platform.getDebugOption(DEBUG_NEWS_URL);
if (debugNewsUrl != null && debugNewsUrl.length() > 0) {
News debugNews = new News();
news = debugNews;
debugNews.setUrl(debugNewsUrl);
String debugNewsTitle = Platform.getDebugOption(DEBUG_NEWS_TITLE);
if (debugNewsTitle == null || debugNewsTitle.length() == 0) {
// $NON-NLS-1$
debugNews.setShortTitle("Debug News");
} else {
debugNews.setShortTitle(debugNewsTitle);
}
debugNews.setTimestamp(System.currentTimeMillis());
}
}
if (news == null) {
// try requesting news from marketplace
try {
final INews[] result = new INews[1];
getContainer().run(true, true, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
IStatus status = getCatalog().performNewsDiscovery(monitor);
if (!status.isOK() && status.getSeverity() != IStatus.CANCEL) {
// don't bother user with missing news
MarketplaceClientUi.handle(status, StatusManager.LOG);
}
result[0] = getCatalog().getNews();
}
});
if (result[0] != null) {
news = result[0];
}
} catch (InvocationTargetException e) {
final IStatus status = MarketplaceClientCore.computeStatus(e, Messages.MarketplaceViewer_unexpectedException);
MarketplaceClientUi.handle(status, StatusManager.LOG);
} catch (InterruptedException e) {
// cancelled by user
}
}
if (news == null) {
// use news from catalog
news = CatalogRegistry.getInstance().getCatalogNews(catalogDescriptor);
}
CatalogRegistry.getInstance().addCatalogNews(catalogDescriptor, news);
}
Aggregations