Exemple #1
0
        // Activates the window and makes it visible.  This should only be called
        // at the completion of a build process.
        /// <include file='doc\TaskProvider.uex' path='docs/doc[@for="ErrorListProvider.BringToFront"]/*' />
        public void BringToFront()
        {
            IVsTaskList tasklist = this.VsTaskList;

            NativeMethods.ThrowOnFailure(errorList.BringToFront());
            tasklist = null;
        }
        // ------------------------------------------------------
        /// <summary>
        /// Brings the error list window to the front.
        /// </summary>
        public void BringErrorListToFront()
        {
            IVsErrorList errorList =
                (IVsErrorList)GetService(typeof(SVsErrorList));

            errorList.BringToFront();
        }
Exemple #3
0
 public void BringToFront()
 {
     if (!Shell.VsShellUtilities.ShellIsShuttingDown)
     {
         _errorList.BringToFront();
     }
 }
 protected virtual void AfterCodeGenerated(bool error)
 {
     if (error)
     {
         IVsErrorList errorList = ErrorList;
         if (errorList != null)
         {
             errorList.BringToFront();
             errorList.ForceShowErrors();
         }
     }
 }
        /*
         * private void SetTargetNamespace()
         * {
         *  if (!string.IsNullOrEmpty(this.CodeFileNameSpace))
         *  {
         *      TargetNamespace = CodeFileNameSpace;
         *      return;
         *  }
         *
         *  DTE dte = Dte;
         *  if (dte == null)
         *      return;
         *  IEnumerable activeProjects = dte.ActiveSolutionProjects as IEnumerable;
         *  if (activeProjects == null)
         *      return;
         *  Project project = activeProjects.OfType<Project>().First();
         *  if (project == null)
         *      return;
         *  var defaultNamespace = project.Properties.Item("DefaultNamespace");
         *  if (defaultNamespace != null && defaultNamespace.Value is string)
         *  {
         *      string targetNamespace = (string)defaultNamespace.Value;
         *      string projectFolder = Path.GetDirectoryName(project.FullName);
         *      string sourceFileFolder = Path.GetDirectoryName(this.CodeFilePath);
         *      if (sourceFileFolder.StartsWith(sourceFileFolder, StringComparison.InvariantCultureIgnoreCase))
         *      {
         *          string extraFolders = sourceFileFolder.Substring(projectFolder.Length);
         *          if (extraFolders.Length > 0)
         *          {
         *              string[] parts = extraFolders.TrimStart('\\').Split('\\');
         *              targetNamespace += "." + string.Join(".",
         *                  parts.Select(p => p.ToIdentifier()).ToArray());
         *          }
         *          targetNamespace += extraFolders.Replace("\\", ".");
         *      }
         *      TargetNamespace = targetNamespace;
         *  }
         * }
         */

        protected override void AfterCodeGenerated(bool error)
        {
            base.AfterCodeGenerated(error);

            if (error)
            {
                IVsErrorList errorList = ErrorList;
                if (errorList != null)
                {
                    errorList.BringToFront();
                    errorList.ForceShowErrors();
                }
            }
        }
Exemple #6
0
        public static void Show()
        {
            if (_initialized == false)
            {
                return;
            }

            try
            {
                _errorListProvider.Show();
                _errorListProvider.ForceShowErrors();
                _ivsErrorList.BringToFront();
            }
            catch (Exception exception)
            {
                Log.Error($"Failed to show Error List. {exception.Message}");
            }
        }
Exemple #7
0
        protected override byte[] GenerateCode(string inputFileName, string inputFileContent)
        {
            if (this.ShowWarningDialog())
            {
                return(new byte[0]);
            }
            base.SetWaitCursor();
            this.errors = false;
            this.encodingSetFromOutputDirective = false;
            this.outputEncoding = null;
            ITextTemplating textTemplating = this.TextTemplating;
            string          s = string.Empty;

            CallContext.LogicalSetData("NamespaceHint", base.FileNamespace);
            try
            {
                if (textTemplating == null)
                {
                    throw new InvalidOperationException(Resources.TextTemplatingUnavailable);
                }
                textTemplating.BeginErrorSession();
                IVsHierarchy service = base.GetService(typeof(IVsHierarchy)) as IVsHierarchy;
                s            = this.ProcessTemplate(inputFileName, inputFileContent, textTemplating, service);
                this.errors |= textTemplating.EndErrorSession();
                MarkProjectForTextTemplating(service);
            }
            finally
            {
                CallContext.FreeNamedDataSlot("NamespaceHint");
            }
            if (this.errors)
            {
                IVsErrorList errorList = base.ErrorList;
                if (errorList != null)
                {
                    try
                    {
                        errorList.BringToFront();
                        errorList.ForceShowErrors();
                    }
                    catch
                    {
                    }
                }
            }
            if (this.outputEncoding == null)
            {
                this.outputEncoding = EncodingHelper.GetEncoding(inputFileName);
            }
            if (this.outputEncoding == null)
            {
                this.outputEncoding = Encoding.UTF8;
            }
            byte[] bytes    = this.outputEncoding.GetBytes(s);
            byte[] preamble = this.outputEncoding.GetPreamble();
            if ((preamble != null) && (preamble.Length > 0))
            {
                bool flag2 = false;
                if (bytes.Length >= preamble.Length)
                {
                    flag2 = true;
                    for (int i = 0; i < preamble.Length; i++)
                    {
                        if (preamble[i] != bytes[i])
                        {
                            flag2 = false;
                            break;
                        }
                    }
                }
                if (!flag2)
                {
                    byte[] array = new byte[preamble.Length + bytes.Length];
                    preamble.CopyTo(array, 0);
                    bytes.CopyTo(array, preamble.Length);
                    bytes = array;
                }
            }
            return(bytes);
        }