# This patch file was generated by NetBeans IDE # This patch can be applied using context Tools: Apply Diff Patch action on respective folder. # It uses platform neutral UTF-8 encoding. # Above lines and this line are ignored by the patching process. Index: xml/text-edit/src/org/netbeans/modules/xml/text/folding/XmlFoldManager.java --- xml/text-edit/src/org/netbeans/modules/xml/text/folding/XmlFoldManager.java Base (1.17) +++ xml/text-edit/src/org/netbeans/modules/xml/text/folding/XmlFoldManager.java Locally Modified (Based On 1.17) @@ -43,6 +43,7 @@ import org.netbeans.spi.editor.fold.FoldOperation; import org.openide.util.Exceptions; import org.openide.util.NbBundle; +import org.openide.util.RequestProcessor; /** * This class is an implementation of @see org.netbeans.spi.editor.fold.FoldManager @@ -112,17 +113,25 @@ } } - public void initFolds(FoldHierarchyTransaction transaction) { + public void initFolds(final FoldHierarchyTransaction transaction) { + RequestProcessor.getDefault().post(new Runnable() { + //SwingUtilities.invokeLater(new Runnable() { + public void run() { + doInit(transaction); + } + }); + } + + private void doInit(final FoldHierarchyTransaction transaction) { try { Document doc = getOperation().getHierarchy().getComponent().getDocument(); //filtering of the PlainDocument set during the JEditorPane initializatin if (!(doc instanceof BaseDocument)) { return; } - model = DocumentModel.getDocumentModel((BaseDocument) getDocument()); + model = DocumentModel.getDocumentModel(getDocument()); model.addDocumentModelStateListener(DMLS); model.addDocumentModelListener(DML); - updateFolds(transaction); } catch (DocumentModelException ex) { Exceptions.printStackTrace(ex);