Examples of StyleRange


Examples of org.eclipse.swt.custom.StyleRange

        fTextLayout.setWidth(sizeConstraints == null ? SWT.DEFAULT : sizeConstraints.x
                - trim.width);
        @SuppressWarnings("rawtypes")
        final Iterator iter = presentation.getAllStyleRangeIterator();
        while (iter.hasNext()) {
            final StyleRange sr = (StyleRange) iter.next();
            if (sr.fontStyle == SWT.BOLD) {
                fTextLayout.setStyle(fBoldStyle, sr.start, sr.start + sr.length - 1);
            }
        }
View Full Code Here

Examples of org.eclipse.swt.custom.StyleRange

    boolean containsOtherFont= false;
   
    StyleRange[] styleRanges = cell.getStyleRanges();
    if (styleRanges != null) { // user didn't fill styled ranges
      for (int i = 0; i < styleRanges.length; i++) {
        StyleRange curr = prepareStyleRange(styleRanges[i], applyColors);
        layout.setStyle(curr, curr.start, curr.start + curr.length - 1);
        if (curr.font != null) {
          containsOtherFont= true;
        }
      }
View Full Code Here

Examples of org.eclipse.swt.custom.StyleRange

    }
    return -(low + 1); // key not found.
  }

  private StyleRange createStyleRange(int start, int end, Styler style) {
    StyleRange styleRange = new StyleRange();
    styleRange.start = start;
    styleRange.length = end - start;
    style.applyStyles(styleRange);
    return styleRange;
  }
View Full Code Here

Examples of org.eclipse.swt.custom.StyleRange

      if (r.getType() == DOMRegionContext.XML_TAG_ATTRIBUTE_NAME) {
        attrName = sdRegion.getText(r);
        temp = map.get(attrName);
        if (temp != null) {
          p = (Position) temp;
          sorted[p.offset] = new StyleRange(p.offset, p.length, null, null, SWT.BOLD);
        }
      }
    }
    // style ranges need to be added in order
    StyleRange sr = null;
    for (int i = 0; i < sorted.length; i++) {
      sr = sorted[i];
      if (sr != null) {
        presentation.addStyleRange(sr);
      }
View Full Code Here

Examples of org.eclipse.swt.custom.StyleRange

        + messageEvent.getMessage());
    int end = gameInfoText.getCharCount();
   
    gameInfoText.setTopIndex(gameInfoText.getLineCount());
    gameInfoText.update();
    gameInfoText.setStyleRange(new StyleRange(start, end - start, color, Display.getDefault().getSystemColor(
        SWT.COLOR_WIDGET_BACKGROUND)));
   
  }
View Full Code Here

Examples of org.eclipse.swt.custom.StyleRange

    StyledText text = sourceViewer.getTextWidget();

    if (mCurrentStyleRange != null) {
      // reset current style range
      StyleRange resetedStyleRange = new StyleRange(mCurrentStyleRange.start,
              mCurrentStyleRange.length, null, null);

      text.setStyleRange(resetedStyleRange);
    }

    if (length != 0) {
      mCurrentStyleRange = new StyleRange(start, length, text.getSelectionForeground(), text
              .getSelectionBackground());

      text.setStyleRange(mCurrentStyleRange);
    }
  }
View Full Code Here

Examples of org.eclipse.swt.custom.StyleRange

     *            the attribute describing the style of the range to be styled
     */
    protected void addRange(TextPresentation presentation, int offset, int length,
            TextAttribute attr) {
        if (attr != null) {
            presentation.addStyleRange(new StyleRange(offset, length, attr.getForeground(), attr
                    .getBackground(), attr.getStyle()));
        }
    }
View Full Code Here

Examples of org.eclipse.swt.custom.StyleRange

    private void addStyleRange( TextPresentation presentation, int offset, int length, TextAttribute textAttribute )
    {
        if ( offset >= 0 && length > 0 )
        {
            StyleRange range = new StyleRange( offset, length, textAttribute.getForeground(), textAttribute
                .getBackground(), textAttribute.getStyle() & ( SWT.BOLD | SWT.ITALIC ) );
            range.underline = ( textAttribute.getStyle() & TextAttribute.UNDERLINE ) != 0;
            range.strikeout = ( textAttribute.getStyle() & TextAttribute.STRIKETHROUGH ) != 0;
            presentation.addStyleRange( range );
        }
View Full Code Here

Examples of org.eclipse.swt.custom.StyleRange

     *            the attribute describing the style of the range to be styled
     */
    protected void addRange(TextPresentation presentation, int offset, int length,
            TextAttribute attr) {
        if (attr != null)
            presentation.addStyleRange(new StyleRange(offset, length, attr.getForeground(), attr
                    .getBackground(), attr.getStyle()));
    }
View Full Code Here

Examples of org.eclipse.swt.custom.StyleRange

    return true;
  }
  private void printKeyValue(final StyledText styledText,String key, String value) {
    value += styledText.getLineDelimiter();
   
    StyleRange style = getKeyStyle();
    style.start = styledText.getCharCount();
    style.length = key.length();
    styledText.append(key);
    styledText.setStyleRange(style);
    styledText.setCaretOffset(styledText.getCharCount());
    styledText.showSelection();
   
    StyleRange style1 = getValueStyle();
    style1.start = styledText.getCharCount();
    style1.length = value.length();
    styledText.append(value);
    styledText.setStyleRange(style1);
    styledText.setCaretOffset(styledText.getCharCount());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.