org.eclipse.xtext.ui.editor.folding.IFoldingRegionProvider Java Examples
The following examples show how to use
org.eclipse.xtext.ui.editor.folding.IFoldingRegionProvider.
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: 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 #2
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 #3
Source File: XtextUiModule.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IFoldingRegionProvider> bindIFoldingRegionProvider() { return XtextGrammarFoldingRegionProvider.class; }
Example #4
Source File: StatemachineUiModule.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IFoldingRegionProvider> bindIFoldingRegionProvider() { return StatemachineFoldingRegionProvider.class; }
Example #5
Source File: PureXbaseUiModule.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IFoldingRegionProvider> bindFoldingRegionProvider() { return PureXbaseUiModule.NoFolding.class; }
Example #6
Source File: DotHtmlLabelUiModule.java From gef with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IFoldingRegionProvider> bindIFoldingRegionProvider() { return DotHtmlLabelFoldingRegionProvider.class; }
Example #7
Source File: DotUiModule.java From gef with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IFoldingRegionProvider> bindIFoldingRegionProvider() { return DotFoldingRegionProvider.class; }
Example #8
Source File: XtendUiModule.java From xtext-xtend with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IFoldingRegionProvider> bindIFoldingRegionProvider() { return XtendFoldingRegionProvider.class; }
Example #9
Source File: GamlUiModule.java From gama with GNU General Public License v3.0 | 4 votes |
public Class<? extends IFoldingRegionProvider> bindFoldingRegionProvider() { return GamaFoldingRegionProvider.class; }