コード例 #1
0
 public static EnvDTE.vsCommandStatus GetCommandStatusForDAL()
 {
     EnvDTE.vsCommandStatus cs = EnvDTE.vsCommandStatus.vsCommandStatusUnsupported;
     for (int i = 1; i <= Common.chDTE.Solution.Projects.Count; i++)
     {
         if (Common.chDTE.Solution.Projects.Item(i).Name == Kit.SlnKeel.DALProjectName)
         {
             cs = EnvDTE.vsCommandStatus.vsCommandStatusSupported | EnvDTE.vsCommandStatus.vsCommandStatusEnabled;
             break;
         }
     }
     return(cs);
 }
コード例 #2
0
        void IDTCommandTarget.QueryStatus(
            string strCommandName,
            EnvDTE.vsCommandStatusTextWanted cstwStatus,
            ref EnvDTE.vsCommandStatus csCommandStatus,
            ref object oCommandText)
        {
            //System.Diagnostics.Debug.WriteLine( String.Format( "QueryStatus: {0}", strCommandName ) );
            if (strCommandName == "NProf.Connect.Enable")
            {
                csCommandStatus = vsCommandStatus.vsCommandStatusSupported;

                if (_pApplication.Solution.IsOpen)
                {
                    if (_bEnabled)
                    {
                        csCommandStatus |= vsCommandStatus.vsCommandStatusLatched;
                    }

                    csCommandStatus |= vsCommandStatus.vsCommandStatusEnabled;
                }
            }
        }
 /// <summary>
 /// Called by the Object Model whenever this command is going to be displayed (in the menu
 /// or on a toolbar).
 /// </summary>
 /// <param name="status"> The current availability status of the command </param>
 public void QueryStatus(ref EnvDTE.vsCommandStatus status)
 {
     // This command is always supported.
     status = EnvDTE.vsCommandStatus.vsCommandStatusEnabled | EnvDTE.vsCommandStatus.vsCommandStatusSupported;
 }
コード例 #4
0
 /// <summary>
 ///      Implements the QueryStatus method of the IDTCommandTarget interface.
 ///      This is called when the command's availability is updated
 /// </summary>
 /// <param term='commandName'>
 ///		The name of the command to determine state for.
 /// </param>
 /// <param term='neededText'>
 ///		Text that is needed for the command.
 /// </param>
 /// <param term='status'>
 ///		The state of the command in the user interface.
 /// </param>
 /// <param term='commandText'>
 ///		Text requested by the neededText parameter.
 /// </param>
 /// <seealso class='Exec' />
 public void QueryStatus(string commandName, EnvDTE.vsCommandStatusTextWanted neededText, ref EnvDTE.vsCommandStatus status, ref object commandText)
 {
     Debug.WriteLine("DemoAddin: QueryStatus() method called");
     if (neededText == EnvDTE.vsCommandStatusTextWanted.vsCommandStatusTextWantedNone)
     {
         if (commandName == "DemoAddin.Connect.DemoAddin")
         {
             status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled;
         }
     }
 }
コード例 #5
0
 /// <summary>
 ///      Implements the QueryStatus method of the IDTCommandTarget interface.
 ///      This is called when the command's availability is updated
 /// </summary>
 /// <param term='commandName'>
 ///		The name of the command to determine state for.
 /// </param>
 /// <param term='neededText'>
 ///		Text that is needed for the command.
 /// </param>
 /// <param term='status'>
 ///		The state of the command in the user interface.
 /// </param>
 /// <param term='commandText'>
 ///		Text requested by the neededText parameter.
 /// </param>
 /// <seealso class='Exec' />
 public void QueryStatus(string commandName, EnvDTE.vsCommandStatusTextWanted neededText, ref EnvDTE.vsCommandStatus status, ref object commandText)
 {
     if (neededText == EnvDTE.vsCommandStatusTextWanted.vsCommandStatusTextWantedNone)
     {
         if (commandName == "SynchAdd.Connect.SynchAdd")
         {
             if (((System.Array)applicationObject.ActiveSolutionProjects).Length == 0)
             {
                 status = (vsCommandStatus)vsCommandStatus.vsCommandStatusInvisible;
             }
             else
             {
                 status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled;
             }
         }
     }
 }
コード例 #6
0
        /// <summary>
        ///      Implements the QueryStatus method of the IDTCommandTarget interface.
        ///      This is called when the command's availability is updated
        /// </summary>
        /// <param term='commandName'>
        ///		The name of the command to determine state for.
        /// </param>
        /// <param term='neededText'>
        ///		Text that is needed for the command.
        /// </param>
        /// <param term='status'>
        ///		The state of the command in the user interface.
        /// </param>
        /// <param term='commandText'>
        ///		Text requested by the neededText parameter.
        /// </param>
        /// <seealso class='Exec' />
        public void QueryStatus(string commandName, EnvDTE.vsCommandStatusTextWanted neededText, ref EnvDTE.vsCommandStatus status, ref object commandText)
        {
            IAddInCommand currentCommand = GetAddIn(commandName);

            if (currentCommand == null)
            {
                return;
            }

            currentCommand.QueryStatus(ref status);

            switch (neededText)
            {
            case EnvDTE.vsCommandStatusTextWanted.vsCommandStatusTextWantedName:
                commandText = currentCommand.commandName;
                break;

            case EnvDTE.vsCommandStatusTextWanted.vsCommandStatusTextWantedStatus:
                // CONSIDER: what does this do?
                break;

            default:
                break;
            }
        }
コード例 #7
0
 /// <summary>
 ///      Implements the QueryStatus method of the IDTCommandTarget interface.
 ///      This is called when the command's availability is updated
 /// </summary>
 /// <param term='commandName'>
 ///		The name of the command to determine state for.
 /// </param>
 /// <param term='neededText'>
 ///		Text that is needed for the command.
 /// </param>
 /// <param term='status'>
 ///		The state of the command in the user interface.
 /// </param>
 /// <param term='commandText'>
 ///		Text requested by the neededText parameter.
 /// </param>
 /// <seealso class='Exec' />
 public void QueryStatus(string commandName, EnvDTE.vsCommandStatusTextWanted neededText, ref EnvDTE.vsCommandStatus status, ref object commandText)
 {
     Debug.WriteLine("CodeModelWalker: Connect.QueryStatus() called.");
     if (neededText == EnvDTE.vsCommandStatusTextWanted.vsCommandStatusTextWantedNone)
     {
         if (commandName == "CodeModelWalker.Connect.CodeModelWalker")
         {
             // disable menu choice if no solution open
             if (applicationObject.Solution.IsOpen)
             {
                 status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported |
                          vsCommandStatus.vsCommandStatusEnabled;
             }
             else
             {
                 status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported;
             }
         }
     }
 }
コード例 #8
0
        public void QueryStatus(string commandName,
                                EnvDTE.vsCommandStatusTextWanted neededText,
                                ref EnvDTE.vsCommandStatus status,
                                ref object commandText)
        {
            try
            {
                if (neededText == EnvDTE.vsCommandStatusTextWanted.vsCommandStatusTextWantedNone)
                {
                    if ((commandName == Res.LaunchDesignerFullCommand) ||
                        (commandName == Res.LaunchLinguistFullCommand) ||
                        (commandName == Res.LaunchAssistantFullCommand) ||
                        (commandName == Res.VSQtOptionsFullCommand) ||
                        (commandName == Res.ImportProFileFullCommand))
                    {
                        status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported
                                 | vsCommandStatus.vsCommandStatusEnabled;
                    }
                    else if ((commandName == Res.ImportPriFileFullCommand) ||
                             (commandName == Res.ExportPriFileFullCommand) ||
                             (commandName == Res.ExportProFileFullCommand) ||
                             (commandName == Res.CreateNewTranslationFileFullCommand) ||
                             (commandName == Res.lupdateProjectFullCommand) ||
                             (commandName == Res.lreleaseProjectFullCommand))
                    {
                        Project prj = HelperFunctions.GetSelectedProject(_applicationObject);
                        if (prj != null && HelperFunctions.IsQt5Project(prj))
                        {
                            status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported
                                     | vsCommandStatus.vsCommandStatusEnabled;
                        }
                        else
                        {
                            status = vsCommandStatus.vsCommandStatusSupported;
                        }
                    }
                    else if (commandName == Res.ProjectQtSettingsFullCommand)
                    {
                        Project prj = HelperFunctions.GetSelectedProject(_applicationObject);
                        if (prj == null)
                        {
                            status = vsCommandStatus.vsCommandStatusInvisible;
                        }
                        else if (HelperFunctions.IsQt5Project(prj))
                        {
                            status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported
                                     | vsCommandStatus.vsCommandStatusEnabled;
                        }
                        else if (HelperFunctions.IsQMakeProject(prj))
                        {
                            status = vsCommandStatus.vsCommandStatusInvisible;
                        }
                        else
                        {
                            status = vsCommandStatus.vsCommandStatusSupported;
                        }
                    }
                    else if (commandName == Res.ChangeProjectQtVersionFullCommand)
                    {
                        Project prj = HelperFunctions.GetSelectedProject(_applicationObject);
                        if (prj == null || HelperFunctions.IsQt5Project(prj))
                        {
                            status = vsCommandStatus.vsCommandStatusInvisible;
                        }
                        else if (HelperFunctions.IsQMakeProject(prj))
                        {
                            status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported
                                     | vsCommandStatus.vsCommandStatusEnabled;
                        }
                        else
                        {
                            status = vsCommandStatus.vsCommandStatusInvisible;
                        }
                    }
                    else if (commandName == Res.ConvertToQMakeFullCommand)
                    {
                        Project prj = HelperFunctions.GetSelectedProject(_applicationObject);
                        if (prj == null)
                        {
                            status = vsCommandStatus.vsCommandStatusInvisible;
                        }
                        else if (HelperFunctions.IsQt5Project(prj))
                        {
                            status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported
                                     | vsCommandStatus.vsCommandStatusEnabled;
                        }
                        else if (HelperFunctions.IsQMakeProject(prj))
                        {
                            status = vsCommandStatus.vsCommandStatusInvisible;
                        }
                        else
                        {
                            status = vsCommandStatus.vsCommandStatusInvisible;
                        }
                    }
                    else if (commandName == Res.ConvertToQtFullCommand)
                    {
                        Project prj = HelperFunctions.GetSelectedProject(_applicationObject);
                        if (prj == null || HelperFunctions.IsQt5Project(prj))
                        {
                            status = vsCommandStatus.vsCommandStatusInvisible;
                        }
                        else if (HelperFunctions.IsQMakeProject(prj))
                        {
                            status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported
                                     | vsCommandStatus.vsCommandStatusEnabled;
                        }
                        else if (HelperFunctions.IsVcProject(prj))
                        {
                            status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported
                                     | vsCommandStatus.vsCommandStatusEnabled;
                        }
                        else
                        {
                            status = vsCommandStatus.vsCommandStatusInvisible;
                        }
                    }
                    else if ((commandName == Res.ChangeSolutionQtVersionFullCommand) ||
                             (commandName == Res.lupdateSolutionFullCommand) ||
                             (commandName == Res.lreleaseSolutionFullCommand))
                    {
                        if (_applicationObject.Solution.IsOpen)
                        {
                            status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported
                                     | vsCommandStatus.vsCommandStatusEnabled;
                        }
                        else
                        {
                            status = vsCommandStatus.vsCommandStatusSupported;
                        }
                    }
                    else if (commandName == Res.CommandBarName + ".Connect.lupdate" ||
                             commandName == Res.CommandBarName + ".Connect.lrelease")
                    {
                        Project prj = HelperFunctions.GetSelectedProject(_applicationObject);
                        if (prj == null || !HelperFunctions.IsQt5Project(prj) ||
                            _applicationObject.SelectedItems.Count == 0)
                        {
                            status = vsCommandStatus.vsCommandStatusInvisible;
                        }
                        else
                        {
                            status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported
                                     | vsCommandStatus.vsCommandStatusEnabled;
                        }

                        if (status != vsCommandStatus.vsCommandStatusInvisible)
                        {
                            // Don't display commands if one of the selected files is not a .ts file.
                            foreach (SelectedItem si in _applicationObject.SelectedItems)
                            {
                                if (!si.Name.ToLower().EndsWith(".ts"))
                                {
                                    status = vsCommandStatus.vsCommandStatusInvisible;
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            catch (System.Exception e)
            {
                MessageBox.Show(e.Message + "\r\n\r\nStacktrace:\r\n" + e.StackTrace);
            }
        }
コード例 #9
0
 public void QueryStatus(EnvDTE.vsCommandStatusTextWanted NeededText, ref EnvDTE.vsCommandStatus StatusOption, ref object CommandText)
 {
     StatusOption = _isEnabled()
                        ? vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled
                        : vsCommandStatus.vsCommandStatusSupported;
 }
コード例 #10
0
 void EnvDTE.IDTCommandTarget.QueryStatus(string CmdName, EnvDTE.vsCommandStatusTextWanted NeededText, ref EnvDTE.vsCommandStatus StatusOption, ref object CommandText)
 {
     try
     {
         if (NeededText == EnvDTE.vsCommandStatusTextWanted.vsCommandStatusTextWantedNone)
         {
             //Dynamically enable & disable the command. If the selected file name is File1.cs, then make the command visible.
             UIHierarchyItem item = GetSelectedProjectItem(_applicationObject);
             StatusOption = addins[CmdName].QueryStatus(item);
         }
     }
     catch { }
 }
コード例 #11
0
ファイル: Connect.cs プロジェクト: kzu/dotnetopensrc
 /// <summary>
 ///      Implements the QueryStatus method of the IDTCommandTarget interface.
 ///      This is called when the command's availability is updated
 /// </summary>
 /// <param term='commandName'>
 ///		The name of the command to determine state for.
 /// </param>
 /// <param term='neededText'>
 ///		Text that is needed for the command.
 /// </param>
 /// <param term='status'>
 ///		The state of the command in the user interface.
 /// </param>
 /// <param term='commandText'>
 ///		Text requested by the neededText parameter.
 /// </param>
 /// <seealso class='Exec' />
 public void QueryStatus(string commandName, EnvDTE.vsCommandStatusTextWanted neededText, ref EnvDTE.vsCommandStatus status, ref object commandText)
 {
     if (neededText == EnvDTE.vsCommandStatusTextWanted.vsCommandStatusTextWantedNone)
     {
         if (commandName == "AddIn.Connect.XGoF")
         {
             status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled;
         }
     }
 }
コード例 #12
0
ファイル: Connect.cs プロジェクト: UIKit0/wintools
        /// <summary>
        ///      Implements the QueryStatus method of the IDTCommandTarget interface.
        ///      This is called when the command's availability is updated
        /// </summary>
        /// <param term='commandName'>
        ///		The name of the command to determine state for.
        /// </param>
        /// <param term='neededText'>
        ///		Text that is needed for the command.
        /// </param>
        /// <param term='status'>
        ///		The state of the command in the user interface.
        /// </param>
        /// <param term='commandText'>
        ///		Text requested by the neededText parameter.
        /// </param>
        /// <seealso class='Exec' />
        public void QueryStatus(string commandName, EnvDTE.vsCommandStatusTextWanted neededText, ref EnvDTE.vsCommandStatus status, ref object commandText)
        {
            // MessageBox.Show("Prj2make Debug", "In QueryStatus");
            if (neededText == EnvDTE.vsCommandStatusTextWanted.vsCommandStatusTextWantedNone)
            {
                if (commandName == "vsprj2make.Connect.CreateMake")
                {
                    status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled;
                }

                if (commandName == "vsprj2make.Connect.GenDistUnit")
                {
                    status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled;
                }

                if (commandName == "vsprj2make.Connect.GenMDFiles")
                {
                    status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled;
                }

                if (commandName == "vsprj2make.Connect.PrjxToCsproj")
                {
                    status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled;
                }

                if (commandName == "vsprj2make.Connect.MonoRuntime")
                {
                    status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled;
                }

                if (commandName == "vsprj2make.Connect.RunOnMono")
                {
                    status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled;
                }

                if (commandName == "vsprj2make.Connect.Options")
                {
                    status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled;
                }

                if (commandName == "vsprj2make.Connect.ExploreCurrSln")
                {
                    status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled;
                }

                if (commandName == "vsprj2make.Connect.ExploreCurrDoc")
                {
                    status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled;
                }
            }
        }
コード例 #13
0
 public void QueryStatus(string commandName, EnvDTE.vsCommandStatusTextWanted neededText, ref EnvDTE.vsCommandStatus status, ref object commandText)
 {
     try
     {
         if (neededText == EnvDTE.vsCommandStatusTextWanted.vsCommandStatusTextWantedNone)
         {
             if (DebugInfo.GetEnabledStatus(commandName))
             {
                 status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled;
             }
         }
     }
     catch (System.Exception e)
     {
         MessageBox.Show(e.Message + "\r\n\r\n" + e.InnerException + "\r\n\r\n" + e.StackTrace);
     }
 }
コード例 #14
0
 /// <summary>
 ///      Implements the QueryStatus method of the IDTCommandTarget interface.
 ///      This is called when the command's availability is updated
 /// </summary>
 /// <param term='commandName'>
 ///		The name of the command to determine state for.
 /// </param>
 /// <param term='neededText'>
 ///		Text that is needed for the command.
 /// </param>
 /// <param term='status'>
 ///		The state of the command in the user interface.
 /// </param>
 /// <param term='commandText'>
 ///		Text requested by the neededText parameter.
 /// </param>
 /// <seealso class='Exec' />
 public void QueryStatus(string commandName, EnvDTE.vsCommandStatusTextWanted neededText, ref EnvDTE.vsCommandStatus status, ref object commandText)
 {
     if (neededText == EnvDTE.vsCommandStatusTextWanted.vsCommandStatusTextWantedNone)
     {
         if (commandName == "MultiLineFindReplace.Connect.MultiLineFindReplace")
         {
             status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled;
         }
     }
 }