use highlighter for not top frames

This commit is contained in:
Egor.Ushakov
2014-11-19 17:11:36 +03:00
parent 0047354d53
commit 3cdba97d80
6 changed files with 27 additions and 11 deletions
@@ -565,6 +565,11 @@
<option name="BACKGROUND" value="2d6099" />
</value>
</option>
<option name="NOT_TOP_FRAME_ATTRIBUTES">
<value>
<option name="BACKGROUND" value="243040"/>
</value>
</option>
<option name="FOLDED_TEXT_ATTRIBUTES">
<value>
<option name="FOREGROUND" value="8c8c8c" />
@@ -94,6 +94,7 @@ options.java.attribute.descriptor.unmatched.brace=Unmatched brace
options.java.attribute.descriptor.bad.character=Bad character
options.java.attribute.descriptor.breakpoint.line=Breakpoint line
options.java.attribute.descriptor.execution.point=Execution point
options.java.attribute.descriptor.not.top.frame=Not top frame
options.java.attribute.descriptor.recursive.call=Recursive calls highlighting
options.java.attribute.descriptor.annotation.name=Annotation name
options.java.attribute.descriptor.annotation.attribute.name=Annotation attribute name
@@ -652,6 +652,12 @@
</value>
</option>
<option name="NOT_TOP_FRAME_ATTRIBUTES">
<value>
<option name="BACKGROUND" value="e1ebf7"/>
</value>
</option>
<option name="UNMATCHED_BRACE_ATTRIBUTES">
<value>
<option name="FOREGROUND"/>
@@ -29,6 +29,7 @@ import java.awt.*;
public interface DebuggerColors {
TextAttributesKey BREAKPOINT_ATTRIBUTES = TextAttributesKey.createTextAttributesKey("BREAKPOINT_ATTRIBUTES");
TextAttributesKey EXECUTIONPOINT_ATTRIBUTES = TextAttributesKey.createTextAttributesKey("EXECUTIONPOINT_ATTRIBUTES");
TextAttributesKey NOT_TOP_FRAME_ATTRIBUTES = TextAttributesKey.createTextAttributesKey("NOT_TOP_FRAME_ATTRIBUTES");
ColorKey RECURSIVE_CALL_ATTRIBUTES = ColorKey.createColorKey("RECURSIVE_CALL_ATTRIBUTES", new Color(255, 255, 215));
int BREAKPOINT_HIGHLIGHTER_LAYER = HighlighterLayer.SYNTAX + 1;
@@ -53,6 +53,7 @@ public class DebuggerColorsPage implements ColorSettingsPage, DisplayPrioritySor
return new AttributesDescriptor[] {
new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.breakpoint.line"), DebuggerColors.BREAKPOINT_ATTRIBUTES),
new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.execution.point"), DebuggerColors.EXECUTIONPOINT_ATTRIBUTES),
new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.not.top.frame"), DebuggerColors.NOT_TOP_FRAME_ATTRIBUTES),
};
}
@@ -48,7 +48,7 @@ public class ExecutionPointHighlighter {
private Editor myEditor;
private XSourcePosition mySourcePosition;
private OpenFileDescriptor myOpenFileDescriptor;
private boolean myUseSelection;
private boolean myNotTopFrame;
private GutterIconRenderer myGutterIconRenderer;
private static final Key<Boolean> EXECUTION_POINT_HIGHLIGHTER_KEY = Key.create("EXECUTION_POINT_HIGHLIGHTER_KEY");
@@ -69,7 +69,7 @@ public class ExecutionPointHighlighter {
}
}
public void show(final @NotNull XSourcePosition position, final boolean useSelection,
public void show(final @NotNull XSourcePosition position, final boolean notTopFrame,
@Nullable final GutterIconRenderer gutterIconRenderer) {
updateRequested.set(false);
AppUIUtil.invokeLaterIfProjectAlive(myProject, new Runnable() {
@@ -85,7 +85,7 @@ public class ExecutionPointHighlighter {
//myOpenFileDescriptor.setUseCurrentWindow(true);
myGutterIconRenderer = gutterIconRenderer;
myUseSelection = useSelection;
myNotTopFrame = notTopFrame;
doShow(true);
}
@@ -170,9 +170,9 @@ public class ExecutionPointHighlighter {
adjustCounter(myEditor, -1);
}
if (myUseSelection && myEditor != null) {
myEditor.getSelectionModel().removeSelection();
}
//if (myNotTopFrame && myEditor != null) {
// myEditor.getSelectionModel().removeSelection();
//}
if (myRangeHighlighter != null) {
myRangeHighlighter.dispose();
@@ -186,16 +186,18 @@ public class ExecutionPointHighlighter {
Document document = myEditor.getDocument();
if (line < 0 || line >= document.getLineCount()) return;
if (myUseSelection) {
myEditor.getSelectionModel().setSelection(document.getLineStartOffset(line), document.getLineEndOffset(line) + document.getLineSeparatorLength(line));
return;
}
//if (myNotTopFrame) {
// myEditor.getSelectionModel().setSelection(document.getLineStartOffset(line), document.getLineEndOffset(line) + document.getLineSeparatorLength(line));
// return;
//}
if (myRangeHighlighter != null) return;
EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
myRangeHighlighter = myEditor.getMarkupModel().addLineHighlighter(line, DebuggerColors.EXECUTION_LINE_HIGHLIGHTERLAYER,
scheme.getAttributes(DebuggerColors.EXECUTIONPOINT_ATTRIBUTES));
myNotTopFrame
? scheme.getAttributes(DebuggerColors.NOT_TOP_FRAME_ATTRIBUTES)
: scheme.getAttributes(DebuggerColors.EXECUTIONPOINT_ATTRIBUTES));
myRangeHighlighter.putUserData(EXECUTION_POINT_HIGHLIGHTER_KEY, true);
myRangeHighlighter.setGutterIconRenderer(myGutterIconRenderer);
}