boolean () { if (myView.getEditor().isPurePaintingMode()) return false; FoldingModelImpl model = myView.getEditor().getFoldingModel(); if (model.isFoldingEnabled()) return true; model.setFoldingEnabled(true); FoldRegion[] regions; try { regions = model.fetchTopLevel(); } finally { model.setFoldingEnabled(false); } return regions == null || regions.length == 0; }