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);
}
}
}
}
}
Aggregations