private bool SpecializedEvaluateCanExecute(object parameter)
        {
            var activeSelection = SelectionProvider.ActiveSelection();

            if (!activeSelection.HasValue)
            {
                return(false);
            }

            var member = GetTarget();

            if (member == null || _state.IsNewOrModified(member.QualifiedModuleName))
            {
                return(false);
            }

            var parameters = _state.DeclarationFinder
                             .UserDeclarations(DeclarationType.Parameter)
                             .Where(item => member.Equals(item.ParentScopeDeclaration))
                             .ToList();

            return(member.DeclarationType == DeclarationType.PropertyLet ||
                   member.DeclarationType == DeclarationType.PropertySet
                ? parameters.Count > 1
                : parameters.Any());
        }
Exemple #2
0
        private bool SpecializedEvaluateCanExecute(object parameter)
        {
            var activeSelection = SelectionProvider.ActiveSelection();

            if (!activeSelection.HasValue)
            {
                return(false);
            }
            return(_extractInterfaceRefactoring.CanExecute(_state, activeSelection.Value.QualifiedName));
        }
Exemple #3
0
        private bool SpecializedEvaluateCanExecute(object parameter)
        {
            var activeSelection = SelectionProvider.ActiveSelection();

            if (!activeSelection.HasValue)
            {
                return(false);
            }

            var targetInterface = _state.DeclarationFinder.FindInterface(activeSelection.Value);

            var targetClass = _state.DeclarationFinder.Members(activeSelection.Value.QualifiedName)
                              .SingleOrDefault(declaration => declaration.DeclarationType == DeclarationType.ClassModule);

            return(targetInterface != null && targetClass != null &&
                   !_state.IsNewOrModified(targetInterface.QualifiedModuleName) &&
                   !_state.IsNewOrModified(targetClass.QualifiedModuleName));
        }