Package org.apache.felix.sigil.common.model.eclipse

Examples of org.apache.felix.sigil.common.model.eclipse.ISigilBundle


        try
        {
            for (ICompilationUnit unit : JavaHelper.findCompilationUnits(sigil))
            {
                IPackageFragment p = (IPackageFragment) unit.getParent();
                ISigilBundle b = sigil.getBundle();
                IPackageExport export = b.findExport(p.getElementName());
                index.addEntry(unit, rep, b, export != null);
            }
        }
        catch (JavaModelException e)
        {
View Full Code Here


     * @return
     */
    public ISigilBundle getBundle(String id, IBldBundle bundle)
    {

        ISigilBundle sigilBundle = new SigilBundle();
        IBundleModelElement info = new BundleModelElement();
        sigilBundle.setBundleInfo(info);

        // exports
        // FIXME: UI doesn't understand export wildcard packages
        for (IPackageExport export : bundle.getExports())
        {
            IPackageExport clone = (IPackageExport) export.clone();
            clone.setParent(null);
            info.addExport(clone);
        }

        // imports
        for (IPackageImport import1 : bundle.getImports())
        {
            IPackageImport clone = (IPackageImport) import1.clone();
            clone.setParent(null);
            info.addImport(clone);
        }

        // requires
        for (IRequiredBundle require : bundle.getRequires())
        {
            IRequiredBundle clone = (IRequiredBundle) require.clone();
            clone.setParent(null);
            info.addRequiredBundle(clone);
        }

        // fragment
        IRequiredBundle fragment = bundle.getFragmentHost();
        if (fragment != null)
        {
            info.setFragmentHost(fragment);
        }

        // contents
        for (String pkg : bundle.getContents())
        {
            sigilBundle.addPackage(pkg);
        }

        // sources
        for (String source : config.getList(null, BldConfig.L_SRC_CONTENTS))
        {
            sigilBundle.addClasspathEntry(String.format(classpathFormat, "src", source));
        }

        // libs
        Map<String, Map<String, String>> libs = bundle.getLibs();

        for (String path : libs.keySet())
        {
            Map<String, String> attr = libs.get(path);
            String kind = attr.get(BldAttr.KIND_ATTRIBUTE);

            if ("classpath".equals(kind))
            {
                sigilBundle.addClasspathEntry(String.format(classpathFormat, "lib", path));
            }
            else
            {
                BldCore.error("Can't convert -libs kind=" + kind);
            }
        }

        // resources
        // FIXME: UI doesn't support -resources: path1=path2
        List<Resource> resources = bundle.getResources();
        for (Resource resource : resources)
        {
            sigilBundle.addSourcePath(resource);
        }

        ////////////////////
        // simple headers

View Full Code Here

    public String getText(Object element)
    {
        if (element instanceof ISigilBundle)
        {
            ISigilBundle bundle = (ISigilBundle) element;
            return bundle.getBundleInfo().getSymbolicName();
        }

        if (element instanceof IRequiredBundle)
        {
            IRequiredBundle req = (IRequiredBundle) element;
View Full Code Here

    }

    @Override
    public void commit(boolean onSave)
    {
        ISigilBundle bundle = getProjectModel().getBundle();

        bundle.clearSourcePaths();

        try
        {
            SigilUI.runInUISync(new Callable<Void>()
            {
View Full Code Here

        if (!id.getOrganisation().equals(ORG_SIGIL))
        {
            return null;
        }

        ISigilBundle bundle = resolve(id);
        if (bundle == null)
        {
            Log.error("Failed to find bundle for module " + id);
            return null;
        }

        String symbolicName = id.getName();
        String version = bundle.getVersion().toString();

        Resource res = new SigilIvy(extractBCP ? bundle : null, symbolicName, version);
        ref = new ResolvedResource(res, version);

        Log.debug(format("findIvyFileRef: dd=%s => ref=%s", dd, ref));
View Full Code Here

        if (!id.getOrganisation().equals(ORG_SIGIL))
        {
            return null;
        }

        ISigilBundle bundle = resolve(id);
        if (bundle == null)
        {
            return null;
        }

        IBundleModelElement info = bundle.getBundleInfo();
        URI uri = info.getUpdateLocation();
        Resource res = null;

        try
        {
            URL url = (uri != null) ? uri.toURL() : bundle.getLocation().toURI().toURL();
            if (name.contains("!"))
            {
                String[] split = name.split("!");
                url = new URL("jar:" + url + "!/" + split[1] + "." + artifact.getExt());
            }
            res = new URLResource(url);
        }
        catch (MalformedURLException e)
        {
            System.out.println("Oops! " + e);
        }

        String version = bundle.getVersion().toString();
        ResolvedResource ref = new ResolvedResource(res, version);

        Log.debug(format("findArtifactRef: artifact=%s, date=%s => ref=%s", artifact,
            date, ref));
        return ref;
View Full Code Here

                else
                {
                    StringBuilder b = new StringBuilder();
                    for (IModelElement u : users)
                    {
                        ISigilBundle bndl = u.getAncestor(ISigilBundle.class);
                        b.append(bndl);
                        b.append("->");
                        b.append(u);
                        b.append("\n");
                    }
View Full Code Here

    public void accept(IRepositoryVisitor visitor, int options)
    {
        List<ISigilProjectModel> models = SigilCore.getRoot().getProjects();
        for (ISigilProjectModel project : models)
        {
            ISigilBundle b = project.getBundle();
            if (b == null)
            {
                SigilCore.error("No bundle found for project "
                    + project.getProject().getName());
            }
View Full Code Here

                                | ResolutionConfig.IGNORE_ERRORS);
                        try
                        {
                            IResolution r = manager.getBundleResolver().resolve(rb, config,
                                new ResolutionMonitorAdapter(monitor));
                            ISigilBundle bundle = r.getProvider(rb);
                            boolean found = false;
                            for (IPackageExport pe : bundle.getBundleInfo().getExports())
                            {
                                if (packages.contains(pe.getPackageName()))
                                {
                                    found = true;
                                    break;
View Full Code Here

        File f = p.toFile();
        JarFile jar = null;
        try
        {
            jar = new JarFile(f, false);
            ISigilBundle bundle = buildBundle(jar, f);
            if (bundle != null)
            {
                bundle.setLocation(f);
                bundle.setSourcePathLocation(source.toFile());
                // XXX hard coded src location
                bundle.setSourceRootPath("src");
                bundles.add(bundle);
            }
        }
        catch (IOException e)
        {
View Full Code Here

TOP

Related Classes of org.apache.felix.sigil.common.model.eclipse.ISigilBundle

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.