示例#1
0
        protected IEnumerable <TextEditorPopupItem> PopupGenericParameters(CodeScope scope)
        {
            Bitmap parameterImage            = null;
            List <TextEditorPopupItem> items = new List <TextEditorPopupItem>();

            foreach (CodeNode node in scope.FindAllDistinct())
            {
                NativeXGenericParameter genparam = node as NativeXGenericParameter;
                if (genparam != null && genparam.ParameterName != null)
                {
                    items.Add(new TextEditorPopupItem()
                    {
                        Text  = genparam.ParameterName,
                        Image = (parameterImage ?? (parameterImage = Images.Parameter))
                    });
                }
            }
            return(items);
        }
示例#2
0
        protected IEnumerable <TextEditorPopupItem> CreatePopupTypes(CodeScope scope)
        {
            Bitmap typeImage                 = null;
            Bitmap templateImage             = null;
            Bitmap parameterImage            = null;
            List <TextEditorPopupItem> items = new List <TextEditorPopupItem>();

            foreach (CodeNode node in scope.FindAllDistinct())
            {
                {
                    NativeXStructureDeclaration structdecl = node as NativeXStructureDeclaration;
                    if (structdecl != null && structdecl.Name != null)
                    {
                        items.Add(new TextEditorPopupItem()
                        {
                            Text  = structdecl.Name,
                            Image = structdecl.GenericParameters == null
                                ? (typeImage ?? (typeImage = Images.Type))
                                : (templateImage ?? (templateImage = Images.Template))
                        });
                    }
                }
                {
                    NativeXTypeRenameDeclaration typedecl = node as NativeXTypeRenameDeclaration;
                    if (typedecl != null && typedecl.Name != null)
                    {
                        items.Add(new TextEditorPopupItem()
                        {
                            Text  = typedecl.Name,
                            Image = typedecl.GenericParameters == null
                                ? (typeImage ?? (typeImage = Images.Type))
                                : (templateImage ?? (templateImage = Images.Template))
                        });
                    }
                }
                {
                    NativeXGenericParameter genparam = node as NativeXGenericParameter;
                    if (genparam != null && genparam.ParameterName != null)
                    {
                        items.Add(new TextEditorPopupItem()
                        {
                            Text  = genparam.ParameterName,
                            Image = (parameterImage ?? (parameterImage = Images.Parameter))
                        });
                    }
                }
            }
            foreach (string key in NativeXTokenizer.TypedKeywords)
            {
                items.Add(new TextEditorPopupItem()
                {
                    Text  = key,
                    Image = (typeImage ?? (typeImage = Images.Type))
                });
            }
            foreach (string key in new string[] { "typeof", "function" })
            {
                items.Add(new TextEditorPopupItem()
                {
                    Text  = key,
                    Image = Images.Keyword
                });
            }
            return(items);
        }