Package org.eclipse.jface.viewers

Examples of org.eclipse.jface.viewers.StyledString


                btnSavePreference.setSelection(!btnSavePreference.getSelection());
            }
        });

        // Load data
        StyledString label = createRequirementText();
        txtRequirement.setText(label.getString());
        txtRequirement.setStyleRanges(label.getStyleRanges());

        viewer.setInput(candidates);

        updateSavePreferenceText();
View Full Code Here


    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);
        label.append(") as a ");
        label.append("preferred resource.", UIConstants.ITALIC_STYLER);

        txtSavePreference.setText(label.getString());
        txtSavePreference.setStyleRanges(label.getStyleRanges());
    }
View Full Code Here

        txtSavePreference.setText(label.getString());
        txtSavePreference.setStyleRanges(label.getStyleRanges());
    }

    protected StyledString createRequirementText() {
        StyledString label = new StyledString();
        label.append("Namespace: ");
        label.append(requirement.getNamespace() + "\n", UIConstants.BOLD_STYLER);

        label.append("Filter: ");
        R5LabelFormatter.appendRequirementLabel(label, requirement);
        label.append("\n");

        for (Entry<String,String> entry : requirement.getDirectives().entrySet()) {
            String key = entry.getKey();
            if (!Namespace.REQUIREMENT_FILTER_DIRECTIVE.equals(key) && !Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE.equals(key))
                label.append("    " + key + ":=" + entry.getValue() + "\n");
        }

        if (Namespace.RESOLUTION_OPTIONAL.equals(requirement.getDirectives().get(Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE)))
            label.append("Optionally ", UIConstants.ITALIC_STYLER);
        label.append("Required by Resource: ");
        R5LabelFormatter.appendResourceLabel(label, requirement.getResource());

        return label;
    }
View Full Code Here

        @Override
        public void update(ViewerCell cell) {
            Capability capability = (Capability) cell.getElement();

            StyledString label = new StyledString();
            R5LabelFormatter.appendResourceLabel(label, capability.getResource());

            label.append(" (provides ", StyledString.QUALIFIER_STYLER);
            R5LabelFormatter.appendCapability(label, capability);
            label.append(")", StyledString.QUALIFIER_STYLER);

            cell.setText(label.getString());
            cell.setStyleRanges(label.getStyleRanges());
        }
View Full Code Here

    @Override
    public void update(ViewerCell cell) {
        Object element = cell.getElement();

        StyledString label = new StyledString();
        Image icon = null;

        if (element instanceof ResolutionTreeItem) {
            ResolutionTreeItem item = (ResolutionTreeItem) element;
            R5LabelFormatter.appendCapability(label, item.getCapability());

            // Get the icon from the capability namespace
            icon = getImage(R5LabelFormatter.getNamespaceImagePath(item.getCapability().getNamespace()), true);
        } else if (element instanceof Requirement) {
            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");

            label.append(" [", StyledString.QUALIFIER_STYLER);
            boolean first = true;
            for (Entry<String,String> entry : requirement.getDirectives().entrySet()) {
                String key = entry.getKey();
                if (!key.equals(Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE)) {
                    if (!first)
                        label.append(",", StyledString.QUALIFIER_STYLER);
                    first = false;
                    label.append(key + ":=" + entry.getValue(), StyledString.QUALIFIER_STYLER);
                }
            }
            label.append("]", StyledString.QUALIFIER_STYLER);
        }

        cell.setText(label.getString());
        cell.setStyleRanges(label.getStyleRanges());
        cell.setImage(icon);
    }
View Full Code Here

public class RequirementWithResourceLabelProvider extends RequirementLabelProvider {

    @Override
    public StyledString getLabel(Requirement requirement) {

        StyledString label = new StyledString();

        Resource resource = requirement.getResource();
        if (!(resource == null || resource.getCapabilities("osgi.content").isEmpty()))
            appendResourceLabel(label, resource);

        if (Namespace.RESOLUTION_OPTIONAL.equals(requirement.getDirectives().get(Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE)))
            label.append(" optionally", StyledString.QUALIFIER_STYLER);
        label.append(" requires ", StyledString.QUALIFIER_STYLER);

        super.getLabel(label, requirement);

        return label;
    }
View Full Code Here

    public void update(ViewerCell cell) {
        Object element = cell.getElement();
        if (element instanceof Requirement) {
            Requirement requirement = (Requirement) element;

            StyledString label = getLabel(requirement);

            cell.setText(label.getString());
            cell.setStyleRanges(label.getStyleRanges());

            Image icon = getImage(R5LabelFormatter.getNamespaceImagePath(requirement.getNamespace()), true);
            if (icon != null)
                cell.setImage(icon);
        }
View Full Code Here

                cell.setImage(icon);
        }
    }

    protected StyledString getLabel(Requirement requirement) {
        StyledString label = new StyledString();
        return getLabel(label, requirement);
    }
View Full Code Here

      final String proposalText = ((proposalPrefix + TargetPlatformProposalProvider.TARGET_PLATFORM__NAME_PLACEHOLDER) + "\"");
      ITextViewer _viewer = context.getViewer();
      StyledText _textWidget = _viewer.getTextWidget();
      String _lineDelimiter = _textWidget.getLineDelimiter();
      String _plus = (proposalText + _lineDelimiter);
      StyledString _styledString = new StyledString(proposalText);
      StyledString _append = _styledString.append(" - create a new target platform", StyledString.QUALIFIER_STYLER);
      Image _image = this.getImage(TargetPlatformProposalProvider.TARGET_PLATFORM);
      final ICompletionProposal p = this.createCompletionProposal(_plus, _append, _image, context);
      if ((p instanceof ConfigurableCompletionProposal)) {
        int _replacementOffset = ((ConfigurableCompletionProposal)p).getReplacementOffset();
        int _length = proposalPrefix.length();
View Full Code Here

    }
    StringConcatenation _builder_2 = new StringConcatenation();
    _builder_2.append("\"");
    _builder_2.append(TargetPlatformProposalProvider.TARGET_PLATFORM__NAME_PLACEHOLDER, "");
    _builder_2.append("\"");
    StyledString _styledString = new StyledString(_builder_2.toString());
    StyledString _append = _styledString.append(" - name of the target", StyledString.QUALIFIER_STYLER);
    Image _image = this.getImage(TargetPlatformProposalProvider.TARGET_PLATFORM);
    final ICompletionProposal p = this.createCompletionProposal(textProposal, _append, _image, context);
    if ((p instanceof ConfigurableCompletionProposal)) {
      int _replacementOffset = ((ConfigurableCompletionProposal)p).getReplacementOffset();
      int _plus = (_replacementOffset + offset);
View Full Code Here

TOP

Related Classes of org.eclipse.jface.viewers.StyledString

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.