Package org.eclipse.jface.viewers

Examples of org.eclipse.jface.viewers.StyledString


    @Override
    public void update(ViewerCell cell) {
        //String text = _model.getColumnText((TaskStatus)cell.getElement(), cell.getColumnIndex());
       
        StyledString styledString = new StyledString(cell.getColumnIndex() + "#");
       
        cell.setText(styledString.getString());
        cell.setStyleRanges(styledString.getStyleRanges());

        super.update(cell);
        //getViewer().refresh(true);
    }
View Full Code Here


                cell.setImage(image);
            }
        } else if (element instanceof Project) {
            if (index == 0) {
                Project project = (Project) element;
                StyledString label = new StyledString(project.getName());
                if (showRepoId)
                    label.append("  [Workspace]", StyledString.QUALIFIER_STYLER);

                cell.setText(label.getString());
                cell.setStyleRanges(label.getStyleRanges());
                cell.setImage(projectImg);
            }
        } else if (element instanceof ProjectBundle) {
            if (index == 0) {
                StyledString label = new StyledString(((ProjectBundle) element).getBsn());
                if (showRepoId)
                    label.append("  [Workspace]", StyledString.QUALIFIER_STYLER);

                cell.setText(label.getString());
                cell.setStyleRanges(label.getStyleRanges());
                cell.setImage(bundleImg);
            }
        } else if (element instanceof RepositoryBundle) {
            if (index == 0) {
                RepositoryBundle bundle = (RepositoryBundle) element;
                StyledString label = new StyledString(bundle.getText());
                if (showRepoId)
                    label.append("  [" + bundle.getRepo().getName() + "]", StyledString.QUALIFIER_STYLER);
                cell.setText(label.getString());
                cell.setStyleRanges(label.getStyleRanges());
                cell.setImage(bundleImg);
            }
        } else if (element instanceof RepositoryBundleVersion) {
            if (index == 0) {
                RepositoryBundleVersion bundleVersion = (RepositoryBundleVersion) element;
                StyledString styledString = new StyledString(bundleVersion.getText(), StyledString.COUNTER_STYLER);
                cell.setText(styledString.getString());
                cell.setStyleRanges(styledString.getStyleRanges());
            }
        } else if (element instanceof ContinueSearchElement) {
            StyledString label = new StyledString("Continue Search on JPM4J.org...", new HyperlinkStyler());
            cell.setText(label.getString());
            cell.setStyleRanges(label.getStyleRanges());
        } else if (element != null) {
            // Catch-all
            cell.setText(element.toString());
        }
    }
View Full Code Here

                }

                boolean included = isIncludedRepo(repo);
                styler = included ? null : strikeoutStyler;

                StyledString styledLabel = new StyledString(label, styler);
                cell.setText(styledLabel.getString());
                cell.setStyleRanges(styledLabel.getStyleRanges());
                cell.setImage(image);
            }

            @Override
            public String getToolTipText(Object element) {
View Full Code Here

public class RequirementWithResourceLabelProvider extends RequirementLabelProvider {

    @Override
    public StyledString getLabel(Requirement requirement) {
        StyledString label = super.getLabel(requirement);

        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");

        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());

            getImage(R5LabelFormatter.getNamespaceImagePath(requirement.getNamespace()), true);
        }
    }
View Full Code Here

            getImage(R5LabelFormatter.getNamespaceImagePath(requirement.getNamespace()), true);
        }
    }

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

        public void update(final 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 (cell.getColumnIndex() == 0) {
                cell.setImage(image);
                cell.setText(pkgName);
            } else if (cell.getColumnIndex() == 1) {
                StyledString label = new StyledString("1.0", StyledString.COUNTER_STYLER); //$NON-NLS-1$
                cell.setText(label.getString());
                cell.setStyleRanges(label.getStyleRanges());
            }
        }
View Full Code Here

                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

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.