예제 #1
0
        private void AddField(
            Dictionary <String, LookupListItem> foundItems,
            MemberInfo item)
        {
            FieldInfo fi = (FieldInfo)item;

            if (fi.IsPrivate)
            {
                return;
            }

            if (!foundItems.ContainsKey(fi.Name))
            {
                LookupListItem li = new LookupListItem();
                li.DisplayText = fi.Name;
                li.InsertText  = fi.Name;
                li.ToolTipText = String.Format("{0} {1}",
                                               JScriptFormattingTools.GetTypeSignature(fi.FieldType),
                                               fi.Name);

                if (fi.IsLiteral)
                {
                    if (fi.IsPublic)
                    {
                        li.Category =
                            QuickSharp.CodeAssist.Constants.CONSTANT;
                    }
                    else
                    {
                        li.Category =
                            QuickSharp.CodeAssist.Constants.CONSTANT_FRIEND;
                    }
                }
                else
                {
                    if (fi.IsPublic)
                    {
                        li.Category =
                            QuickSharp.CodeAssist.Constants.FIELD;
                    }
                    else if (fi.IsFamily)
                    {
                        li.Category =
                            QuickSharp.CodeAssist.Constants.EXCEPTION_PROTECTED;
                    }
                    else if (fi.IsPrivate)
                    {
                        li.Category =
                            QuickSharp.CodeAssist.Constants.FIELD_PRIVATE;
                    }
                    else
                    {
                        li.Category =
                            QuickSharp.CodeAssist.Constants.FIELD_FRIEND;
                    }
                }

                foundItems.Add(li.DisplayText, li);
            }
        }
예제 #2
0
        private void AddProperty(
            Dictionary <String, LookupListItem> foundItems,
            MemberInfo item)
        {
            PropertyInfo pi = (PropertyInfo)item;

            if (!foundItems.ContainsKey(pi.Name))
            {
                LookupListItem li = new LookupListItem();
                li.DisplayText = pi.Name;
                li.InsertText  = pi.Name;
                li.Category    = QuickSharp.CodeAssist.Constants.PROPERTIES;

                li.ToolTipText = String.Format("{0} {1}",
                                               JScriptFormattingTools.GetTypeSignature(pi.PropertyType),
                                               pi.Name);

                foundItems.Add(pi.Name, li);
            }
            else
            {
                foundItems[pi.Name].ToolTipText = String.Format("{0} {1}",
                                                                JScriptFormattingTools.GetTypeSignature(pi.PropertyType),
                                                                pi.Name);
            }
        }
예제 #3
0
        private void AddMethod(
            Dictionary <String, LookupListItem> foundItems,
            MemberInfo item)
        {
            MethodInfo mi = (MethodInfo)item;

            if (mi.IsSpecialName)
            {
                return;
            }
            if (mi.IsPrivate)
            {
                return;
            }
            if (mi.Name == "Finalize")
            {
                return;
            }

            if (!foundItems.ContainsKey(mi.Name))
            {
                bool isExtensionMethod = mi.GetCustomAttributes(
                    typeof(ExtensionAttribute), false).Length > 0;

                LookupListItem lli = new LookupListItem();
                lli.DisplayText = mi.Name;
                lli.InsertText  = mi.Name;
                lli.ToolTipText = String.Format("{0} {1}_OVR_",
                                                JScriptFormattingTools.GetTypeSignature(mi.ReturnType),
                                                JScriptFormattingTools.GetMethodSignature(mi));

                if (isExtensionMethod)
                {
                    lli.Category =
                        QuickSharp.CodeAssist.Constants.METHOD_EXTENSION;
                }
                else if (mi.IsPublic)
                {
                    lli.Category =
                        QuickSharp.CodeAssist.Constants.METHOD;
                }
                else if (mi.IsFamily)
                {
                    lli.Category =
                        QuickSharp.CodeAssist.Constants.METHOD_PROTECTED;
                }
                else
                {
                    lli.Category =
                        QuickSharp.CodeAssist.Constants.METHOD_FRIEND;
                }

                LookupMenuItem lmi = new LookupMenuItem();

                lmi.DisplayText = String.Format("{0} {1}",
                                                JScriptFormattingTools.GetTypeSignature(mi.ReturnType),
                                                JScriptFormattingTools.GetMethodSignature(mi));

                lmi.InsertText =
                    JScriptFormattingTools.GetMinimalMethodSignature(mi);

                lli.MenuItems.Add(lmi);

                foundItems.Add(mi.Name, lli);
            }
            else
            {
                // Overloaded method
                LookupListItem lli = foundItems[mi.Name];
                LookupMenuItem lmi = new LookupMenuItem();

                lmi.DisplayText = String.Format("{0} {1}",
                                                JScriptFormattingTools.GetTypeSignature(mi.ReturnType),
                                                JScriptFormattingTools.GetMethodSignature(mi));

                lmi.InsertText =
                    JScriptFormattingTools.GetMinimalMethodSignature(mi);

                lli.MenuItems.Add(lmi);
            }
        }