Example #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);
        }
Example #2
0
        protected IEnumerable <TextEditorPopupItem> CreatePopupConcepts(CodeScope scope)
        {
            Bitmap templateImage             = null;
            List <TextEditorPopupItem> items = new List <TextEditorPopupItem>();

            foreach (CodeNode node in scope.FindAllDistinct())
            {
                NativeXConceptDeclaration conceptdecl = node as NativeXConceptDeclaration;
                if (conceptdecl != null && conceptdecl.Name != null)
                {
                    items.Add(new TextEditorPopupItem()
                    {
                        Text  = conceptdecl.Name,
                        Image = (templateImage ?? (templateImage = Images.Template))
                    });
                }
            }
            return(items);
        }
Example #3
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);
        }
Example #4
0
        protected IEnumerable <TextEditorPopupItem> CreatePopupExpressions(CodeScope scope)
        {
            Bitmap functionImage             = null;
            Bitmap memberImage               = null;
            Bitmap templateImage             = null;
            Bitmap parameterImage            = null;
            List <TextEditorPopupItem> items = new List <TextEditorPopupItem>();

            foreach (CodeNode node in scope.FindAllDistinct())
            {
                {
                    NativeXNameTypePair parameter = node as NativeXNameTypePair;
                    if (parameter != null && parameter.Name != null)
                    {
                        items.Add(new TextEditorPopupItem()
                        {
                            Text  = parameter.Name,
                            Image = (parameterImage ?? (parameterImage = Images.Parameter))
                        });
                    }
                }
                {
                    NativeXVariableStatement varstat = node as NativeXVariableStatement;
                    if (varstat != null && varstat.Name != null)
                    {
                        items.Add(new TextEditorPopupItem()
                        {
                            Text  = varstat.Name,
                            Image = (memberImage ?? (memberImage = Images.Member))
                        });
                    }
                }
                {
                    NativeXVariableDeclaration vardecl = node as NativeXVariableDeclaration;
                    if (vardecl != null && vardecl.Name != null)
                    {
                        items.Add(new TextEditorPopupItem()
                        {
                            Text  = vardecl.Name,
                            Image = (memberImage ?? (memberImage = Images.Member))
                        });
                    }
                }
                {
                    NativeXFunctionDeclaration funcdecl = node as NativeXFunctionDeclaration;
                    if (funcdecl != null && funcdecl.Name != null)
                    {
                        items.Add(new TextEditorPopupItem()
                        {
                            Text  = funcdecl.Name,
                            Image = (functionImage ?? (functionImage = Images.Function))
                        });
                    }
                }
                {
                    NativeXConceptDeclaration conceptdecl = node as NativeXConceptDeclaration;
                    if (conceptdecl != null && conceptdecl.Name != null)
                    {
                        items.Add(new TextEditorPopupItem()
                        {
                            Text  = conceptdecl.Name,
                            Image = (templateImage ?? (templateImage = Images.Template))
                        });
                    }
                }
            }

            Bitmap keywordImage = Images.Keyword;

            string[] keywords = new string[] { "result", "cast", "exception", "true", "false", "null", "sizeof", "offsetof" };
            items.AddRange(
                keywords.Select(k => new TextEditorPopupItem()
            {
                Text  = k,
                Image = keywordImage
            }));
            return(items);
        }