Exemplo n.º 1
0
        /// <summary>
        /// Checks if command is available or not.
        /// </summary>
        /// <param name="commandId">Command Id.</param>
        /// <returns>Command status.</returns>
        public override bool IsValidContext(int commandId)
        {
            switch (commandId)
            {
            case CommandIDs.COLLAPSE_SOLUTION_CONTEXT:
                if (_shellSelectionService.IsContextActive(ContextType.SolutionHasProjects))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            case CommandIDs.COPY_REFERENCES_CONTEXT:
            case CommandIDs.PASTE_REFERENCES_CONTEXT:
            case CommandIDs.COPY_REFERENCE_CONTEXT:
                return(true);

            case CommandIDs.LOCATE_IN_SOLUTION_EXPLORER_CONTEXT:
                return(true);

            case CommandIDs.COMMAND_PROMPT:
                return(true);

            case CommandIDs.COPY_FULL_PATH:
                return(true);

            default:
                return(base.IsValidContext(commandId));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Checks if command is available or not.
        /// </summary>
        /// <param name="commandId">Command Id.</param>
        /// <returns>Command status.</returns>
        public override bool IsValidContext(int commandId)
        {
            switch (commandId)
            {
            case CommandIDs.BOOKMARK_SET_1:
            case CommandIDs.BOOKMARK_SET_2:
            case CommandIDs.BOOKMARK_SET_3:
            case CommandIDs.BOOKMARK_SET_4:
            case CommandIDs.BOOKMARK_SET_5:
            case CommandIDs.BOOKMARK_SET_6:
            case CommandIDs.BOOKMARK_SET_7:
            case CommandIDs.BOOKMARK_SET_8:
            case CommandIDs.BOOKMARK_SET_9:
            case CommandIDs.BOOKMARK_SET_0:
            case CommandIDs.BOOKMARK_GET_1:
            case CommandIDs.BOOKMARK_GET_2:
            case CommandIDs.BOOKMARK_GET_3:
            case CommandIDs.BOOKMARK_GET_4:
            case CommandIDs.BOOKMARK_GET_5:
            case CommandIDs.BOOKMARK_GET_6:
            case CommandIDs.BOOKMARK_GET_7:
            case CommandIDs.BOOKMARK_GET_8:
            case CommandIDs.BOOKMARK_GET_9:
            case CommandIDs.BOOKMARK_GET_0:
            case CommandIDs.BOOKMARK_SET_GLB_1:
            case CommandIDs.BOOKMARK_SET_GLB_2:
            case CommandIDs.BOOKMARK_SET_GLB_3:
            case CommandIDs.BOOKMARK_SET_GLB_4:
            case CommandIDs.BOOKMARK_SET_GLB_5:
            case CommandIDs.BOOKMARK_SET_GLB_6:
            case CommandIDs.BOOKMARK_SET_GLB_7:
            case CommandIDs.BOOKMARK_SET_GLB_8:
            case CommandIDs.BOOKMARK_SET_GLB_9:
            case CommandIDs.BOOKMARK_SET_GLB_0:
            case CommandIDs.BOOKMARK_GET_GLB_1:
            case CommandIDs.BOOKMARK_GET_GLB_2:
            case CommandIDs.BOOKMARK_GET_GLB_3:
            case CommandIDs.BOOKMARK_GET_GLB_4:
            case CommandIDs.BOOKMARK_GET_GLB_5:
            case CommandIDs.BOOKMARK_GET_GLB_6:
            case CommandIDs.BOOKMARK_GET_GLB_7:
            case CommandIDs.BOOKMARK_GET_GLB_8:
            case CommandIDs.BOOKMARK_GET_GLB_9:
            case CommandIDs.BOOKMARK_GET_GLB_0:
            case CommandIDs.BOOKMARK_CLEAR_F:
            case CommandIDs.BOOKMARK_CLEAR_S:
                return
                    (_shellSelectionService.IsContextActive(ContextType.SolutionExists) && (
                         _shellSelectionService.IsContextActive(ContextType.TextEditor) ||
                         _shellSelectionService.IsContextActive(ContextType.XMLTextEditor) ||
                         _shellSelectionService.IsContextActive(ContextType.XamlEditor) ||
                         _shellSelectionService.IsContextActive(ContextType.NewXamlEditor) ||
                         _shellSelectionService.IsContextActive(ContextType.HTMLSourceEditor) ||
                         _shellSelectionService.IsContextActive(ContextType.CSSTextEditor)));

            default:
                return(base.IsValidContext(commandId));
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Checks if command is available or not.
        /// </summary>
        /// <param name="commandId">Command Id.</param>
        /// <returns>Command status.</returns>
        public override bool IsValidContext(int commandId)
        {
            switch (commandId)
            {
            case CommandIDs.FILE_BROWSER:
                if (_shellSelectionService.IsContextActive(ContextType.SolutionHasProjects))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            default:
                return(base.IsValidContext(commandId));
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Checks if command is available or not.
        /// </summary>
        /// <param name="commandId">Command Id.</param>
        /// <returns>Command status.</returns>
        public override bool IsValidContext(int commandId)
        {
            switch (commandId)
            {
            case CommandIDs.SW_TRY_CATCH:
            case CommandIDs.SW_TRY_FINALLY:
            case CommandIDs.SW_FOR:
            case CommandIDs.SW_FOR_EACH:
            case CommandIDs.SW_REGION:
                return
                    (_shellSelectionService.IsContextActive(ContextType.SolutionExists) && (
                         _shellSelectionService.IsContextActive(ContextType.TextEditor) ||
                         _shellSelectionService.IsContextActive(ContextType.XMLTextEditor) ||
                         _shellSelectionService.IsContextActive(ContextType.XamlEditor) ||
                         _shellSelectionService.IsContextActive(ContextType.NewXamlEditor) ||
                         _shellSelectionService.IsContextActive(ContextType.HTMLSourceEditor) ||
                         _shellSelectionService.IsContextActive(ContextType.CSSTextEditor)));

            default:
                return(base.IsValidContext(commandId));
            }
        }