Search in sources :

Example 1 with ResourceCapReqLoader

use of bndtools.tasks.ResourceCapReqLoader in project bndtools by bndtools.

the class ResolutionView method getLoadersFromSelection.

private Set<CapReqLoader> getLoadersFromSelection(IStructuredSelection structSel) {
    Set<CapReqLoader> result = new LinkedHashSet<CapReqLoader>();
    Iterator<?> iter = structSel.iterator();
    while (iter.hasNext()) {
        Object element = iter.next();
        CapReqLoader loader = null;
        File file = SelectionUtils.adaptObject(element, File.class);
        if (file != null) {
            loader = getLoaderForFile(file);
        } else {
            IResource eresource = SelectionUtils.adaptObject(element, IResource.class);
            if (eresource != null) {
                IPath location = eresource.getLocation();
                if (location != null) {
                    loader = getLoaderForFile(location.toFile());
                }
            } else if (element instanceof RepositoryResourceElement) {
                Resource resource = ((RepositoryResourceElement) element).getResource();
                loader = new ResourceCapReqLoader(resource);
            }
        }
        if (loader != null)
            result.add(loader);
    }
    return result;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) RepositoryResourceElement(bndtools.model.repo.RepositoryResourceElement) IPath(org.eclipse.core.runtime.IPath) ResourceCapReqLoader(bndtools.tasks.ResourceCapReqLoader) Resource(org.osgi.resource.Resource) IResource(org.eclipse.core.resources.IResource) BndFileCapReqLoader(bndtools.tasks.BndFileCapReqLoader) BndBuilderCapReqLoader(bndtools.tasks.BndBuilderCapReqLoader) JarFileCapReqLoader(bndtools.tasks.JarFileCapReqLoader) ResourceCapReqLoader(bndtools.tasks.ResourceCapReqLoader) CapReqLoader(bndtools.tasks.CapReqLoader) IFile(org.eclipse.core.resources.IFile) File(java.io.File) IResource(org.eclipse.core.resources.IResource)

Aggregations

RepositoryResourceElement (bndtools.model.repo.RepositoryResourceElement)1 BndBuilderCapReqLoader (bndtools.tasks.BndBuilderCapReqLoader)1 BndFileCapReqLoader (bndtools.tasks.BndFileCapReqLoader)1 CapReqLoader (bndtools.tasks.CapReqLoader)1 JarFileCapReqLoader (bndtools.tasks.JarFileCapReqLoader)1 ResourceCapReqLoader (bndtools.tasks.ResourceCapReqLoader)1 File (java.io.File)1 LinkedHashSet (java.util.LinkedHashSet)1 IFile (org.eclipse.core.resources.IFile)1 IResource (org.eclipse.core.resources.IResource)1 IPath (org.eclipse.core.runtime.IPath)1 Resource (org.osgi.resource.Resource)1