Package aQute.bnd.header

Examples of aQute.bnd.header.Attrs$DataType


            return Collections.emptyList();
        }
    }

    public static VersionedClause convertRepoBundle(RepositoryBundle bundle) {
        Attrs attribs = new Attrs();
        if (RepoUtils.isWorkspaceRepo(bundle.getRepo())) {
            attribs.put(Constants.VERSION_ATTRIBUTE, VERSION_LATEST);
        }
        return new VersionedClause(bundle.getBsn(), attribs);
    }
View Full Code Here


        }
        return new VersionedClause(bundle.getBsn(), attribs);
    }

    public static VersionedClause convertRepoBundleVersion(RepositoryBundleVersion bundleVersion, DependencyPhase phase) {
        Attrs attribs = new Attrs();
        if (RepoUtils.isWorkspaceRepo(bundleVersion.getBundle().getRepo()))
            attribs.put(Constants.VERSION_ATTRIBUTE, VERSION_LATEST);
        else {
            StringBuilder builder = new StringBuilder();

            builder.append(bundleVersion.getVersion().getMajor());
            builder.append('.').append(bundleVersion.getVersion().getMinor());
            if (phase != DependencyPhase.Build)
                builder.append('.').append(bundleVersion.getVersion().getMicro());

            attribs.put(Constants.VERSION_ATTRIBUTE, builder.toString());
        }
        return new VersionedClause(bundleVersion.getBundle().getBsn(), attribs);
    }
View Full Code Here

        boolean appendStar = getClauses().isEmpty();

        super.doAddClauses(clauses, index, select);

        if (appendStar) {
            ImportPattern starPattern = new ImportPattern("*", new Attrs()); //$NON-NLS-1$
            super.doAddClauses(Arrays.asList(starPattern), -1, false);
        }
    }
View Full Code Here

        }
    }

    @Override
    protected ImportPattern newHeaderClause(String text) {
        return new ImportPattern(text, new Attrs());
    }
View Full Code Here

            }

            // Add a "*" at the end, if not already present
            List<ImportPattern> patterns = getClauses();
            if (patterns.size() != 0 && !patterns.get(patterns.size() - 1).getName().equals("*")) {
                ImportPattern starPattern = new ImportPattern("*", new Attrs());
                ImportPatternsListPart.super.doAddClauses(Arrays.asList(starPattern), -1, false);
            }
        }
View Full Code Here

            added = new LinkedList<ExportedPackage>();

            // Select the results
            for (Object result : results) {
                String newPackageName = (String) result;
                ExportedPackage newPackage = new ExportedPackage(newPackageName, new Attrs());
                added.add(newPackage);
            }
        }
        return added;
    }
View Full Code Here

                    if (Window.OK == dialog.open()) {
                        List<Pair<String,String>> addingBundles = wizard.getSelectedBundles();
                        List<VersionedClause> addingClauses = new ArrayList<VersionedClause>(addingBundles.size());

                        for (Pair<String,String> addingBundle : addingBundles) {
                            Attrs attribs = new Attrs();
                            attribs.put(Constants.VERSION_ATTRIBUTE, addingBundle.getSecond());
                            addingClauses.add(new VersionedClause(addingBundle.getFirst(), attribs));
                        }

                        handleAdd(addingClauses);
                    }
                    return true;
                }
                return false;
            }

            private boolean handleSelectionDrop() {
                ISelection selection = LocalSelectionTransfer.getTransfer().getSelection();
                if (selection.isEmpty() || !(selection instanceof IStructuredSelection)) {
                    return false;
                }
                List<VersionedClause> adding = new LinkedList<VersionedClause>();
                Iterator< ? > iterator = ((IStructuredSelection) selection).iterator();
                while (iterator.hasNext()) {
                    Object item = iterator.next();
                    if (item instanceof RepositoryBundle) {
                        VersionedClause newClause = RepositoryUtils.convertRepoBundle((RepositoryBundle) item);
                        adding.add(newClause);
                    } else if (item instanceof RepositoryBundleVersion) {
                        RepositoryBundleVersion bundleVersion = (RepositoryBundleVersion) item;
                        VersionedClause newClause = RepositoryUtils.convertRepoBundleVersion(bundleVersion, phase);
                        adding.add(newClause);
                    }
                }

                handleAdd(adding);
                return true;
            }

            private boolean handleURLDrop(String urlStr) {
                try {
                    URI uri = new URI(urlStr);
                    AddJpmDependenciesWizard wizard = new AddJpmDependenciesWizard(uri);
                    WizardDialog dialog = new WizardDialog(getSection().getShell(), wizard);
                    if (dialog.open() == Window.OK) {
                        Set<ResourceDescriptor> resources = wizard.getResult();
                        List<VersionedClause> newBundles = new ArrayList<VersionedClause>(resources.size());
                        for (ResourceDescriptor resource : resources) {
                            Attrs attrs = new Attrs();
                            attrs.put(Constants.VERSION_ATTRIBUTE, resource.version != null ? resource.version.toString() : Version.emptyVersion.toString());
                            VersionedClause clause = new VersionedClause(resource.bsn, attrs);
                            newBundles.add(clause);
                        }

                        handleAdd(newBundles);
View Full Code Here

        }
    }

    @Override
    protected ExportedPackage newHeaderClause(String text) {
        return new ExportedPackage(text, new Attrs());
    }
View Full Code Here

    }

    void doEdit() {
        HeaderClause header = (HeaderClause) ((IStructuredSelection) viewer.getSelection()).getFirstElement();
        if (header != null) {
            Attrs copyOfProperties = new Attrs(header.getAttribs());

            IConfigurationElement configElem = configElements.get(header.getName());
            PluginEditWizard wizard = new PluginEditWizard(configElem, copyOfProperties);
            WizardDialog dialog = new WizardDialog(getManagedForm().getForm().getShell(), wizard);
View Full Code Here

    private static VersionedClause resourceToRunBundle(Resource resource) {
        Capability idCap = ResourceUtils.getIdentityCapability(resource);
        String identity = ResourceUtils.getIdentity(idCap);

        // Map version range string, using "latest" for any workspace resources
        Attrs attribs = new Attrs();
        String versionRangeStr;
        if (isWorkspace(resource)) {
            versionRangeStr = VERSION_LATEST;
        } else {
            Version version = ResourceUtils.getVersion(idCap);
            VersionRange versionRange = createVersionRange(version);
            versionRangeStr = versionRange.toString();
        }
        attribs.put(Constants.VERSION_ATTRIBUTE, versionRangeStr);

        return new VersionedClause(identity, attribs);

    }
View Full Code Here

TOP

Related Classes of aQute.bnd.header.Attrs$DataType

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.