use of org.eclipse.equinox.p2.publisher.eclipse.FeatureEntry in project epp.mpc by eclipse.
the class ProfileChangeOperationComputer method pruneNonInstall.
private void pruneNonInstall(List<IInstallableUnit> installableUnits) {
Set<String> installableFeatureIds = new HashSet<String>();
for (FeatureEntry featureEntry : featureEntries) {
Operation operation = featureEntry.computeChangeOperation();
if (operation == Operation.INSTALL || operation == Operation.UPDATE) {
installableFeatureIds.add(featureEntry.getFeatureDescriptor().getId());
}
}
Iterator<IInstallableUnit> it = installableUnits.iterator();
while (it.hasNext()) {
IInstallableUnit iu = it.next();
if (!installableFeatureIds.contains(iu.getId())) {
it.remove();
}
}
}
use of org.eclipse.equinox.p2.publisher.eclipse.FeatureEntry in project epp.mpc by eclipse.
the class ProfileChangeOperationComputer method pruneNonUninstall.
private void pruneNonUninstall(List<IInstallableUnit> installableUnits) {
Set<String> installableFeatureIds = new HashSet<String>();
for (FeatureEntry featureEntry : featureEntries) {
if (featureEntry.computeChangeOperation() == Operation.UNINSTALL) {
installableFeatureIds.add(featureEntry.getFeatureDescriptor().getId());
}
}
Iterator<IInstallableUnit> it = installableUnits.iterator();
while (it.hasNext()) {
IInstallableUnit iu = it.next();
if (!installableFeatureIds.contains(iu.getId())) {
it.remove();
}
}
}
use of org.eclipse.equinox.p2.publisher.eclipse.FeatureEntry in project epp.mpc by eclipse.
the class ProfileChangeOperationComputer method checkForUnavailable.
/**
* Verifies that we found what we were looking for: it's possible that we have connector descriptors that are no
* longer available on their respective sites. In that case we must inform the user. Unfortunately this is the
* earliest point at which we can know.
*/
private void checkForUnavailable(final List<IInstallableUnit> installableUnits) throws CoreException {
// at least one selected connector could not be found in a repository
Set<String> foundIds = new HashSet<String>();
for (IInstallableUnit unit : installableUnits) {
foundIds.add(unit.getId());
}
Set<String> installFeatureIds = new HashSet<String>();
for (FeatureEntry entry : featureEntries) {
Operation operation = entry.computeChangeOperation();
if (operation == Operation.INSTALL || operation == Operation.UPDATE) {
installFeatureIds.add(entry.getFeatureDescriptor().getId());
}
}
// $NON-NLS-1$
String message = "";
// $NON-NLS-1$
String detailedMessage = "";
for (CatalogItem descriptor : items) {
StringBuilder unavailableIds = null;
for (String id : getFeatureIds(descriptor)) {
if (!foundIds.contains(id) && installFeatureIds.contains(id)) {
if (unavailableIds == null) {
unavailableIds = new StringBuilder();
} else {
unavailableIds.append(Messages.ProvisioningOperation_commaSeparator);
}
unavailableIds.append(id);
}
}
if (unavailableIds != null) {
if (message.length() > 0) {
message += Messages.ProvisioningOperation_commaSeparator;
}
message += descriptor.getName();
if (detailedMessage.length() > 0) {
detailedMessage += Messages.ProvisioningOperation_commaSeparator;
}
detailedMessage += NLS.bind(Messages.ProvisioningOperation_unavailableFeatures, new Object[] { descriptor.getName(), unavailableIds.toString(), descriptor.getSiteUrl() });
}
}
if (message.length() > 0) {
// instead of aborting here we ask the user if they wish to proceed anyways
final boolean[] okayToProceed = new boolean[1];
final String finalMessage = message;
Display.getDefault().syncExec(new Runnable() {
public void run() {
okayToProceed[0] = MessageDialog.openQuestion(WorkbenchUtil.getShell(), Messages.ProvisioningOperation_proceedQuestion, NLS.bind(Messages.ProvisioningOperation_unavailableSolutions_proceedQuestion, new Object[] { finalMessage }));
}
});
if (!okayToProceed[0]) {
throw new CoreException(new Status(IStatus.ERROR, MarketplaceClientUi.BUNDLE_ID, NLS.bind(Messages.ProvisioningOperation_unavailableSolutions, detailedMessage), null));
}
}
}
use of org.eclipse.equinox.p2.publisher.eclipse.FeatureEntry in project tycho by eclipse.
the class FeatureDependenciesAction method getRequiredCapabilities.
@Override
protected Set<IRequirement> getRequiredCapabilities() {
Set<IRequirement> required = new LinkedHashSet<>();
if (feature.getLicenseFeature() != null) {
String id = feature.getLicenseFeature() + FEATURE_GROUP_IU_SUFFIX;
VersionRange range = getVersionRange(createVersion(feature.getLicenseFeatureVersion()));
required.add(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, id, range, null, false, /* optional */
false));
}
for (FeatureEntry entry : feature.getEntries()) {
if (entry.isPatch()) {
// target platform
continue;
}
VersionRange range;
if (entry.isRequires()) {
range = getVersionRange(entry);
} else {
range = getVersionRange(createVersion(entry.getVersion()));
}
String id = getInstallableUnitId(entry);
// TODO 391283 without enhancement 391283, additional filters will always evaluate to false -> ignore for now
boolean optional = entry.isOptional();
required.add(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, id, range, createFilter(entry), optional, false));
}
return required;
}
use of org.eclipse.equinox.p2.publisher.eclipse.FeatureEntry in project tycho by eclipse.
the class FeatureDependenciesAction method addProperties.
@Override
protected void addProperties(InstallableUnitDescription iud) {
iud.setProperty(QueryUtil.PROP_TYPE_GROUP, "true");
StringBuilder includedIUs = new StringBuilder();
for (FeatureEntry entry : feature.getEntries()) {
String id = getInstallableUnitId(entry);
if (includedIUs.length() > 0) {
includedIUs.append(',');
}
includedIUs.append(id);
}
iud.setProperty(INCLUDED_IUS, includedIUs.toString());
}
Aggregations