Currently Custom Folds does not have any persistence ID. Also the Custom-Fold recognition is started asynchronously on a change in a document.
Therefore it is not possible to keep collapse/expand state of folds that are regenerated in a document e.g. MultiDataObject with a text and binary file when some parts of text is re-generated from the binary file.
If a custom-fold tag "<editor-fold ...>" would be having a "persistenceID" attribute, then the CustomFoldManager/FoldHierarchy would be able to store the collapse/expand state inside persistently (e.g. through the Document life-cycle). The custom-fold when will automatically expand/collapse itself when recognized in a text.
Connecting with 188573 - persistence for folds.
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.
Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss
A subset of persistent folding requested by issue #188573
*** This bug has been marked as a duplicate of bug 188573 ***