use of bndtools.wizards.repo.RepoBundleSelectionWizard in project bndtools by bndtools.
the class RepositoryBundleSelectionPart method doAdd.
private void doAdd() {
try {
RepoBundleSelectionWizard wizard = createBundleSelectionWizard(getBundles());
if (wizard != null) {
WizardDialog dialog = new WizardDialog(getSection().getShell(), wizard);
if (dialog.open() == Window.OK) {
setBundles(wizard.getSelectedBundles());
markDirty();
}
}
} catch (Exception e) {
ErrorDialog.openError(getSection().getShell(), "Error", null, new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Error opening bundle resolver wizard.", e));
}
}
use of bndtools.wizards.repo.RepoBundleSelectionWizard in project bndtools by bndtools.
the class RepositoryBundleSelectionPart method createBundleSelectionWizard.
protected final RepoBundleSelectionWizard createBundleSelectionWizard(List<VersionedClause> bundles) throws Exception {
RepoBundleSelectionWizard wizard = new RepoBundleSelectionWizard(bundles, phase);
setSelectionWizardTitleAndMessage(wizard);
return wizard;
}
use of bndtools.wizards.repo.RepoBundleSelectionWizard in project bndtools by bndtools.
the class RunRequirementsPart method doAddBundle.
private void doAddBundle() {
try {
RepoBundleSelectionWizard wizard = new RepoBundleSelectionWizard(new ArrayList<VersionedClause>(), DependencyPhase.Run);
wizard.setSelectionPageTitle("Add Bundle Requirement");
WizardDialog dialog = new WizardDialog(getSection().getShell(), wizard);
if (Window.OK == dialog.open()) {
List<VersionedClause> result = wizard.getSelectedBundles();
Set<Requirement> adding = new LinkedHashSet<Requirement>(result.size());
for (VersionedClause bundle : result) {
Filter filter = new SimpleFilter(IdentityNamespace.IDENTITY_NAMESPACE, bundle.getName());
String versionRange = bundle.getVersionRange();
if (versionRange != null && !"latest".equals(versionRange)) {
filter = new AndFilter().addChild(filter).addChild(new LiteralFilter(Filters.fromVersionRange(versionRange)));
}
Requirement req = new CapReqBuilder(IdentityNamespace.IDENTITY_NAMESPACE).addDirective(Namespace.REQUIREMENT_FILTER_DIRECTIVE, filter.toString()).buildSyntheticRequirement();
adding.add(req);
}
updateViewerWithNewRequirements(adding);
}
} catch (Exception e) {
ErrorDialog.openError(getSection().getShell(), "Error", null, new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Error selecting bundles.", e));
}
}
use of bndtools.wizards.repo.RepoBundleSelectionWizard in project bndtools by bndtools.
the class RunBlacklistPart method doAddBundle.
private void doAddBundle() {
try {
RepoBundleSelectionWizard wizard = new RepoBundleSelectionWizard(new ArrayList<VersionedClause>(), DependencyPhase.Run);
wizard.setSelectionPageTitle("Add Bundle Blacklist");
WizardDialog dialog = new WizardDialog(getSection().getShell(), wizard);
if (Window.OK == dialog.open()) {
List<VersionedClause> result = wizard.getSelectedBundles();
Set<Requirement> adding = new LinkedHashSet<Requirement>(result.size());
for (VersionedClause bundle : result) {
Filter filter = new SimpleFilter(IdentityNamespace.IDENTITY_NAMESPACE, bundle.getName());
String versionRange = bundle.getVersionRange();
if (versionRange != null && !"latest".equals(versionRange)) {
filter = new AndFilter().addChild(filter).addChild(new LiteralFilter(Filters.fromVersionRange(versionRange)));
}
Requirement req = new CapReqBuilder(IdentityNamespace.IDENTITY_NAMESPACE).addDirective(Namespace.REQUIREMENT_FILTER_DIRECTIVE, filter.toString()).buildSyntheticRequirement();
adding.add(req);
}
updateViewerWithNewBlacklist(adding);
}
} catch (Exception e) {
ErrorDialog.openError(getSection().getShell(), "Error", null, new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Error selecting bundles for blacklist.", e));
}
}
Aggregations