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