/// <summary>
        ///
        /// </summary>
        /// <param name="editor"></param>
        /// <param name="defaultSchema"></param>
        /// <param name="hasOpenToken"></param>
        /// <param name="path"></param>
        /// <returns></returns>
        protected XmlCompletionItemCollection GetCompletionItems(XmlSchemaCompletion defaultSchema, XmlSchemaCompletionCollection schemas)
        {
            XmlCompletionItemCollection completionItems = new XmlCompletionItemCollection();

            int    offset         = this.Position.Offset;
            string textUpToCursor = this.Text.GetText(0, offset);

            if (XmlParser.IsInsideAttributeValue(textUpToCursor, offset))
            {
                completionItems.AddRange(this.GetCompletionItemsInsideAttribute(defaultSchema, schemas));
            }
            else
            {
                completionItems.AddRange(this.GetCompletionItemsForAttribute(defaultSchema, schemas));
            }
            return(completionItems);
        }
Пример #2
0
		XmlCompletionItemCollection GetAttributeValueCompletion(XmlSchemaAttribute attribute)
		{
			XmlCompletionItemCollection completionItems = new XmlCompletionItemCollection();
			
			if (attribute.SchemaType != null) {
				XmlSchemaSimpleTypeRestriction simpleTypeRestriction = attribute.SchemaType.Content as XmlSchemaSimpleTypeRestriction;
				if (simpleTypeRestriction != null) {
					completionItems.AddRange(GetAttributeValueCompletion(simpleTypeRestriction));
				}
			} else if (attribute.AttributeSchemaType != null) {
				XmlSchemaSimpleType simpleType = attribute.AttributeSchemaType as XmlSchemaSimpleType;
				
				if (simpleType != null) {
					if (simpleType.Datatype.TypeCode == XmlTypeCode.Boolean) {
						completionItems.AddRange(GetBooleanAttributeValueCompletion());
					} else {
						completionItems.AddRange(GetAttributeValueCompletion(simpleType));
					}
				}
			}
			
			return completionItems;
		}
Пример #3
0
		XmlCompletionItemCollection GetAttributeValueCompletion(XmlSchemaElement element, string name)
		{
			XmlCompletionItemCollection completionItems = new XmlCompletionItemCollection();
			
			XmlSchemaComplexType complexType = GetElementAsComplexType(element);
			if (complexType != null) {
				XmlSchemaAttribute attribute = FindAttribute(complexType, name);
				if (attribute != null) {
					completionItems.AddRange(GetAttributeValueCompletion(attribute));
				}
			}
			
			return completionItems;
		}
Пример #4
0
		XmlCompletionItemCollection GetAttributeCompletion(XmlSchemaObjectCollection attributes, XmlNamespaceCollection namespacesInScope)
		{
			XmlCompletionItemCollection completionItems = new XmlCompletionItemCollection();
			
			foreach (XmlSchemaObject schemaObject in attributes) {
				XmlSchemaAttribute attribute = schemaObject as XmlSchemaAttribute;
				XmlSchemaAttributeGroupRef attributeGroupRef = schemaObject as XmlSchemaAttributeGroupRef;
				if (attribute != null) {
					if (!IsProhibitedAttribute(attribute)) {
						AddAttribute(completionItems, attribute, namespacesInScope);
					} else {
						prohibitedAttributes.Add(attribute);
					}
				} else if (attributeGroupRef != null) {
					completionItems.AddRange(GetAttributeCompletion(attributeGroupRef, namespacesInScope));
				}
			}
			return completionItems;
		}
Пример #5
0
		XmlCompletionItemCollection GetAttributeCompletion(XmlSchemaSimpleContentExtension extension, XmlNamespaceCollection namespacesInScope)
		{
			XmlCompletionItemCollection completionItems = new XmlCompletionItemCollection();
			
			completionItems.AddRange(GetAttributeCompletion(extension.Attributes, namespacesInScope));
			completionItems.AddRange(GetBaseComplexTypeAttributeCompletion(extension.BaseTypeName, namespacesInScope));
			
			return completionItems;
		}
Пример #6
0
		XmlCompletionItemCollection GetAttributeCompletion(XmlSchemaSimpleContent simpleContent, XmlNamespaceCollection namespacesInScope)
		{
			XmlCompletionItemCollection completionItems = new XmlCompletionItemCollection();
			
			XmlSchemaSimpleContentExtension extension = simpleContent.Content as XmlSchemaSimpleContentExtension;
			if (extension != null) {
				completionItems.AddRange(GetAttributeCompletion(extension, namespacesInScope));
			}
			
			return completionItems;
		}
Пример #7
0
		XmlCompletionItemCollection GetAttributeCompletion(XmlSchemaElement element, XmlNamespaceCollection namespacesInScope)
		{
			XmlCompletionItemCollection completionItems = new XmlCompletionItemCollection();
			
			XmlSchemaComplexType complexType = GetElementAsComplexType(element);
			if (complexType != null) {
				completionItems.AddRange(GetAttributeCompletion(complexType, namespacesInScope));
			}
			
			return completionItems;
		}
Пример #8
0
		XmlCompletionItemCollection GetAttributeValueCompletion(XmlSchemaSimpleTypeList list)
		{
			XmlCompletionItemCollection completionItems = new XmlCompletionItemCollection();
			
			if (list.ItemType != null) {
				completionItems.AddRange(GetAttributeValueCompletion(list.ItemType));
			} else if (list.ItemTypeName != null) {
				XmlSchemaSimpleType simpleType = FindSimpleType(list.ItemTypeName);
				if (simpleType != null) {
					completionItems.AddRange(GetAttributeValueCompletion(simpleType));
				}
			}
			
			return completionItems;
		}
Пример #9
0
		XmlCompletionItemCollection GetAttributeValueCompletion(XmlSchemaSimpleType simpleType)
		{
			XmlCompletionItemCollection completionItems = new XmlCompletionItemCollection();
			
			XmlSchemaSimpleTypeRestriction simpleTypeRestriction = simpleType.Content as XmlSchemaSimpleTypeRestriction;
			XmlSchemaSimpleTypeUnion union = simpleType.Content as XmlSchemaSimpleTypeUnion;
			XmlSchemaSimpleTypeList list = simpleType.Content as XmlSchemaSimpleTypeList;
			
			if (simpleTypeRestriction != null) {
				completionItems.AddRange(GetAttributeValueCompletion(simpleTypeRestriction));
			} else if (union != null) {
				completionItems.AddRange(GetAttributeValueCompletion(union));
			} else if (list != null) {
				completionItems.AddRange(GetAttributeValueCompletion(list));
			}

			return completionItems;
		}
Пример #10
0
		XmlCompletionItemCollection GetAttributeValueCompletion(XmlSchemaSimpleTypeUnion union)
		{
			XmlCompletionItemCollection completionItems = new XmlCompletionItemCollection();
			
			foreach (XmlSchemaObject schemaObject in union.BaseTypes) {
				XmlSchemaSimpleType simpleType = schemaObject as XmlSchemaSimpleType;
				if (simpleType != null) {
					completionItems.AddRange(GetAttributeValueCompletion(simpleType));
				}
			}
			
			if (union.BaseMemberTypes != null) {
				foreach (XmlSchemaSimpleType simpleType in union.BaseMemberTypes) {
					completionItems.AddRange(GetAttributeValueCompletion(simpleType));
				}
			}
			
			return completionItems;
		}