private bool EvaluateCanExecute(ICodeExplorerNode node)
        {
            if (!ApplicableNodes.Contains(node.GetType()) ||
                !(node is CodeExplorerItemViewModel) ||
                node.Declaration == null)
            {
                return(false);
            }

            var project = node.Declaration.Project;

            return(AllowableProjectTypes.Contains(project.Type));
        }
        private bool EvaluateCanExecute(ICodeExplorerNode node)
        {
            if (node?.Declaration == null ||
                !ApplicableNodes.Contains(node.GetType()) ||
                !(node is CodeExplorerItemViewModel))
            {
                return(false);
            }

            var project = _projectsProvider.Project(node.Declaration.ProjectId);

            return(project != null &&
                   AllowableProjectTypes.Contains(project.Type));
        }
Exemplo n.º 3
0
        public bool CanExecuteForNode(ICodeExplorerNode node)
        {
            if (!ApplicableNodes.Contains(node.GetType()) ||
                !(node is CodeExplorerItemViewModel) ||
                node.Declaration == null)
            {
                return(false);
            }

            var target     = node.Declaration;
            var targetType = target.DeclarationType;

            if (!targetType.HasFlag(DeclarationType.Module) &&
                !targetType.HasFlag(DeclarationType.Variable) &&
                !targetType.HasFlag(DeclarationType.Constant) &&
                !targetType.HasFlag(DeclarationType.Member) ||
                targetType == DeclarationType.LibraryFunction ||
                targetType == DeclarationType.LibraryProcedure)
            {
                return(false);
            }

            return(!_state.IsNewOrModified(target.QualifiedModuleName));
        }