Search in sources :

Example 1 with IFoldingRegionAcceptorExtension

use of org.eclipse.xtext.ui.editor.folding.IFoldingRegionAcceptorExtension in project xtext-xtend by eclipse.

the class XtendFoldingRegionProvider method computeImportFolding.

protected void computeImportFolding(XtendFile xtendFile, IFoldingRegionAcceptor<ITextRegion> foldingRegionAcceptor) {
    if (xtendFile.getImportSection() != null && xtendFile.getImportSection().getImportDeclarations().size() > 1) {
        ICompositeNode node = NodeModelUtils.findActualNodeFor(xtendFile.getImportSection());
        if (node != null) {
            ITextRegion textRegion = node.getTextRegion();
            ((IFoldingRegionAcceptorExtension<ITextRegion>) foldingRegionAcceptor).accept(textRegion.getOffset(), textRegion.getLength(), foldingPreferences.isFoldImports());
        }
    }
}
Also used : ITextRegion(org.eclipse.xtext.util.ITextRegion) IFoldingRegionAcceptorExtension(org.eclipse.xtext.ui.editor.folding.IFoldingRegionAcceptorExtension) ICompositeNode(org.eclipse.xtext.nodemodel.ICompositeNode)

Aggregations

ICompositeNode (org.eclipse.xtext.nodemodel.ICompositeNode)1 IFoldingRegionAcceptorExtension (org.eclipse.xtext.ui.editor.folding.IFoldingRegionAcceptorExtension)1 ITextRegion (org.eclipse.xtext.util.ITextRegion)1