void () { myTextAnnotationGuttersSize = 0; myGapAfterAnnotations = false; final int lineCount = Math.max(myEditor.getDocument().getLineCount(), 1); final int guttersCount = myTextAnnotationGutters.size(); for (int j = 0; j < guttersCount; j++) { TextAnnotationGutterProvider gutterProvider = myTextAnnotationGutters.get(j); int gutterSize = 0; for (int i = 0; i < lineCount; i++) { String lineText = gutterProvider.getLineText(i, myEditor); if (!StringUtil.isEmpty(lineText)) { EditorFontType style = gutterProvider.getStyle(i, myEditor); Font font = getFontForText(lineText, style); FontMetrics fontMetrics = getFontMetrics(font); gutterSize = Math.max(gutterSize, fontMetrics.stringWidth(lineText)); } else if (gutterProvider instanceof TextAnnotationGutterProvider.Filler) { gutterSize = Math.max(gutterSize, ((TextAnnotationGutterProvider.Filler)gutterProvider).getWidth()); } } if (gutterSize > 0) { boolean margin = gutterProvider.useMargin(); myGapAfterAnnotations = margin; if (margin) { gutterSize += getGapBetweenAnnotations(); } } myTextAnnotationGutterSizes.set(j, gutterSize); myTextAnnotationGuttersSize += gutterSize; } }