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

项目:e4macs    文件:BrowseKillRingHandler.java   
/**
 * Return the correct background highlight for the kill ring entry line offset
 * 
 * @see org.eclipse.swt.custom.LineBackgroundListener#lineGetBackground(org.eclipse.swt.custom.LineBackgroundEvent)
 */
public void lineGetBackground(LineBackgroundEvent event) {
    KilledText kt = offsetHash.get(event.lineOffset);
    if (kt == null) {
        for (KilledText k : ringEntries) {
            if (event.lineOffset >= k.begin && event.lineOffset <= k.end) {
                offsetHash.put(event.lineOffset, k);
                kt = k;
                break;
            }
        }
    }
    if (kt != null) {
        event.lineBackground = kt.color;
    }
}
项目:SPELL    文件:CustomStyledText.java   
@Override
public void lineGetBackground(LineBackgroundEvent event)
{
    int lineIndex = m_view.getLineAtOffset(event.lineOffset);
    TextViewLine line = (TextViewLine) m_model.getLineObject(lineIndex);
    // Set background color
    Color lineBg = m_labelProvider.getBackgroundColor(line.getType());
    event.lineBackground = lineBg;
}
项目:chromedevtools    文件:LiveEditDiffViewer.java   
@Override
public void lineGetBackground(LineBackgroundEvent event) {
  if (currentInput == null) {
    return;
  }
  TextChangesMap changesMap = currentInput.getMap(side);
  ColorName colorName =
      changesMap.getLineColorName(event.lineOffset, event.lineText.length() + 1);
  if (colorName != null) {
    event.lineBackground = colors.get(colorName);
  }
}
项目:Rel    文件:FindReplaceDialog.java   
@Override
public void lineGetBackground(LineBackgroundEvent event) {
    if (!btnRadioSelected.getSelection())
        return;
    if (isOverlappingOriginalSelectionLineOffsetRange(event.lineOffset, event.lineText.length()))
        event.lineBackground = originalSelectionHighlightColor;
}
项目:RepDev    文件:SyntaxHighlighter.java   
public void lineGetBackground(LineBackgroundEvent event) {
    boolean go = false;

    for( int i : customLines)
        if( i == txt.getLineAtOffset(event.lineOffset) )
        {
            go = true;
            break;
        }

    if( go ){
        event.lineBackground = customColor;
    }
}
项目:APICloud-Studio    文件:LineBackgroundPainter.java   
public void lineGetBackground(LineBackgroundEvent event)
{
    if (fViewer == null)
    {
        return;
    }
    final StyledText textWidget = fViewer.getTextWidget();
    if (textWidget == null)
    {
        return;
    }

    try
    {
        final int offset = event.lineOffset;
        IDocument document = fViewer.getDocument();
        int line = document.getLineOfOffset(offset);
        final IRegion lineRegion = document.getLineInformation(line);

        // Handle fully opaque line highlight here. A modified approach from CursorLinePainter.
        if (fEnabled && isOpaque() && isCurrentLine(line))
        {
            // draw current line
            drawCurrentLine(event, lineRegion);
            return;
        }

        // Not drawing an opaque line highlight, so we need to do our normal line coloring here.
        // This extends the bg color out for a given line based on it's end scope.
        String endOfLineScope = getScopeManager().getScopeAtOffset(document, lineRegion.getLength() + offset);
        String commonPrefix = getScope(document, line, endOfLineScope);
        TextAttribute at = getCurrentTheme().getTextAttribute(commonPrefix);

        // if we have no color we need to extend to end of line, but this used to be the highlight line, force the
        // theme bg color
        if (at.getBackground() == null && isOpaque() && fLastLine.includes(offset))
        {
            event.lineBackground = getColorManager().getColor(getCurrentTheme().getBackground());
        }
        else
        {
            event.lineBackground = at.getBackground();
        }
    }
    catch (BadLocationException e)
    {
        IdeLog.logError(CommonEditorPlugin.getDefault(), e);
    }
}
项目:APICloud-Studio    文件:LineBackgroundPainter.java   
private void drawCurrentLine(LineBackgroundEvent event, final IRegion lineRegion)
{
    final StyledText textWidget = fViewer.getTextWidget();
    final int offset = event.lineOffset;
    final RGBa lineHighlight = getCurrentTheme().getLineHighlight();
    event.lineBackground = getColorManager().getColor(lineHighlight.toRGB());

    // In this case, we should be overriding the bg of the style ranges for the line too!
    if (textWidget.isDisposed())
    {
        return;
    }
    // FIXME Only change bg colors of visible ranges!
    int replaceLength = 160;
    if (lineRegion != null)
    {
        replaceLength = Math.min(replaceLength, lineRegion.getLength());
    }

    // be safe about offsets
    int charCount = textWidget.getCharCount();
    if (offset + replaceLength > charCount)
    {
        replaceLength = charCount - offset;
        if (replaceLength < 0)
        {
            // Just playing safe here
            replaceLength = 0;
        }
    }
    final StyleRange[] ranges = textWidget.getStyleRanges(offset, replaceLength, true);
    if (ranges == null || ranges.length == 0)
    {
        return;
    }
    Color background = textWidget.getBackground();
    final int[] positions = new int[ranges.length << 1];
    int x = 0;
    boolean apply = false;
    for (StyleRange range : ranges)
    {
        if (range.background != null)
        {
            if (!range.background.equals(background))
            {
                positions[x] = range.start;
                positions[x + 1] = range.length;
                x += 2;
                continue;
            }
            apply = true;
        }
        range.background = null;
        positions[x] = range.start;
        positions[x + 1] = range.length;
        x += 2;
    }

    if (apply)
    {
        textWidget.setStyleRanges(offset, replaceLength, positions, ranges);
    }
}
项目:Pydev    文件:ScriptConsoleViewerWrapper.java   
public void lineGetBackground(LineBackgroundEvent event) {
    viewer.lineGetBackground(event);
}