Package org.osgi.resource

Examples of org.osgi.resource.Resource


    public Object[] getChildren(Object parent) {
        Object[] result;

        if (parent instanceof Resource) {
            Resource parentResource = (Resource) parent;

            Map<Capability,ResolutionTreeItem> items = new HashMap<Capability,ResolutionTreeItem>();
            List<Wire> wires = resolution.get(parentResource);
            processWires(wires, items);
View Full Code Here


        if (Namespace.RESOLUTION_OPTIONAL.equals(requirement.getDirectives().get(Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE)))
            label.append(" OPTIONALLY", StyledString.QUALIFIER_STYLER);
        label.append(" REQUIRED BY ", StyledString.QUALIFIER_STYLER);

        Resource resource = requirement.getResource();
        if (resource != null)
            appendResourceLabel(label, resource);
        else
            label.append(" INITIAL");
View Full Code Here

        return contents;
    }

    private void updateSavePreferenceText() {
        Resource resource = candidates.get(0).getResource();
        Capability identity = ResourceUtils.getIdentityCapability(resource);
        String name = ResourceUtils.getIdentity(identity);

        StyledString label = new StyledString("Save top candidate (");
        label.append(name, UIConstants.BOLD_STYLER);
View Full Code Here

        requiredViewer.setSorter(new BundleSorter());

        requiredViewer.addSelectionChangedListener(new ISelectionChangedListener() {
            public void selectionChanged(SelectionChangedEvent event) {
                IStructuredSelection sel = (IStructuredSelection) event.getSelection();
                Resource resource = (Resource) sel.getFirstElement();

                reasonsContentProvider.setOptional(false);
                reasonsContentProvider.setResolution(result.getResourceWirings());

                reasonsViewer.setInput(resource);
                reasonsViewer.expandToLevel(2);
            }
        });

        Composite cmpOptional = new Composite(sashForm, SWT.NONE);
        cmpOptional.setLayout(new GridLayout(2, false));

        Label lblOptional = new Label(cmpOptional, SWT.NONE);
        lblOptional.setText("Optional Resources");
        lblOptional.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));

        ToolBar optionalToolbar = new ToolBar(cmpOptional, SWT.FLAT | SWT.HORIZONTAL);
        optionalToolbar.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, true, false));
        optionalMaximiser = new SashFormPanelMaximiser(sashForm);
        optionalMaximiser.createToolItem(cmpOptional, optionalToolbar);

        Table tblOptional = new Table(cmpOptional, SWT.BORDER | SWT.CHECK | SWT.FULL_SELECTION | SWT.H_SCROLL);
        tblOptional.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));

        optionalViewer = new CheckboxTableViewer(tblOptional);
        optionalViewer.setContentProvider(ArrayContentProvider.getInstance());
        optionalViewer.setLabelProvider(new ResourceLabelProvider());
        optionalViewer.setSorter(new BundleSorter());

        optionalViewer.addCheckStateListener(new ICheckStateListener() {
            public void checkStateChanged(CheckStateChangedEvent event) {
                Resource resource = (Resource) event.getElement();
                if (event.getChecked()) {
                    checkedOptional.add(resource);
                } else {
                    checkedOptional.remove(resource);
                }
View Full Code Here

    private static class BundleSorter extends ViewerSorter {

        @Override
        public int compare(Viewer viewer, Object e1, Object e2) {
            Resource r1 = (Resource) e1;
            Resource r2 = (Resource) e2;

            Capability id1 = ResourceUtils.getIdentityCapability(r1);
            Capability id2 = ResourceUtils.getIdentityCapability(r2);

            String name1 = ResourceUtils.getIdentity(id1);
View Full Code Here

    private final Image bundleImg = AbstractUIPlugin.imageDescriptorFromPlugin(Plugin.PLUGIN_ID, "icons/brick.png").createImage();

    @Override
    public void update(ViewerCell cell) {
        Resource resource = (Resource) cell.getElement();

        StyledString label = new StyledString();
        try {
            Capability identityCap = ResourceUtils.getIdentityCapability(resource);
View Full Code Here

        return contents;
    }

    private void updateSavePreferenceText() {
        Resource resource = candidates.get(0).getResource();
        Capability identity = ResourceUtils.getIdentityCapability(resource);
        String name = ResourceUtils.getIdentity(identity);

        StyledString label = new StyledString("Save top candidate (");
        label.append(name, UIConstants.BOLD_STYLER);
View Full Code Here

class BundleSorter extends ViewerSorter {

    @Override
    public int compare(Viewer viewer, Object e1, Object e2) {
        Resource r1 = (Resource) e1;
        Resource r2 = (Resource) e2;

        Capability id1 = ResourceUtils.getIdentityCapability(r1);
        Capability id2 = ResourceUtils.getIdentityCapability(r2);

        String name1 = ResourceUtils.getIdentity(id1);
View Full Code Here

            Requirement requirement = (Requirement) element;
            if (Namespace.RESOLUTION_OPTIONAL.equals(requirement.getDirectives().get(Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE)))
                label.append(" OPTIONALLY", StyledString.QUALIFIER_STYLER);
            label.append(" REQUIRED BY ", StyledString.QUALIFIER_STYLER);

            Resource resource = requirement.getResource();
            if (resource != null)
                R5LabelFormatter.appendResourceLabel(label, resource);
            else
                label.append(" INITIAL");
View Full Code Here

        requiredViewer.addSelectionChangedListener(new ISelectionChangedListener() {
            @Override
            public void selectionChanged(SelectionChangedEvent event) {
                IStructuredSelection sel = (IStructuredSelection) event.getSelection();
                Resource resource = (Resource) sel.getFirstElement();

                reasonsContentProvider.setOptional(false);
                if (result != null)
                    reasonsContentProvider.setResolution(result.getResourceWirings());

                reasonsViewer.setInput(resource);
                reasonsViewer.expandToLevel(2);
            }
        });

        Section sectOptional = toolkit.createSection(composite, Section.TITLE_BAR | Section.TWISTIE);
        sectOptional.setText("Optional Resources");

        Composite cmpOptional = toolkit.createComposite(sectOptional);
        sectOptional.setClient(cmpOptional);
        cmpOptional.setLayout(new GridLayout(2, false));

        gd = new GridData(SWT.FILL, SWT.FILL, true, false);
        gd.widthHint = 200;
        sectOptional.setLayoutData(gd);

        Table tblOptional = toolkit.createTable(cmpOptional, SWT.BORDER | SWT.CHECK | SWT.FULL_SELECTION | SWT.H_SCROLL);
        tblOptional.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));

        optionalViewer = new CheckboxTableViewer(tblOptional);
        optionalViewer.setContentProvider(ArrayContentProvider.getInstance());
        optionalViewer.setLabelProvider(new ResourceLabelProvider());
        optionalViewer.setSorter(new BundleSorter());

        optionalViewer.addCheckStateListener(new ICheckStateListener() {
            @Override
            public void checkStateChanged(CheckStateChangedEvent event) {
                Resource resource = (Resource) event.getElement();
                if (event.getChecked()) {
                    checkedOptional.add(resource);
                } else {
                    checkedOptional.remove(resource);
                }
View Full Code Here

TOP

Related Classes of org.osgi.resource.Resource

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.