Ejemplo n.º 1
0
 private void validateMaxLineWithExtension() {
   if (myMaxLineWithExtensionWidth > 0) {
     Project project = myEditor.getProject();
     VirtualFile virtualFile = myEditor.getVirtualFile();
     if (project != null && virtualFile != null) {
       for (EditorLinePainter painter : EditorLinePainter.EP_NAME.getExtensions()) {
         Collection<LineExtensionInfo> extensions =
             painter.getLineExtensions(project, virtualFile, myWidestLineWithExtension);
         if (extensions != null && !extensions.isEmpty()) {
           return;
         }
       }
     }
     myMaxLineWithExtensionWidth = 0;
   }
 }
 private void paintLineExtensions(Graphics2D g, int line, float x, int y) {
   Project project = myEditor.getProject();
   VirtualFile virtualFile = myEditor.getVirtualFile();
   if (project == null || virtualFile == null) return;
   for (EditorLinePainter painter : EditorLinePainter.EP_NAME.getExtensions()) {
     Collection<LineExtensionInfo> extensions =
         painter.getLineExtensions(project, virtualFile, line);
     if (extensions != null) {
       for (LineExtensionInfo info : extensions) {
         LineLayout layout =
             new LineLayout(myView, info.getText(), info.getFontType(), g.getFontRenderContext());
         g.setColor(info.getColor());
         x =
             paintLineLayoutWithEffect(
                 g, layout, x, y, info.getEffectColor(), info.getEffectType());
         int currentLineWidth = (int) x;
         EditorSizeManager sizeManager = myView.getSizeManager();
         if (currentLineWidth > sizeManager.getMaxLineWithExtensionWidth()) {
           sizeManager.setMaxLineWithExtensionWidth(line, currentLineWidth);
         }
       }
     }
   }
 }