org.eclipse.xtext.ui.editor.folding.FoldedPosition Java Examples
The following examples show how to use
org.eclipse.xtext.ui.editor.folding.FoldedPosition.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultFoldingRegionProviderTest.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@Test public void testSignificantPartOfMlComment_04() throws Exception { IFile iFile = createFile("foo/bar.foldingtestlanguage", "\n/**\n *\n * foo */\n element foo end"); IXtextDocument document = openFileAndReturnDocument(iFile); DefaultFoldingRegionProvider reg = createFoldingRegionProvider(); Collection<FoldedPosition> regions = reg.getFoldingRegions(document); assertEquals(1, regions.size()); FoldedPosition position = Iterables.getOnlyElement(regions); assertEquals(1, position.getOffset()); assertEquals("/**\n *\n * foo */\n".length(), position.getLength()); assertEquals("/**\n *\n * ".length(), position.computeCaptionOffset(document)); IRegion[] projectionRegions = position.computeProjectionRegions(document); assertEquals(1, projectionRegions.length); assertEquals("\n".length(), projectionRegions[0].getOffset()); assertEquals("/**\n *\n".length(), projectionRegions[0].getLength()); }
Example #2
Source File: XtendFoldingRegionProviderTest.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
@Test public void testFoldCopyrightHeader2() throws Exception { String content = "package test\n/**\n * \n * Hello Copyright\n * \n */\nimport java.util.List\nimport java.util.Set\nclass Bar{}"; Collection<FoldedPosition> foldingRegions = calculateFoldingRegions("test/Bar", content); assertEquals(2, foldingRegions.size()); Iterator<FoldedPosition> iterator = foldingRegions.iterator(); FoldedPosition first = iterator.next(); assertEquals(48, first.getOffset()); assertEquals(43, first.length); assertTrue(((DefaultFoldedPosition)first).isInitiallyFolded()); FoldedPosition second = iterator.next(); assertEquals(13, second.getOffset()); assertEquals(35, second.length); assertFalse(((DefaultFoldedPosition)second).isInitiallyFolded()); }
Example #3
Source File: XtendFoldingRegionProviderTest.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
@Test public void testFoldCopyrightHeader() throws Exception { String content = "/**\n * \n * Hello Copyright\n * \n */\npackage test\nimport java.util.List\nimport java.util.Set\nclass Bar{}"; Collection<FoldedPosition> foldingRegions = calculateFoldingRegions("test/Bar", content); assertEquals(2, foldingRegions.size()); Iterator<FoldedPosition> iterator = foldingRegions.iterator(); FoldedPosition first = iterator.next(); assertEquals(48, first.getOffset()); assertEquals(43, first.length); assertTrue(((DefaultFoldedPosition)first).isInitiallyFolded()); FoldedPosition second = iterator.next(); assertEquals(0, second.getOffset()); assertEquals(35, second.length); assertTrue(((DefaultFoldedPosition)second).isInitiallyFolded()); }
Example #4
Source File: XtendFoldingRegionProviderTest.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
@Test public void testFoldAnonymousClass() throws Exception { String content = "class Foo {\n" + " val foo = new Runnable() {\n" + " override run() {\n" + " }\n" + " }\n" + "}"; Collection<FoldedPosition> foldingRegions = calculateFoldingRegions("test/Bar", content); assertEquals(3, foldingRegions.size()); Iterator<FoldedPosition> iterator = foldingRegions.iterator(); FoldedPosition next = iterator.next(); assertEquals(0, next.offset); assertEquals(69, next.length); next = iterator.next(); assertEquals(12, next.offset); assertEquals(56, next.length); next = iterator.next(); assertEquals(40, next.offset); assertEquals(25, next.length); }
Example #5
Source File: XtendFoldingRegionProviderTest.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
@Test public void testFoldClosure_01() throws Exception { String content = "class Foo {\n" + " def void xxx() {\n" + " #[1,2,3].filter [\n" + " println(it)\n" + " it%2==0\n" + " ]\n" + " }\n" + "}"; Collection<FoldedPosition> foldingRegions = calculateFoldingRegions("test/Foo",content); assertEquals(3, foldingRegions.size()); Iterator<FoldedPosition> iterator = foldingRegions.iterator(); FoldedPosition next = iterator.next(); assertEquals(0, next.offset); assertEquals(96, next.length); next = iterator.next(); assertEquals(12, next.offset); assertEquals(83, next.length); next = iterator.next(); assertEquals(31, next.offset); assertEquals(60, next.length); }
Example #6
Source File: XtendFoldingRegionProviderTest.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
@Test public void testFoldClosure_02() throws Exception { String content = "class Foo {\n" + " def void xxx() {\n" + " #[1,2,3].filter [ i % 2 == 0 ]\n" + " }\n" + "}"; Collection<FoldedPosition> foldingRegions = calculateFoldingRegions("test/Foo", content); assertEquals(2, foldingRegions.size()); Iterator<FoldedPosition> iterator = foldingRegions.iterator(); FoldedPosition next = iterator.next(); assertEquals(0, next.offset); assertEquals(71, next.length); next = iterator.next(); assertEquals(12, next.offset); assertEquals(58, next.length); }
Example #7
Source File: XtendFoldingRegionProviderTest.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
@Test public void testFoldRichString_01() throws Exception { String content = "class Foo {\n" + " def void xxx() {\n" + " println('''\n" + " x\n" + " y\n" + " ''')\n" + " }\n" + "}"; Collection<FoldedPosition> foldingRegions = calculateFoldingRegions("test/Foo", content); assertEquals(3, foldingRegions.size()); Iterator<FoldedPosition> iterator = foldingRegions.iterator(); FoldedPosition next = iterator.next(); assertEquals(0, next.offset); assertEquals(77, next.length); next = iterator.next(); assertEquals(12, next.offset); assertEquals(64, next.length); next = iterator.next(); assertEquals(31, next.offset); assertEquals(41, next.length); }
Example #8
Source File: DefaultFoldingRegionProviderTest.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@SuppressWarnings("deprecation") @Test public void testIsHandled() throws Exception { IFile iFile = createFile("foo/bar.foldingtestlanguage", "element foo \n" + "element bar \n" + "end \n" + "end"); IXtextDocument document = openFileAndReturnDocument(iFile); DefaultFoldingRegionProvider reg = new DefaultFoldingRegionProvider(new DefaultLocationInFileProvider()) { @Override protected boolean isHandled(EObject object) { if (object instanceof Element) { return !"foo".equals(((Element) object).getName()); } return super.isHandled(object); } }; Collection<FoldedPosition> regions = reg.getFoldingRegions(document); assertEquals(1, regions.size()); assertEquals("element foo \n".length(), regions.iterator().next().getOffset()); }
Example #9
Source File: DefaultFoldingRegionProviderTest.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@SuppressWarnings("deprecation") @Test public void testShouldProcessContent() throws Exception { IFile iFile = createFile("foo/bar.foldingtestlanguage", "element foo \n" + "element bar \n" + "end \n" + "end"); IXtextDocument document = openFileAndReturnDocument(iFile); DefaultFoldingRegionProvider reg = new DefaultFoldingRegionProvider(new DefaultLocationInFileProvider()) { @Override protected boolean shouldProcessContent(EObject object) { if (object instanceof Element) { return !"foo".equals(((Element) object).getName()); } return super.shouldProcessContent(object); } }; Collection<FoldedPosition> regions = reg.getFoldingRegions(document); assertEquals(1, regions.size()); assertEquals(0, regions.iterator().next().getOffset()); }
Example #10
Source File: DefaultFoldingRegionProviderTest.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@Test public void testSignificantPartOfModel_03() throws Exception { IFile iFile = createFile("foo/bar.foldingtestlanguage", "\n" + "element\n" + " foo end\n"); IXtextDocument document = openFileAndReturnDocument(iFile); DefaultFoldingRegionProvider reg = createFoldingRegionProvider(); Collection<FoldedPosition> regions = reg.getFoldingRegions(document); assertEquals(1, regions.size()); FoldedPosition position = Iterables.getOnlyElement(regions); assertEquals("\n".length(), position.getOffset()); assertEquals("element\n foo end\n".length(), position.getLength()); assertEquals("element\n ".length(), position.computeCaptionOffset(document)); IRegion[] projectionRegions = position.computeProjectionRegions(document); assertEquals(1, projectionRegions.length); assertEquals("\n".length(), projectionRegions[0].getOffset()); assertEquals("element\n".length(), projectionRegions[0].getLength()); }
Example #11
Source File: DefaultFoldingRegionProviderTest.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@Test public void testSignificantPartOfModel_02() throws Exception { IFile iFile = createFile("foo/bar.foldingtestlanguage", "\n" + "element\n" + " foo\n" + "end\n"); IXtextDocument document = openFileAndReturnDocument(iFile); DefaultFoldingRegionProvider reg = createFoldingRegionProvider(); Collection<FoldedPosition> regions = reg.getFoldingRegions(document); assertEquals(1, regions.size()); FoldedPosition position = Iterables.getOnlyElement(regions); assertEquals("\n".length(), position.getOffset()); assertEquals("element\n foo\nend\n".length(), position.getLength()); assertEquals("element\n ".length(), position.computeCaptionOffset(document)); IRegion[] projectionRegions = position.computeProjectionRegions(document); assertEquals(2, projectionRegions.length); assertEquals("\n".length(), projectionRegions[0].getOffset()); assertEquals("element\n".length(), projectionRegions[0].getLength()); assertEquals("\nelement\n foo\n".length(), projectionRegions[1].getOffset()); assertEquals("end\n".length(), projectionRegions[1].getLength()); }
Example #12
Source File: DefaultFoldingRegionProviderTest.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@Test public void testSignificantPartOfModel_01() throws Exception { IFile iFile = createFile("foo/bar.foldingtestlanguage", "\n" + "element foo\n" + "end\n"); IXtextDocument document = openFileAndReturnDocument(iFile); DefaultFoldingRegionProvider reg = createFoldingRegionProvider(); Collection<FoldedPosition> regions = reg.getFoldingRegions(document); assertEquals(1, regions.size()); FoldedPosition position = Iterables.getOnlyElement(regions); assertEquals("\n".length(), position.getOffset()); assertEquals("element foo\nend\n".length(), position.getLength()); assertEquals("element ".length(), position.computeCaptionOffset(document)); IRegion[] projectionRegions = position.computeProjectionRegions(document); assertEquals(1, projectionRegions.length); assertEquals("\nelement foo\n".length(), projectionRegions[0].getOffset()); assertEquals("end\n".length(), projectionRegions[0].getLength()); }
Example #13
Source File: DefaultFoldingRegionProviderTest.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@Test public void testSignificantPartOfMlComment_03() throws Exception { IFile iFile = createFile("foo/bar.foldingtestlanguage", "\n/**\n *\n * foo\n *\n */\n element foo end"); IXtextDocument document = openFileAndReturnDocument(iFile); DefaultFoldingRegionProvider reg = createFoldingRegionProvider(); Collection<FoldedPosition> regions = reg.getFoldingRegions(document); assertEquals(1, regions.size()); FoldedPosition position = Iterables.getOnlyElement(regions); assertEquals(1, position.getOffset()); assertEquals("/**\n *\n * foo\n *\n */\n".length(), position.getLength()); assertEquals("/**\n *\n * ".length(), position.computeCaptionOffset(document)); IRegion[] projectionRegions = position.computeProjectionRegions(document); assertEquals(2, projectionRegions.length); assertEquals("\n".length(), projectionRegions[0].getOffset()); assertEquals("/**\n *\n".length(), projectionRegions[0].getLength()); assertEquals("\n/**\n *\n * foo\n".length(), projectionRegions[1].getOffset()); assertEquals(" *\n */\n".length(), projectionRegions[1].getLength()); }
Example #14
Source File: DefaultFoldingRegionProviderTest.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@Test public void testSignificantPartOfMlComment_02() throws Exception { IFile iFile = createFile("foo/bar.foldingtestlanguage", "\n/** foo\n *\n */\n element foo end"); IXtextDocument document = openFileAndReturnDocument(iFile); DefaultFoldingRegionProvider reg = createFoldingRegionProvider(); Collection<FoldedPosition> regions = reg.getFoldingRegions(document); assertEquals(1, regions.size()); FoldedPosition position = Iterables.getOnlyElement(regions); assertEquals(1, position.getOffset()); assertEquals("/** foo\n *\n */\n".length(), position.getLength()); assertEquals("/** ".length(), position.computeCaptionOffset(document)); IRegion[] projectionRegions = position.computeProjectionRegions(document); assertEquals(1, projectionRegions.length); assertEquals("\n/** foo\n".length(), projectionRegions[0].getOffset()); assertEquals(" *\n */\n".length(), projectionRegions[0].getLength()); }
Example #15
Source File: DefaultFoldingRegionProviderTest.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@Test public void testSignificantPartOfMlComment_01() throws Exception { IFile iFile = createFile("foo/bar.foldingtestlanguage", "\n/**\n *\n */\n element foo end"); IXtextDocument document = openFileAndReturnDocument(iFile); DefaultFoldingRegionProvider reg = createFoldingRegionProvider(); Collection<FoldedPosition> regions = reg.getFoldingRegions(document); assertEquals(1, regions.size()); FoldedPosition position = Iterables.getOnlyElement(regions); assertEquals(1, position.getOffset()); assertEquals("/**\n *\n */\n".length(), position.getLength()); assertEquals(0, position.computeCaptionOffset(document)); IRegion[] projectionRegions = position.computeProjectionRegions(document); assertEquals(1, projectionRegions.length); assertEquals("\n/**\n".length(), projectionRegions[0].getOffset()); assertEquals(" *\n */\n".length(), projectionRegions[0].getLength()); }
Example #16
Source File: XtendFoldingRegionProviderTest.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
@Test public void testRichString_02() throws Exception { String content = "class Foo {\n" + " def void xxx() {\n" + " println('''x y''')\n" + " }\n" + "}"; Collection<FoldedPosition> foldingRegions = calculateFoldingRegions("test/Foo", content); assertEquals(2, foldingRegions.size()); Iterator<FoldedPosition> iterator = foldingRegions.iterator(); FoldedPosition next = iterator.next(); assertEquals(0, next.offset); assertEquals(59, next.length); next = iterator.next(); assertEquals(12, next.offset); assertEquals(46, next.length); }
Example #17
Source File: XtendFoldingRegionProviderTest.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
@Test public void testFoldListLiteral_01() throws Exception { String content = "class Foo {\n" + " def xxx() {\n" + " #[\n" + " 1,\n" + " 2\n" + " ]\n" + " }\n" + "}"; Collection<FoldedPosition> foldingRegions = calculateFoldingRegions("test/Foo", content); assertEquals(3, foldingRegions.size()); Iterator<FoldedPosition> iterator = foldingRegions.iterator(); FoldedPosition next = iterator.next(); assertEquals(0, next.offset); assertEquals(61, next.length); next = iterator.next(); assertEquals(12, next.offset); assertEquals(48, next.length); next = iterator.next(); assertEquals(26, next.offset); assertEquals(30, next.length); }
Example #18
Source File: XtendFoldingRegionProviderTest.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
@Test public void testFoldListLiteral_02() throws Exception { String content = "class Foo {\n" + " def xxx() {\n" + " #[1,2]\n" + " }\n" + "}"; Collection<FoldedPosition> foldingRegions = calculateFoldingRegions("test/Foo", content); assertEquals(2, foldingRegions.size()); Iterator<FoldedPosition> iterator = foldingRegions.iterator(); FoldedPosition next = iterator.next(); assertEquals(0, next.offset); assertEquals(42, next.length); next = iterator.next(); assertEquals(12, next.offset); assertEquals(29, next.length); }
Example #19
Source File: XtendFoldingRegionProviderTest.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
@Test public void testFoldSetLiteral_01() throws Exception { String content = "class Foo {\n" + " def xxx() {\n" + " #{\n" + " 1,\n" + " 2\n" + " }\n" + " }\n" + "}"; Collection<FoldedPosition> foldingRegions = calculateFoldingRegions("test/Foo", content); assertEquals(3, foldingRegions.size()); Iterator<FoldedPosition> iterator = foldingRegions.iterator(); FoldedPosition next = iterator.next(); assertEquals(0, next.offset); assertEquals(61, next.length); next = iterator.next(); assertEquals(12, next.offset); assertEquals(48, next.length); next = iterator.next(); assertEquals(26, next.offset); assertEquals(30, next.length); }
Example #20
Source File: XtendFoldingRegionProviderTest.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
@Test public void testFoldSetLiteral_02() throws Exception { String content = "class Foo {\n" + " def xxx() {\n" + " #{1,2}\n" + " }\n" + "}"; Collection<FoldedPosition> foldingRegions = calculateFoldingRegions("test/Foo", content); assertEquals(2, foldingRegions.size()); Iterator<FoldedPosition> iterator = foldingRegions.iterator(); FoldedPosition next = iterator.next(); assertEquals(0, next.offset); assertEquals(42, next.length); next = iterator.next(); assertEquals(12, next.offset); assertEquals(29, next.length); }
Example #21
Source File: DefaultFoldingRegionProviderTest.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Test public void testGetFoldingRegions1() throws Exception { IFile iFile = createFile("foo/bar.foldingtestlanguage", "element foo \nelement bar end \nelement baz end end"); IXtextDocument document = openFileAndReturnDocument(iFile); DefaultFoldingRegionProvider reg = createFoldingRegionProvider(); Collection<FoldedPosition> regions = reg.getFoldingRegions(document); assertEquals(1, regions.size()); }
Example #22
Source File: XtendFoldingRegionProvider.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Override public Collection<FoldedPosition> getFoldingRegions(IXtextDocument xtextDocument) { if (foldingPreferences.isEnabled()) { return super.getFoldingRegions(xtextDocument); } else { return Collections.emptyList(); } }
Example #23
Source File: AbstractFoldingTest.java From dsl-devkit with Eclipse Public License 1.0 | 5 votes |
/** * Verifies that FoldedPositions are valid. * If the assertion fails that is probably due to an ITextRegion.EMPTY_REGION being provided for the object's significant text region. */ @BugTest("ACF-2605") public void testFoldedPositions() { Collection<FoldedPosition> foldingRegions = getXtextTestUtil().get(IFoldingRegionProvider.class).getFoldingRegions(getDocument()); for (DefaultFoldedPosition foldedPosition : Iterables.filter(foldingRegions, DefaultFoldedPosition.class)) { try { Assert.assertFalse("Illegal significant region for FoldedPosition " + foldedPosition, foldedPosition.computeCaptionOffset(getDocument()) < 0); /* If the above assertion fails that is probably due to an ITextRegion.EMPTY_REGION being provided for the object's significant text region. */ } catch (BadLocationException e) { fail("Bad location for FoldedPosition: " + e.getMessage()); } } }
Example #24
Source File: GamaFoldingRegionProvider.java From gama with GNU General Public License v3.0 | 5 votes |
@Override protected FoldedPosition newFoldedPosition(final IRegion region, final ITextRegion significantRegion) { FoldedPosition result = null; if (region != null) { if (type != null && significantRegion != null) { result = new TypedFoldedPosition(region.getOffset(), region.getLength(), significantRegion.getOffset() - region.getOffset() - 1, significantRegion.getLength(), type); } else { result = super.newFoldedPosition(region, significantRegion); } } return result; }
Example #25
Source File: XtendFoldingRegionProviderTest.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Test public void testFoldingOfMoreThanOneImports() throws Exception { String content = "package test\nimport java.util.List\nimport java.util.Set\nclass Bar{}"; Collection<FoldedPosition> foldingRegions = calculateFoldingRegions("test/Bar", content); assertEquals(1, foldingRegions.size()); FoldedPosition first = foldingRegions.iterator().next(); assertEquals(13, first.getOffset()); assertEquals(43, first.length); }
Example #26
Source File: DotFoldingRegionProvider.java From gef with Eclipse Public License 2.0 | 5 votes |
/** * Compute folding regions for the dot attribute value if possible. * * @param dotAttribute * @param foldingRegionAcceptor */ private void computeDotAttributeValueFolding(Attribute attribute, IFoldingRegionAcceptor<ITextRegion> foldingRegionAcceptor) { // The folding should be able to cope with incomplete statements if (attribute.getValue() != null && attribute.getValue().getType() == ID.Type.HTML_STRING) { String htmlLabelValue = attribute.getValue().toValue(); Injector injector = DotActivator.getInstance().getInjector( DotActivator.ORG_ECLIPSE_GEF_DOT_INTERNAL_LANGUAGE_DOTHTMLLABEL); IFoldingRegionProvider htmlLabelFoldingRegionProvider = injector .getInstance(IFoldingRegionProvider.class); IXtextDocument xtextDocument = null; try { xtextDocument = DotEditorUtils.getDocument(injector, htmlLabelValue); } catch (Exception e) { DotActivatorEx.logError(e); } if (xtextDocument != null) { Collection<FoldedPosition> htmlLabelFoldingRegions = htmlLabelFoldingRegionProvider .getFoldingRegions(xtextDocument); for (Iterator<FoldedPosition> iterator = htmlLabelFoldingRegions .iterator(); iterator.hasNext();) { FoldedPosition htmlFoldedPosition = iterator.next(); int attributeValueStartOffset = getAttributeValueStartOffset( attribute); foldingRegionAcceptor.accept( attributeValueStartOffset + htmlFoldedPosition.getOffset(), htmlFoldedPosition.getLength() - 1); } } } }
Example #27
Source File: DefaultFoldingRegionProviderTest.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Test public void testGetFoldingRegionsWithMutltipleMlComment() throws Exception { IFile iFile = createFile("foo/bar.foldingtestlanguage", "/**\n*/\n element foo \nelement bar \n/**\n*/\n end \nelement \n/**\n*/\n baz end \n/**\n*/\n end"); IXtextDocument document = openFileAndReturnDocument(iFile); DefaultFoldingRegionProvider reg = createFoldingRegionProvider(); Collection<FoldedPosition> regions = reg.getFoldingRegions(document); assertEquals(7, regions.size()); }
Example #28
Source File: DefaultFoldingRegionProviderTest.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Test public void testGetFoldingRegionsWithMlCommentBetween() throws Exception { IFile iFile = createFile("foo/bar.foldingtestlanguage", "element foo \nelement bar \n /**\n*/ \n end \nelement baz end end"); IXtextDocument document = openFileAndReturnDocument(iFile); DefaultFoldingRegionProvider reg = createFoldingRegionProvider(); Collection<FoldedPosition> regions = reg.getFoldingRegions(document); assertEquals(3, regions.size()); }
Example #29
Source File: DefaultFoldingRegionProviderTest.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Test public void testGetFoldingRegionsWithMlCommentEnd() throws Exception { IFile iFile = createFile("foo/bar.foldingtestlanguage", "element foo \nelement bar end \nelement baz end end\n/**\n*/"); IXtextDocument document = openFileAndReturnDocument(iFile); DefaultFoldingRegionProvider reg = createFoldingRegionProvider(); Collection<FoldedPosition> regions = reg.getFoldingRegions(document); assertEquals(2, regions.size()); }
Example #30
Source File: DefaultFoldingRegionProviderTest.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Test public void testGetFoldingRegionsWithMlCommentStart() throws Exception { IFile iFile = createFile("foo/bar.foldingtestlanguage", "/**\n*/\n element foo \nelement bar end \nelement baz end end"); IXtextDocument document = openFileAndReturnDocument(iFile); DefaultFoldingRegionProvider reg = createFoldingRegionProvider(); Collection<FoldedPosition> regions = reg.getFoldingRegions(document); assertEquals(2, regions.size()); }