public override bool CanExecute(SolutionModel solutionModel, SelectionContext context) { FileModel fileModel; CodeSpan selection; if (!solutionModel.IsEditorSelection(context, out fileModel, out selection)) { return(false); } IConstructEnumerable <IFieldDeclaration> fields = FindFields(fileModel, selection); return(fields.Exist() && ImplementsINotifyPropertyChanged(fields.First().EnclosingClass)); }
private List <IPropertyDeclaration> GetPropertiesForWrappingByName(IClassDeclaration classDeclaration, List <string> confirmedPropertiesNamesForWrapping) { List <IPropertyDeclaration> properties = new List <IPropertyDeclaration>(); IConstructEnumerable <IDeclaration> containedDeclarations = classDeclaration.ContainedDeclarations; foreach (string propertyName in confirmedPropertiesNamesForWrapping) { IPropertyDeclaration property = containedDeclarations.First(d => string.Equals(propertyName, d.Identifier.Name, StringComparison.Ordinal)) .As <IPropertyDeclaration>(); if (property.Exists) { properties.Add(property); } } return(properties); }