Package org.eclipse.swt.custom

Examples of org.eclipse.swt.custom.StyleRange


   * @param start the start of the range
   * @param length the length of the range
   * @return the created StyleRange
   */
  private StyleRange createAttributeLabelStyle(int start, int length) {
    StyleRange result = new StyleRange(start, length, null, null);
    result.fontStyle = SWT.ITALIC;
    return result;
  }
View Full Code Here


   * @param start the start of the range
   * @param length the length of the range
   * @return the created StyleRange
   */
  private StyleRange createAttributeNameStyle(int start, int length) {
    StyleRange result = new StyleRange(start, length, null, null);
    result.fontStyle = SWT.BOLD;
    return result;
  }
View Full Code Here

   * @param start the start of the range
   * @param length the length of the range
   * @return the created StyleRange
   */
  private StyleRange createAttributeValueStyle(int start, int length) {
    StyleRange result = new StyleRange(start, length, null, null);
    return result;
  }
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 static final Color VARIABLE_COLOR = new Color(null, 155, 155, 255);

        public FormulaConfigurationStyling(List<String> variables) {
            super(new ArrayList<RegexpHighlight>());
            for (String variableName : variables) {
                StyleRange styleRange = new StyleRange(0, 0, VARIABLE_COLOR, null, SWT.NORMAL);
                addHighlightDefinition(new RegexpHighlight(variableName, variableName, styleRange));
            }
        }
View Full Code Here

        addHighlight("cdata", "(?s)(?<=>)\\s*?<\\!\\[CDATA\\[.*?\\]\\]>\\s*?(?=<)", COLOR_XML_ELEMENT_TEXT, SWT.NORMAL);
        addHighlight("comment", "(?s)(<!--.*?-->)|(<!--.*?\\z)", COLOR_XML_COMMENT, SWT.ITALIC);
    }

    public static void addHighlight(String name, String regexp, Color fg, int textStyle) {
        StyleRange styleRange = new StyleRange(0, 0, fg, null, textStyle);
        RegexpHighlight highlight = new RegexpHighlight(name, regexp, styleRange);
        highlightDefinitions.add(highlight);
    }
View Full Code Here

        addHighlight("lineComment", "(?m)//.*$", COLOR_COMMENT, SWT.ITALIC);
        addHighlight("blockComment", "(?s)/\\*.*?(?:\\*/|\\z)", COLOR_COMMENT, SWT.ITALIC);
    }

    public static void addHighlight(String name, String regexp, Color fg, int textStyle) {
        StyleRange styleRange = new StyleRange(0, 0, fg, null, textStyle);
        highlightDefinitions.add(new RegexpHighlight(name, regexp, styleRange));
    }
View Full Code Here

    }

    public JavaHighlightTextStyling(List<String> variableNames) {
        super(highlightDefinitions);
        for (String variableName : variableNames) {
            StyleRange styleRange = new StyleRange(0, 0, VARIABLE_COLOR, null, SWT.NORMAL);
            addHighlightDefinition(new RegexpHighlight(variableName, variableName, styleRange));
        }
    }
View Full Code Here

  public void applyTextPresentation(TextPresentation textPresentation) {
    if (activeRegion == null)
      return;
    IRegion region= textPresentation.getExtent();
    if (activeRegion.getOffset() + activeRegion.getLength() >= region.getOffset() && region.getOffset() + region.getLength() > activeRegion.getOffset())
      textPresentation.mergeStyleRange(new StyleRange(activeRegion.getOffset(), activeRegion.getLength(), color, null));
  }
View Full Code Here

        }
        event.styles = lineStyleRanges.toArray(new StyleRange[lineStyleRanges.size()]);
    }

    private StyleRange copyWithNewRegion(int start, int length, StyleRange styleRange) {
        return new StyleRange(start, length, styleRange.foreground, styleRange.background, styleRange.fontStyle);
    }
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.