Package org.eclipse.swt.custom

Examples of org.eclipse.swt.custom.StyleRange


            }
            if (end == start) {
                break;
            }
            lastIndex = end;
            presentation.addStyleRange(new StyleRange(start, end - start, null, null,
                    SWT.BOLD));
        }

        // return the input (this one doesn't change the string)
        return str;
View Full Code Here


        yoursEnd = Math.max(yoursStart, yoursEnd);

        final Iterator<StyleRange> e = presentation.getAllStyleRangeIterator();
        while (e.hasNext()) {

            final StyleRange range = e.next();

            final int myStart = range.start;
            int myEnd = range.start + range.length - 1;
            myEnd = Math.max(myStart, myEnd);
View Full Code Here

        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

    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

    }
    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

      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

        + 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

    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

     *            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

    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

TOP

Related Classes of org.eclipse.swt.custom.StyleRange

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.