Esempio n. 1
0
        internal void EnableFolding(bool enableFolding)
        {
            if (enableFolding)
            {
                switch (innerType)
                {
                case Enumerations.WebResourceType.Script:
                case Enumerations.WebResourceType.Css:
                {
                    if (!foldingManagerInstalled)
                    {
                        foldingManager          = FoldingManager.Install(textEditor.TextArea);
                        foldingManagerInstalled = true;
                    }

                    foldingManager.UpdateFoldings(CreateBraceFoldings(textEditor.Document), -1);
                }
                break;

                case Enumerations.WebResourceType.WebPage:
                {
                    if (!foldingManagerInstalled)
                    {
                        foldingManager          = FoldingManager.Install(textEditor.TextArea);
                        foldingManagerInstalled = true;
                    }

                    htmlFoldingStrategy = new HtmlFoldingStrategy();
                    htmlFoldingStrategy.UpdateFoldings(foldingManager, textEditor.Document);
                }
                break;

                case Enumerations.WebResourceType.Data:
                case Enumerations.WebResourceType.Xsl:
                {
                    if (!foldingManagerInstalled)
                    {
                        foldingManager          = FoldingManager.Install(textEditor.TextArea);
                        foldingManagerInstalled = true;
                    }

                    xmlFoldingStrategy = new XmlFoldingStrategy();
                    xmlFoldingStrategy.UpdateFoldings(foldingManager, textEditor.Document);
                }
                break;
                }

                FoldingEnabled = true;
            }
            else
            {
                if (foldingManager != null)
                {
                    foldingManager.Clear();
                }

                FoldingEnabled = false;
            }
        }
        public void EnableFolding(bool enableFolding)
        {
            if (enableFolding)
            {
                switch (item.Type)
                {
                case CodeItemType.JavaScript:
                case CodeItemType.Style:
                {
                    if (!foldingManagerInstalled)
                    {
                        foldingManager          = FoldingManager.Install(textEditor.TextArea);
                        foldingManagerInstalled = true;
                    }

                    foldingManager.UpdateFoldings(CreateBraceFoldings(textEditor.Document), -1);
                }
                break;

                case CodeItemType.LiquidTemplate:
                {
                    if (!foldingManagerInstalled)
                    {
                        foldingManager          = FoldingManager.Install(textEditor.TextArea);
                        foldingManagerInstalled = true;
                    }

                    htmlFoldingStrategy = new HtmlFoldingStrategy();
                    htmlFoldingStrategy.UpdateFoldings(foldingManager, textEditor.Document);
                }
                break;
                }

                FoldingEnabled = true;
            }
            else
            {
                if (foldingManager != null)
                {
                    foldingManager.Clear();
                }

                FoldingEnabled = false;
            }
        }