public override void SetOutliningNodeCollapsedText(OutliningNode node)
        {
            string          str2;
            TokenCollection tokens = node.get_Document().get_Tokens();
            int             index  = tokens.IndexOf(node.get_StartOffset());
            string          str    = tokens.get_Item(index).get_Key();

            switch (str)
            {
            case null:
                return;

            case "MultiLineCommentStartToken":
            case "XMLCommentStartToken":
                node.set_CollapsedText("/**/");
                return;

            default:
                if (!(str == "RegionPreProcessorDirectiveStartToken"))
                {
                    return;
                }
                str2 = string.Empty;
                while (++index < tokens.Count)
                {
                    if (tokens.get_Item(index).get_Key() == "PreProcessorDirectiveEndToken")
                    {
                        break;
                    }
                    str2 = str2 + tokens.get_Document().GetTokenText(tokens.get_Item(index));
                }
                break;
            }
            node.set_CollapsedText(str2.Trim());
        }
Ejemplo n.º 2
0
        public override void SetOutliningNodeCollapsedText(OutliningNode node)
        {
            string          tokenText;
            TokenCollection tokens = node.get_Document().get_Tokens();
            int             index  = tokens.IndexOf(node.get_StartOffset());
            string          str    = tokens.get_Item(index).get_Key();
            string          str2   = str;

            switch (str2)
            {
            case "XMLCommentStartToken":
                node.set_CollapsedText("/**/");
                return;

            case "FunctionReservedWordToken":
            case "PropertyReservedWordToken":
            case "SubReservedWordToken":
            case "ClassReservedWordToken":
            case "InterfaceReservedWordToken":
            case "EnumReservedWordToken":
            case "StructureReservedWordToken":
            case "ModuleReservedWordToken":
            case "NamespaceReservedWordToken":
                tokenText = string.Empty;
                while (++index < tokens.Count)
                {
                    if (!tokens.get_Item(index).get_IsWhitespace())
                    {
                        str2 = tokens.get_Item(index).get_Key();
                        if ((str2 == null) || (!(str2 == "LineTerminatorToken") && !(str2 == "OpenParenthesisPatternGroup")))
                        {
                            tokenText = tokens.get_Document().GetTokenText(tokens.get_Item(index));
                            break;
                        }
                    }
                }
                break;

            case "RegionPreProcessorDirectiveStartToken":
                tokenText = string.Empty;
                while (++index < tokens.Count)
                {
                    if (tokens.get_Item(index).get_Key() == "PreProcessorDirectiveEndToken")
                    {
                        break;
                    }
                    tokenText = tokenText + tokens.get_Document().GetTokenText(tokens.get_Item(index));
                }
                goto Label_03AC;

            default:
                return;
            }
            switch (str)
            {
            case "FunctionReservedWordToken":
                node.set_CollapsedText(string.Format("Function {0}()", tokenText.Trim()));
                return;

            case "PropertyReservedWordToken":
                node.set_CollapsedText(string.Format("Property {0}()", tokenText.Trim()));
                return;

            case "SubReservedWordToken":
                node.set_CollapsedText(string.Format("Sub {0}()", tokenText.Trim()));
                return;

            case "ClassReservedWordToken":
                node.set_CollapsedText(string.Format("Class {0}", tokenText.Trim()));
                return;

            case "InterfaceReservedWordToken":
                node.set_CollapsedText(string.Format("Interface {0}", tokenText.Trim()));
                return;

            case "EnumReservedWordToken":
                node.set_CollapsedText(string.Format("Enum {0}", tokenText.Trim()));
                return;

            case "StructureReservedWordToken":
                node.set_CollapsedText(string.Format("Structure {0}", tokenText.Trim()));
                return;

            case "ModuleReservedWordToken":
                node.set_CollapsedText(string.Format("Module {0}", tokenText.Trim()));
                return;

            case "NamespaceReservedWordToken":
                node.set_CollapsedText(string.Format("Namespace {0}", tokenText.Trim()));
                return;

            default:
                return;
            }
Label_03AC:
            tokenText = tokenText.Trim();
            if (tokenText.StartsWith("\"", StringComparison.Ordinal))
            {
                tokenText = tokenText.Substring(1);
            }
            if (tokenText.EndsWith("\"", StringComparison.Ordinal))
            {
                tokenText = tokenText.Substring(0, tokenText.Length - 1);
            }
            if (tokenText.Length == 0)
            {
                tokenText = "...";
            }
            node.set_CollapsedText(tokenText.Trim());
        }