Class BslFoldingRegionProvider

  • All Implemented Interfaces:
    org.eclipse.xtext.ui.editor.folding.IFoldingRegionProvider

    public class BslFoldingRegionProvider
    extends CustomFoldingRegionProvider
    Custom folding for BSL
    See Also:
    DefaultFoldingRegionProvider
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected FoldingPreferences preferences  
      • Fields inherited from class org.eclipse.xtext.ui.editor.folding.DefaultFoldingRegionProvider

        TEXT_PATTERN_IN_COMMENT
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void computeCommentFolding​(org.eclipse.xtext.ui.editor.model.IXtextDocument xtextDocument, org.eclipse.xtext.ui.editor.folding.IFoldingRegionAcceptor<org.eclipse.xtext.util.ITextRegion> foldingRegionAcceptor)
      no multiline comment in BSL
      protected void computeObjectFolding​(org.eclipse.emf.ecore.EObject eObject, org.eclipse.xtext.ui.editor.folding.IFoldingRegionAcceptor<org.eclipse.xtext.util.ITextRegion> foldingRegionAcceptor)  
      protected org.eclipse.xtext.ui.editor.folding.IFoldingRegionAcceptor<org.eclipse.xtext.util.ITextRegion> createAcceptor​(org.eclipse.xtext.ui.editor.model.IXtextDocument xtextDocument, Collection<org.eclipse.xtext.ui.editor.folding.FoldedPosition> foldedPositions)  
      Collection<org.eclipse.xtext.ui.editor.folding.FoldedPosition> getFoldingRegions​(org.eclipse.xtext.ui.editor.model.IXtextDocument xtextDocument)  
      protected boolean isConditionStatement​(org.eclipse.emf.ecore.EObject eObject)
      Checks if given object is condition statement
      protected boolean isControlFlowFoldingEnabled​(org.eclipse.emf.ecore.EObject eObject)
      Checks if given object is control flow object and folding for it is enabled
      protected boolean isControlFlowStatement​(org.eclipse.emf.ecore.EObject eObject)
      Checks if given object is control flow object
      protected boolean isHandled​(org.eclipse.emf.ecore.EObject eObject)  
      protected boolean isInitiallyCollapsed​(org.eclipse.emf.ecore.EObject eObject)
      Returns whether the given folded object should be initially collapsed.
      protected boolean isLoopStatement​(org.eclipse.emf.ecore.EObject eObject)
      Checks if given object is loop
      protected boolean isPreprocessorBlock​(org.eclipse.emf.ecore.EObject eObject)
      Checks if given object is preprocessor
      protected boolean isPreprocessorFoldingEnabled​(org.eclipse.emf.ecore.EObject eObject)
      Checks if given object is preprocessor and folding for preprocessor is enabled
      protected boolean isTryExceptFoldingEnabled​(org.eclipse.emf.ecore.EObject eObject)
      Checks if given object is try\except statement and folding for it is enabled
      protected boolean shouldProcessContent​(org.eclipse.emf.ecore.EObject object)  
      protected boolean shouldProcessMethodContent()
      Checks if folding enabled for ant statements in method
      • Methods inherited from class org.eclipse.xtext.ui.editor.folding.DefaultFoldingRegionProvider

        computeCommentFolding, computeObjectFolding, computeObjectFolding, doGetFoldingRegions, getLocationInFileProvider, getTextPatternInComment
    • Constructor Detail

      • BslFoldingRegionProvider

        public BslFoldingRegionProvider()
    • Method Detail

      • getFoldingRegions

        public Collection<org.eclipse.xtext.ui.editor.folding.FoldedPosition> getFoldingRegions​(org.eclipse.xtext.ui.editor.model.IXtextDocument xtextDocument)
        Specified by:
        getFoldingRegions in interface org.eclipse.xtext.ui.editor.folding.IFoldingRegionProvider
        Overrides:
        getFoldingRegions in class org.eclipse.xtext.ui.editor.folding.DefaultFoldingRegionProvider
      • createAcceptor

        protected org.eclipse.xtext.ui.editor.folding.IFoldingRegionAcceptor<org.eclipse.xtext.util.ITextRegion> createAcceptor​(org.eclipse.xtext.ui.editor.model.IXtextDocument xtextDocument,
                                                                                                                                Collection<org.eclipse.xtext.ui.editor.folding.FoldedPosition> foldedPositions)
        Overrides:
        createAcceptor in class CustomFoldingRegionProvider
      • computeCommentFolding

        protected void computeCommentFolding​(org.eclipse.xtext.ui.editor.model.IXtextDocument xtextDocument,
                                             org.eclipse.xtext.ui.editor.folding.IFoldingRegionAcceptor<org.eclipse.xtext.util.ITextRegion> foldingRegionAcceptor)
        no multiline comment in BSL
        Overrides:
        computeCommentFolding in class org.eclipse.xtext.ui.editor.folding.DefaultFoldingRegionProvider
      • isInitiallyCollapsed

        protected boolean isInitiallyCollapsed​(org.eclipse.emf.ecore.EObject eObject)
        Description copied from class: CustomFoldingRegionProvider
        Returns whether the given folded object should be initially collapsed.
        Overrides:
        isInitiallyCollapsed in class CustomFoldingRegionProvider
        Parameters:
        eObject - not null
        Returns:
        true if the given object is to be initially collapsed, and false otherwise
      • isHandled

        protected boolean isHandled​(org.eclipse.emf.ecore.EObject eObject)
        Overrides:
        isHandled in class org.eclipse.xtext.ui.editor.folding.DefaultFoldingRegionProvider
      • shouldProcessContent

        protected boolean shouldProcessContent​(org.eclipse.emf.ecore.EObject object)
        Overrides:
        shouldProcessContent in class org.eclipse.xtext.ui.editor.folding.DefaultFoldingRegionProvider
      • shouldProcessMethodContent

        protected boolean shouldProcessMethodContent()
        Checks if folding enabled for ant statements in method
        Returns:
        true if folding enabled for ant statements in method
      • isTryExceptFoldingEnabled

        protected boolean isTryExceptFoldingEnabled​(org.eclipse.emf.ecore.EObject eObject)
        Checks if given object is try\except statement and folding for it is enabled
        Parameters:
        eObject - the context object (not null)
        Returns:
        true if given object is try\except statement and folding for it is enabled
      • isControlFlowFoldingEnabled

        protected boolean isControlFlowFoldingEnabled​(org.eclipse.emf.ecore.EObject eObject)
        Checks if given object is control flow object and folding for it is enabled
        Parameters:
        eObject - the context object (not null)
        Returns:
        true if given object is control flow object and folding for it is enabled
      • isControlFlowStatement

        protected boolean isControlFlowStatement​(org.eclipse.emf.ecore.EObject eObject)
        Checks if given object is control flow object
        Parameters:
        eObject - the context object (not null)
        Returns:
        true if given object is control flow object
      • isLoopStatement

        protected boolean isLoopStatement​(org.eclipse.emf.ecore.EObject eObject)
        Checks if given object is loop
        Parameters:
        eObject - the context object (not null)
        Returns:
        true if given object is loop
      • isConditionStatement

        protected boolean isConditionStatement​(org.eclipse.emf.ecore.EObject eObject)
        Checks if given object is condition statement
        Parameters:
        eObject - the context object (not null)
        Returns:
        true if given object is condition statement
      • isPreprocessorFoldingEnabled

        protected boolean isPreprocessorFoldingEnabled​(org.eclipse.emf.ecore.EObject eObject)
        Checks if given object is preprocessor and folding for preprocessor is enabled
        Parameters:
        eObject - the context object (not null)
        Returns:
        true if given object is preprocessor and folding for preprocessor is enabled
      • isPreprocessorBlock

        protected boolean isPreprocessorBlock​(org.eclipse.emf.ecore.EObject eObject)
        Checks if given object is preprocessor
        Parameters:
        eObject - the context object (not null)
        Returns:
        true if given object is preprocessor
      • computeObjectFolding

        protected void computeObjectFolding​(org.eclipse.emf.ecore.EObject eObject,
                                            org.eclipse.xtext.ui.editor.folding.IFoldingRegionAcceptor<org.eclipse.xtext.util.ITextRegion> foldingRegionAcceptor)
        Overrides:
        computeObjectFolding in class CustomFoldingRegionProvider