Package org.eclipse.swt.custom

Examples of org.eclipse.swt.custom.StyleRange


    /* Old Version */
    if (StringUtils.isSet(oldVer)) {
      int offset = fUpdateInfoTextLeft.getText().length();
      fUpdateInfoTextLeft.append(Messages.UpdateDialog_CURRENT_VERSION);
      fUpdateInfoTextLeft.setStyleRange(new StyleRange(offset, fUpdateInfoTextLeft.getText().length() - offset, null, null, SWT.BOLD));
      fUpdateInfoTextRight.append(oldVer);
      fUpdateInfoTextLeft.append("\n"); //$NON-NLS-1$
      fUpdateInfoTextRight.append("\n"); //$NON-NLS-1$
    }

    /* New Version */
    if (StringUtils.isSet(newVer)) {
      int offset = fUpdateInfoTextLeft.getText().length();
      fUpdateInfoTextLeft.append(Messages.UpdateDialog_NEW_VERSION);
      fUpdateInfoTextLeft.setStyleRange(new StyleRange(offset, fUpdateInfoTextLeft.getText().length() - offset, null, null, SWT.BOLD));
      fUpdateInfoTextRight.append(newVer);
      fUpdateInfoTextLeft.append("\n"); //$NON-NLS-1$
      fUpdateInfoTextRight.append("\n"); //$NON-NLS-1$
    }

    /* Provider */
    if (StringUtils.isSet(provider)) {
      int offset = fUpdateInfoTextLeft.getText().length();
      fUpdateInfoTextLeft.append(Messages.UpdateDialog_UPDATE_PROVIDER);
      fUpdateInfoTextLeft.setStyleRange(new StyleRange(offset, fUpdateInfoTextLeft.getText().length() - offset, null, null, SWT.BOLD));
      fUpdateInfoTextRight.append(provider);
      fUpdateInfoTextLeft.append("\n"); //$NON-NLS-1$
      fUpdateInfoTextRight.append("\n"); //$NON-NLS-1$
    }

    /* Size */
    if (dlSize > 0) {
      int offset = fUpdateInfoTextLeft.getText().length();
      fUpdateInfoTextLeft.append(Messages.UpdateDialog_DL_SIZE);
      fUpdateInfoTextLeft.setStyleRange(new StyleRange(offset, fUpdateInfoTextLeft.getText().length() - offset, null, null, SWT.BOLD));
      fUpdateInfoTextRight.append(OwlUI.getSize((int) dlSize));
      fUpdateInfoTextLeft.append("\n"); //$NON-NLS-1$
      fUpdateInfoTextRight.append("\n"); //$NON-NLS-1$
    }

    /* Description */
    if (StringUtils.isSet(description)) {
      int offset = fUpdateInfoTextBottom.getText().length();
      fUpdateInfoTextBottom.append(Messages.UpdateDialog_DESCRIPTION);
      fUpdateInfoTextBottom.append("\n"); //$NON-NLS-1$
      fUpdateInfoTextBottom.setStyleRange(new StyleRange(offset, fUpdateInfoTextBottom.getText().length() - offset, null, null, SWT.BOLD));
      fUpdateInfoTextBottom.append(description);
    }
  }
View Full Code Here


        }

        /* Bold End */
        else if (character == BOLD && inBold) {
          inBold = false;
          ranges.add(new StyleRange(boldStartIndex, index - boldStartIndex, null, null, SWT.BOLD));
        }

        /* Blue Start */
        else if (character == BLUE && !inBlue) {
          inBlue = true;
          blueStartIndex = index;
        }

        /* Blue End */
        else if (character == BLUE && inBlue) {
          inBlue = false;
          StyleRange range = new StyleRange();
          range.foreground = widget.getDisplay().getSystemColor(SWT.COLOR_DARK_BLUE);
          range.start = blueStartIndex;
          range.length = index - blueStartIndex;

          ranges.add(range);
View Full Code Here

        + Options.getSchemaVersion() + "\n" +
        "SVN: \t" + getSVNVersion()   
    );
    dialog.setContent(message, SWT.CENTER);
    dialog.getStyledText().setEditable(false);
    StyleRange bold = new StyleRange();
    bold.start = 0;
    bold.length = message.lastIndexOf("\n");
   
    bold.fontStyle = SWT.BOLD;
    //dialog.getStyledText().setStyleRange(bold);
View Full Code Here

    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

        new Color(display, new RGB(0, 128, 0)),   // Green
        new Color(display, new RGB(128, 128, 128))   // Gray
    };
   
    styles = new StyleRange[] {
      new StyleRange(0, 0, null, null, SWT.NORMAL),
      new StyleRange(0, 0, colors[COLOR_RED], null, SWT.NORMAL),
      new StyleRange(0, 0, colors[COLOR_ORANGE], null, SWT.NORMAL),
      new StyleRange(0, 0, colors[COLOR_BLUE], null, SWT.BOLD),
      new StyleRange(0, 0, colors[COLOR_GREEN], null, SWT.NORMAL),
      new StyleRange(0, 0, colors[COLOR_GREEN], null, SWT.NORMAL),
      new StyleRange(0, 0, colors[COLOR_GRAY], null, SWT.BOLD),
      new StyleRange(0, 0, colors[COLOR_GREENISH], null, SWT.ITALIC),
      new StyleRange(0, 0, colors[COLOR_GRAY], null, SWT.BOLD),
      new StyleRange(0, 0, colors[COLOR_GRAY], null, SWT.NORMAL)
    };

    // -- lexer for finding language parts --
    lexer = new RubyYaccLexer();
View Full Code Here

    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

   * @param attr 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

      for (int i = 0; i < matches.length; i++) {
        int color = 0;
        for (int j = 1; j <= re.getNumSubs(); j++) {

          StyleRange styleRange = new StyleRange();

          styleRange.start = matches[i].getStartIndex(j);
          styleRange.length = matches[i].getEndIndex(j)
              - matches[i].getStartIndex(j);
View Full Code Here

    REMatch[] matches = debugInfo.getMatches(position - 1);

    debugPosition = position;

    StyleRange styleRangeRegExp = new StyleRange();

    Display display = panel.getDisplay();
    styleRangeRegExp.background = display.getSystemColor(SWT.COLOR_BLUE);
    styleRangeRegExp.foreground = display.getSystemColor(SWT.COLOR_WHITE);

    // Colour the regexp
    SubexpressionPos pos = debugInfo.getSubexpressionPosition(position - 1);
    //Reset style
    regExpText.setStyleRange(null);

    styleRangeRegExp.start = pos.getStart();
    styleRangeRegExp.length = pos.getEnd() - pos.getStart();

    regExpText.setStyleRange(styleRangeRegExp);

    //  Update text position
    regExpText.setTopIndex(styleRangeRegExp.start);
    regExpText.setCaretOffset(styleRangeRegExp.start);
    int offsetFromLine = styleRangeRegExp.start
        - regExpText.getOffsetAtLine(regExpText
            .getLineAtOffset(styleRangeRegExp.start));
    regExpText.setHorizontalIndex(offsetFromLine);
    regExpText.redraw();

    // Colour the matching text
    matchText.setStyleRange(null);

    if (position <= debugInfo.geMatchingBracketsCount()) {
      setResultLabelImage(RegExpImages.RESULT_GREEN);
      for (int i = 0; i < matches.length; i++) {

        StyleRange styleRangeMatch = new StyleRange();
        styleRangeMatch.background = display
            .getSystemColor(SWT.COLOR_BLUE);
        styleRangeMatch.foreground = display
            .getSystemColor(SWT.COLOR_WHITE);
View Full Code Here

    protected void stopBold() {
        --fBold;
        if (fBold == 0) {
            if (fTextPresentation != null) {
                fTextPresentation.addStyleRange(new StyleRange(fStartOffset, fCounter
                        - fStartOffset, null, null, SWT.BOLD));
            }
            fStartOffset = -1;
        }
    }
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.