Search in sources :

Example 6 with ProjectBundle

use of bndtools.model.repo.ProjectBundle 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

ProjectBundle (bndtools.model.repo.ProjectBundle)6 RepositoryBundle (bndtools.model.repo.RepositoryBundle)6 RepositoryBundleVersion (bndtools.model.repo.RepositoryBundleVersion)6 VersionedClause (aQute.bnd.build.model.clauses.VersionedClause)3 CapReqBuilder (aQute.bnd.osgi.resource.CapReqBuilder)3 AndFilter (aQute.libg.filters.AndFilter)3 Filter (aQute.libg.filters.Filter)3 SimpleFilter (aQute.libg.filters.SimpleFilter)3 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3 Attrs (aQute.bnd.header.Attrs)2 Version (aQute.bnd.version.Version)2 LiteralFilter (aQute.libg.filters.LiteralFilter)2 ArrayList (java.util.ArrayList)2 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)2 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)2 KeyAdapter (org.eclipse.swt.events.KeyAdapter)2 KeyEvent (org.eclipse.swt.events.KeyEvent)2 GridData (org.eclipse.swt.layout.GridData)2 GridLayout (org.eclipse.swt.layout.GridLayout)2 Composite (org.eclipse.swt.widgets.Composite)2