package jetbrains.mps.ide.actions;

/*Generated by MPS */

import jetbrains.mps.annotations.GeneratedClass;
import jetbrains.mps.editor.runtime.style.StyledTextPrinter;
import javax.swing.text.StyledDocument;
import javax.swing.text.DefaultStyledDocument;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import javax.swing.text.BadLocationException;

@GeneratedClass(node = "r:00000000-0000-4000-0000-011c895904a4(jetbrains.mps.ide.actions)/8394433674396727873", model = "r:00000000-0000-4000-0000-011c895904a4(jetbrains.mps.ide.actions)")
public class StyledTextPrinterImpl implements StyledTextPrinter {
  private StyledDocument myDocument = new DefaultStyledDocument();
  private SimpleAttributeSet myAttributeSet = new SimpleAttributeSet();
  public StyledTextPrinterImpl() {
  }
  @Override
  public StyledTextPrinter setBold(boolean flag) {
    StyleConstants.setBold(this.myAttributeSet, flag);
    return this;
  }
  @Override
  public StyledTextPrinter append(String text) {
    try {
      this.myDocument.insertString(this.myDocument.getLength(), text, this.myAttributeSet);
    } catch (BadLocationException badLocationException) {
      badLocationException.printStackTrace();
    }
    return this;
  }
  public StyledDocument getDocument() {
    return this.myDocument;
  }

}
