Package org.eclipse.jface.viewers

Examples of org.eclipse.jface.viewers.StyledString


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

    StyledString styledString = getStyledText(element);
    String newText = styledString.toString();

    StyleRange[] oldStyleRanges = cell.getStyleRanges();
    StyleRange[] newStyleRanges = isOwnerDrawEnabled() ? styledString
        .getStyleRanges() : null;

    if (!Arrays.equals(oldStyleRanges, newStyleRanges)) {
      cell.setStyleRanges(newStyleRanges);
      if (cell.getText().equals(newText)) {
View Full Code Here


          item.setImage(p.getImage());
       
        String displayString;
        StyleRange[] styleRanges= null;
        if (fIsColoredLabelsSupportEnabled && p instanceof ICompletionProposalExtension6) {
          StyledString styledString= ((ICompletionProposalExtension6)p).getStyledDisplayString();
          displayString= styledString.getString();
          styleRanges= styledString.getStyleRanges();
        } else
          displayString= p.getDisplayString();

        item.setText(displayString);
        if (fIsColoredLabelsSupportEnabled)
View Full Code Here

    }
  }

  @Override
  public void update(ViewerCell cell) {
    StyledString cellStyledString = getCellText(cell.getElement());
    cell.setText(cellStyledString.getString());
    cell.setStyleRanges(cellStyledString.getStyleRanges());
    super.update(cell);
  }
View Full Code Here

  protected StyledString getCellText(Object element) {
    if (element instanceof GeneralMatchingFilter) {
      return getCellText((GeneralMatchingFilter) element);
    }
    return new StyledString("???");
  }
View Full Code Here

    }
    return new StyledString("???");
  }

  protected StyledString getCellText(GeneralMatchingFilter filter) {
    StyledString ss = new StyledString();
    ss.append("Filters ", defaultStyler);

    if (!filter.isUsesMatchText()) {
      ss.append("all ", defaultStyler);
    }

    switch (filter.getMatchType()) {
    case ALL_ITEMS:
      ss.append("Files and Folders ", matchTypeStyler);
      break;
    case FILE:
      ss.append("Files ", matchTypeStyler);
      break;
    case FOLDER:
      ss.append("Folders ", matchTypeStyler);
      break;
    }

    if (filter.isUsesMatchText()) {
      ss.append("whose names ", defaultStyler);

      if (filter.isUsesRegex()) {
        ss.append("match the pattern ", defaultStyler);
      } else {
        ss.append("contain ", defaultStyler);
      }

      ss.append(filter.getMatchText(), filter.isUsesRegex() ? matchRegexStyler : matchTextStyler);
    }

    if (filter.isCaseSensitive()) {
      ss.append(" (case sensitive)", afterthoughtStyler);
    }

    return ss;
  }
View Full Code Here

  @Override
  public void update(ViewerCell cell) {
    Object cellElement = cell.getElement();
    MetadataTag tag = (MetadataTag) cellElement;

    StyledString styledString = new StyledString(tag.tagName, null);

    if (tag.getFieldKey() == null) {
      styledString.append(": (");
      styledString.append(tag.getDefaultText(), plaintextStyler);
      styledString.append(")");
    }
    cell.setText(styledString.getString());
    cell.setStyleRanges(styledString.getStyleRanges());
  }
View Full Code Here

    super();
  }
 
  @Override
  public String getText(Object element) {
    StyledString styledText = getStyledText(element);
    if(styledText != null) {
      return styledText.getString();
    }
    return null;
  }
View Full Code Here

 
  // By default, use full string of styled text 
  @Override
  public String getDescription(Object anElement) {
   
    StyledString styledText = getStyledText(anElement);
    if(styledText != null) {
      return styledText.getString();
    }
    return null;
  }
View Full Code Here

  public void setTextSelection(boolean textSelection) {
    this.textSelection = textSelection;
  }
 
  public StyledString getStyledString() {
    StyledString styledString = new StyledString();
    if (jsonNode.getKey() != null) {
      StyledString.Styler style1 = StyledString.createColorRegistryStyler("BLACK", "WHITE");
      styledString.append(jsonNode.getKey().getValue(), style1);
      StyledString.Styler style2 = StyledString.createColorRegistryStyler("BLACK", "WHITE");
      styledString.append(" : ", style2);
    }
   
    if (jsonNode.getValue() != null && (jsonNode.getJsonType() != JsonType.Object && jsonNode.getJsonType() != JsonType.Array)) {
      StyledString.Styler style3 = styleMap.get(jsonNode.getJsonType());
      styledString.append(jsonNode.getValue().getValue(), style3);
    }
    return styledString;
  }
View Full Code Here

  /* (non-Javadoc)
   * @see org.sourceforge.jsonedit.core.core.outline.elements.JsonElement#getStyledString()
   */
  @Override
  public StyledString getStyledString() {
    StyledString styledString = new StyledString();
    StyledString.Styler style1 = StyledString.createColorRegistryStyler("RED", "WHITE");
    styledString.append(message, style1);
    return styledString;
  }
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.