public void coloration() {
   String text = editor.getTextPaneEditor().getText().replaceAll("\n", " ");
   final StyledDocument doc = editor.getTextPaneEditor().getStyledDocument();
   final MutableAttributeSet normal = new SimpleAttributeSet();
   StyleConstants.setForeground(normal, Color.black);
   StyleConstants.setBold(normal, false);
   SwingUtilities.invokeLater(
       new Runnable() {
         public void run() {
           doc.setCharacterAttributes(0, doc.getLength(), normal, true);
         }
       });
   colorationPrimitives(text, doc);
   colorationPolicyScript(text, doc);
 }
 public void colorationPolicyScript(String text, final StyledDocument doc) {
   Pattern p = Pattern.compile("(GraphOScript)");
   Matcher m = p.matcher(text);
   while (m.find() == true) {
     MutableAttributeSet attri = new SimpleAttributeSet();
     StyleConstants.setForeground(attri, Color.orange);
     StyleConstants.setBold(attri, true);
     final int start = m.start(0);
     final int end = m.end(0);
     final int length = end - start;
     final MutableAttributeSet style = attri;
     SwingUtilities.invokeLater(
         new Runnable() {
           public void run() {
             doc.setCharacterAttributes(start, length, style, true);
           }
         });
   }
 }