Exemplo n.º 1
0
        /// <summary>
        /// Show the position of a textpoint by printing the surrounding text
        /// </summary>
        /// <param name="point"></param>
        /// <param name="charCount"></param>
        /// <param name="listener"></param>
        /// <returns></returns>
        /// <remarks></remarks>
        public static string DebugPosition(this TextPoint point, int charCount = 50, OutputPaneTraceListener listener = null)
        {
            var start = point.CreateEditPoint();
            var text  = string.Format("{0}>|<{1}", start.GetText(-charCount), start.GetText(charCount));

            if (listener != null)
            {
                listener.WriteLine(text);
            }
            return(text);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Do not use this method ( OutputPaneTraceListener will not ready, and will throw an exception) within constructor, do it in PreRender or Render
 /// </summary>
 /// <param name="listener"></param>
 static public void SetTraceListener(OutputPaneTraceListener listener)
 {
     if (_traceListener != null)
     {
         if (MessageBox.Show("There's already a TraceListener, replace?",
                             "Set default Reegenerator Template trace listener", MessageBoxButton.YesNo) !=
             MessageBoxResult.Yes)
         {
             return;
         }
     }
     _traceListener = listener;
 }
Exemplo n.º 3
0
        private void Thread_Start(object obj)
        {
            ThreadParameter         parameter     = (ThreadParameter)obj;
            DTE2                    application   = parameter.Application;
            CSqlOptions             settings      = parameter.CSqlOptions;
            OutputPaneTraceListener traceListener = null;

            try {
                var outputPane = Gui.Output.GetAndActivateOutputPane(application);
                if (outputPane != null)
                {
                    outputPane.Clear();
                    traceListener = new OutputPaneTraceListener(outputPane);
                }

                if (traceListener != null)
                {
                    Trace.Listeners.Add(traceListener);
                }
                this.currentExecutor = new ScriptExecutor(settings);
                this.currentExecutor.Execute();

                if (!String.IsNullOrEmpty(settings.DistributionFile))
                {
                    application.ItemOperations.OpenFile(settings.DistributionFile, Constants.vsViewKindCode);
                }
                currentExecutor = null;
            }
            finally {
                currentExecutor = null;
                if (traceListener != null)
                {
                    Trace.Listeners.Remove(traceListener);
                    traceListener.Close();
                    traceListener.Dispose();
                }
            }
            Commands2 commands = application.Commands as Commands2;

            if (commands != null)
            {
                commands.UpdateCommandUI(false);
            }
        }
Exemplo n.º 4
0
 public void DebugWriteLine(string text)
 {
     OutputPaneTraceListener.WriteLine(text);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Alias for DebugPosition
 /// </summary>
 /// <param name="point"></param>
 /// <param name="charCount"></param>
 /// <param name="listener"></param>
 /// <returns></returns>
 /// <remarks></remarks>
 public static string DP(this TextPoint point, int charCount = 10, OutputPaneTraceListener listener = null)
 {
     return(DebugPosition(point, charCount, listener));
 }