예제 #1
0
        /// <summary>
        ///   Adds a <see cref='XmlCompletionData'/> with the specified value to the
        ///   <see cref='XmlCompletionDataCollection'/>.
        /// </summary>
        /// <remarks>
        /// If the completion data already exists in the collection it is not added.
        /// </remarks>
        /// <param name='val'>The <see cref='XmlCompletionData'/> to add.</param>
        /// <returns>The index at which the new element was inserted.</returns>
        /// <seealso cref='XmlCompletionDataCollection.AddRange'/>
        public int Add(XmlCompletionData val)
        {
            int index = -1;

            if (!Contains(val))
            {
                index = List.Add(val);
            }
            return(index);
        }
예제 #2
0
 /// <summary>
 ///   Gets a value indicating whether the
 ///    <see cref='XmlCompletionDataCollection'/> contains the specified <see cref='XmlCompletionData'/>.
 /// </summary>
 /// <param name='val'>The <see cref='XmlCompletionData'/> to locate.</param>
 /// <returns>
 /// <see langword='true'/> if the <see cref='XmlCompletionData'/> is contained in the collection;
 ///   otherwise, <see langword='false'/>.
 /// </returns>
 /// <seealso cref='XmlCompletionDataCollection.IndexOf'/>
 public bool Contains(XmlCompletionData val)
 {
     if (val.Text != null)
     {
         if (val.Text.Length > 0)
         {
             return(Contains(val.Text));
         }
     }
     return(false);
 }
        public ICompletionData[] GetNamespaceCompletionData()
        {
            List <ICompletionData> completionItems = new List <ICompletionData>();

            foreach (XmlSchemaCompletionData schema in this)
            {
                XmlCompletionData completionData = new XmlCompletionData(schema.NamespaceUri, XmlCompletionData.DataType.NamespaceUri);
                completionItems.Add(completionData);
            }

            return(completionItems.ToArray());
        }
 /// <summary>
 ///   Adds a <see cref='XmlCompletionData'/> with the specified value to the 
 ///   <see cref='XmlCompletionDataCollection'/>.
 /// </summary>
 /// <remarks>
 /// If the completion data already exists in the collection it is not added.
 /// </remarks>
 /// <param name='val'>The <see cref='XmlCompletionData'/> to add.</param>
 /// <returns>The index at which the new element was inserted.</returns>
 /// <seealso cref='XmlCompletionDataCollection.AddRange'/>
 public int Add(XmlCompletionData val)
 {
     int index = -1;
     if (!Contains(val)) {
         index = List.Add(val);
     }
     return index;
 }
 /// <summary>
 ///   Initializes a new instance of <see cref='XmlCompletionDataCollection'/> containing any array of <see cref='XmlCompletionData'/> objects.
 /// </summary>
 /// <param name='val'>
 ///       A array of <see cref='XmlCompletionData'/> objects with which to intialize the collection
 /// </param>
 public XmlCompletionDataCollection(XmlCompletionData[] val)
 {
     this.AddRange(val);
 }
 /// <summary>
 ///   Removes a specific <see cref='XmlCompletionData'/> from the <see cref='XmlCompletionDataCollection'/>.
 /// </summary>
 /// <param name='val'>The <see cref='XmlCompletionData'/> to remove from the <see cref='XmlCompletionDataCollection'/>.</param>
 /// <exception cref='ArgumentException'><paramref name='val'/> is not found in the Collection.</exception>
 public void Remove(XmlCompletionData val)
 {
     List.Remove(val);
 }
 /// <summary>
 ///   Inserts a <see cref='XmlCompletionData'/> into the <see cref='XmlCompletionDataCollection'/> at the specified index.
 /// </summary>
 /// <param name='index'>The zero-based index where <paramref name='val'/> should be inserted.</param>
 /// <param name='val'>The <see cref='XmlCompletionData'/> to insert.</param>
 /// <seealso cref='XmlCompletionDataCollection.Add'/>
 public void Insert(int index, XmlCompletionData val)
 {
     List.Insert(index, val);
 }
 /// <summary>
 ///    Returns the index of a <see cref='XmlCompletionData'/> in 
 ///       the <see cref='XmlCompletionDataCollection'/>.
 /// </summary>
 /// <param name='val'>The <see cref='XmlCompletionData'/> to locate.</param>
 /// <returns>
 ///   The index of the <see cref='XmlCompletionData'/> of <paramref name='val'/> in the 
 ///   <see cref='XmlCompletionDataCollection'/>, if found; otherwise, -1.
 /// </returns>
 /// <seealso cref='XmlCompletionDataCollection.Contains'/>
 public int IndexOf(XmlCompletionData val)
 {
     return List.IndexOf(val);
 }
 /// <summary>
 /// Adds an attribute value to the completion data collection.
 /// </summary>
 void AddAttributeValue(XmlCompletionDataCollection data, string valueText, string description)
 {
     XmlCompletionData completionData = new XmlCompletionData(valueText, description, XmlCompletionData.DataType.XmlAttributeValue);
       data.Add(completionData);
 }
 /// <summary>
 ///   Copies the elements of an array to the end of the <see cref='XmlCompletionDataCollection'/>.
 /// </summary>
 /// <param name='val'>
 ///    An array of type <see cref='XmlCompletionData'/> containing the objects to add to the collection.
 /// </param>
 /// <seealso cref='XmlCompletionDataCollection.Add'/>
 public void AddRange(XmlCompletionData[] val)
 {
     for (int i = 0; i < val.Length; i++) {
         this.Add(val[i]);
     }
 }
예제 #11
0
 /// <summary>
 ///   Removes a specific <see cref='XmlCompletionData'/> from the <see cref='XmlCompletionDataCollection'/>.
 /// </summary>
 /// <param name='val'>The <see cref='XmlCompletionData'/> to remove from the <see cref='XmlCompletionDataCollection'/>.</param>
 /// <exception cref='ArgumentException'><paramref name='val'/> is not found in the Collection.</exception>
 public void Remove(XmlCompletionData val)
 {
     List.Remove(val);
 }
예제 #12
0
 /// <summary>
 ///   Inserts a <see cref='XmlCompletionData'/> into the <see cref='XmlCompletionDataCollection'/> at the specified index.
 /// </summary>
 /// <param name='index'>The zero-based index where <paramref name='val'/> should be inserted.</param>
 /// <param name='val'>The <see cref='XmlCompletionData'/> to insert.</param>
 /// <seealso cref='XmlCompletionDataCollection.Add'/>
 public void Insert(int index, XmlCompletionData val)
 {
     List.Insert(index, val);
 }
예제 #13
0
 /// <summary>
 ///    Returns the index of a <see cref='XmlCompletionData'/> in
 ///       the <see cref='XmlCompletionDataCollection'/>.
 /// </summary>
 /// <param name='val'>The <see cref='XmlCompletionData'/> to locate.</param>
 /// <returns>
 ///   The index of the <see cref='XmlCompletionData'/> of <paramref name='val'/> in the
 ///   <see cref='XmlCompletionDataCollection'/>, if found; otherwise, -1.
 /// </returns>
 /// <seealso cref='XmlCompletionDataCollection.Contains'/>
 public int IndexOf(XmlCompletionData val)
 {
     return(List.IndexOf(val));
 }
        /// <summary>
        /// Adds an attribute to the completion data collection.
        /// </summary>
        /// <remarks>
        /// Note the special handling of xml:lang attributes.
        /// </remarks>
        void AddAttribute(XmlCompletionDataCollection data, XmlSchemaAttribute attribute)
        {
            string name = attribute.Name;
              if (name == null)
              {
            if (attribute.RefName.Namespace == "http://www.w3.org/XML/1998/namespace")
            {
              name = String.Concat("xml:", attribute.RefName.Name);
            }
              }

              if (name != null)
              {
            string documentation = GetDocumentation(attribute.Annotation);
            string defaultValue = attribute.DefaultValue;
            bool isFixed = false;
            if (string.IsNullOrEmpty(defaultValue))
            {
              defaultValue = attribute.FixedValue;
              if (!string.IsNullOrEmpty(defaultValue)) isFixed = true;
            }
            XmlCompletionData completionData = new XmlCompletionData(name, documentation, XmlCompletionData.DataType.XmlAttribute, defaultValue, isFixed);
            data.Add(completionData);
              }
        }
 /// <summary>
 ///   Gets a value indicating whether the 
 ///    <see cref='XmlCompletionDataCollection'/> contains the specified <see cref='XmlCompletionData'/>.
 /// </summary>
 /// <param name='val'>The <see cref='XmlCompletionData'/> to locate.</param>
 /// <returns>
 /// <see langword='true'/> if the <see cref='XmlCompletionData'/> is contained in the collection; 
 ///   otherwise, <see langword='false'/>.
 /// </returns>
 /// <seealso cref='XmlCompletionDataCollection.IndexOf'/>
 public bool Contains(XmlCompletionData val)
 {
     if (val.Text != null) {
         if (val.Text.Length > 0) {
             return Contains(val.Text);
         }
     }
     return false;
 }
 /// <summary>
 /// Adds an attribute value to the completion data collection.
 /// </summary>
 void AddAttributeValue(XmlCompletionDataCollection data, string valueText, XmlSchemaAnnotation annotation)
 {
     string documentation = GetDocumentation(annotation);
       XmlCompletionData completionData = new XmlCompletionData(valueText, documentation, XmlCompletionData.DataType.XmlAttributeValue);
       data.Add(completionData);
 }
 /// <summary>
 ///   Copies the <see cref='XmlCompletionDataCollection'/> values to a one-dimensional <see cref='Array'/> instance at the 
 ///    specified index.
 /// </summary>
 /// <param name='array'>The one-dimensional <see cref='Array'/> that is the destination of the values copied from <see cref='XmlCompletionDataCollection'/>.</param>
 /// <param name='index'>The index in <paramref name='array'/> where copying begins.</param>
 /// <exception cref='ArgumentException'>
 ///   <para><paramref name='array'/> is multidimensional.</para>
 ///   <para>-or-</para>
 ///   <para>The number of elements in the <see cref='XmlCompletionDataCollection'/> is greater than
 ///         the available space between <paramref name='arrayIndex'/> and the end of
 ///         <paramref name='array'/>.</para>
 /// </exception>
 /// <exception cref='ArgumentNullException'><paramref name='array'/> is <see langword='null'/>. </exception>
 /// <exception cref='ArgumentOutOfRangeException'><paramref name='arrayIndex'/> is less than <paramref name='array'/>'s lowbound. </exception>
 /// <seealso cref='Array'/>
 public void CopyTo(XmlCompletionData[] array, int index)
 {
     List.CopyTo(array, index);
 }
 /// <summary>
 /// Adds an element completion data to the collection if it does not 
 /// already exist.
 /// </summary>
 void AddElement(XmlCompletionDataCollection data, string name, string prefix, string documentation)
 {
     if (!data.Contains(name))
       {
     if (prefix.Length > 0)
     {
       name = String.Concat(prefix, ":", name);
     }
     XmlCompletionData completionData = new XmlCompletionData(name, documentation);
     data.Add(completionData);
       }
 }
        public ICompletionData[] GetNamespaceCompletionData()
        {
            List<ICompletionData> completionItems = new List<ICompletionData>();

            foreach (XmlSchemaCompletionData schema in this) {
                XmlCompletionData completionData = new XmlCompletionData(schema.NamespaceUri, XmlCompletionData.DataType.NamespaceUri);
                completionItems.Add(completionData);
            }

            return completionItems.ToArray();
        }