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