bugfix 1412408
authorbananeweizen <bananeweizen>
Sun, 29 Jan 2006 14:25:16 +0000 (14:25 +0000)
committerbananeweizen <bananeweizen>
Sun, 29 Jan 2006 14:25:16 +0000 (14:25 +0000)
https://sourceforge.net/tracker/index.php?func=detail&aid=1412408&group_id=57621&atid=484801
comment folding caused class bodies to be folded

net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/folding/DefaultJavaFoldingStructureProvider.java

index 2396518..48be71c 100644 (file)
@@ -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()];