use of org.eclipse.equinox.internal.p2.discovery.model.CatalogItem in project epp.mpc by eclipse.
the class MarketplacePage method canSkipFeatureSelection.
protected boolean canSkipFeatureSelection() {
SelectionModel selectionModel = getWizard().getSelectionModel();
Map<CatalogItem, Operation> selectedOperations = selectionModel.getItemToSelectedOperation();
Set<Entry<CatalogItem, Operation>> entrySet = selectedOperations.entrySet();
Operation mode = null;
for (Entry<CatalogItem, Operation> entry : entrySet) {
if (!(entry.getKey() instanceof MarketplaceNodeCatalogItem)) {
return false;
}
MarketplaceNodeCatalogItem item = (MarketplaceNodeCatalogItem) entry.getKey();
Operation value = entry.getValue();
switch(value) {
case NONE:
continue;
case INSTALL:
case UPDATE:
if (mode == null) {
mode = Operation.INSTALL;
} else if (mode == Operation.UNINSTALL) {
return false;
}
if (hasOptionalFeatures(item)) {
return false;
}
break;
case UNINSTALL:
if (mode == null) {
mode = Operation.UNINSTALL;
} else if (mode == Operation.INSTALL) {
return false;
}
if (hasOptionalFeatures(item)) {
return false;
}
break;
case CHANGE:
return false;
}
}
if (mode == null) {
return false;
}
return true;
}
use of org.eclipse.equinox.internal.p2.discovery.model.CatalogItem in project epp.mpc by eclipse.
the class MarketplaceWizard method updateSelection.
protected void updateSelection() {
List<Entry<CatalogItem, Operation>> itemToSelectedOperation = new ArrayList<Entry<CatalogItem, Operation>>(getSelectionModel().getItemToSelectedOperation().entrySet());
final List<CatalogItem> noninstallableItems = new ArrayList<CatalogItem>();
for (Entry<CatalogItem, Operation> entry : itemToSelectedOperation) {
if (entry.getValue() != Operation.NONE) {
boolean unavailableInstall = (Boolean.FALSE.equals(entry.getKey().getAvailable()) || entry.getKey().getSiteUrl() == null) && (entry.getValue() == Operation.INSTALL || entry.getValue() == Operation.UPDATE);
if (unavailableInstall) {
getSelectionModel().select(entry.getKey(), Operation.NONE);
noninstallableItems.add(entry.getKey());
} else {
entry.getKey().setSelected(true);
}
}
}
MarketplacePage marketplacePage = getCatalogPage();
MarketplaceViewer viewer = marketplacePage == null ? null : marketplacePage.getViewer();
if (marketplacePage != null && viewer != null && !viewer.getControl().isDisposed()) {
viewer.setSelection(new StructuredSelection(viewer.getCheckedItems()));
marketplacePage.setPageComplete(viewer.isComplete());
}
if (!noninstallableItems.isEmpty()) {
notifyNonInstallableItems(noninstallableItems);
}
}
use of org.eclipse.equinox.internal.p2.discovery.model.CatalogItem in project epp.mpc by eclipse.
the class MarketplaceWizard method computeNewInstallCatalogItems.
private Set<CatalogItem> computeNewInstallCatalogItems() {
Set<CatalogItem> items = new HashSet<CatalogItem>();
Map<CatalogItem, Collection<String>> iusByCatalogItem = new HashMap<CatalogItem, Collection<String>>();
for (CatalogItemEntry entry : getSelectionModel().getCatalogItemEntries()) {
List<FeatureEntry> features = entry.getChildren();
Collection<String> featureIds = new ArrayList<String>(features.size());
for (FeatureEntry feature : features) {
if (feature.computeChangeOperation() == Operation.INSTALL) {
featureIds.add(feature.getFeatureDescriptor().getId());
}
}
if (!featureIds.isEmpty()) {
iusByCatalogItem.put(entry.getItem(), featureIds);
}
}
for (IInstallableUnit unit : operationIUs) {
for (Entry<CatalogItem, Collection<String>> entry : iusByCatalogItem.entrySet()) {
if (entry.getValue().contains(unit.getId())) {
items.add(entry.getKey());
}
}
}
return items;
}
use of org.eclipse.equinox.internal.p2.discovery.model.CatalogItem in project epp.mpc by eclipse.
the class MarketplaceDiscoveryStrategy method createIcon.
private static void createIcon(CatalogItem catalogItem, final INode node) {
Icon icon = new Icon();
// don't know the size
icon.setImage32(node.getImage());
icon.setImage48(node.getImage());
icon.setImage64(node.getImage());
icon.setImage128(node.getImage());
catalogItem.setIcon(icon);
}
use of org.eclipse.equinox.internal.p2.discovery.model.CatalogItem in project epp.mpc by eclipse.
the class MarketplaceDiscoveryStrategy method addCatalogItem.
public void addCatalogItem(MarketplaceCategory catalogCategory) {
CatalogItem catalogItem = createCategoryItem(catalogCategory);
items.add(catalogItem);
}
Aggregations