Пример #1
0
 public override int GetGlyph(Cci.Member member)
 {
     Cci.Field f = member as Cci.Field;
     if (f != null && f.DeclaringType == null && f.IsCompilerControlled)
     {
         return((int)ScopeIconGroup.IconGroupFieldYellow + (int)ScopeIconItem.IconItemPublic);
     }
     return(base.GetGlyph(member));
 }
Пример #2
0
        public static MessageContext Member(MessageContext parent, CCI.Member member)
        {
            var loc = default(Location);

            if (member.SourceContext.Document != null)
            {
                loc = member.SourceContext.ToLocation();
            }
            else if (member.Name != null && member.Name.SourceContext.Document != null)
            {
                loc = member.Name.SourceContext.ToLocation();
            }

            return(new MessageContext
                       (parent,
                       loc,
                       sb =>
            {
                sb.Append("Member ");
                sb.Append(member.FullName);
            }));
        }
Пример #3
0
        private void PopulateMemberPositionsAndGlyphs()
        {
            Cci.MemberList members = this.scTypeAndMemberDropdownBars.sortedDropDownMembers;
            int            n       = members == null ? 0 : members.Count;

            int[] startColumns = new int[n];
            int[] startLines   = new int[n];
            int[] glyphs       = new int[n];
            for (int i = 0; i < n; i++)
            {
                Cci.Member member = members[i];
                if (member == null || member.Name == null)
                {
                    continue;
                }
                startColumns[i] = member.Name.SourceContext.StartColumn - 1;
                startLines[i]   = member.Name.SourceContext.StartLine - 1;
                glyphs[i]       = this.glyphProvider.GetGlyph(member);
            }
            this.dropDownMemberStartColumns = startColumns;
            this.dropDownMemberStartLines   = startLines;
            this.dropDownMemberGlyphs       = glyphs;
        }
Пример #4
0
 public static MessageContext Member(CCI.Member member)
 {
     return(Member(null, member));
 }
Пример #5
0
        protected const int IconGroupSize = 6; // does not get imported into the type lib.
        public virtual int GetGlyph(Cci.Member member)
        {
            ScopeIconGroup group;

            if (member is Cci.Method)
            {
                if (member.IsSpecialName && member.IsStatic && member.Name.ToString().StartsWith("op_"))
                {
                    group = ScopeIconGroup.IconGroupFormula;
                }
                else
                {
                    group = ScopeIconGroup.IconGroupMethod;
                }
            }
            else if (member is Cci.Property)
            {
                group = ScopeIconGroup.IconGroupProperty;
            }
            else if (member is Cci.Class)
            {
                group = ScopeIconGroup.IconGroupClass;
            }
            else if (member is Cci.DelegateNode)
            {
                group = ScopeIconGroup.IconGroupDelegate;
            }
            else if (member is Cci.Event)
            {
                group = ScopeIconGroup.IconGroupEvent;
            }
            else if (member is Cci.EnumNode)
            {
                group = ScopeIconGroup.IconGroupEnum;
            }
            else if (member is Cci.Interface)
            {
                group = ScopeIconGroup.IconGroupInterface;
            }
            else if (member is Cci.Struct)
            {
                group = ScopeIconGroup.IconGroupStruct;
            }
            else if (member is Cci.Namespace)
            {
                group = ScopeIconGroup.IconGroupNameSpace;
            }
            else if (member is Cci.Field)
            {
                if (member.DeclaringType is Cci.EnumNode)
                {
                    group = ScopeIconGroup.IconGroupEnumConst;
                }
                else if (((Cci.Field)member).IsLiteral || ((Cci.Field)member).IsInitOnly)
                {
                    group = ScopeIconGroup.IconGroupFieldRed;
                }
                else
                {
                    group = ScopeIconGroup.IconGroupFieldBlue;
                }
            }
            else
            {
                return((int)ScopeIconMisc.IconBlackBox);
            }
            int glyph = (int)group * IconGroupSize;

            if (member.IsPublic)
            {
                glyph += (int)ScopeIconItem.IconItemPublic;
            }
            else if (member.IsFamily || member.IsFamilyAndAssembly || member.IsFamilyOrAssembly)
            {
                glyph += (int)ScopeIconItem.IconItemProtected;
            }
            else if (member.IsAssembly)
            {
                glyph += (int)ScopeIconItem.IconItemInternal;
            }
            else if (!(member is Cci.Namespace))
            {
                glyph += (int)ScopeIconItem.IconItemPrivate;
            }
            return(glyph);
        }
Пример #6
0
 public override int GetGlyph(int index)
 {
     Cci.Member member = this.scDeclarations.GetMember(index);
     return(this.glyphProvider.GetGlyph(member));
 }