Java 类org.eclipse.swt.custom.LineStyleEvent 实例源码

项目:egradle    文件:EGradleConsoleStyleListener.java   
private void parseByIndex(LineStyleEvent event, StyleRange startStyle, String currentText, List<StyleRange> ranges,
        ParseData data) {
    int fromIndex = 0;
    int pos = 0;
    int length = currentText.length();
    do {
        if (fromIndex >= length) {
            break;
        }
        pos = currentText.indexOf(data.subString, fromIndex);
        fromIndex = pos + 1;

        if (pos != -1) {
            addRange(ranges, event.lineOffset + pos, data.subString.length(), getColor(data.color), data.bold);
        }
    } while (pos != -1);
}
项目:TranskribusSwtGui    文件:LineEditor.java   
public LineEditor(final SWTCanvas canvas, int style) {
        super(canvas, style, TrpTextLineType.class);

        textField = new StyledText(SWTUtil.dummyShell, SWT.SINGLE | SWT.BORDER);
        textField.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
        // this one highlights words that are tagged:
        textField.addLineStyleListener(new LineStyleListener() {
            @Override
            public void lineGetStyle(LineStyleEvent event) {                
                if (shape==null)
                    return;

//              List<StyleRange> styleList = ATranscriptionWidget.getTagStylesForLine(shape, event.lineOffset);
//              event.styles = (StyleRange[]) ArrayUtils.addAll(event.styles, styleList.toArray(new StyleRange[0]));
            }
        });
        addWidget(textField);

        // autocomplete field:
        autocomplete = new TrpAutoCompleteField(textField, 
                new StyledTextContentAdapter(textField), new String[]{}, 
                KeyStroke.getInstance(SWT.CTRL, SWT.SPACE), null
                );
        autocomplete.getAdapter().setEnabled(false);
    }
项目:eclipse-debug-console-history    文件:StyledTextConsolePage.java   
@Override
public void lineGetStyle(LineStyleEvent e) {
    // Set the line number
    int line = tc.getLineAtOffset(e.lineOffset);
    int lastLine = tc.getLineCount() - 1;

    e.bulletIndex = line;

    String prompt = "gdb>";

    // Set the style, 12 pixles wide for each digit
    StyleRange style = new StyleRange();
    style.metrics = new GlyphMetrics(0, 0, prompt.length() * 12);

    // Create and set the bullet
    e.bullet = new Bullet(ST.BULLET_TEXT, style);
    if (line == lastLine) {
        e.bullet.text = prompt;
    } else {
        e.bullet.text = "";
    }
}
项目:termsuite-ui    文件:FileEditorPart.java   
public void lineGetStyle(LineStyleEvent e) {
    int lineStart = e.lineOffset;
    int lineEnd = lineStart + e.lineText.length();
    // Set the line number
    e.bulletIndex = text.getLineAtOffset(lineStart);

    // Set the style, 12 pixels wide for each digit
    StyleRange style = new StyleRange();
    style.foreground = new Color(text.getDisplay(), 120, 120, 120);
    style.fontStyle = SWT.ITALIC;
    style.metrics = new GlyphMetrics(0, 0, Integer.toString(text.getLineCount() + 1).length() * 12);
    // Create and set the bullet
    e.bullet = new Bullet(ST.BULLET_NUMBER, style);

    List<StyleRange> ranges = Lists.newArrayList();
    for(TermOccurrence occ:FileEditorPart.this.occurrences) {
        if((occ.getBegin() < lineEnd && occ.getEnd() > lineStart)) {
            int styleStart = Ints.max(occ.getBegin(), lineStart);
            int styleEnd = Ints.min(occ.getEnd(), lineEnd);
            int overlap = styleEnd - styleStart;
            StyleRange styleRange = new StyleRange();
            styleRange.start = styleStart;
            styleRange.length =  overlap;
            if(occ.equals(activeOccurrence)) {
                styleRange.fontStyle = SWT.BOLD | SWT.ITALIC;
                styleRange.background = COLOR_CYAN;
            } else {
                styleRange.background = COLOR_GRAY;                     
            }

            ranges.add(styleRange);
        }
    }
    e.styles = ranges.toArray(new StyleRange[ranges.size()]);
}
项目:egradle    文件:EGradleConsoleStyleListener.java   
private boolean markLine(LineStyleEvent event, String lineText, List<StyleRange> ranges, boolean handled,
        String searchText, RGB color1, boolean bold1, RGB color2, boolean bold2) {
    if (!handled) {

        if (lineText.startsWith(searchText)) {
            /* download itself is rendered by parsedata, here we only markup the remianing links*/
            addRange(ranges, event.lineOffset, searchText.length(),
                    getColor(color1), bold1);
            addRange(ranges, event.lineOffset+searchText.length(), lineText.length(),
                    getColor(color2), bold2);
            handled=true;
        }
    }
    return handled;
}
项目:egradle    文件:EGradleConsoleStyleListener.java   
private void parse(LineStyleEvent event, StyleRange defStyle, String currentText, List<StyleRange> ranges,
        ParseData data) {
    if (data.isSearchingSimpleSubstring()) {
        parseByIndex(event, defStyle, currentText, ranges, data);
    } else {
        throw new UnsupportedOperationException("Unsupported/unimplemented");
    }

}
项目:scouter    文件:SqlFormatUtil.java   
public static void applyStyledFormat(StyledText text, String sql) {
    if (StringUtil.isEmpty(sql)) return;
    text.setText(sql);
    text.addLineStyleListener(new LineStyleListener() {
        public void lineGetStyle(LineStyleEvent event) {
            String line = event.lineText;
            LinkedList<StyleRange> list = new LinkedList<StyleRange>();
            line = line.toLowerCase();
            String[] tokens = StringUtil.tokenizer(line, " \n\r\f\t()+*/-=<>'`\"[],");
            if (tokens == null) return;
            HashSet<String> set = new HashSet<String>();
            for (int i = 0; i < tokens.length; i++) {
                set.add(tokens[i]);
            }
            for (int i = 0; i < key.length; i++) {
                if (set.contains(key[i])) {
                    int cursor = -1;
                    while ((cursor = line.indexOf(key[i], cursor + 1)) > -1) {
                        StyleRange sr = new StyleRange();
                        sr.start = event.lineOffset + cursor;
                        sr.length = key[i].length();
                        sr.foreground = Display.getCurrent().getSystemColor(SWT.COLOR_BLUE);
                        list.add(sr);
                    }
                }
            }
            event.styles = list.toArray(new StyleRange[list.size()]);
        }
    });
}
项目:AndroidRobot    文件:LogLineStyleListener.java   
@Override
public void lineGetStyle(LineStyleEvent event) {
    List<StyleRange> styles = new ArrayList<StyleRange>();
    String line = event.lineText;
    if(line == null || line.trim().equals(""))
        return;
    if(line.startsWith(keywords[0])){
        //[���Կ�ʼ]
        styles.add(new StyleRange(event.lineOffset, line.length(), colorBlue, null, SWT.NORMAL));
    }else if(line.startsWith(keywords[1])){
        //[���Խ��]
        if(line.contains(keywords[2]))
            styles.add(new StyleRange(event.lineOffset, line.length(), colorRed, null, SWT.NORMAL));
        else if(line.contains(keywords[3]))
            styles.add(new StyleRange(event.lineOffset, line.length(), colorGreen, null, SWT.NORMAL));
    }else if(line.startsWith(keywords[4])){
        //[��Ϣ]
        styles.add(new StyleRange(0, line.length(), colorRed, null, SWT.BOLD));
    }else if(line.startsWith(keywords[5])){
        //[��ѯ]
        if(line.contains(keywords[2]))
            styles.add(new StyleRange(event.lineOffset, line.length(), colorRed, null, SWT.NORMAL));
        else if(line.contains(keywords[6]))
            styles.add(new StyleRange(event.lineOffset, line.length(), colorGreen, null, SWT.NORMAL));
    }

    event.styles = (StyleRange[]) styles.toArray(new StyleRange[0]);
}
项目:SPELL    文件:CustomStyledText.java   
@Override
/**************************************************************************
 * Callback from LineStyleListener interface for the styled text widget.
 * Used to set the text styles (bold, italic, etc)
 *************************************************************************/
public void lineGetStyle(LineStyleEvent event)
{
    /*
     * Icon style range
     */
    // This method basically establishes the glyph metrics required for
    // creating the leading blank space at the beginning of each line,
    // which will allow us to paint the icons later. Besides, the
    // corresponding line model is stored in the style range in order
    // to be utilized later on in paintObject().
    int lineIndex = m_view.getLineAtOffset(event.lineOffset);
    TextViewLine line = (TextViewLine) m_model.getLineObject(lineIndex);
    // We need to create a style rang for each line
    StyleRange bulletStyle = new StyleRange();
    // Reuse the same glyphmetrics, it never changes and we save memory and
    // creation time
    bulletStyle.metrics = s_metrics;
    bulletStyle.start = event.lineOffset;
    // Store the line model that will be used later for painting

    // NOT COMPATIBLE WITH ECLIPSE 3.3 --BEGIN
    // This is the corresponding line index
    // int lineIndex = m_model.getLineAtOffset(event.lineOffset);
    // theStyle.data = (TextViewLine) m_model.getLineObject(lineIndex);
    // NOT COMPATIBLE WITH ECLIPSE 3.3 --END
    event.bullet = new Bullet(ST.BULLET_CUSTOM, bulletStyle);

    TextStyle lineStyle = new TextStyle(null, null, null);
    lineStyle.foreground = m_labelProvider.getForegroundColor(line.getType(), line.getScope());
    StyleRange lineStyleRange = new StyleRange(lineStyle);
    lineStyleRange.start = event.lineOffset;
    lineStyleRange.length = event.lineText.length();
    lineStyleRange.fontStyle = m_labelProvider.getFontStyle(line.getScope());
    event.styles = new StyleRange[] { lineStyleRange };
}
项目:PDFReporter-Studio    文件:HwSwDetailsDialog.java   
@Override
public void lineGetStyle(LineStyleEvent event) {
    List<StyleRange> styles = new ArrayList<StyleRange>();

    for (int i = 0, n = event.lineText.length(); i < n; i++) {
        if (event.lineText.charAt(i) == ':') {
            styles.add(new StyleRange(event.lineOffset, i, null, null,
                    SWT.BOLD));
            break;
        }
    }
    event.styles = (StyleRange[]) styles.toArray(new StyleRange[0]);
}
项目:RepDev    文件:SyntaxHighlighter.java   
public void lineGetStyle(LineStyleEvent event) {
    ArrayList<Token> ltokens = parser.getLtokens();
    ArrayList<StyleRange> ranges = new ArrayList<StyleRange>();

    int line = txt.getLineAtOffset(event.lineOffset);

    int ftoken;
    for (ftoken = 0; ftoken < ltokens.size(); ftoken++)
        if (ltokens.get(ftoken).getEnd() >= event.lineOffset)
            break;

    int ltoken = ltokens.size();
    if (line + 1 < txt.getLineCount()) {
        int pos = txt.getOffsetAtLine(line + 1);

        for (ltoken = ftoken; ltoken < ltokens.size(); ltoken++)
            if (ltokens.get(ltoken).getStart() > pos)
                break;
    }

    for (int i = ftoken; i < ltoken; i++){
        StyleRange range = getStyle(ltokens.get(i));            
        ranges.add(range);

        //If we are a backgroudn highlighted token, and a CODE SNIPPET one, then connect the highlighting over whitespace between tokens
        if( ltokens.get(i).getBackgroundReason() == SpecialBackgroundReason.CODE_SNIPPET )
            if( i + 1 < ltoken && ltokens.get(i+1).getBackgroundReason() == SpecialBackgroundReason.CODE_SNIPPET && ltokens.get(i+1).getSnippetVar() == ltokens.get(i).getSnippetVar())
                ranges.add(new StyleRange(ltokens.get(i).getEnd(),ltokens.get(i+1).getStart()-ltokens.get(i).getEnd(),null,ltokens.get(i).getSpecialBackground()));
    }

    StyleRange[] rangesArray = new StyleRange[ranges.size()];

    event.styles = ranges.toArray(rangesArray);
}
项目:gradle4eclipse    文件:GradleLineStyleListener.java   
public void lineGetStyle(LineStyleEvent lineStyle) {
    // make all upper case lines bold
    if (lineStyle.lineText != null && lineStyle.lineText.length() != 0) {
        if (lineStyle.lineText.equals(lineStyle.lineText.toUpperCase()))
            if (lineStyle.styles!= null && lineStyle.styles.length != 0)
                lineStyle.styles[0].fontStyle = 1; // bold
    }
}
项目:TranskribusSwtGui    文件:SearchStyleText.java   
public SearchStyleText() {
  shell.setLayout(new GridLayout(2, false));

  styledText = new StyledText(shell, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
  GridData gridData = new GridData(GridData.FILL_BOTH);
  gridData.horizontalSpan = 2;    
  styledText.setLayoutData(gridData);

  keywordText = new Text(shell, SWT.SINGLE | SWT.BORDER);
  keywordText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  Font font = new Font(shell.getDisplay(), "Courier New", 12, SWT.NORMAL);
  styledText.setFont(font);

  button = new Button(shell, SWT.PUSH);
  button.setText("Search");
  button.addSelectionListener(new SelectionAdapter() {
    public void widgetSelected(SelectionEvent e) {
      keyword = keywordText.getText();
      styledText.redraw();
    }
  });

  styledText.addLineStyleListener(new LineStyleListener() {
    public void lineGetStyle(LineStyleEvent event) {
      if(keyword == null || keyword.length() == 0) {
        event.styles = new StyleRange[0];
        return;
      }

      String line = event.lineText;
      int cursor = -1;

      LinkedList list = new LinkedList();
      while( (cursor = line.indexOf(keyword, cursor+1)) >= 0) {
        list.add(getHighlightStyle(event.lineOffset+cursor, keyword.length()));
      }

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

  keyword = "SW";

  styledText.setText("AWT, SWING \r\nSWT & JFACE");

  shell.pack();
  shell.open();
  //textUser.forceFocus();

  // Set up the event loop.
  while (!shell.isDisposed()) {
    if (!display.readAndDispatch()) {
      // If no more entries in event queue
      display.sleep();
    }
  }

  display.dispose();
}
项目:tesb-studio-se    文件:AnsiConsoleStyleListener.java   
@Override
public void lineGetStyle(LineStyleEvent event) {
    if (event == null || event.lineText == null || event.lineText.length() == 0)
        return;

    StyleRange defStyle;

    if (event.styles != null && event.styles.length > 0) {
        defStyle = (StyleRange) event.styles[0].clone();
        if (defStyle.background == null)
            defStyle.background = AnsiConsoleUtils.getDebugConsoleBgColor();
    } else {
        defStyle = new StyleRange(1, lastRangeEnd, new Color(null, AnsiConsoleColorPalette.getColor(0)), new Color(null,
                AnsiConsoleColorPalette.getColor(15)), SWT.NORMAL);
    }

    lastRangeEnd = 0;
    List<StyleRange> ranges = new ArrayList<StyleRange>();
    String currentText = event.lineText;
    Matcher matcher = pattern.matcher(currentText);
    while (matcher.find()) {
        int start = matcher.start();
        int end = matcher.end();

        String theEscape = currentText.substring(matcher.start() + 2, matcher.end() - 1);
        char code = currentText.charAt(matcher.end() - 1);
        if (code == ESCAPE_SGR) {
            // Select Graphic Rendition (SGR) escape sequence
            List<Integer> nCommands = new ArrayList<Integer>();
            for (String cmd : theEscape.split(";")) {
                int nCmd = AnsiConsoleUtils.tryParseInteger(cmd);
                if (nCmd != -1)
                    nCommands.add(nCmd);
            }
            if (nCommands.isEmpty())
                nCommands.add(0);
            interpretCommand(nCommands);
        }

        if (lastRangeEnd != start)
            addRange(ranges, event.lineOffset + lastRangeEnd, start - lastRangeEnd, defStyle.foreground, false);
        lastAttributes = currentAttributes.clone();

        addRange(ranges, event.lineOffset + start, end - start, defStyle.foreground, true);
    }
    if (lastRangeEnd != currentText.length())
        addRange(ranges, event.lineOffset + lastRangeEnd, currentText.length() - lastRangeEnd, defStyle.foreground, false);
    lastAttributes = currentAttributes.clone();

    if (!ranges.isEmpty())
        event.styles = ranges.toArray(new StyleRange[ranges.size()]);
}
项目:geokettle-2.0    文件:ScriptValuesHighlight.java   
/**
 * Event.detail         line start offset (input)   
 * Event.text           line text (input)
 * LineStyleEvent.styles    Enumeration of StyleRanges, need to be in order. (output)
 * LineStyleEvent.background    line background color (output)
 */
public void lineGetStyle(LineStyleEvent event) {
    Vector<StyleRange> styles = new Vector<StyleRange>();
    int token;
    StyleRange lastStyle;

    if (inBlockComment(event.lineOffset, event.lineOffset + event.lineText.length())) {
        styles.addElement(new StyleRange(event.lineOffset, event.lineText.length()+4, colors[2], null));
        event.styles = new StyleRange[styles.size()];
        styles.copyInto(event.styles);
        return;
    }
    scanner.setRange(event.lineText);
    String xs = ((StyledText)event.widget).getText();
    if(xs!=null) parseBlockComments(xs);
    token = scanner.nextToken();
    while (token != EOF) {
        if (token == OTHER) {
            // do nothing
        } else if ((token == WHITE) && (!styles.isEmpty())) {
            int start = scanner.getStartOffset() + event.lineOffset;
            lastStyle = (StyleRange)styles.lastElement();
            if (lastStyle.fontStyle != SWT.NORMAL) {
                if (lastStyle.start + lastStyle.length == start) {
                    // have the white space take on the style before it to minimize font style
                    // changes
                    lastStyle.length += scanner.getLength();
                }
            }
        } else {        
            Color color = getColor(token);
            if (color != colors[0]) {       // hardcoded default foreground color, black
                StyleRange style = new StyleRange(scanner.getStartOffset() + event.lineOffset, scanner.getLength(), color, null);
                if (token == KEY) {
                    style.fontStyle = SWT.BOLD;
                }
                if (styles.isEmpty()) {
                    styles.addElement(style);
                } else {
                    lastStyle = (StyleRange)styles.lastElement();
                    if (lastStyle.similarTo(style) && (lastStyle.start + lastStyle.length == style.start)) {
                        lastStyle.length += style.length;
                    } else {
                        styles.addElement(style); 
                    }
                } 
            } 
        }
        token= scanner.nextToken();
    }
    event.styles = new StyleRange[styles.size()];
    styles.copyInto(event.styles);
}
项目:geokettle-2.0    文件:SQLValuesHighlight.java   
/**
 * Event.detail         line start offset (input)   
 * Event.text           line text (input)
 * LineStyleEvent.styles    Enumeration of StyleRanges, need to be in order. (output)
 * LineStyleEvent.background    line background color (output)
 */
public void lineGetStyle(LineStyleEvent event) {
    Vector<StyleRange> styles = new Vector<StyleRange>();
    int token;
    StyleRange lastStyle;

    if (inBlockComment(event.lineOffset, event.lineOffset + event.lineText.length())) {
        styles.addElement(new StyleRange(event.lineOffset, event.lineText.length()+4, colors[1], null));
        event.styles = new StyleRange[styles.size()];
        styles.copyInto(event.styles);
        return;
    }
    scanner.setRange(event.lineText);
    String xs = ((StyledText)event.widget).getText();
    if(xs!=null) parseBlockComments(xs);
    token = scanner.nextToken();
    while (token != EOF) {
        if (token == OTHER) {
            // do nothing
        } else if ((token == WHITE) && (!styles.isEmpty())) {
            int start = scanner.getStartOffset() + event.lineOffset;
            lastStyle = (StyleRange)styles.lastElement();
            if (lastStyle.fontStyle != SWT.NORMAL) {
                if (lastStyle.start + lastStyle.length == start) {
                    // have the white space take on the style before it to minimize font style
                    // changes
                    lastStyle.length += scanner.getLength();
                }
            }
        } else {        
            Color color = getColor(token);
            if (color != colors[0]) {       // hardcoded default foreground color, black
                StyleRange style = new StyleRange(scanner.getStartOffset() + event.lineOffset, scanner.getLength(), color, null);
                if (token == KEY) {
                    style.fontStyle = SWT.BOLD;
                }
                if (styles.isEmpty()) {
                    styles.addElement(style);
                } else {
                    lastStyle = (StyleRange)styles.lastElement();
                    if (lastStyle.similarTo(style) && (lastStyle.start + lastStyle.length == style.start)) {
                        lastStyle.length += style.length;
                    } else {
                        styles.addElement(style); 
                    }
                } 
            } 
        }
        token= scanner.nextToken();
    }
    event.styles = new StyleRange[styles.size()];
    styles.copyInto(event.styles);
}
项目:geokettle-2.0    文件:MDXValuesHighlight.java   
/**
 * Event.detail         line start offset (input)   
 * Event.text           line text (input)
 * LineStyleEvent.styles    Enumeration of StyleRanges, need to be in order. (output)
 * LineStyleEvent.background    line background color (output)
 */
public void lineGetStyle(LineStyleEvent event) {
    Vector<StyleRange> styles = new Vector<StyleRange>();
    int token;
    StyleRange lastStyle;

    if (inBlockComment(event.lineOffset, event.lineOffset + event.lineText.length())) {
        styles.addElement(new StyleRange(event.lineOffset, event.lineText.length()+4, colors[1], null));
        event.styles = new StyleRange[styles.size()];
        styles.copyInto(event.styles);
        return;
    }
    scanner.setRange(event.lineText);
    String xs = ((StyledText)event.widget).getText();
    if(xs!=null) parseBlockComments(xs);
    token = scanner.nextToken();
    while (token != EOF) {
        if (token == OTHER) {
            // do nothing
        } else if ((token == WHITE) && (!styles.isEmpty())) {
            int start = scanner.getStartOffset() + event.lineOffset;
            lastStyle = (StyleRange)styles.lastElement();
            if (lastStyle.fontStyle != SWT.NORMAL) {
                if (lastStyle.start + lastStyle.length == start) {
                    // have the white space take on the style before it to minimize font style
                    // changes
                    lastStyle.length += scanner.getLength();
                }
            }
        } else {        
            Color color = getColor(token);
            if (color != colors[0]) {       // hardcoded default foreground color, black
                StyleRange style = new StyleRange(scanner.getStartOffset() + event.lineOffset, scanner.getLength(), color, null);
                if (token == KEY) {
                    style.fontStyle = SWT.BOLD;
                }
                if (styles.isEmpty()) {
                    styles.addElement(style);
                } else {
                    lastStyle = (StyleRange)styles.lastElement();
                    if (lastStyle.similarTo(style) && (lastStyle.start + lastStyle.length == style.start)) {
                        lastStyle.length += style.length;
                    } else {
                        styles.addElement(style); 
                    }
                } 
            } 
        }
        token= scanner.nextToken();
    }
    event.styles = new StyleRange[styles.size()];
    styles.copyInto(event.styles);
}
项目:read-open-source-code    文件:ScriptHighlight.java   
/**
 * Event.detail         line start offset (input)   
 * Event.text           line text (input)
 * LineStyleEvent.styles    Enumeration of StyleRanges, need to be in order. (output)
 * LineStyleEvent.background    line background color (output)
 */
public void lineGetStyle(LineStyleEvent event) {
    Vector<StyleRange> styles = new Vector<StyleRange>();
    int token;
    StyleRange lastStyle;

    if (inBlockComment(event.lineOffset, event.lineOffset + event.lineText.length())) {
        styles.addElement(new StyleRange(event.lineOffset, event.lineText.length()+4, colors[2], null));
        event.styles = new StyleRange[styles.size()];
        styles.copyInto(event.styles);
        return;
    }
    scanner.setRange(event.lineText);
    String xs = ((StyledText)event.widget).getText();
    if(xs!=null) parseBlockComments(xs);
    token = scanner.nextToken();
    while (token != EOF) {
        if (token == OTHER) {
            // do nothing
        } else if ((token == WHITE) && (!styles.isEmpty())) {
            int start = scanner.getStartOffset() + event.lineOffset;
            lastStyle = (StyleRange)styles.lastElement();
            if (lastStyle.fontStyle != SWT.NORMAL) {
                if (lastStyle.start + lastStyle.length == start) {
                    // have the white space take on the style before it to minimize font style
                    // changes
                    lastStyle.length += scanner.getLength();
                }
            }
        } else {        
            Color color = getColor(token);
            if (color != colors[0]) {       // hardcoded default foreground color, black
                StyleRange style = new StyleRange(scanner.getStartOffset() + event.lineOffset, scanner.getLength(), color, null);
                if (token == KEY) {
                    style.fontStyle = SWT.BOLD;
                }
                if (styles.isEmpty()) {
                    styles.addElement(style);
                } else {
                    lastStyle = (StyleRange)styles.lastElement();
                    if (lastStyle.similarTo(style) && (lastStyle.start + lastStyle.length == style.start)) {
                        lastStyle.length += style.length;
                    } else {
                        styles.addElement(style); 
                    }
                } 
            } 
        }
        token= scanner.nextToken();
    }
    event.styles = new StyleRange[styles.size()];
    styles.copyInto(event.styles);
}
项目:read-open-source-code    文件:ScriptValuesHighlight.java   
/**
 * Event.detail         line start offset (input)   
 * Event.text           line text (input)
 * LineStyleEvent.styles    Enumeration of StyleRanges, need to be in order. (output)
 * LineStyleEvent.background    line background color (output)
 */
public void lineGetStyle(LineStyleEvent event) {
    Vector<StyleRange> styles = new Vector<StyleRange>();
    int token;
    StyleRange lastStyle;

    if (inBlockComment(event.lineOffset, event.lineOffset + event.lineText.length())) {
        styles.addElement(new StyleRange(event.lineOffset, event.lineText.length()+4, colors[2], null));
        event.styles = new StyleRange[styles.size()];
        styles.copyInto(event.styles);
        return;
    }
    scanner.setRange(event.lineText);
    String xs = ((StyledText)event.widget).getText();
    if(xs!=null) parseBlockComments(xs);
    token = scanner.nextToken();
    while (token != EOF) {
        if (token == OTHER) {
            // do nothing
        } else if ((token == WHITE) && (!styles.isEmpty())) {
            int start = scanner.getStartOffset() + event.lineOffset;
            lastStyle = (StyleRange)styles.lastElement();
            if (lastStyle.fontStyle != SWT.NORMAL) {
                if (lastStyle.start + lastStyle.length == start) {
                    // have the white space take on the style before it to minimize font style
                    // changes
                    lastStyle.length += scanner.getLength();
                }
            }
        } else {        
            Color color = getColor(token);
            if (color != colors[0]) {       // hardcoded default foreground color, black
                StyleRange style = new StyleRange(scanner.getStartOffset() + event.lineOffset, scanner.getLength(), color, null);
                if (token == KEY) {
                    style.fontStyle = SWT.BOLD;
                }
                if (styles.isEmpty()) {
                    styles.addElement(style);
                } else {
                    lastStyle = (StyleRange)styles.lastElement();
                    if (lastStyle.similarTo(style) && (lastStyle.start + lastStyle.length == style.start)) {
                        lastStyle.length += style.length;
                    } else {
                        styles.addElement(style); 
                    }
                } 
            } 
        }
        token= scanner.nextToken();
    }
    event.styles = new StyleRange[styles.size()];
    styles.copyInto(event.styles);
}
项目:read-open-source-code    文件:UserDefinedJavaClassHighlight.java   
/**
 * Event.detail         line start offset (input)   
 * Event.text           line text (input)
 * LineStyleEvent.styles    Enumeration of StyleRanges, need to be in order. (output)
 * LineStyleEvent.background    line background color (output)
 */
public void lineGetStyle(LineStyleEvent event) {
    Vector<StyleRange> styles = new Vector<StyleRange>();
    int token;
    StyleRange lastStyle;

    if (inBlockComment(event.lineOffset, event.lineOffset + event.lineText.length())) {
        styles.addElement(new StyleRange(event.lineOffset, event.lineText.length()+4, colors[2], null));
        event.styles = new StyleRange[styles.size()];
        styles.copyInto(event.styles);
        return;
    }
    scanner.setRange(event.lineText);
    String xs = ((StyledText)event.widget).getText();
    if(xs!=null) parseBlockComments(xs);
    token = scanner.nextToken();
    while (token != EOF) {
        if (token == OTHER) {
            // do nothing
        } else if ((token == WHITE) && (!styles.isEmpty())) {
            int start = scanner.getStartOffset() + event.lineOffset;
            lastStyle = (StyleRange)styles.lastElement();
            if (lastStyle.fontStyle != SWT.NORMAL) {
                if (lastStyle.start + lastStyle.length == start) {
                    // have the white space take on the style before it to minimize font style
                    // changes
                    lastStyle.length += scanner.getLength();
                }
            }
        } else {        
            Color color = getColor(token);
            if (color != colors[0]) {       // hardcoded default foreground color, black
                StyleRange style = new StyleRange(scanner.getStartOffset() + event.lineOffset, scanner.getLength(), color, null);
                if (token == KEY) {
                    style.fontStyle = SWT.BOLD;
                }
                if (styles.isEmpty()) {
                    styles.addElement(style);
                } else {
                    lastStyle = (StyleRange)styles.lastElement();
                    if (lastStyle.similarTo(style) && (lastStyle.start + lastStyle.length == style.start)) {
                        lastStyle.length += style.length;
                    } else {
                        styles.addElement(style); 
                    }
                } 
            } 
        }
        token= scanner.nextToken();
    }
    event.styles = new StyleRange[styles.size()];
    styles.copyInto(event.styles);
}
项目:read-open-source-code    文件:MDXValuesHighlight.java   
/**
 * Event.detail         line start offset (input)   
 * Event.text           line text (input)
 * LineStyleEvent.styles    Enumeration of StyleRanges, need to be in order. (output)
 * LineStyleEvent.background    line background color (output)
 */
public void lineGetStyle(LineStyleEvent event) {
    Vector<StyleRange> styles = new Vector<StyleRange>();
    int token;
    StyleRange lastStyle;

    if (inBlockComment(event.lineOffset, event.lineOffset + event.lineText.length())) {
        styles.addElement(new StyleRange(event.lineOffset, event.lineText.length()+4, colors[1], null));
        event.styles = new StyleRange[styles.size()];
        styles.copyInto(event.styles);
        return;
    }
    scanner.setRange(event.lineText);
    String xs = ((StyledText)event.widget).getText();
    if(xs!=null) parseBlockComments(xs);
    token = scanner.nextToken();
    while (token != EOF) {
        if (token == OTHER) {
            // do nothing
        } else if ((token == WHITE) && (!styles.isEmpty())) {
            int start = scanner.getStartOffset() + event.lineOffset;
            lastStyle = (StyleRange)styles.lastElement();
            if (lastStyle.fontStyle != SWT.NORMAL) {
                if (lastStyle.start + lastStyle.length == start) {
                    // have the white space take on the style before it to minimize font style
                    // changes
                    lastStyle.length += scanner.getLength();
                }
            }
        } else {        
            Color color = getColor(token);
            if (color != colors[0]) {       // hardcoded default foreground color, black
                StyleRange style = new StyleRange(scanner.getStartOffset() + event.lineOffset, scanner.getLength(), color, null);
                if (token == KEY) {
                    //style.fontStyle = SWT.BOLD;
                }
                if (styles.isEmpty()) {
                    styles.addElement(style);
                } else {
                    lastStyle = (StyleRange)styles.lastElement();
                    if (lastStyle.similarTo(style) && (lastStyle.start + lastStyle.length == style.start)) {
                        lastStyle.length += style.length;
                    } else {
                        styles.addElement(style); 
                    }
                } 
            } 
        }
        token= scanner.nextToken();
    }
    event.styles = new StyleRange[styles.size()];
    styles.copyInto(event.styles);
}
项目:read-open-source-code    文件:SQLValuesHighlight.java   
/**
 * Event.detail         line start offset (input)   
 * Event.text           line text (input)
 * LineStyleEvent.styles    Enumeration of StyleRanges, need to be in order. (output)
 * LineStyleEvent.background    line background color (output)
 */
public void lineGetStyle(LineStyleEvent event) {
    Vector<StyleRange> styles = new Vector<StyleRange>();
    int token;
    StyleRange lastStyle;

    if (inBlockComment(event.lineOffset, event.lineOffset + event.lineText.length())) {
        styles.addElement(new StyleRange(event.lineOffset, event.lineText.length()+4, colors[1], null));
        event.styles = new StyleRange[styles.size()];
        styles.copyInto(event.styles);
        return;
    }
    scanner.setRange(event.lineText);
    String xs = ((StyledText)event.widget).getText();
    if(xs!=null) parseBlockComments(xs);
    token = scanner.nextToken();
    while (token != EOF) {
        if (token == OTHER) {
            // do nothing
        } else if ((token == WHITE) && (!styles.isEmpty())) {
            int start = scanner.getStartOffset() + event.lineOffset;
            lastStyle = (StyleRange)styles.lastElement();
            if (lastStyle.fontStyle != SWT.NORMAL) {
                if (lastStyle.start + lastStyle.length == start) {
                    // have the white space take on the style before it to minimize font style
                    // changes
                    lastStyle.length += scanner.getLength();
                }
            }
        } else {        
            Color color = getColor(token);
            if (color != colors[0]) {       // hardcoded default foreground color, black
                StyleRange style = new StyleRange(scanner.getStartOffset() + event.lineOffset, scanner.getLength(), color, null);
                if (token == KEY) {
                    //style.fontStyle = SWT.BOLD;
                }
                if (styles.isEmpty()) {
                    styles.addElement(style);
                } else {
                    lastStyle = (StyleRange)styles.lastElement();
                    if (lastStyle.similarTo(style) && (lastStyle.start + lastStyle.length == style.start)) {
                        lastStyle.length += style.length;
                    } else {
                        styles.addElement(style); 
                    }
                } 
            } 
        }
        token= scanner.nextToken();
    }
    event.styles = new StyleRange[styles.size()];
    styles.copyInto(event.styles);
}
项目:read-open-source-code    文件:MDXValuesHighlight.java   
/**
 * Event.detail         line start offset (input)   
 * Event.text           line text (input)
 * LineStyleEvent.styles    Enumeration of StyleRanges, need to be in order. (output)
 * LineStyleEvent.background    line background color (output)
 */
public void lineGetStyle(LineStyleEvent event) {
    Vector<StyleRange> styles = new Vector<StyleRange>();
    int token;
    StyleRange lastStyle;

    if (inBlockComment(event.lineOffset, event.lineOffset + event.lineText.length())) {
        styles.addElement(new StyleRange(event.lineOffset, event.lineText.length()+4, colors[1], null));
        event.styles = new StyleRange[styles.size()];
        styles.copyInto(event.styles);
        return;
    }
    scanner.setRange(event.lineText);
    String xs = ((StyledText)event.widget).getText();
    if(xs!=null) parseBlockComments(xs);
    token = scanner.nextToken();
    while (token != EOF) {
        if (token == OTHER) {
            // do nothing
        } else if ((token == WHITE) && (!styles.isEmpty())) {
            int start = scanner.getStartOffset() + event.lineOffset;
            lastStyle = (StyleRange)styles.lastElement();
            if (lastStyle.fontStyle != SWT.NORMAL) {
                if (lastStyle.start + lastStyle.length == start) {
                    // have the white space take on the style before it to minimize font style
                    // changes
                    lastStyle.length += scanner.getLength();
                }
            }
        } else {        
            Color color = getColor(token);
            if (color != colors[0]) {       // hardcoded default foreground color, black
                StyleRange style = new StyleRange(scanner.getStartOffset() + event.lineOffset, scanner.getLength(), color, null);
                if (token == KEY) {
                    //style.fontStyle = SWT.BOLD;
                }
                if (styles.isEmpty()) {
                    styles.addElement(style);
                } else {
                    lastStyle = (StyleRange)styles.lastElement();
                    if (lastStyle.similarTo(style) && (lastStyle.start + lastStyle.length == style.start)) {
                        lastStyle.length += style.length;
                    } else {
                        styles.addElement(style); 
                    }
                } 
            } 
        }
        token= scanner.nextToken();
    }
    event.styles = new StyleRange[styles.size()];
    styles.copyInto(event.styles);
}
项目:read-open-source-code    文件:SOQLValuesHighlight.java   
/**
 * Event.detail         line start offset (input)   
 * Event.text           line text (input)
 * LineStyleEvent.styles    Enumeration of StyleRanges, need to be in order. (output)
 * LineStyleEvent.background    line background color (output)
 */
public void lineGetStyle(LineStyleEvent event) {
    Vector<StyleRange> styles = new Vector<StyleRange>();
    int token;
    StyleRange lastStyle;

    if (inBlockComment(event.lineOffset, event.lineOffset + event.lineText.length())) {
        styles.addElement(new StyleRange(event.lineOffset, event.lineText.length()+4, colors[1], null));
        event.styles = new StyleRange[styles.size()];
        styles.copyInto(event.styles);
        return;
    }
    scanner.setRange(event.lineText);
    String xs = ((StyledText)event.widget).getText();
    if(xs!=null) parseBlockComments(xs);
    token = scanner.nextToken();
    while (token != EOF) {
        if (token == OTHER) {
            // do nothing
        } else if ((token == WHITE) && (!styles.isEmpty())) {
            int start = scanner.getStartOffset() + event.lineOffset;
            lastStyle = (StyleRange)styles.lastElement();
            if (lastStyle.fontStyle != SWT.NORMAL) {
                if (lastStyle.start + lastStyle.length == start) {
                    // have the white space take on the style before it to minimize font style
                    // changes
                    lastStyle.length += scanner.getLength();
                }
            }
        } else {        
            Color color = getColor(token);
            if (color != colors[0]) {       // hardcoded default foreground color, black
                StyleRange style = new StyleRange(scanner.getStartOffset() + event.lineOffset, scanner.getLength(), color, null);
                if (token == KEY) {
                    //style.fontStyle = SWT.BOLD;
                }
                if (styles.isEmpty()) {
                    styles.addElement(style);
                } else {
                    lastStyle = (StyleRange)styles.lastElement();
                    if (lastStyle.similarTo(style) && (lastStyle.start + lastStyle.length == style.start)) {
                        lastStyle.length += style.length;
                    } else {
                        styles.addElement(style); 
                    }
                } 
            } 
        }
        token= scanner.nextToken();
    }
    event.styles = new StyleRange[styles.size()];
    styles.copyInto(event.styles);
}
项目:kettle-4.4.0-stable    文件:ScriptHighlight.java   
/**
 * Event.detail         line start offset (input)   
 * Event.text           line text (input)
 * LineStyleEvent.styles    Enumeration of StyleRanges, need to be in order. (output)
 * LineStyleEvent.background    line background color (output)
 */
public void lineGetStyle(LineStyleEvent event) {
    Vector<StyleRange> styles = new Vector<StyleRange>();
    int token;
    StyleRange lastStyle;

    if (inBlockComment(event.lineOffset, event.lineOffset + event.lineText.length())) {
        styles.addElement(new StyleRange(event.lineOffset, event.lineText.length()+4, colors[2], null));
        event.styles = new StyleRange[styles.size()];
        styles.copyInto(event.styles);
        return;
    }
    scanner.setRange(event.lineText);
    String xs = ((StyledText)event.widget).getText();
    if(xs!=null) parseBlockComments(xs);
    token = scanner.nextToken();
    while (token != EOF) {
        if (token == OTHER) {
            // do nothing
        } else if ((token == WHITE) && (!styles.isEmpty())) {
            int start = scanner.getStartOffset() + event.lineOffset;
            lastStyle = (StyleRange)styles.lastElement();
            if (lastStyle.fontStyle != SWT.NORMAL) {
                if (lastStyle.start + lastStyle.length == start) {
                    // have the white space take on the style before it to minimize font style
                    // changes
                    lastStyle.length += scanner.getLength();
                }
            }
        } else {        
            Color color = getColor(token);
            if (color != colors[0]) {       // hardcoded default foreground color, black
                StyleRange style = new StyleRange(scanner.getStartOffset() + event.lineOffset, scanner.getLength(), color, null);
                if (token == KEY) {
                    style.fontStyle = SWT.BOLD;
                }
                if (styles.isEmpty()) {
                    styles.addElement(style);
                } else {
                    lastStyle = (StyleRange)styles.lastElement();
                    if (lastStyle.similarTo(style) && (lastStyle.start + lastStyle.length == style.start)) {
                        lastStyle.length += style.length;
                    } else {
                        styles.addElement(style); 
                    }
                } 
            } 
        }
        token= scanner.nextToken();
    }
    event.styles = new StyleRange[styles.size()];
    styles.copyInto(event.styles);
}
项目:kettle-4.4.0-stable    文件:ScriptValuesHighlight.java   
/**
 * Event.detail         line start offset (input)   
 * Event.text           line text (input)
 * LineStyleEvent.styles    Enumeration of StyleRanges, need to be in order. (output)
 * LineStyleEvent.background    line background color (output)
 */
public void lineGetStyle(LineStyleEvent event) {
    Vector<StyleRange> styles = new Vector<StyleRange>();
    int token;
    StyleRange lastStyle;

    if (inBlockComment(event.lineOffset, event.lineOffset + event.lineText.length())) {
        styles.addElement(new StyleRange(event.lineOffset, event.lineText.length()+4, colors[2], null));
        event.styles = new StyleRange[styles.size()];
        styles.copyInto(event.styles);
        return;
    }
    scanner.setRange(event.lineText);
    String xs = ((StyledText)event.widget).getText();
    if(xs!=null) parseBlockComments(xs);
    token = scanner.nextToken();
    while (token != EOF) {
        if (token == OTHER) {
            // do nothing
        } else if ((token == WHITE) && (!styles.isEmpty())) {
            int start = scanner.getStartOffset() + event.lineOffset;
            lastStyle = (StyleRange)styles.lastElement();
            if (lastStyle.fontStyle != SWT.NORMAL) {
                if (lastStyle.start + lastStyle.length == start) {
                    // have the white space take on the style before it to minimize font style
                    // changes
                    lastStyle.length += scanner.getLength();
                }
            }
        } else {        
            Color color = getColor(token);
            if (color != colors[0]) {       // hardcoded default foreground color, black
                StyleRange style = new StyleRange(scanner.getStartOffset() + event.lineOffset, scanner.getLength(), color, null);
                if (token == KEY) {
                    style.fontStyle = SWT.BOLD;
                }
                if (styles.isEmpty()) {
                    styles.addElement(style);
                } else {
                    lastStyle = (StyleRange)styles.lastElement();
                    if (lastStyle.similarTo(style) && (lastStyle.start + lastStyle.length == style.start)) {
                        lastStyle.length += style.length;
                    } else {
                        styles.addElement(style); 
                    }
                } 
            } 
        }
        token= scanner.nextToken();
    }
    event.styles = new StyleRange[styles.size()];
    styles.copyInto(event.styles);
}
项目:kettle-4.4.0-stable    文件:UserDefinedJavaClassHighlight.java   
/**
 * Event.detail         line start offset (input)   
 * Event.text           line text (input)
 * LineStyleEvent.styles    Enumeration of StyleRanges, need to be in order. (output)
 * LineStyleEvent.background    line background color (output)
 */
public void lineGetStyle(LineStyleEvent event) {
    Vector<StyleRange> styles = new Vector<StyleRange>();
    int token;
    StyleRange lastStyle;

    if (inBlockComment(event.lineOffset, event.lineOffset + event.lineText.length())) {
        styles.addElement(new StyleRange(event.lineOffset, event.lineText.length()+4, colors[2], null));
        event.styles = new StyleRange[styles.size()];
        styles.copyInto(event.styles);
        return;
    }
    scanner.setRange(event.lineText);
    String xs = ((StyledText)event.widget).getText();
    if(xs!=null) parseBlockComments(xs);
    token = scanner.nextToken();
    while (token != EOF) {
        if (token == OTHER) {
            // do nothing
        } else if ((token == WHITE) && (!styles.isEmpty())) {
            int start = scanner.getStartOffset() + event.lineOffset;
            lastStyle = (StyleRange)styles.lastElement();
            if (lastStyle.fontStyle != SWT.NORMAL) {
                if (lastStyle.start + lastStyle.length == start) {
                    // have the white space take on the style before it to minimize font style
                    // changes
                    lastStyle.length += scanner.getLength();
                }
            }
        } else {        
            Color color = getColor(token);
            if (color != colors[0]) {       // hardcoded default foreground color, black
                StyleRange style = new StyleRange(scanner.getStartOffset() + event.lineOffset, scanner.getLength(), color, null);
                if (token == KEY) {
                    style.fontStyle = SWT.BOLD;
                }
                if (styles.isEmpty()) {
                    styles.addElement(style);
                } else {
                    lastStyle = (StyleRange)styles.lastElement();
                    if (lastStyle.similarTo(style) && (lastStyle.start + lastStyle.length == style.start)) {
                        lastStyle.length += style.length;
                    } else {
                        styles.addElement(style); 
                    }
                } 
            } 
        }
        token= scanner.nextToken();
    }
    event.styles = new StyleRange[styles.size()];
    styles.copyInto(event.styles);
}
项目:kettle-4.4.0-stable    文件:MDXValuesHighlight.java   
/**
 * Event.detail         line start offset (input)   
 * Event.text           line text (input)
 * LineStyleEvent.styles    Enumeration of StyleRanges, need to be in order. (output)
 * LineStyleEvent.background    line background color (output)
 */
public void lineGetStyle(LineStyleEvent event) {
    Vector<StyleRange> styles = new Vector<StyleRange>();
    int token;
    StyleRange lastStyle;

    if (inBlockComment(event.lineOffset, event.lineOffset + event.lineText.length())) {
        styles.addElement(new StyleRange(event.lineOffset, event.lineText.length()+4, colors[1], null));
        event.styles = new StyleRange[styles.size()];
        styles.copyInto(event.styles);
        return;
    }
    scanner.setRange(event.lineText);
    String xs = ((StyledText)event.widget).getText();
    if(xs!=null) parseBlockComments(xs);
    token = scanner.nextToken();
    while (token != EOF) {
        if (token == OTHER) {
            // do nothing
        } else if ((token == WHITE) && (!styles.isEmpty())) {
            int start = scanner.getStartOffset() + event.lineOffset;
            lastStyle = (StyleRange)styles.lastElement();
            if (lastStyle.fontStyle != SWT.NORMAL) {
                if (lastStyle.start + lastStyle.length == start) {
                    // have the white space take on the style before it to minimize font style
                    // changes
                    lastStyle.length += scanner.getLength();
                }
            }
        } else {        
            Color color = getColor(token);
            if (color != colors[0]) {       // hardcoded default foreground color, black
                StyleRange style = new StyleRange(scanner.getStartOffset() + event.lineOffset, scanner.getLength(), color, null);
                if (token == KEY) {
                    //style.fontStyle = SWT.BOLD;
                }
                if (styles.isEmpty()) {
                    styles.addElement(style);
                } else {
                    lastStyle = (StyleRange)styles.lastElement();
                    if (lastStyle.similarTo(style) && (lastStyle.start + lastStyle.length == style.start)) {
                        lastStyle.length += style.length;
                    } else {
                        styles.addElement(style); 
                    }
                } 
            } 
        }
        token= scanner.nextToken();
    }
    event.styles = new StyleRange[styles.size()];
    styles.copyInto(event.styles);
}
项目:kettle-4.4.0-stable    文件:SQLValuesHighlight.java   
/**
 * Event.detail         line start offset (input)   
 * Event.text           line text (input)
 * LineStyleEvent.styles    Enumeration of StyleRanges, need to be in order. (output)
 * LineStyleEvent.background    line background color (output)
 */
public void lineGetStyle(LineStyleEvent event) {
    Vector<StyleRange> styles = new Vector<StyleRange>();
    int token;
    StyleRange lastStyle;

    if (inBlockComment(event.lineOffset, event.lineOffset + event.lineText.length())) {
        styles.addElement(new StyleRange(event.lineOffset, event.lineText.length()+4, colors[1], null));
        event.styles = new StyleRange[styles.size()];
        styles.copyInto(event.styles);
        return;
    }
    scanner.setRange(event.lineText);
    String xs = ((StyledText)event.widget).getText();
    if(xs!=null) parseBlockComments(xs);
    token = scanner.nextToken();
    while (token != EOF) {
        if (token == OTHER) {
            // do nothing
        } else if ((token == WHITE) && (!styles.isEmpty())) {
            int start = scanner.getStartOffset() + event.lineOffset;
            lastStyle = (StyleRange)styles.lastElement();
            if (lastStyle.fontStyle != SWT.NORMAL) {
                if (lastStyle.start + lastStyle.length == start) {
                    // have the white space take on the style before it to minimize font style
                    // changes
                    lastStyle.length += scanner.getLength();
                }
            }
        } else {        
            Color color = getColor(token);
            if (color != colors[0]) {       // hardcoded default foreground color, black
                StyleRange style = new StyleRange(scanner.getStartOffset() + event.lineOffset, scanner.getLength(), color, null);
                if (token == KEY) {
                    //style.fontStyle = SWT.BOLD;
                }
                if (styles.isEmpty()) {
                    styles.addElement(style);
                } else {
                    lastStyle = (StyleRange)styles.lastElement();
                    if (lastStyle.similarTo(style) && (lastStyle.start + lastStyle.length == style.start)) {
                        lastStyle.length += style.length;
                    } else {
                        styles.addElement(style); 
                    }
                } 
            } 
        }
        token= scanner.nextToken();
    }
    event.styles = new StyleRange[styles.size()];
    styles.copyInto(event.styles);
}
项目:kettle-4.4.0-stable    文件:MDXValuesHighlight.java   
/**
 * Event.detail         line start offset (input)   
 * Event.text           line text (input)
 * LineStyleEvent.styles    Enumeration of StyleRanges, need to be in order. (output)
 * LineStyleEvent.background    line background color (output)
 */
public void lineGetStyle(LineStyleEvent event) {
    Vector<StyleRange> styles = new Vector<StyleRange>();
    int token;
    StyleRange lastStyle;

    if (inBlockComment(event.lineOffset, event.lineOffset + event.lineText.length())) {
        styles.addElement(new StyleRange(event.lineOffset, event.lineText.length()+4, colors[1], null));
        event.styles = new StyleRange[styles.size()];
        styles.copyInto(event.styles);
        return;
    }
    scanner.setRange(event.lineText);
    String xs = ((StyledText)event.widget).getText();
    if(xs!=null) parseBlockComments(xs);
    token = scanner.nextToken();
    while (token != EOF) {
        if (token == OTHER) {
            // do nothing
        } else if ((token == WHITE) && (!styles.isEmpty())) {
            int start = scanner.getStartOffset() + event.lineOffset;
            lastStyle = (StyleRange)styles.lastElement();
            if (lastStyle.fontStyle != SWT.NORMAL) {
                if (lastStyle.start + lastStyle.length == start) {
                    // have the white space take on the style before it to minimize font style
                    // changes
                    lastStyle.length += scanner.getLength();
                }
            }
        } else {        
            Color color = getColor(token);
            if (color != colors[0]) {       // hardcoded default foreground color, black
                StyleRange style = new StyleRange(scanner.getStartOffset() + event.lineOffset, scanner.getLength(), color, null);
                if (token == KEY) {
                    //style.fontStyle = SWT.BOLD;
                }
                if (styles.isEmpty()) {
                    styles.addElement(style);
                } else {
                    lastStyle = (StyleRange)styles.lastElement();
                    if (lastStyle.similarTo(style) && (lastStyle.start + lastStyle.length == style.start)) {
                        lastStyle.length += style.length;
                    } else {
                        styles.addElement(style); 
                    }
                } 
            } 
        }
        token= scanner.nextToken();
    }
    event.styles = new StyleRange[styles.size()];
    styles.copyInto(event.styles);
}
项目:kettle-4.4.0-stable    文件:SOQLValuesHighlight.java   
/**
 * Event.detail         line start offset (input)   
 * Event.text           line text (input)
 * LineStyleEvent.styles    Enumeration of StyleRanges, need to be in order. (output)
 * LineStyleEvent.background    line background color (output)
 */
public void lineGetStyle(LineStyleEvent event) {
    Vector<StyleRange> styles = new Vector<StyleRange>();
    int token;
    StyleRange lastStyle;

    if (inBlockComment(event.lineOffset, event.lineOffset + event.lineText.length())) {
        styles.addElement(new StyleRange(event.lineOffset, event.lineText.length()+4, colors[1], null));
        event.styles = new StyleRange[styles.size()];
        styles.copyInto(event.styles);
        return;
    }
    scanner.setRange(event.lineText);
    String xs = ((StyledText)event.widget).getText();
    if(xs!=null) parseBlockComments(xs);
    token = scanner.nextToken();
    while (token != EOF) {
        if (token == OTHER) {
            // do nothing
        } else if ((token == WHITE) && (!styles.isEmpty())) {
            int start = scanner.getStartOffset() + event.lineOffset;
            lastStyle = (StyleRange)styles.lastElement();
            if (lastStyle.fontStyle != SWT.NORMAL) {
                if (lastStyle.start + lastStyle.length == start) {
                    // have the white space take on the style before it to minimize font style
                    // changes
                    lastStyle.length += scanner.getLength();
                }
            }
        } else {        
            Color color = getColor(token);
            if (color != colors[0]) {       // hardcoded default foreground color, black
                StyleRange style = new StyleRange(scanner.getStartOffset() + event.lineOffset, scanner.getLength(), color, null);
                if (token == KEY) {
                    //style.fontStyle = SWT.BOLD;
                }
                if (styles.isEmpty()) {
                    styles.addElement(style);
                } else {
                    lastStyle = (StyleRange)styles.lastElement();
                    if (lastStyle.similarTo(style) && (lastStyle.start + lastStyle.length == style.start)) {
                        lastStyle.length += style.length;
                    } else {
                        styles.addElement(style); 
                    }
                } 
            } 
        }
        token= scanner.nextToken();
    }
    event.styles = new StyleRange[styles.size()];
    styles.copyInto(event.styles);
}
项目:Pydev    文件:ScriptConsoleViewerWrapper.java   
public void lineGetStyle(LineStyleEvent event) {
    viewer.lineGetStyle(event);
}
项目:kettle-trunk    文件:ScriptHighlight.java   
/**
 * Event.detail         line start offset (input)   
 * Event.text           line text (input)
 * LineStyleEvent.styles    Enumeration of StyleRanges, need to be in order. (output)
 * LineStyleEvent.background    line background color (output)
 */
public void lineGetStyle(LineStyleEvent event) {
    Vector<StyleRange> styles = new Vector<StyleRange>();
    int token;
    StyleRange lastStyle;

    if (inBlockComment(event.lineOffset, event.lineOffset + event.lineText.length())) {
        styles.addElement(new StyleRange(event.lineOffset, event.lineText.length()+4, colors[2], null));
        event.styles = new StyleRange[styles.size()];
        styles.copyInto(event.styles);
        return;
    }
    scanner.setRange(event.lineText);
    String xs = ((StyledText)event.widget).getText();
    if(xs!=null) parseBlockComments(xs);
    token = scanner.nextToken();
    while (token != EOF) {
        if (token == OTHER) {
            // do nothing
        } else if ((token == WHITE) && (!styles.isEmpty())) {
            int start = scanner.getStartOffset() + event.lineOffset;
            lastStyle = (StyleRange)styles.lastElement();
            if (lastStyle.fontStyle != SWT.NORMAL) {
                if (lastStyle.start + lastStyle.length == start) {
                    // have the white space take on the style before it to minimize font style
                    // changes
                    lastStyle.length += scanner.getLength();
                }
            }
        } else {        
            Color color = getColor(token);
            if (color != colors[0]) {       // hardcoded default foreground color, black
                StyleRange style = new StyleRange(scanner.getStartOffset() + event.lineOffset, scanner.getLength(), color, null);
                if (token == KEY) {
                    style.fontStyle = SWT.BOLD;
                }
                if (styles.isEmpty()) {
                    styles.addElement(style);
                } else {
                    lastStyle = (StyleRange)styles.lastElement();
                    if (lastStyle.similarTo(style) && (lastStyle.start + lastStyle.length == style.start)) {
                        lastStyle.length += style.length;
                    } else {
                        styles.addElement(style); 
                    }
                } 
            } 
        }
        token= scanner.nextToken();
    }
    event.styles = new StyleRange[styles.size()];
    styles.copyInto(event.styles);
}
项目:kettle-trunk    文件:ScriptValuesHighlight.java   
/**
 * Event.detail         line start offset (input)   
 * Event.text           line text (input)
 * LineStyleEvent.styles    Enumeration of StyleRanges, need to be in order. (output)
 * LineStyleEvent.background    line background color (output)
 */
public void lineGetStyle(LineStyleEvent event) {
    Vector<StyleRange> styles = new Vector<StyleRange>();
    int token;
    StyleRange lastStyle;

    if (inBlockComment(event.lineOffset, event.lineOffset + event.lineText.length())) {
        styles.addElement(new StyleRange(event.lineOffset, event.lineText.length()+4, colors[2], null));
        event.styles = new StyleRange[styles.size()];
        styles.copyInto(event.styles);
        return;
    }
    scanner.setRange(event.lineText);
    String xs = ((StyledText)event.widget).getText();
    if(xs!=null) parseBlockComments(xs);
    token = scanner.nextToken();
    while (token != EOF) {
        if (token == OTHER) {
            // do nothing
        } else if ((token == WHITE) && (!styles.isEmpty())) {
            int start = scanner.getStartOffset() + event.lineOffset;
            lastStyle = (StyleRange)styles.lastElement();
            if (lastStyle.fontStyle != SWT.NORMAL) {
                if (lastStyle.start + lastStyle.length == start) {
                    // have the white space take on the style before it to minimize font style
                    // changes
                    lastStyle.length += scanner.getLength();
                }
            }
        } else {        
            Color color = getColor(token);
            if (color != colors[0]) {       // hardcoded default foreground color, black
                StyleRange style = new StyleRange(scanner.getStartOffset() + event.lineOffset, scanner.getLength(), color, null);
                if (token == KEY) {
                    style.fontStyle = SWT.BOLD;
                }
                if (styles.isEmpty()) {
                    styles.addElement(style);
                } else {
                    lastStyle = (StyleRange)styles.lastElement();
                    if (lastStyle.similarTo(style) && (lastStyle.start + lastStyle.length == style.start)) {
                        lastStyle.length += style.length;
                    } else {
                        styles.addElement(style); 
                    }
                } 
            } 
        }
        token= scanner.nextToken();
    }
    event.styles = new StyleRange[styles.size()];
    styles.copyInto(event.styles);
}
项目:kettle-trunk    文件:UserDefinedJavaClassHighlight.java   
/**
 * Event.detail         line start offset (input)   
 * Event.text           line text (input)
 * LineStyleEvent.styles    Enumeration of StyleRanges, need to be in order. (output)
 * LineStyleEvent.background    line background color (output)
 */
public void lineGetStyle(LineStyleEvent event) {
    Vector<StyleRange> styles = new Vector<StyleRange>();
    int token;
    StyleRange lastStyle;

    if (inBlockComment(event.lineOffset, event.lineOffset + event.lineText.length())) {
        styles.addElement(new StyleRange(event.lineOffset, event.lineText.length()+4, colors[2], null));
        event.styles = new StyleRange[styles.size()];
        styles.copyInto(event.styles);
        return;
    }
    scanner.setRange(event.lineText);
    String xs = ((StyledText)event.widget).getText();
    if(xs!=null) parseBlockComments(xs);
    token = scanner.nextToken();
    while (token != EOF) {
        if (token == OTHER) {
            // do nothing
        } else if ((token == WHITE) && (!styles.isEmpty())) {
            int start = scanner.getStartOffset() + event.lineOffset;
            lastStyle = (StyleRange)styles.lastElement();
            if (lastStyle.fontStyle != SWT.NORMAL) {
                if (lastStyle.start + lastStyle.length == start) {
                    // have the white space take on the style before it to minimize font style
                    // changes
                    lastStyle.length += scanner.getLength();
                }
            }
        } else {        
            Color color = getColor(token);
            if (color != colors[0]) {       // hardcoded default foreground color, black
                StyleRange style = new StyleRange(scanner.getStartOffset() + event.lineOffset, scanner.getLength(), color, null);
                if (token == KEY) {
                    style.fontStyle = SWT.BOLD;
                }
                if (styles.isEmpty()) {
                    styles.addElement(style);
                } else {
                    lastStyle = (StyleRange)styles.lastElement();
                    if (lastStyle.similarTo(style) && (lastStyle.start + lastStyle.length == style.start)) {
                        lastStyle.length += style.length;
                    } else {
                        styles.addElement(style); 
                    }
                } 
            } 
        }
        token= scanner.nextToken();
    }
    event.styles = new StyleRange[styles.size()];
    styles.copyInto(event.styles);
}
项目:kettle-trunk    文件:MDXValuesHighlight.java   
/**
 * Event.detail         line start offset (input)   
 * Event.text           line text (input)
 * LineStyleEvent.styles    Enumeration of StyleRanges, need to be in order. (output)
 * LineStyleEvent.background    line background color (output)
 */
public void lineGetStyle(LineStyleEvent event) {
    Vector<StyleRange> styles = new Vector<StyleRange>();
    int token;
    StyleRange lastStyle;

    if (inBlockComment(event.lineOffset, event.lineOffset + event.lineText.length())) {
        styles.addElement(new StyleRange(event.lineOffset, event.lineText.length()+4, colors[1], null));
        event.styles = new StyleRange[styles.size()];
        styles.copyInto(event.styles);
        return;
    }
    scanner.setRange(event.lineText);
    String xs = ((StyledText)event.widget).getText();
    if(xs!=null) parseBlockComments(xs);
    token = scanner.nextToken();
    while (token != EOF) {
        if (token == OTHER) {
            // do nothing
        } else if ((token == WHITE) && (!styles.isEmpty())) {
            int start = scanner.getStartOffset() + event.lineOffset;
            lastStyle = (StyleRange)styles.lastElement();
            if (lastStyle.fontStyle != SWT.NORMAL) {
                if (lastStyle.start + lastStyle.length == start) {
                    // have the white space take on the style before it to minimize font style
                    // changes
                    lastStyle.length += scanner.getLength();
                }
            }
        } else {        
            Color color = getColor(token);
            if (color != colors[0]) {       // hardcoded default foreground color, black
                StyleRange style = new StyleRange(scanner.getStartOffset() + event.lineOffset, scanner.getLength(), color, null);
                if (token == KEY) {
                    //style.fontStyle = SWT.BOLD;
                }
                if (styles.isEmpty()) {
                    styles.addElement(style);
                } else {
                    lastStyle = (StyleRange)styles.lastElement();
                    if (lastStyle.similarTo(style) && (lastStyle.start + lastStyle.length == style.start)) {
                        lastStyle.length += style.length;
                    } else {
                        styles.addElement(style); 
                    }
                } 
            } 
        }
        token= scanner.nextToken();
    }
    event.styles = new StyleRange[styles.size()];
    styles.copyInto(event.styles);
}
项目:kettle-trunk    文件:MDXValuesHighlight.java   
/**
 * Event.detail         line start offset (input)   
 * Event.text           line text (input)
 * LineStyleEvent.styles    Enumeration of StyleRanges, need to be in order. (output)
 * LineStyleEvent.background    line background color (output)
 */
public void lineGetStyle(LineStyleEvent event) {
    Vector<StyleRange> styles = new Vector<StyleRange>();
    int token;
    StyleRange lastStyle;

    if (inBlockComment(event.lineOffset, event.lineOffset + event.lineText.length())) {
        styles.addElement(new StyleRange(event.lineOffset, event.lineText.length()+4, colors[1], null));
        event.styles = new StyleRange[styles.size()];
        styles.copyInto(event.styles);
        return;
    }
    scanner.setRange(event.lineText);
    String xs = ((StyledText)event.widget).getText();
    if(xs!=null) parseBlockComments(xs);
    token = scanner.nextToken();
    while (token != EOF) {
        if (token == OTHER) {
            // do nothing
        } else if ((token == WHITE) && (!styles.isEmpty())) {
            int start = scanner.getStartOffset() + event.lineOffset;
            lastStyle = (StyleRange)styles.lastElement();
            if (lastStyle.fontStyle != SWT.NORMAL) {
                if (lastStyle.start + lastStyle.length == start) {
                    // have the white space take on the style before it to minimize font style
                    // changes
                    lastStyle.length += scanner.getLength();
                }
            }
        } else {        
            Color color = getColor(token);
            if (color != colors[0]) {       // hardcoded default foreground color, black
                StyleRange style = new StyleRange(scanner.getStartOffset() + event.lineOffset, scanner.getLength(), color, null);
                if (token == KEY) {
                    //style.fontStyle = SWT.BOLD;
                }
                if (styles.isEmpty()) {
                    styles.addElement(style);
                } else {
                    lastStyle = (StyleRange)styles.lastElement();
                    if (lastStyle.similarTo(style) && (lastStyle.start + lastStyle.length == style.start)) {
                        lastStyle.length += style.length;
                    } else {
                        styles.addElement(style); 
                    }
                } 
            } 
        }
        token= scanner.nextToken();
    }
    event.styles = new StyleRange[styles.size()];
    styles.copyInto(event.styles);
}
项目:kettle-trunk    文件:SOQLValuesHighlight.java   
/**
 * Event.detail         line start offset (input)   
 * Event.text           line text (input)
 * LineStyleEvent.styles    Enumeration of StyleRanges, need to be in order. (output)
 * LineStyleEvent.background    line background color (output)
 */
public void lineGetStyle(LineStyleEvent event) {
    Vector<StyleRange> styles = new Vector<StyleRange>();
    int token;
    StyleRange lastStyle;

    if (inBlockComment(event.lineOffset, event.lineOffset + event.lineText.length())) {
        styles.addElement(new StyleRange(event.lineOffset, event.lineText.length()+4, colors[1], null));
        event.styles = new StyleRange[styles.size()];
        styles.copyInto(event.styles);
        return;
    }
    scanner.setRange(event.lineText);
    String xs = ((StyledText)event.widget).getText();
    if(xs!=null) parseBlockComments(xs);
    token = scanner.nextToken();
    while (token != EOF) {
        if (token == OTHER) {
            // do nothing
        } else if ((token == WHITE) && (!styles.isEmpty())) {
            int start = scanner.getStartOffset() + event.lineOffset;
            lastStyle = (StyleRange)styles.lastElement();
            if (lastStyle.fontStyle != SWT.NORMAL) {
                if (lastStyle.start + lastStyle.length == start) {
                    // have the white space take on the style before it to minimize font style
                    // changes
                    lastStyle.length += scanner.getLength();
                }
            }
        } else {        
            Color color = getColor(token);
            if (color != colors[0]) {       // hardcoded default foreground color, black
                StyleRange style = new StyleRange(scanner.getStartOffset() + event.lineOffset, scanner.getLength(), color, null);
                if (token == KEY) {
                    //style.fontStyle = SWT.BOLD;
                }
                if (styles.isEmpty()) {
                    styles.addElement(style);
                } else {
                    lastStyle = (StyleRange)styles.lastElement();
                    if (lastStyle.similarTo(style) && (lastStyle.start + lastStyle.length == style.start)) {
                        lastStyle.length += style.length;
                    } else {
                        styles.addElement(style); 
                    }
                } 
            } 
        }
        token= scanner.nextToken();
    }
    event.styles = new StyleRange[styles.size()];
    styles.copyInto(event.styles);
}
项目:kettle-trunk    文件:LibFormulaValuesHighlight.java   
/**
 * Event.detail         line start offset (input)   
 * Event.text           line text (input)
 * LineStyleEvent.styles    Enumeration of StyleRanges, need to be in order. (output)
 * LineStyleEvent.background    line background color (output)
 */
public void lineGetStyle(LineStyleEvent event) {
    Vector<StyleRange> styles = new Vector<StyleRange>();
    int token;
    StyleRange lastStyle;

    if (inBlockComment(event.lineOffset, event.lineOffset + event.lineText.length())) {
        styles.addElement(new StyleRange(event.lineOffset, event.lineText.length()+4, colors[1], null));
        event.styles = new StyleRange[styles.size()];
        styles.copyInto(event.styles);
        return;
    }
    scanner.setRange(event.lineText);
    String xs = ((StyledText)event.widget).getText();
    if(xs!=null) parseBlockComments(xs);
    token = scanner.nextToken();
    while (token != EOF) {
        if (token == OTHER) {
            // do nothing
        } else if ((token == WHITE) && (!styles.isEmpty())) {
            int start = scanner.getStartOffset() + event.lineOffset;
            lastStyle = (StyleRange)styles.lastElement();
            if (lastStyle.fontStyle != SWT.NORMAL) {
                if (lastStyle.start + lastStyle.length == start) {
                    // have the white space take on the style before it to minimize font style
                    // changes
                    lastStyle.length += scanner.getLength();
                }
            }
        } else {        
            Color color = getColor(token);
            if (color != colors[0]) {       // hardcoded default foreground color, black
                StyleRange style = new StyleRange(scanner.getStartOffset() + event.lineOffset, scanner.getLength(), color, null);
                if (token == KEY) {
                    style.fontStyle = SWT.BOLD;
                }
                if (styles.isEmpty()) {
                    styles.addElement(style);
                } else {
                    lastStyle = (StyleRange)styles.lastElement();
                    if (lastStyle.similarTo(style) && (lastStyle.start + lastStyle.length == style.start)) {
                        lastStyle.length += style.length;
                    } else {
                        styles.addElement(style); 
                    }
                } 
            } 
        }
        token= scanner.nextToken();
    }
    event.styles = new StyleRange[styles.size()];
    styles.copyInto(event.styles);
}
项目:pdi-graph-computing    文件:ScriptHighlight.java   
/**
 * Event.detail         line start offset (input)   
 * Event.text           line text (input)
 * LineStyleEvent.styles    Enumeration of StyleRanges, need to be in order. (output)
 * LineStyleEvent.background    line background color (output)
 */
public void lineGetStyle(LineStyleEvent event) {
    Vector<StyleRange> styles = new Vector<StyleRange>();
    int token;
    StyleRange lastStyle;

    if (inBlockComment(event.lineOffset, event.lineOffset + event.lineText.length())) {
        styles.addElement(new StyleRange(event.lineOffset, event.lineText.length()+4, colors[2], null));
        event.styles = new StyleRange[styles.size()];
        styles.copyInto(event.styles);
        return;
    }
    scanner.setRange(event.lineText);
    String xs = ((StyledText)event.widget).getText();
    if(xs!=null) parseBlockComments(xs);
    token = scanner.nextToken();
    while (token != EOF) {
        if (token == OTHER) {
            // do nothing
        } else if ((token == WHITE) && (!styles.isEmpty())) {
            int start = scanner.getStartOffset() + event.lineOffset;
            lastStyle = styles.lastElement();
            if (lastStyle.fontStyle != SWT.NORMAL) {
                if (lastStyle.start + lastStyle.length == start) {
                    // have the white space take on the style before it to minimize font style
                    // changes
                    lastStyle.length += scanner.getLength();
                }
            }
        } else {        
            Color color = getColor(token);
            if (color != colors[0]) {       // hardcoded default foreground color, black
                StyleRange style = new StyleRange(scanner.getStartOffset() + event.lineOffset, scanner.getLength(), color, null);
                if (token == KEY) {
                    style.fontStyle = SWT.BOLD;
                }
                if (styles.isEmpty()) {
                    styles.addElement(style);
                } else {
                    lastStyle = styles.lastElement();
                    if (lastStyle.similarTo(style) && (lastStyle.start + lastStyle.length == style.start)) {
                        lastStyle.length += style.length;
                    } else {
                        styles.addElement(style); 
                    }
                } 
            } 
        }
        token= scanner.nextToken();
    }
    event.styles = new StyleRange[styles.size()];
    styles.copyInto(event.styles);
}