/// <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;
            }
        }
Example #2
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 == "AddIn.Connect.XGoF")
         {
             status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled;
         }
     }
 }
 /// <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;
         }
     }
 }
Example #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;
         }
     }
 }
 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 { }
 }
Example #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)
        {
            // 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;
                }
            }
        }
 /// <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;
             }
         }
     }
 }
Example #8
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);
     }
 }
Example #9
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;
             }
         }
     }
 }
Example #10
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;
                }
            }
        }
Example #11
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);
            }
        }
 public void QueryStatus(EnvDTE.vsCommandStatusTextWanted NeededText, ref EnvDTE.vsCommandStatus StatusOption, ref object CommandText)
 {
     StatusOption = _isEnabled()
                        ? vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled
                        : vsCommandStatus.vsCommandStatusSupported;
 }