Package org.eclipse.jface.viewers

Examples of org.eclipse.jface.viewers.StyledString


        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

        private final Image imgJar = AbstractUIPlugin.imageDescriptorFromPlugin(Plugin.PLUGIN_ID, "icons/jar_obj.gif").createImage();

        @Override
        public void update(ViewerCell cell) {
            ResourceDescriptor descriptor = (ResourceDescriptor) cell.getElement();
            StyledString label = new StyledString(descriptor.bsn + " ");
            if (descriptor.version != null)
                label.append(descriptor.version.toString(), StyledString.COUNTER_STYLER);

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

            cell.setImage(imgJar);
        }
View Full Code Here

        public void update(ViewerCell cell) {
            ZipTreeNode node = (ZipTreeNode) cell.getElement();

            String name = node.toString();

            StyledString label = new StyledString(name);

            if (name.endsWith("/")) {
                cell.setImage(folderImg);
            } else {
                cell.setImage(fileImg);
                ZipEntry entry = node.getZipEntry();
                if (entry != null) {
                    label.append(String.format(" [sz: %,d; crc: %d]", entry.getSize(), entry.getCrc()), StyledString.QUALIFIER_STYLER);
                }
            }

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

    if( !hasItField && "it".startsWith(prefix) )
    {
      String relpacement = paramType.getName() + " it;";
      Image image = JavaPluginImages.get(JavaPluginImages.IMG_FIELD_DEFAULT);

      StyledString displayName = new StyledString("it : " + paramType.getName());
      displayName.append(" - Access the mocked object 'it' of type '"
          + paramType.getName() +"'", QUALIFIER_STYLER);

      IJavaCompletionProposal proposal
      = new JavaCompletionProposal(relpacement, context.getInvocationOffset()-prefix.length(), prefix.length(),
          image, displayName, MockMethodCompletionProposal.MAX_RELEVANCE);
View Full Code Here

      final ITypeBinding paramType, final ICompilationUnit cunit,
      final String prefix, final IMethodBinding meth, final String methodName) throws JavaModelException
  {
    String params = getParameters(meth);

    StyledString displayName = new StyledString(methodName
        + "(" + params + ") : " + meth.getReturnType().getName() );

    String desc = meth.isConstructor() ? "constructor" : "method";

    displayName.append(" - Mock " + desc + " of '"
        + paramType.getName() +"'", QUALIFIER_STYLER);

    String completionProposal = meth.getReturnType().getName() + " " + methodName;

    MockMethodCompletionProposal proposal = new MockMethodCompletionProposal(cunit, meth,
View Full Code Here

                    if (bundleId == null) {
                        cell.setImage(errorImg);
                    } else {
                        cell.setImage(jarImg);
                    }
                    StyledString label = new StyledString(file.getName());
                    String parentPath = file.getParent();
                    if (parentPath != null) {
                        label.append(" (" + parentPath + ")", StyledString.QUALIFIER_STYLER);
                    }
                    cell.setText(label.getString());
                    cell.setStyleRanges(label.getStyleRanges());
                } else if (index == 1) {
                    if (bundleId == null) {
                        cell.setImage(errorImg);
                        cell.setText("Not a JAR file");
                    } else {
                        String bsn = bundleId.getFirst();
                        String version = bundleId.getSecond();
                        if (bsn == null) {
                            cell.setImage(warnImg);
                            cell.setText("Not a Bundle JAR");
                        } else {
                            cell.setImage(okayImg);
                            StyledString styledString = new StyledString(bsn);
                            if (version != null) {
                                styledString.append(" [" + version + "]", StyledString.COUNTER_STYLER);
                                cell.setText(styledString.getString());
                                cell.setStyleRanges(styledString.getStyleRanges());
                            }
                        }
                    }
                }
            }
View Full Code Here

    public void update(ViewerCell cell) {
        cell.setImage(linkImg);

        Object element = cell.getElement();
        if (element instanceof OBRLink) {
            StyledString label = ((OBRLink) element).getLabel();
            cell.setStyleRanges(label.getStyleRanges());
            cell.setText(label.getString());
        } else {
            cell.setText(element == null ? "null" : element.toString());
        }
    }
View Full Code Here

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

    @Override
    public void update(ViewerCell cell) {
        aQute.bnd.build.model.clauses.VersionedClause clause = (aQute.bnd.build.model.clauses.VersionedClause) cell.getElement();
        StyledString label = new StyledString(clause.getName());
        String version = clause.getVersionRange();
        if (version != null) {
            label.append(" " + version, StyledString.COUNTER_STYLER);
        }
        cell.setText(label.getString());
        cell.setStyleRanges(label.getStyleRanges());
        cell.setImage(bundleImg);
    }
View Full Code Here

        @SuppressWarnings("unchecked")
        C clause = (C) cell.getElement();

        cell.setImage(packageImg);

        StyledString styledString = new StyledString(clause.getName());
        String version = clause.getAttribs().get(org.osgi.framework.Constants.VERSION_ATTRIBUTE);
        if (version != null) {
            styledString.append(": " + version, StyledString.COUNTER_STYLER);
        }

        decorate(styledString, clause);

        cell.setText(styledString.getString());
        cell.setStyleRanges(styledString.getStyleRanges());
    }
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.