Search in sources :

Example 1 with DetailView

use of com.intellij.ui.popup.util.DetailView in project intellij-community by JetBrains.

the class BreakpointItem method showInEditor.

protected static void showInEditor(DetailView panel, VirtualFile virtualFile, int line) {
    TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(DebuggerColors.BREAKPOINT_ATTRIBUTES);
    DetailView.PreviewEditorState state = DetailView.PreviewEditorState.create(virtualFile, line, attributes);
    if (state.equals(panel.getEditorState())) {
        return;
    }
    panel.navigateInPreviewEditor(state);
    TextAttributes softerAttributes = attributes.clone();
    Color backgroundColor = softerAttributes.getBackgroundColor();
    if (backgroundColor != null) {
        softerAttributes.setBackgroundColor(ColorUtil.softer(backgroundColor));
    }
    final Editor editor = panel.getEditor();
    if (editor != null) {
        final MarkupModel editorModel = editor.getMarkupModel();
        final MarkupModel documentModel = DocumentMarkupModel.forDocument(editor.getDocument(), editor.getProject(), false);
        for (RangeHighlighter highlighter : documentModel.getAllHighlighters()) {
            if (highlighter.getUserData(DebuggerColors.BREAKPOINT_HIGHLIGHTER_KEY) == Boolean.TRUE) {
                final int line1 = editor.offsetToLogicalPosition(highlighter.getStartOffset()).line;
                if (line1 != line) {
                    editorModel.addLineHighlighter(line1, DebuggerColors.BREAKPOINT_HIGHLIGHTER_LAYER + 1, softerAttributes);
                }
            }
        }
    }
}
Also used : RangeHighlighter(com.intellij.openapi.editor.markup.RangeHighlighter) DetailView(com.intellij.ui.popup.util.DetailView) TextAttributes(com.intellij.openapi.editor.markup.TextAttributes) Editor(com.intellij.openapi.editor.Editor) DocumentMarkupModel(com.intellij.openapi.editor.impl.DocumentMarkupModel) MarkupModel(com.intellij.openapi.editor.markup.MarkupModel)

Aggregations

Editor (com.intellij.openapi.editor.Editor)1 DocumentMarkupModel (com.intellij.openapi.editor.impl.DocumentMarkupModel)1 MarkupModel (com.intellij.openapi.editor.markup.MarkupModel)1 RangeHighlighter (com.intellij.openapi.editor.markup.RangeHighlighter)1 TextAttributes (com.intellij.openapi.editor.markup.TextAttributes)1 DetailView (com.intellij.ui.popup.util.DetailView)1