use of org.eclipse.epp.internal.mpc.ui.operations.ResolveFeatureNamesOperation in project epp.mpc by eclipse.
the class FeatureSelectionWizardPage method updateFeatures.
private void updateFeatures() {
SelectionModel selectionModel = getWizard().getSelectionModel();
Set<CatalogItem> allSelectionCatalogItems = selectionModel.getItemToSelectedOperation().keySet();
Set<CatalogItem> selectedCatalogItems = selectionModel.getSelectedCatalogItems();
if (allSelectionCatalogItems.isEmpty() || selectedCatalogItems.isEmpty()) {
showPreviousPage();
return;
}
viewer.setInput(selectionModel);
ResolveFeatureNamesOperation operation = new ResolveFeatureNamesOperation(new ArrayList<CatalogItem>(allSelectionCatalogItems)) {
Display display = getControl().getDisplay();
@Override
public void run(IProgressMonitor progressMonitor) throws InvocationTargetException, InterruptedException {
super.run(progressMonitor);
if (!display.isDisposed() && isActivePage()) {
display.asyncExec(new Runnable() {
public void run() {
if (isActivePage()) {
updateFeatureDescriptors(getFeatureDescriptors(), getUnresolvedFeatureDescriptors());
}
}
});
}
}
};
try {
getContainer().run(true, true, operation);
} catch (InvocationTargetException e) {
// we only log here since any error will also be displayed when resolving the provisioning operation.
int statusFlags = StatusManager.LOG;
IStatus status;
if (e.getCause() instanceof ProvisionException) {
status = ((ProvisionException) e.getCause()).getStatus();
} else {
status = MarketplaceClientCore.computeStatus(e, Messages.FeatureSelectionWizardPage_unexpectedException_verifyingFeatures);
statusFlags |= StatusManager.BLOCK | StatusManager.SHOW;
}
MarketplaceClientUi.handle(status, statusFlags);
} catch (InterruptedException e) {
// canceled
} finally {
if (!isActivePage()) {
return;
}
refresh();
// bug 470485: need to recompute button state, because run() resets that to previous state
refreshState();
}
// maybeUpdateProfileChangeOperation();
}
Aggregations