예제 #1
0
        internal static Accessibility ToAccessibility(this IVbMember member)
        {
            if (member.Visibility == MemberVisibility.Public)
            {
                return(Accessibility.Public);
            }

            return(Accessibility.Private);
        }
        private void memberNode_Selected(object sender, RoutedEventArgs e)
        {
            IVbMember member = ((TreeViewItem)e.Source).Tag as IVbMember;

            if (member == null)
            {
                return;
            }

            _textEditor.JumpTo(member.Location.Line, 1);
        }
예제 #3
0
        /// <summary>
        /// Adds the given member to the list of members.
        /// </summary>
        /// <param name="member">The member to add. The member is only added if it does not yet exist in the collection.</param>
        protected internal void AddMember(IVbMember member)
        {
            if (member == null)
            {
                throw new ArgumentNullException("member");
            }

            if (!_membersInternal.Contains(member))
            {
                _membersInternal.Add(member);
            }
        }
예제 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="VB6UnresolvedMemberBase"/> class.
        /// </summary>
        /// <param name="member">The instance of <see cref="IVbMember"/> that is the source of this entity.</param>
        /// <param name="file">The file that is the source of this entity.</param>
        /// <param name="typeReference">The <see cref="IUnresolvedTypeReference"/> that this member is a child of. May be null.</param>
        /// <param name="typeDefinition">The <see cref="IUnresolvedTypeDefinition"/> that this entity is a child of. May be null.</param>
        protected VB6UnresolvedMemberBase(IVbMember member, IUnresolvedFile file, ITypeReference typeReference, IUnresolvedTypeDefinition typeDefinition)
            : base(file, typeDefinition)
        {
            if (member == null)
            {
                throw new ArgumentNullException("member");
            }

            this.Member = member;

            this.Name = member.Name;
            this.Accessibility = member.ToAccessibility();

            this.DeclaringTypeReference = typeReference;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="VB6UnresolvedMemberBase"/> class.
        /// </summary>
        /// <param name="member">The instance of <see cref="IVbMember"/> that is the source of this entity.</param>
        /// <param name="file">The file that is the source of this entity.</param>
        /// <param name="typeReference">The <see cref="IUnresolvedTypeReference"/> that this member is a child of. May be null.</param>
        /// <param name="typeDefinition">The <see cref="IUnresolvedTypeDefinition"/> that this entity is a child of. May be null.</param>
        protected VB6UnresolvedMemberBase(IVbMember member, IUnresolvedFile file, ITypeReference typeReference, IUnresolvedTypeDefinition typeDefinition)
            : base(file, typeDefinition)
        {
            if (member == null)
            {
                throw new ArgumentNullException("member");
            }

            this.Member = member;

            this.Name          = member.Name;
            this.Accessibility = member.ToAccessibility();

            this.DeclaringTypeReference = typeReference;
        }
예제 #6
0
        private void DisplayElementProperties(object tag)
        {
            if (tag == null)
            {
                return;
            }

            if (tag is ClassElement || tag is ModuleElement || tag is FormElement)
            {
                try
                {
                    ElementBase element = (ElementBase)tag;

                    using (Stream stream = _fileReader.Read(element, _project))
                    {
                        VbPartitionedFile content = _fileReader.ReadPartitionedFile(element, stream);
                        txtEdit.Text = content.Source;
                    }
                }
                catch (Exception)
                {
                }
            }
            else
            {
                IVbMember member = tag as IVbMember;
                if (member != null)
                {
                    AddPropertyListViewItem("(Declaration)", member.ToVbDeclaration());
                    AddPropertyListViewItem("(Member type)", member.GetType().Name);

                    AddPropertyListViewItem("Name", member.Name);
                    AddPropertyListViewItem("Line", member.Location.Line);
                    AddPropertyListViewItem("Column", member.Location.Column);
                    AddPropertyListViewItem("Visibility", member.Visibility);

                    IVbMethod method = member as IVbMethod;
                    if (method != null)
                    {
                        AddPropertyListViewItem("Kind", method.MethodKind);
                        AddPropertyListViewItem("Return type", method.ReturnType.TypeName);

                        AddPropertyListViewItem("End Line", method.EndStatementLocation.Line);
                        AddPropertyListViewItem("End Column", method.EndStatementLocation.Column);

                        AddPropertyListViewItem("(Parameter count)", method.Parameters.Count);
                        for (int i = 0; i < method.Parameters.Count; i++)
                        {
                            IVbParameter parameter = method.Parameters[i];

                            AddPropertyListViewItem(string.Format("Param {0} (Declaration)", i), parameter.ToVbDeclaration());
                            AddPropertyListViewItem(string.Format("Param {0}: Access", i), parameter.Access);
                            AddPropertyListViewItem(string.Format("Param {0}: Name", i), parameter.Name);
                            AddPropertyListViewItem(string.Format("Param {0}: Line", i), parameter.Location.Line);
                            AddPropertyListViewItem(string.Format("Param {0}: Column", i), parameter.Location.Column);
                            AddPropertyListViewItem(string.Format("Param {0}: Type", i), parameter.Type.TypeName);

                            if (parameter.IsOptional)
                            {
                                AddPropertyListViewItem(string.Format("Param {0}: Is optional", i), true);
                                AddPropertyListViewItem(string.Format("Param {0}: Default value", i), parameter.OptionalDefaultValue);
                            }
                        }
                    }

                    IVbAttribute attribute = member as IVbAttribute;
                    if (attribute != null)
                    {
                        AddPropertyListViewItem("Value", attribute.Value);
                    }
                }
                else
                {
                    txtEdit.Clear();
                }
            }
        }
예제 #7
0
        /// <summary>
        /// Adds the given member to the list of members.
        /// </summary>
        /// <param name="member">The member to add. The member is only added if it does not yet exist in the collection.</param>
        protected internal void AddMember(IVbMember member)
        {
            if (member == null)
            {
                throw new ArgumentNullException("member");
            }

            if (!_membersInternal.Contains(member))
            {
                _membersInternal.Add(member);
            }
        }