Skip to content

Commit e2ac351

Browse files
committed
Add basic code mining tracing option to trace rendering
See eclipse-platform#2786
1 parent c9f129d commit e2ac351

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

bundles/org.eclipse.jface.text/.options

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ org.eclipse.jface.text/debug/AbstractInformationControlManager= false
1717

1818
# Enables assertion check for valid offset and length when creating a TextSelection
1919
org.eclipse.jface.text/assert/TextSelection/validConstructorArguments= false
20+
21+
org.eclipse.jface.text/debug/CodeMining/render= false

bundles/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/codemining/CodeMiningManager.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ public class CodeMiningManager implements Runnable {
7777
*/
7878
private IProgressMonitor fMonitor;
7979

80+
/**
81+
* Debug option for rendering code minings.
82+
*/
83+
public static final boolean DEBUG_RENDER= "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.jface.text/debug/CodeMining/render")); //$NON-NLS-1$ //$NON-NLS-2$
84+
85+
8086
/**
8187
* Constructor of codemining manager with the given arguments.
8288
*
@@ -245,6 +251,11 @@ private void renderCodeMinings(Map<Position, List<ICodeMining>> groups, ISourceV
245251
// done.
246252
return;
247253
}
254+
255+
if (DEBUG_RENDER) {
256+
System.out.println("CodeMiningManager.renderCodeMinings() start"); //$NON-NLS-1$
257+
}
258+
248259
Set<ICodeMiningAnnotation> annotationsToRedraw= new HashSet<>();
249260
Set<AbstractInlinedAnnotation> currentAnnotations= new HashSet<>();
250261
// Loop for grouped code minings
@@ -287,6 +298,10 @@ private void renderCodeMinings(Map<Position, List<ICodeMining>> groups, ISourceV
287298
fInlinedAnnotationSupport.updateAnnotations(currentAnnotations);
288299
// redraw the existing codemining annotations since their content can change
289300
annotationsToRedraw.stream().forEach(ICodeMiningAnnotation::redraw);
301+
302+
if (DEBUG_RENDER) {
303+
System.out.println("renderCodeMinings end of " + annotationsToRedraw.size() + " mining annotations"); //$NON-NLS-1$ //$NON-NLS-2$
304+
}
290305
}
291306

292307
/**

bundles/org.eclipse.jface.text/src/org/eclipse/jface/text/source/inlined/AbstractInlinedAnnotation.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
import org.eclipse.swt.graphics.Color;
2222
import org.eclipse.swt.graphics.GC;
2323

24+
import org.eclipse.jface.internal.text.codemining.CodeMiningManager;
25+
2426
import org.eclipse.jface.text.IRegion;
2527
import org.eclipse.jface.text.ITextViewer;
2628
import org.eclipse.jface.text.ITextViewerExtension5;
@@ -159,6 +161,9 @@ public void redraw() {
159161
// adjust offset according folded content
160162
offset= ((ITextViewerExtension5) viewer).modelOffset2WidgetOffset(offset);
161163
}
164+
if (CodeMiningManager.DEBUG_RENDER) {
165+
System.out.println("AbstractInlinedAnnotation.redraw()"); //$NON-NLS-1$
166+
}
162167
InlinedAnnotationDrawingStrategy.draw(this, null, text, offset, pos.getLength(), null);
163168
} catch (RuntimeException e) {
164169
// Ignore UI error

0 commit comments

Comments
 (0)