use of org.eclipse.equinox.internal.p2.discovery.model.CatalogItem in project epp.mpc by eclipse.
the class FavoritesDiscoveryStrategy method addInfoItem.
private void addInfoItem(CatalogCategory catalogCategory, String title, String description) {
MarketplaceCatalogSource source = getCatalogSource();
// $NON-NLS-1$
String id = catalogDescriptor.getUrl().toString() + "#info:" + title;
for (ListIterator<CatalogItem> i = items.listIterator(items.size()); i.hasPrevious(); ) {
CatalogItem item = i.previous();
if (item.getSource() == source && (item.getCategory() == catalogCategory || catalogCategory.getId().equals(item.getCategoryId())) && item instanceof UserActionCatalogItem) {
UserActionCatalogItem actionItem = (UserActionCatalogItem) item;
if (actionItem.getUserAction() == UserAction.INFO && id.equals(actionItem.getId())) {
return;
}
}
}
UserActionCatalogItem infoItem = new UserActionCatalogItem();
infoItem.setUserAction(UserAction.INFO);
infoItem.setDescription(description);
infoItem.setName(title);
infoItem.setId(id);
addItem(catalogCategory, infoItem);
}
use of org.eclipse.equinox.internal.p2.discovery.model.CatalogItem in project epp.mpc by eclipse.
the class FavoritesDiscoveryStrategy method createIcon.
private static void createIcon(CatalogItem catalogItem, final IFavoriteList list) {
Icon icon = new Icon();
// don't know the size
icon.setImage32(list.getIcon());
icon.setImage48(list.getIcon());
icon.setImage64(list.getIcon());
icon.setImage128(list.getIcon());
catalogItem.setIcon(icon);
}
use of org.eclipse.equinox.internal.p2.discovery.model.CatalogItem in project epp.mpc by eclipse.
the class MarketplaceCatalog method checkForUpdates.
public IStatus checkForUpdates(final IProgressMonitor monitor) {
SubMonitor progress = SubMonitor.convert(monitor, Messages.MarketplaceCatalog_checkingForUpdates, 10000000);
try {
Map<String, IInstallableUnit> installedIUs = calculateInstalledIUs(progress.newChild(100000));
List<MarketplaceNodeCatalogItem> updateCheckNeeded = new ArrayList<MarketplaceNodeCatalogItem>();
for (CatalogItem item : getItems()) {
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
if (!(item instanceof MarketplaceNodeCatalogItem)) {
continue;
}
MarketplaceNodeCatalogItem catalogItem = (MarketplaceNodeCatalogItem) item;
if (catalogItem.isInstalled()) {
if (setUpdatesAvailable(installedIUs, catalogItem)) {
updateCheckNeeded.add(catalogItem);
}
}
}
if (!updateCheckNeeded.isEmpty()) {
checkForUpdates(updateCheckNeeded, installedIUs, progress.newChild(10000000 - 100000));
}
return monitor.isCanceled() ? Status.CANCEL_STATUS : Status.OK_STATUS;
} finally {
monitor.done();
}
}
use of org.eclipse.equinox.internal.p2.discovery.model.CatalogItem in project epp.mpc by eclipse.
the class MarketplaceCatalog method removeItem.
public void removeItem(CatalogItem item) {
getItems().remove(item);
getFilteredItems().remove(item);
for (CatalogCategory category : getCategories()) {
category.getItems().remove(item);
}
}
use of org.eclipse.equinox.internal.p2.discovery.model.CatalogItem in project epp.mpc by eclipse.
the class SelectionModel method computeProvisioningOperationViability.
/**
* Determine what message related to finishing the wizard should correspond to the current selection.
*
* @return the message, or null if there should be no message.
*/
public IStatus computeProvisioningOperationViability() {
IStatus featureStatus = computeFeatureOperationViability();
if (featureStatus == null || !featureStatus.isOK()) {
return featureStatus;
}
Map<Operation, List<CatalogItem>> operationToItem = computeOperationToItem();
if (operationToItem.size() == 0) {
return new Status(IStatus.ERROR, MarketplaceClientUi.BUNDLE_ID, Messages.SelectionModel_Nothing_Selected);
} else if (operationToItem.size() == 1) {
Entry<Operation, List<CatalogItem>> entry = operationToItem.entrySet().iterator().next();
return new Status(IStatus.INFO, MarketplaceClientUi.BUNDLE_ID, NLS.bind(Messages.SelectionModel_count_selectedFor_operation, entry.getValue().size() == 1 ? Messages.SelectionModel_oneSolution : NLS.bind(Messages.SelectionModel_countSolutions, entry.getValue().size()), entry.getKey().getLabel()));
} else if (operationToItem.size() == 2 && operationToItem.containsKey(Operation.INSTALL) && operationToItem.containsKey(Operation.UPDATE)) {
int count = 0;
for (List<CatalogItem> items : operationToItem.values()) {
count += items.size();
}
return new Status(IStatus.INFO, MarketplaceClientUi.BUNDLE_ID, NLS.bind(Messages.SelectionModel_countSolutionsSelectedForInstallUpdate, count));
} else {
return new Status(IStatus.ERROR, MarketplaceClientUi.BUNDLE_ID, Messages.SelectionModel_cannotInstallRemoveConcurrently);
}
}
Aggregations