Search in sources :

Example 26 with VersionedClause

use of aQute.bnd.build.model.clauses.VersionedClause in project bndtools by bndtools.

the class MapValuesContentProvider method doAdd.

void doAdd() {
    IStructuredSelection selection = (IStructuredSelection) availableViewer.getSelection();
    List<VersionedClause> adding = new ArrayList<VersionedClause>(selection.size());
    for (Iterator<?> iter = selection.iterator(); iter.hasNext(); ) {
        Object item = iter.next();
        if (item instanceof RepositoryBundle) {
            adding.add(RepositoryBundleUtils.convertRepoBundle((RepositoryBundle) item));
        } else if (item instanceof RepositoryBundleVersion) {
            adding.add(RepositoryBundleUtils.convertRepoBundleVersion((RepositoryBundleVersion) item, phase));
        } else if (item instanceof ProjectBundle) {
            String bsn = ((ProjectBundle) item).getBsn();
            Attrs attribs = new Attrs();
            attribs.put(Constants.VERSION_ATTRIBUTE, "latest");
            adding.add(new VersionedClause(bsn, attribs));
        }
    }
    if (!adding.isEmpty()) {
        for (VersionedClause clause : adding) {
            selectedBundles.put(clause.getName(), clause);
        }
        selectedViewer.add(adding.toArray());
        availableViewer.refresh();
        propSupport.firePropertyChange(PROP_SELECTION, null, selectedBundles);
    }
}
Also used : RepositoryBundle(bndtools.model.repo.RepositoryBundle) ProjectBundle(bndtools.model.repo.ProjectBundle) RepositoryBundleVersion(bndtools.model.repo.RepositoryBundleVersion) VersionedClause(aQute.bnd.build.model.clauses.VersionedClause) ArrayList(java.util.ArrayList) Attrs(aQute.bnd.header.Attrs) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Aggregations

VersionedClause (aQute.bnd.build.model.clauses.VersionedClause)26 Attrs (aQute.bnd.header.Attrs)16 Resource (org.osgi.resource.Resource)7 File (java.io.File)6 BndEditModel (aQute.bnd.build.model.BndEditModel)5 ArrayList (java.util.ArrayList)5 CapReqBuilder (aQute.bnd.osgi.resource.CapReqBuilder)4 WizardDialog (org.eclipse.jface.wizard.WizardDialog)4 Test (org.junit.Test)4 Workspace (aQute.bnd.build.Workspace)3 ResourceBuilder (aQute.bnd.osgi.resource.ResourceBuilder)3 Document (aQute.bnd.properties.Document)3 AndFilter (aQute.libg.filters.AndFilter)3 Filter (aQute.libg.filters.Filter)3 SimpleFilter (aQute.libg.filters.SimpleFilter)3 ProjectBundle (bndtools.model.repo.ProjectBundle)3 RepositoryBundle (bndtools.model.repo.RepositoryBundle)3 RepositoryBundleVersion (bndtools.model.repo.RepositoryBundleVersion)3 RepoBundleSelectionWizard (bndtools.wizards.repo.RepoBundleSelectionWizard)3 LinkedHashSet (java.util.LinkedHashSet)3