Class EmbeddedEditorFoldingStructureProvider

  • All Implemented Interfaces:
    org.eclipse.xtext.ui.editor.model.IXtextModelListener

    public class EmbeddedEditorFoldingStructureProvider
    extends Object
    implements org.eclipse.xtext.ui.editor.model.IXtextModelListener
    Folding structure provider for abstract Xtext viewers and document. Can be used with Xtext EmbeddedEditor.
    • Constructor Detail

      • EmbeddedEditorFoldingStructureProvider

        public EmbeddedEditorFoldingStructureProvider()
    • Method Detail

      • initialize

        public void initialize()
        Initialize folding structure.
      • install

        public void install​(org.eclipse.xtext.ui.editor.model.XtextDocument document,
                            org.eclipse.xtext.ui.editor.XtextSourceViewer viewer)
        Install folding structure to given embedded editor.
        Parameters:
        document - target xtext document (not null)
        viewer - target xtext source viewer (not null)
      • uninstall

        public void uninstall()
        Uninstall folding structure from associated embedded editor.
      • isInstalled

        protected final boolean isInstalled()
        Returns true if the provider is installed, false otherwise.
        Returns:
        true if the provider is installed, false otherwise
      • modelChanged

        public void modelChanged​(org.eclipse.xtext.resource.XtextResource resource)
        Specified by:
        modelChanged in interface org.eclipse.xtext.ui.editor.model.IXtextModelListener
      • handleProjectionEnabled

        protected void handleProjectionEnabled()
        Handle projection enabled event.
      • handleProjectionDisabled

        protected void handleProjectionDisabled()
        Handle projection disabled event.
      • calculateProjectionAnnotationModel

        protected void calculateProjectionAnnotationModel​(boolean allowCollapse)
        Calculate folding in viewer projection annotation model.
        Parameters:
        allowCollapse - allow folding to collapse
      • mergeFoldingRegions

        protected org.eclipse.jface.text.source.Annotation[] mergeFoldingRegions​(Collection<org.eclipse.xtext.ui.editor.folding.FoldedPosition> foldedPositions,
                                                                                 org.eclipse.jface.text.source.projection.ProjectionAnnotationModel projectionAnnotationModel)
        Merge given folding regions.
        Parameters:
        foldedPositions - folding positions (not null)
        projectionAnnotationModel - projection annotation model (not null)
        Returns:
        annotations (not null)
      • updateFoldingRegions

        protected void updateFoldingRegions​(boolean allowCollapse,
                                            org.eclipse.jface.text.source.projection.ProjectionAnnotationModel model,
                                            Collection<org.eclipse.xtext.ui.editor.folding.FoldedPosition> foldedPositions,
                                            org.eclipse.jface.text.source.Annotation[] deletions)
        Update given folding regions in associated viewer.
        Parameters:
        allowCollapse - allow folding to collapse
        model - annotation model (not null)
        foldedPositions - folded positions (not null)
        deletions - deletion annotations (not null)