示例#1
0
        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));
        }
示例#2
0
        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);
        }