Example #1
0
        private void XMLRefSearch_CheckAvailability(object sender, CheckSearchAvailabilityEventArgs ea)
        {
            // Get Active LanguageElement
            var Element = CodeRush.Documents.ActiveTextDocument.GetNodeAt(CodeRush.Caret.Line, CodeRush.Caret.Offset);
            if (Element == null)
                return;
            if (!(Element is XmlAttribute))
                return;
            // Allow search to start if Attribute

            string AttributeName = ((XmlAttribute)Element).Name;

            List<List<string>> AttributeCollections = new List<List<string>>();
            settings = Options1.LoadSettings(Options1.Storage);
            string[] AttributeSets = settings.AttributeNames.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries );
            foreach (string AttributeSet in AttributeSets)
            {
                AttributeCollections.Add(AttributeSet.Split('|').ToList());
            }
            _Attributes = null;
            foreach (List<string> attributes in AttributeCollections)
            {
                if (attributes.Contains(AttributeName))
                {
                    _Attributes = attributes;
                }
            }
            ea.Available = _Attributes != null;
        }
Example #2
0
        private void XMLRefSearch_CheckAvailability(object sender, CheckSearchAvailabilityEventArgs ea)
        {
            // Get Active LanguageElement
            var Element = CodeRush.Documents.ActiveTextDocument.GetNodeAt(CodeRush.Caret.Line, CodeRush.Caret.Offset);

            if (Element == null)
            {
                return;
            }
            if (!(Element is XmlAttribute))
            {
                return;
            }
            // Allow search to start if Attribute

            string AttributeName = ((XmlAttribute)Element).Name;

            List <List <string> > AttributeCollections = new List <List <string> >();

            settings = Options1.LoadSettings(Options1.Storage);
            string[] AttributeSets = settings.AttributeNames.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
            foreach (string AttributeSet in AttributeSets)
            {
                AttributeCollections.Add(AttributeSet.Split('|').ToList());
            }
            _Attributes = null;
            foreach (List <string> attributes in AttributeCollections)
            {
                if (attributes.Contains(AttributeName))
                {
                    _Attributes = attributes;
                }
            }
            ea.Available = _Attributes != null;
        }
Example #3
0
        private void spFindPrimitives_CheckAvailability(object sender, CheckSearchAvailabilityEventArgs ea)
        {
            if (ea.Element is PrimitiveExpression)
            {
                ContextProviderBase inFormatItemProvider = CodeRush.Context.GetContextProvider("Editor\\Code\\InFormatItem");
                if (inFormatItemProvider != null)
                    if (inFormatItemProvider.IsContextSatisfied(""))
                        return;

                //PrimitiveExpression primitiveExpression = (PrimitiveExpression)ea.Element;
                //if (primitiveExpression.PrimitiveType == PrimitiveType.String)
                //{
                //	if (CodeRush.Caret.SourcePoint == primitiveExpression.NameRange.Start)
                //		ea.Available = true;
                //	return;
                //}
                ea.Available = true;
            }
        }
Example #4
0
 private void spINotifyPropertyChangedRename_CheckAvailability(object sender, CheckSearchAvailabilityEventArgs ea)
 {
     ea.Available = GetPrimitiveExpressionAndProperty(ea.Element);
 }
		private void spINotifyPropertyChangedRename_CheckAvailability(object sender, CheckSearchAvailabilityEventArgs ea)
		{
			ea.Available = GetPrimitiveExpressionAndProperty(ea.Element);
		}
 private void spFormatItems_CheckAvailability(object sender, CheckSearchAvailabilityEventArgs ea)
 {
     ea.Available = InFormatItem(ea.Element, ea.Caret.Line, ea.Caret.Offset);
 }
 private void spHtmlTagNav_CheckAvailability(object sender, CheckSearchAvailabilityEventArgs ea)
 {
     ea.Available = IsCaretOnPairedHtmlTag(ea.Element, ea.Caret);
 }