Beispiel #1
0
        /// <summary>
        /// Constructor.  Inititialize member data.
        /// </summary>
        public IDEBuildLogger(IVsOutputWindowPane output, TaskProvider taskProvider, IVsHierarchy hierarchy)
        {
            if (taskProvider == null)
                throw new ArgumentNullException("taskProvider");
            if (hierarchy == null)
                throw new ArgumentNullException("hierarchy");

            this.taskProvider = taskProvider;
            this.outputWindowPane = output;
            this.hierarchy = hierarchy;
            IOleServiceProvider site;
            Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(hierarchy.GetSite(out site));
            this.serviceProvider = new ServiceProvider(site);
        }
Beispiel #2
0
        /// <summary>
        /// Constructor.  Inititialize member data.
        /// </summary>
        public IDEBuildLogger(IVsOutputWindowPane output, TaskProvider taskProvider, IVsHierarchy hierarchy)
        {
            if (taskProvider == null)
            {
                throw new ArgumentNullException("taskProvider");
            }
            if (hierarchy == null)
            {
                throw new ArgumentNullException("hierarchy");
            }

            Trace.WriteLineIf(Thread.CurrentThread.GetApartmentState() != ApartmentState.STA, "WARNING: IDEBuildLogger constructor running on the wrong thread.");

            IOleServiceProvider site;

            Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(hierarchy.GetSite(out site));

            this.taskProvider     = taskProvider;
            this.outputWindowPane = output;
            this.hierarchy        = hierarchy;
            this.serviceProvider  = new ServiceProvider(site);
            this.dispatcher       = Dispatcher.CurrentDispatcher;
        }
Beispiel #3
0
    public void Close() {
      if (this.textLinesEventsCookie != 0) 
        VsShell.DisConnect(this.textLines, ref VsConstants.IID_IVsTextLinesEvents, this.textLinesEventsCookie );
      if (this.textChangeCommitEventsCookie != 0) 
        VsShell.DisConnect( this.textLines, ref VsConstants.IID_IVsFinalTextChangeCommitEvents, this.textChangeCommitEventsCookie );

      this.statusBar = null;
      this.methodData.Close();
      this.methodData = null;
      this.completionSet.Close();
      this.completionSet = null;
      this.taskProvider.Close();
      this.taskProvider = null;
      this.service = null;
      this.colorizer = null;      
    }
Beispiel #4
0
    public Source(LanguageService service, IVsTextLines textLines, Colorizer colorizer) {
      this.service = service;
      this.textLines = textLines;
      this.colorizer = colorizer;
      this.taskProvider = new TaskProvider(service.site); // task list
      this.completionSet = this.GetCompletionSet();      
      this.methodData = this.GetMethodData();
      this.colorState = (IVsTextColorState)textLines;

      Guid statusBarGuid = typeof(VsShellInterop.IVsStatusbar).GUID;
      this.statusBar = (VsShellInterop.IVsStatusbar)service.site.QueryService(statusBarGuid, typeof(VsShellInterop.IVsStatusbar));

      service.GetCommentFormat(ref commentInfo);

      // track source changes
      if (service.Preferences.EnableCodeSenseFastOnLineChange) {
        textChangeCommitEventsCookie = VsShell.Connect( textLines, (IVsFinalTextChangeCommitEvents)this, ref VsConstants.IID_IVsFinalTextChangeCommitEvents);
      }
      this.textLinesEventsCookie = VsShell.Connect( textLines, (IVsTextLinesEvents)this, ref VsConstants.IID_IVsTextLinesEvents);

    }
Beispiel #5
0
    public void Close(){
      if (this.textLinesEventsCookie != 0) 
        VsShell.DisConnect(this.textLines, ref VsConstants.IID_IVsTextLinesEvents, this.textLinesEventsCookie );
      if (this.textChangeCommitEventsCookie != 0) 
        VsShell.DisConnect(this.textLines, ref VsConstants.IID_IVsFinalTextChangeCommitEvents, this.textChangeCommitEventsCookie );

#if WHIDBEY
      // release the task manager
      if (this.taskManager != null) {
        ITaskManagerFactory taskManagerFactory = (ITaskManagerFactory)service.site.GetService(typeof(ITaskManagerFactory));
        if (taskManagerFactory != null) {
          taskManagerFactory.ReleaseSharedTaskManager(this.taskManager);
        }
      }
      this.taskManager = null;
#endif

      this.statusBar = null;
      this.methodData.Close();
      this.methodData = null;
      this.completionSet.Close();
      this.completionSet = null;
      this.taskProvider.Dispose();
      this.taskProvider = null;
      this.service = null;
      this.colorizer = null;      
    }
Beispiel #6
0
    public Source(LanguageService service, IVsTextLines textLines, Colorizer colorizer){
      this.service = service;
      this.textLines = textLines;
      this.colorizer = colorizer;
      this.taskProvider = new TaskProvider(service.site); // task list
      this.completionSet = this.GetCompletionSet();      
      this.methodData = this.GetMethodData();
      this.colorState = (IVsTextColorState)textLines;

      Guid statusBarGuid = typeof(VsShellInterop.IVsStatusbar).GUID;
      this.statusBar = (VsShellInterop.IVsStatusbar)service.site.QueryService(statusBarGuid, typeof(VsShellInterop.IVsStatusbar));
      
      this.commentInfo = new CommentInfo();
      service.GetCommentFormat(this.commentInfo);

      // track source changes
      if (service.Preferences.EnableCodeSenseFastOnLineChange){
        textChangeCommitEventsCookie = VsShell.Connect(textLines, (IVsFinalTextChangeCommitEvents)this, ref VsConstants.IID_IVsFinalTextChangeCommitEvents);
      }
      this.textLinesEventsCookie = VsShell.Connect(textLines, (IVsTextLinesEvents)this, ref VsConstants.IID_IVsTextLinesEvents);
      this.SetDirty();

#if WHIDBEY
      // create a task manager
      if (taskManager == null) {
        ITaskManagerFactory taskManagerFactory = (ITaskManagerFactory)(service.site).GetService(typeof(ITaskManagerFactory));
        if (taskManagerFactory != null) {
          taskManager = taskManagerFactory.QuerySharedTaskManager("SpecSharp", true);
        }
      }
#endif
    }