php.smarty/src/org/netbeans/modules/php/smarty/editor/utlis/LexerUtils.java
changeset 17309 60f4cc6038b3
parent 16264 0bcd1b2b366f
child 17329 54d8f8c364b0
     1.1 --- a/php.smarty/src/org/netbeans/modules/php/smarty/editor/utlis/LexerUtils.java	Fri Apr 09 19:09:01 2010 +0200
     1.2 +++ b/php.smarty/src/org/netbeans/modules/php/smarty/editor/utlis/LexerUtils.java	Thu Mar 03 00:03:37 2011 +0100
     1.3 @@ -39,6 +39,7 @@
     1.4  package org.netbeans.modules.php.smarty.editor.utlis;
     1.5  
     1.6  import javax.swing.text.Document;
     1.7 +import org.netbeans.modules.editor.NbEditorDocument;
     1.8  import org.netbeans.modules.php.smarty.editor.TplKit;
     1.9  import org.netbeans.spi.lexer.MutableTextInput;
    1.10  import org.openide.text.CloneableEditor;
    1.11 @@ -70,14 +71,21 @@
    1.12                  TopComponent[] topComponents = WindowManager.getDefault().getOpenedTopComponents(WindowManager.getDefault().findMode("editor"));
    1.13                  for (TopComponent topComponent : topComponents) {
    1.14                      if (topComponent instanceof CloneableEditor) {
    1.15 -                        Document doc = ((CloneableEditor) topComponent).getEditorPane().getDocument();
    1.16 +                        final Document doc = ((CloneableEditor) topComponent).getEditorPane().getDocument();
    1.17                          if (((CloneableEditor) topComponent).getEditorPane().getEditorKit() instanceof TplKit) {
    1.18                              ((TplKit) ((CloneableEditor) topComponent).getEditorPane().getEditorKit()).initLexerColoringListener(doc);
    1.19                          }
    1.20 -                        MutableTextInput mti = (MutableTextInput) doc.getProperty(MutableTextInput.class);
    1.21 -                        if (mti != null) {
    1.22 -                            mti.tokenHierarchyControl().rebuild();
    1.23 -                        }
    1.24 +                        NbEditorDocument nbdoc = (NbEditorDocument) doc;
    1.25 +                        nbdoc.runAtomic(new Runnable() {
    1.26 +
    1.27 +                            @Override
    1.28 +                            public void run() {
    1.29 +                                MutableTextInput mti = (MutableTextInput) doc.getProperty(MutableTextInput.class);
    1.30 +                                if (mti != null) {
    1.31 +                                    mti.tokenHierarchyControl().rebuild();
    1.32 +                                }
    1.33 +                            }
    1.34 +                        });
    1.35                      }
    1.36                  }
    1.37              }