From: bananeweizen Date: Sun, 29 Jan 2006 14:25:16 +0000 (+0000) Subject: bugfix 1412408 X-Git-Url: http://secure.phpeclipse.com?hp=80a968ddb5fff37aaac287c3ac144097969a55c2 bugfix 1412408 https://sourceforge.net/tracker/index.php?func=detail&aid=1412408&group_id=57621&atid=484801 comment folding caused class bodies to be folded --- diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/folding/DefaultJavaFoldingStructureProvider.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/folding/DefaultJavaFoldingStructureProvider.java index 2396518..48be71c 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/folding/DefaultJavaFoldingStructureProvider.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/folding/DefaultJavaFoldingStructureProvider.java @@ -630,6 +630,7 @@ public class DefaultJavaFoldingStructureProvider implements IProjectionListener, return null; List regions = new ArrayList(); + // now add all comments first to the regions list if (fFirstType == null && element instanceof IType) { fFirstType = (IType) element; IRegion headerComment = computeHeaderComment(fFirstType); @@ -641,7 +642,6 @@ public class DefaultJavaFoldingStructureProvider implements IProjectionListener, final int shift = range.getOffset(); int start = shift; - regions.add(new Region(range.getOffset(), range.getLength())); if (element instanceof IType) { Scanner scanner = ToolFactory.createScanner(true, false, false, false); scanner.setSource(contents.toCharArray()); @@ -663,9 +663,9 @@ public class DefaultJavaFoldingStructureProvider implements IProjectionListener, continue; } } - regions.add(new Region(start, shift + range.getLength() - start)); } - + // at the end add the element region + regions.add(new Region(range.getOffset(), range.getLength())); if (regions.size() > 0) { IRegion[] result = new IRegion[regions.size()];