use of org.eclipse.epp.internal.mpc.ui.catalog.MarketplaceNodeCatalogItem in project epp.mpc by eclipse.
the class MarketplaceInfoSerializationTest method load.
@Test
public void load() throws Exception {
File registryFile = getUserHomeRegistryFile();
copyRegistryFile(registryFile, 100);
MarketplaceInfo loaded = loadMarketplaceInfo();
assertFalse(loaded.getIuToNodeKey().isEmpty());
assertFalse(loaded.getNodeKeyToIU().isEmpty());
MarketplaceNodeCatalogItem item = MarketplaceInfoTest.createTestItem();
catalogRegistry.map(item.getMarketplaceUrl(), item.getData());
assertEquals(catalogRegistry.getIuToNodeKey(), loaded.getIuToNodeKey());
assertEquals(catalogRegistry.getNodeKeyToIU(), loaded.getNodeKeyToIU());
}
use of org.eclipse.epp.internal.mpc.ui.catalog.MarketplaceNodeCatalogItem in project epp.mpc by eclipse.
the class ProvisioningJobListener method done.
@Override
public void done(IJobChangeEvent event) {
if (event.getResult().isOK()) {
Job job = new Job(Messages.ProvisioningJobListener_notificationTaskName) {
{
setPriority(Job.LONG);
setSystem(true);
setUser(true);
}
@Override
protected IStatus run(final IProgressMonitor monitor) {
ConcurrentTaskManager taskManager = new ConcurrentTaskManager(installItems.size(), Messages.ProvisioningJobListener_notificationTaskName);
for (CatalogItem item : installItems) {
if (item instanceof MarketplaceNodeCatalogItem) {
final MarketplaceNodeCatalogItem nodeItem = (MarketplaceNodeCatalogItem) item;
taskManager.submit(new Runnable() {
public void run() {
INode node = nodeItem.getData();
URL marketplaceUrl = nodeItem.getMarketplaceUrl();
IMarketplaceService marketplaceService = ServiceHelper.getMarketplaceServiceLocator().getMarketplaceService(marketplaceUrl.toString());
marketplaceService.reportInstallSuccess(node, new NullProgressMonitor() {
@Override
public boolean isCanceled() {
return monitor.isCanceled();
}
});
}
});
}
}
try {
taskManager.waitUntilFinished(monitor);
} catch (CoreException e) {
return e.getStatus();
}
return monitor.isCanceled() ? Status.CANCEL_STATUS : Status.OK_STATUS;
}
};
job.schedule();
}
}
use of org.eclipse.epp.internal.mpc.ui.catalog.MarketplaceNodeCatalogItem in project epp.mpc by eclipse.
the class SelectionModel method computeChildren.
private void computeChildren(CatalogItemEntry itemEntry) {
List<FeatureEntry> children = new ArrayList<FeatureEntry>();
List<MarketplaceNodeInstallableUnitItem> iuItems = ((MarketplaceNodeCatalogItem) itemEntry.getItem()).getInstallableUnitItems();
if (iuItems != null) {
for (MarketplaceNodeInstallableUnitItem iuItem : iuItems) {
FeatureEntry featureEntry = new FeatureEntry(itemEntry, iuItem);
featureEntry.setInstalled(computeInstalled(featureEntry));
featureEntry.setChecked(computeInitiallyChecked(featureEntry));
children.add(featureEntry);
}
}
itemEntry.children = children;
}
use of org.eclipse.epp.internal.mpc.ui.catalog.MarketplaceNodeCatalogItem in project epp.mpc by eclipse.
the class SelectionModelStateSerializer method deserialize.
/**
* @param state
* the state to restore
* @param operationByNodeExtras
* additional operations to include
* @param monitor
*/
public void deserialize(String state, Map<String, Operation> operationByNodeExtras, IProgressMonitor monitor) {
Map<String, Operation> operationByNodeId = new HashMap<String, Operation>();
if (state != null && state.length() > 0) {
// $NON-NLS-1$
Pattern pattern = Pattern.compile("([^\\s=]+)=(\\S+)");
Matcher matcher = pattern.matcher(state);
while (matcher.find()) {
String nodeId = matcher.group(1);
String operationName = matcher.group(2);
Operation operation = Operation.valueOf(operationName);
operationByNodeId.put(nodeId, operation);
}
}
if (operationByNodeExtras != null) {
operationByNodeId.putAll(operationByNodeExtras);
}
if (!operationByNodeId.isEmpty()) {
catalog.performQuery(monitor, operationByNodeId.keySet());
for (CatalogItem item : catalog.getItems()) {
if (item instanceof MarketplaceNodeCatalogItem) {
MarketplaceNodeCatalogItem nodeItem = (MarketplaceNodeCatalogItem) item;
Operation operation = operationByNodeId.get(nodeItem.getData().getId());
if (operation != null && operation != Operation.NONE) {
if (nodeItem.isInstalled() && operation == Operation.INSTALL) {
operation = Operation.UPDATE;
}
selectionModel.select(nodeItem, operation);
}
}
}
}
}
use of org.eclipse.epp.internal.mpc.ui.catalog.MarketplaceNodeCatalogItem in project epp.mpc by eclipse.
the class DiscoveryItem method setFavorited.
private void setFavorited(boolean newFavorited) {
boolean oldFavorited = isFavorited();
if (oldFavorited != newFavorited) {
// FIXME we should type the connector to MarketplaceNodeCatalogItem
MarketplaceNodeCatalogItem nodeConnector = (MarketplaceNodeCatalogItem) connector;
nodeConnector.setUserFavorite(newFavorited);
if (!newFavorited && getViewer().getContentType() == ContentType.FAVORITES) {
getViewer().getCatalog().removeItem(connector);
getViewer().refresh();
} else {
refreshFavoriteButton();
}
}
}
Aggregations