Bug 579148 - Fix collapsing of unpainted folding annotations "Collapse All" would only collapse part of the annotations, omitting those that have never been painted. More generally, the same applied to any kind of programmatic collapsing via markCollapsed() or ProjectionAnnotationModel.collapse(). As a side effect, single-line folding annotations that have been collapsed by "Collapse All" now appear visible when they are revealed and only hide after being expanded once, but that's the best we can do within the hack set up by bug 85874/88943 (0fe6d28) and seems the lesser evil. Change-Id: Ic9d46de1e4998fd40c1db2e9df9483aa7ccf5a3a Signed-off-by: Christian Walther <walther@indel.ch>
diff --git a/core/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/projection/AbstractStructuredFoldingStrategy.java b/core/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/projection/AbstractStructuredFoldingStrategy.java index 60f5c7e..4d4df83 100644 --- a/core/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/projection/AbstractStructuredFoldingStrategy.java +++ b/core/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/projection/AbstractStructuredFoldingStrategy.java
@@ -350,7 +350,10 @@ public FoldingAnnotation(IndexedRegion region, boolean isCollapsed) { super(isCollapsed); - fIsVisible = false; + // assume visible until proven otherwise because it must be possible + // to programmatically collapse multi-line annotations that have + // never been painted, e.g. from "Collapse All" + fIsVisible = true; fRegion = region; } @@ -378,9 +381,9 @@ public void paint(GC gc, Canvas canvas, Rectangle rectangle) { /* workaround for BUG85874 */ /* - * only need to check annotations that are expanded because hidden - * annotations should never have been given the chance to - * collapse. + * only need to check annotations that are expanded because + * collapsed annotations by definition always only occupy one line + * and would be wrongly hidden when containing multiple lines. */ if (!isCollapsed()) { // working with rectangle, so line height