예제 #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;
        }
예제 #2
0
 private void Options1_RestoreDefaults(object sender, OptionsPageEventArgs ea)
 {
     var Settings = new Settings();
     txtAttributeNames.Text = Settings.AttributeNames;
 }
예제 #3
0
 private void Options1_CommitChanges(object sender, CommitChangesEventArgs ea)
 {
     var settings = new Settings();
     settings.AttributeNames = txtAttributeNames.Text;
     SaveSettings(ea.Storage, settings);
 }
예제 #4
0
 public static void SaveSettings(DecoupledStorage storage, Settings settings)
 {
     storage.WriteString("XMLNav", "AttributeNames", settings.AttributeNames);
 }
예제 #5
0
 public static Settings LoadSettings(DecoupledStorage storage)
 {
     Settings settings = new Settings();
     settings.AttributeNames = storage.ReadString("XMLNav", "AttributeNames","id|ref");
     return settings;
 }