Пример #1
0
    public Task( TaskManager taskManager
               , string description, string tipText, string code, string helpKeyword
               , TaskPriority priority, TaskCategory category, TaskMarker markerType
               , Location loc
               , ITaskCommands commands
               )
    {
      this.taskManager = taskManager;
      this.code = code;
      this.description = description;
      this.tipText = ((tipText == null || tipText.Length == 0) ? description : tipText);
      this.helpKeyword = helpKeyword;
      this.priority = priority;
      this.category = category;
      this.markerType = markerType;
      this.commands = commands;

      this.location = (loc == null ? new Location(null, null) : loc);
      this.initLoc = this.location.Clone();
      this.persistLoc = this.location.Clone();

      // isChecked = false;
      // isDeleted = false;
      // marker = null;

      // Create markers if the document is already opened.
      IVsTextLines textLines = this.location.GetTextLines(false);
      if (textLines != null) {
        OnOpenFile(textLines);
      }
    }
Пример #2
0
    public void AddTask(string description, string tipText, string code, string helpKeyword
                       ,TaskPriority priority, TaskCategory category
                       ,TaskMarker marker, Guid outputPane
                       ,string projectName
                       ,string fileName, int startLine, int startColumn, int endLine, int endColumn 
                       ,ITaskCommands commands
                       )
    {
      // Add a new task
      Location span = new Location(projectName,fileName, startLine, startColumn, endLine, endColumn);
      Task task = new Task(this
                          ,description, tipText, code, helpKeyword
                          ,priority, category, marker
                          ,span
                          ,commands);
      tasks.Add(task);

      // show standard error in the build output pane
      if (outputPane != TaskOutputPane.None && description != null) {
        string kind;
        switch (category) {
          case TaskCategory.Error: kind = "error "; break;
          case TaskCategory.Warning: kind = "warning "; break;
          case TaskCategory.Message: kind = "message "; break;
          default: kind = ""; break;
        }
        OutputString(span + ": " + kind + (code != null ? code : "") + ": " + description + "\n", outputPane);
      }
    }
Пример #3
0
 /// <summary>
 /// Do two locations overlap?
 /// </summary>
 public bool Overlaps(Location span)
 {
   // do the files match
   if (span == null) return false;
   if (!IsSameFile(span.FilePath)) return false;
   // are they line-overlapping?
   if (startLine > span.endLine ||
       endLine < span.startLine) return false;
   // are they line/column-overlapping?
   if ((startLine == span.endLine && startColumn > span.endColumn) ||
       (endLine == span.startLine && endColumn < span.startColumn)) return false;
   // they overlap
   return true;
 }
Пример #4
0
 public void ClearTasksOnSourceSpan(string projectName, string fileName
                                   , int startLine, int startColumn, int endLine, int endColumn)
 {
     if (fileName != null && fileName.Length > 0)
     {
         Common.ThreadSafeASync(delegate ()
         {
             Location span = new Location(projectName, fileName, startLine, startColumn, endLine, endColumn);
             foreach (Task t in tasks)
             {
                 if (t != null && t.Overlaps(span))
                 {
                     t.OnDeleteTask();
                 }
             }
             tasks.RemoveAll(delegate (Task t) { return (t == null || t.Overlaps(span)); });
             Refresh();
         });
     }
 }
Пример #5
0
 public void NavigateToLocation(string projectName, string fileName, int startLine, int startColumn, int endLine, int endColumn, bool highlight)
 {
   if (projectName == null || projectName.Length == 0) projectName = this.ProjectName;
   if (fileName == null || fileName.Length == 0) fileName = this.FilePath;
   Location location = new Location(projectName, fileName, startLine, startColumn, endLine, endColumn);
   location.NavigateTo(highlight);
 }
Пример #6
0
 public void Release()
 {
   // Called from "OnDelete"
   // task list makes sure it doesn't show up 
   //  and we remove it later when an enumeration is asked.
   isDeleted = true;     
   if (marker != null) {
     marker.Invalidate();
     marker = null;
   }
   if (commands != null) {
     commands.Dispose();
     commands = null;
   }     
   userContext = null;
   taskManager = null;
   if (location != null) {
     location.Dispose();
     location = null;
   }
   if (persistLoc != null) {
     persistLoc.Dispose();
     persistLoc = null;
   }
   if (initLoc != null) {
     initLoc.Dispose();
     initLoc = null;
   }
 }
Пример #7
0
 public void OnBufferSave(string pszFileName)
 {
   if (location != null) {
     location.OnRename(pszFileName);
     persistLoc = location.Clone(); // save the persistent span
   }
 }
Пример #8
0
 public void OnBeforeBufferClose()
 {
   if (persistLoc != null) {
     location = persistLoc.Clone(); // back to persistent span
     if (marker != null) {
       marker.Invalidate();
       marker = null;
     }
   }
 }
Пример #9
0
 internal bool Overlaps( Location span )
 {
   return (span != null && location != null && location.Overlaps(span));
 }