3737
3838import org .eclipse .jface .preference .IPreferenceStore ;
3939
40- import org .eclipse .jface .text .IRegion ;
4140import org .eclipse .jface .text .Position ;
4241import org .eclipse .jface .text .source .Annotation ;
4342import org .eclipse .jface .text .source .projection .ProjectionAnnotation ;
@@ -101,7 +100,7 @@ public void testNoCustomFoldingRegions() throws Exception {
101100 package org.example.test;
102101 public class Test { }
103102 """ ;
104- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
103+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
105104 assertEquals (0 , projectionRanges .size ());
106105 }
107106
@@ -118,7 +117,7 @@ class Test {
118117 // endregion
119118 }
120119 """ ;
121- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
120+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
122121 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 1 , 3 ); // region 1
123122 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 5 , 7 ); // region 2
124123 }
@@ -136,7 +135,7 @@ class Test {
136135 // endregion inner
137136 }
138137 """ ;
139- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
138+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
140139 assertEquals (3 , projectionRanges .size ());
141140 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 2 , 8 );//class Test
142141 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 3 , 7 );//outer
@@ -157,7 +156,7 @@ class Test {
157156 // endregion inner
158157 }
159158 """ ;
160- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
159+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
161160 FoldingTestUtils .assertDoesNotContainRegionUsingStartLine (projectionRanges , str , 3 );//outer
162161 }
163162
@@ -173,7 +172,7 @@ void a(){
173172 }
174173 }
175174 """ ;
176- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
175+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
177176 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 3 , 5 ); // region 1
178177 }
179178
@@ -184,7 +183,7 @@ public void testNoCustomFoldingRegionsSingleImport() throws Exception {
184183
185184 import java.util.List;
186185 """ ;
187- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
186+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
188187 assertEquals (0 , projectionRanges .size ());
189188 }
190189
@@ -197,7 +196,7 @@ public void testCustomFoldingRegionAroundSingleImport() throws Exception {
197196 import java.util.List;
198197 // endregion
199198 """ ;
200- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
199+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
201200 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 2 , 4 ); // imports
202201 }
203202
@@ -225,7 +224,7 @@ class D {
225224
226225 }
227226 """ ;
228- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
227+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
229228 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 6 , 15 ); // region 1
230229 }
231230
@@ -247,7 +246,7 @@ void a(){
247246 }
248247 // endregion outside class
249248 """ ;
250- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
249+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
251250 assertEquals (5 , projectionRanges .size ());
252251 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 2 , 12 );//class Test
253252 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 1 , 13 );//outside class
@@ -269,7 +268,7 @@ void a(){
269268 }
270269 // endregion outside class
271270 """ ;
272- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
271+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
273272 FoldingTestUtils .assertDoesNotContainRegionUsingStartLine (projectionRanges , str , 4 );//region inside method
274273 }
275274
@@ -289,7 +288,7 @@ void a(){
289288 }
290289 }
291290 """ ;
292- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
291+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
293292 if (extendedFoldingActive ) {
294293 assertEquals (5 , projectionRanges .size ());
295294 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 2 , 11 );//class SpecialCommentTypes
@@ -323,7 +322,7 @@ class Inner{
323322 }
324323 }
325324 """ ;
326- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
325+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
327326 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 4 , 7 );//region 1
328327 }
329328
@@ -348,7 +347,7 @@ class B {
348347
349348 }
350349 """ ;
351- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
350+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
352351 FoldingTestUtils .assertDoesNotContainRegionUsingStartLine (projectionRanges , str , 3 );// region outside
353352 }
354353
@@ -367,7 +366,7 @@ void b(){
367366 // endregion
368367 }
369368 """ ;
370- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
369+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
371370 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 3 , 9 );//region 1
372371 }
373372
@@ -387,7 +386,7 @@ class Test {
387386 // endregion should be ignored
388387 }
389388 """ ;
390- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
389+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
391390 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 3 , 4 ); // this is the region
392391 }
393392
@@ -403,7 +402,7 @@ void a(){
403402 }
404403 }
405404 """ ;
406- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
405+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
407406 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 3 , 5 );//region 1
408407 }
409408
@@ -419,7 +418,7 @@ void a(){
419418 }
420419 }
421420 """ ;
422- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
421+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
423422 FoldingTestUtils .assertDoesNotContainRegionUsingStartLine (projectionRanges , str , 3 );
424423 }
425424
@@ -435,7 +434,7 @@ void a(){
435434 }
436435 }
437436 """ ;
438- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
437+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
439438 FoldingTestUtils .assertDoesNotContainRegionUsingStartLine (projectionRanges , str , 3 );
440439 }
441440
@@ -451,7 +450,7 @@ void a(){
451450 }
452451 }
453452 """ ;
454- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
453+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
455454 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 3 , 5 );//region 1
456455 }
457456
@@ -468,7 +467,7 @@ void a(){
468467 }
469468 }
470469 """ ;
471- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
470+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
472471 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 4 , 6 );//region 1
473472 }
474473
@@ -485,7 +484,7 @@ void a(){
485484 }
486485 }
487486 """ ;
488- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
487+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
489488 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 4 , 6 );//region 1
490489 }
491490
@@ -501,7 +500,7 @@ void a(){
501500 }
502501 }
503502 """ ;
504- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
503+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
505504 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 3 , 4 );//region 1
506505 }
507506
@@ -515,7 +514,7 @@ void a(){/* region 1*/}
515514 /* endregion */
516515 }
517516 """ ;
518- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
517+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
519518 FoldingTestUtils .assertDoesNotContainRegionUsingStartLine (projectionRanges , str , 2 );
520519 }
521520
@@ -529,7 +528,7 @@ class Test {
529528 void a(){/* endregion*/}
530529 }
531530 """ ;
532- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
531+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
533532 FoldingTestUtils .assertDoesNotContainRegionUsingStartLine (projectionRanges , str , 2 );
534533 }
535534
@@ -549,7 +548,7 @@ void a(){
549548 }
550549 }
551550 """ ;
552- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
551+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
553552 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 3 , 4 );//region 1
554553 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 5 , 6 );//region 1
555554 }
@@ -574,7 +573,7 @@ void a() {
574573 }
575574 }
576575 """ ;
577- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
576+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
578577 FoldingTestUtils .assertDoesNotContainRegionUsingStartLine (projectionRanges , str , 3 );// region 1
579578 FoldingTestUtils .assertDoesNotContainRegionUsingStartLine (projectionRanges , str , 6 );// region 2
580579 FoldingTestUtils .assertDoesNotContainRegionUsingStartLine (projectionRanges , str , 9 );// region 3
@@ -591,7 +590,7 @@ class Test {
591590 /* endregion */ void test(){}
592591 }
593592 """ ;
594- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
593+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
595594 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 3 , 4 ); // region 1
596595 }
597596
@@ -611,7 +610,7 @@ class Test {
611610
612611 }
613612 """ ;
614- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
613+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
615614 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 3 , 4 );//first start
616615 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 5 , 6 );//second start
617616 }
@@ -641,7 +640,7 @@ void test() {
641640 // ----
642641 }
643642 """ ;
644- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
643+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
645644 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 3 , 7 );//variables
646645 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 8 , 13 );//methods
647646 }
@@ -675,7 +674,7 @@ void otherMethod() {
675674 }
676675 }
677676 """ ;
678- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
677+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
679678 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 6 , 9 );//inner
680679 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 10 , 12 );//inner 2
681680 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 15 , 19 );//outer 2
@@ -699,7 +698,7 @@ class Test {
699698
700699 }
701700 """ ;
702- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
701+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
703702 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 3 , 8 );//no end marker
704703 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 5 , 6 );//first
705704 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 7 , 8 );//second
@@ -721,7 +720,7 @@ public void testStartMarkerStartsWithEndMarkerWithoutTopLevelType() throws Excep
721720
722721 // regend second
723722 """ ;
724- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
723+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
725724 FoldingTestUtils .assertContainsRegionWithOffsetAndLength (projectionRanges , 2 , 7 , //no end marker
726725 FoldingTestUtils .findLineStartIndex (str , 2 ), str .length () - 1 );
727726 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 4 , 5 );//first
@@ -751,7 +750,7 @@ class Test {
751750 // reg end
752751 }
753752 """ ;
754- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
753+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
755754 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 6 , 7 );//first
756755 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 10 , 11 );//second
757756 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 12 , 13 );//third
@@ -767,7 +766,7 @@ public void testSameStartAndEndMarkerTerminatesAtEOF() throws Exception {
767766 // reg my region
768767
769768 // some comment without line break""" ;
770- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
769+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
771770 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 0 , 2 );
772771 }
773772
@@ -782,7 +781,7 @@ public void testSameStartAndEndMarkerTerminatesAtEOFEmptyLine() throws Exception
782781
783782
784783 """ ;
785- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
784+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
786785 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 0 , 3 );
787786 }
788787
@@ -809,7 +808,7 @@ public String test(boolean b) {
809808
810809 }
811810 """ ;
812- List <IRegion > projectionRanges = getProjectionRangesOfFile (str );
811+ List <FoldingTestUtils . ProjectionRegion > projectionRanges = getProjectionRangesOfFile (str );
813812 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (projectionRanges , str , 4 , 12 );//custom region
814813 }
815814
@@ -838,7 +837,7 @@ void someMethod() {
838837 try {
839838 ProjectionAnnotationModel model = editor .getAdapter (ProjectionAnnotationModel .class );
840839
841- List <IRegion > initialRegions = FoldingTestUtils .extractRegions (model );
840+ List <FoldingTestUtils . ProjectionRegion > initialRegions = FoldingTestUtils .extractRegions (model );
842841
843842 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (initialRegions , code , 2 , 15 );//outer
844843 FoldingTestUtils .assertContainsRegionUsingStartAndEndLine (initialRegions , code , 5 , 12 );//middle
@@ -856,8 +855,8 @@ void someMethod() {
856855
857856 // check that regions are in the same order as before and not modified in another way
858857 for (int i = 0 ; i < positions .size (); i ++) {
859- assertEquals (initialRegions .get (i ).getOffset (), positions .get (i ).getOffset ());
860- assertEquals (initialRegions .get (i ).getLength () + additionalText .length (), positions .get (i ).getLength ());
858+ assertEquals (initialRegions .get (i ).offset (), positions .get (i ).getOffset ());
859+ assertEquals (initialRegions .get (i ).length () + additionalText .length (), positions .get (i ).getLength ());
861860 }
862861 } finally {
863862 editor .close (false );
@@ -946,8 +945,9 @@ private List<Position> getFoldingPositionsFromModel(ProjectionAnnotationModel mo
946945 return positions ;
947946 }
948947
949- private List <IRegion > getProjectionRangesOfFile (String str ) throws Exception {
948+ private List <FoldingTestUtils . ProjectionRegion > getProjectionRangesOfFile (String str ) throws Exception {
950949 return FoldingTestUtils .getProjectionRangesOfPackage (fPackageFragment , str );
951950 }
952951
953952}
953+
0 commit comments