Beispiel #1
0
        void OnGenTaskCopied(object o, EventArgs args)
        {
            TaskListEntry task = SelectedTask;

            if (task != null)
            {
                clipboard      = Clipboard.Get(Gdk.Atom.Intern("CLIPBOARD", false));
                clipboard.Text = task.Description;
                clipboard      = Clipboard.Get(Gdk.Atom.Intern("PRIMARY", false));
                clipboard.Text = task.Description;
            }
        }
Beispiel #2
0
 void UserTaskCompletedToggled(object o, ToggledArgs args)
 {
     Gtk.TreeIter iter;
     if (store.GetIterFromString(out iter, args.Path))
     {
         bool          val  = (bool)store.GetValue(iter, (int)Columns.Completed);
         TaskListEntry task = (TaskListEntry)store.GetValue(iter, (int)Columns.UserTask);
         task.Completed = !val;
         store.SetValue(iter, (int)Columns.Completed, !val);
         store.SetValue(iter, (int)Columns.Bold, task.Completed ? (int)Pango.Weight.Light : (int)Pango.Weight.Bold);
         TaskService.SaveUserTasks(task.WorkspaceObject);
     }
 }
Beispiel #3
0
        void UserTaskDescEdited(object o, EditedArgs args)
        {
            Gtk.TreeIter iter, sortedIter;

            if (sortModel.GetIterFromString(out sortedIter, args.Path))
            {
                iter = sortModel.ConvertIterToChildIter(sortedIter);
                TaskListEntry task = (TaskListEntry)sortModel.GetValue(sortedIter, (int)Columns.UserTask);
                task.Message = args.NewText;
                store.SetValue(iter, (int)Columns.Description, args.NewText);
                TaskService.SaveUserTasks(task.WorkspaceObject);
            }
        }
		static TreeIter FindTask (ListStore store, TaskListEntry task)
		{
			TreeIter iter;
			if (!store.GetIterFirst (out iter))
				return TreeIter.Zero;
			
			do {
				TaskListEntry t = store.GetValue (iter, (int)Columns.Task) as TaskListEntry;
				if (t == task)
					return iter;
			}
			while (store.IterNext (ref iter));
			
			return TreeIter.Zero;
		}
Beispiel #5
0
 void DeleteUserTaskClicked(object obj, EventArgs e)
 {
     if (view.Selection.CountSelectedRows() > 0)
     {
         TreeIter iter;
         if (store.GetIter(out iter, view.Selection.GetSelectedRows()[0]))
         {
             TaskListEntry task = (TaskListEntry)store.GetValue(iter, (int)Columns.UserTask);
             updating = true;
             TaskService.UserTasks.Remove(task);
             updating = false;
             store.Remove(ref iter);
             TaskService.SaveUserTasks(task.WorkspaceObject);
         }
     }
 }
		public static void AddTask(string fileName, string message, int column, int line, TaskSeverity taskType)
		{
			// HACK: Use a compiler error since we cannot add an error
			// task otherwise (task type property is read-only and
			// no constructors usable).
			BuildError error = new BuildError ();
			error.Column = column;
			error.Line = line;
			error.ErrorText = message;
			error.FileName = fileName;
			error.IsWarning = false;
			
			//Task task = new Task(fileName, message, column, line);
			TaskListEntry task = new TaskListEntry (error);
			TaskService.Errors.Add(task);
		}
Beispiel #7
0
        void NewUserTaskClicked(object obj, EventArgs e)
        {
            TaskListEntry task = new TaskListEntry();

            task.WorkspaceObject = IdeApp.ProjectOperations.CurrentSelectedWorkspaceItem;
            updating             = true;
            TaskService.UserTasks.Add(task);
            updating = false;
            TreeIter iter = store.AppendValues(GettextCatalog.GetString(Enum.GetName(typeof(TaskPriority), task.Priority)), task.Completed, task.Description, task, GetColorByPriority(task.Priority), task.Completed ? (int)Pango.Weight.Light : (int)Pango.Weight.Bold);

            view.Selection.SelectIter(iter);
            TreePath path = store.GetPath(iter);

            view.ScrollToCell(path, view.Columns[(int)Columns.Description], true, 0, 0);
            view.SetCursorOnCell(path, view.Columns[(int)Columns.Description], cellRendDesc, true);
            TaskService.SaveUserTasks(task.WorkspaceObject);
        }
Beispiel #8
0
 void DeleteUserTaskClicked(object obj, EventArgs e)
 {
     if (view.Selection.CountSelectedRows() > 0)
     {
         TreeIter     iter;
         Gtk.TreePath path = sortModel.ConvertPathToChildPath(view.Selection.GetSelectedRows() [0]);
         if (store.GetIter(out iter, path))
         {
             TaskListEntry task = (TaskListEntry)store.GetValue(iter, (int)Columns.UserTask);
             updating = true;
             IdeServices.TaskService.UserTasks.Remove(task);
             updating = false;
             store.Remove(ref iter);
             IdeServices.TaskService.SaveUserTasks(task.WorkspaceObject);
         }
     }
 }
Beispiel #9
0
        void OnPropertyUpdated(object sender, EventArgs e)
        {
            highPrioColor   = StringToColor(IdeApp.Preferences.UserTasksHighPrioColor);
            normalPrioColor = StringToColor(IdeApp.Preferences.UserTasksNormalPrioColor);
            lowPrioColor    = StringToColor(IdeApp.Preferences.UserTasksLowPrioColor);

            TreeIter iter;

            if (store.GetIterFirst(out iter))
            {
                do
                {
                    TaskListEntry task = (TaskListEntry)store.GetValue(iter, (int)Columns.UserTask);
                    store.SetValue(iter, (int)Columns.Foreground, GetColorByPriority(task.Priority));
                } while (store.IterNext(ref iter));
            }
        }
Beispiel #10
0
        void NewUserTaskClicked(object obj, EventArgs e)
        {
            TaskListEntry task = new TaskListEntry();

            task.WorkspaceObject = IdeApp.ProjectOperations.CurrentSelectedWorkspaceItem;
            updating             = true;
            TaskService.UserTasks.Add(task);
            updating = false;
            var      text = priorities [GetEnumIndex(task.Priority)];
            TreeIter iter = store.AppendValues(text, task.Completed, task.Description, task, GetColorByPriority(task.Priority), task.Completed ? (int)Pango.Weight.Light : (int)Pango.Weight.Bold);

            view.Selection.SelectIter(sortModel.ConvertChildIterToIter(iter));
            TreePath sortedPath = sortModel.ConvertChildPathToPath(store.GetPath(iter));

            view.ScrollToCell(sortedPath, view.Columns[(int)Columns.Description], true, 0, 0);
            view.SetCursorOnCell(sortedPath, view.Columns[(int)Columns.Description], cellRendDesc, true);
            TaskService.SaveUserTasks(task.WorkspaceObject);
        }
Beispiel #11
0
 /// <summary>
 /// Shows a description of the task in the status bar
 /// </summary>
 public static void ShowStatus(TaskListEntry t)
 {
     if (t == null)
     {
         IdeApp.Workbench.StatusBar.ShowMessage(GettextCatalog.GetString("No more errors or warnings"));
     }
     else if (t.Severity == TaskSeverity.Error)
     {
         IdeApp.Workbench.StatusBar.ShowError(t.Description);
     }
     else if (t.Severity == TaskSeverity.Warning)
     {
         IdeApp.Workbench.StatusBar.ShowWarning(t.Description);
     }
     else
     {
         IdeApp.Workbench.StatusBar.ShowMessage(t.Description);
     }
 }
Beispiel #12
0
 void UserTaskPriorityEdited(object o, ComboSelectionChangedArgs args)
 {
     Gtk.TreeIter iter;
     if (store.GetIterFromString(out iter, args.Path))
     {
         TaskListEntry task = (TaskListEntry)store.GetValue(iter, (int)Columns.UserTask);
         if (args.Active == 0)
         {
             task.Priority = TaskPriority.High;
         }
         else if (args.Active == 1)
         {
             task.Priority = TaskPriority.Normal;
         }
         else
         {
             task.Priority = TaskPriority.Low;
         }
         store.SetValue(iter, (int)Columns.Priority, priorities [args.Active]);
         store.SetValue(iter, (int)Columns.Foreground, GetColorByPriority(task.Priority));
         TaskService.SaveUserTasks(task.WorkspaceObject);
     }
 }
		/// <summary>
		/// Shows a description of the task in the status bar
		/// </summary>
		public static void ShowStatus (TaskListEntry t)
		{
			if (t == null)
				IdeApp.Workbench.StatusBar.ShowMessage (GettextCatalog.GetString ("No more errors or warnings"));
			else if (t.Severity == TaskSeverity.Error)
				IdeApp.Workbench.StatusBar.ShowError (t.Description);
			else if (t.Severity == TaskSeverity.Warning)
				IdeApp.Workbench.StatusBar.ShowWarning (t.Description);
			else
				IdeApp.Workbench.StatusBar.ShowMessage (t.Description);
		}
		internal static void InformJumpToTask (TaskListEntry task)
		{
			EventHandler<TaskEventArgs> handler = JumpedToTask;
			if (handler != null)
				handler (null, new TaskEventArgs (task));
		}
		TaskListEntry[] ReportErrors (BuildResult result)
		{
			var tasks = new TaskListEntry [result.Errors.Count];
			for (int n = 0; n < tasks.Length; n++) {
				tasks [n] = new TaskListEntry (result.Errors [n]);
				tasks [n].Owner = this;
			}

			TaskService.Errors.AddRange (tasks);
			TaskService.Errors.ResetLocationList ();
			IdeApp.Workbench.ActiveLocationList = TaskService.Errors;
			return tasks;
		}
		void MonoDevelop.Ide.Editor.IMessageBubbleLineMarker.AddTask (TaskListEntry task)
		{
			AddError (task, task.Severity == TaskSeverity.Error, task.Description);
		}
Beispiel #17
0
		void AddGeneratedTask (TaskListEntry t)
		{
			FilePath tmpPath = t.FileName;
			if (t.WorkspaceObject != null)
				tmpPath = tmpPath.ToRelative (t.WorkspaceObject.BaseDirectory);

			store.AppendValues (t.Line, t.Description, tmpPath.FileName, tmpPath.ParentDirectory.FileName, t, GetColorByPriority (t.Priority), (int)Pango.Weight.Bold);
		}
		static string GetPath (TaskListEntry task)
		{
			if (task.WorkspaceObject != null)
				return FileService.AbsoluteToRelativePath (task.WorkspaceObject.BaseDirectory, task.FileName);
			
			return task.FileName;
		}
		void BuildDone (ProgressMonitor monitor, BuildResult result, IBuildTarget entry, ITimeTracker tt)
		{
			TaskListEntry[] tasks = null;
			tt.Trace ("Begin reporting build result");
			try {
				if (result != null) {
					lastResult = result;
					monitor.Log.WriteLine ();
					monitor.Log.WriteLine (GettextCatalog.GetString ("---------------------- Done ----------------------"));
					
					tt.Trace ("Updating task service");
					tasks = new TaskListEntry [result.Errors.Count];
					for (int n=0; n<tasks.Length; n++) {
						tasks [n] = new TaskListEntry (result.Errors [n]);
						tasks [n].Owner = this;
					}

					TaskService.Errors.AddRange (tasks);
					TaskService.Errors.ResetLocationList ();
					IdeApp.Workbench.ActiveLocationList = TaskService.Errors;
					
					tt.Trace ("Reporting result");
					
					string errorString = GettextCatalog.GetPluralString("{0} error", "{0} errors", result.ErrorCount, result.ErrorCount);
					string warningString = GettextCatalog.GetPluralString("{0} warning", "{0} warnings", result.WarningCount, result.WarningCount);

					if (monitor.CancellationToken.IsCancellationRequested) {
						monitor.ReportError (GettextCatalog.GetString ("Build canceled."), null);
					} else if (result.ErrorCount == 0 && result.WarningCount == 0 && lastResult.FailedBuildCount == 0) {
						monitor.ReportSuccess (GettextCatalog.GetString ("Build successful."));
					} else if (result.ErrorCount == 0 && result.WarningCount > 0) {
						monitor.ReportWarning(GettextCatalog.GetString("Build: ") + errorString + ", " + warningString);
					} else if (result.ErrorCount > 0) {
						monitor.ReportError(GettextCatalog.GetString("Build: ") + errorString + ", " + warningString, null);
					} else {
						monitor.ReportError(GettextCatalog.GetString("Build failed."), null);
					}
					tt.Trace ("End build event");
					OnEndBuild (monitor, lastResult.FailedBuildCount == 0, lastResult, entry as SolutionFolderItem);
				} else {
					tt.Trace ("End build event");
					OnEndBuild (monitor, false);
				}
				
				tt.Trace ("Showing results pad");
				
				try {
					Pad errorsPad = IdeApp.Workbench.GetPad<MonoDevelop.Ide.Gui.Pads.ErrorListPad> ();
					switch (IdeApp.Preferences.ShowErrorPadAfterBuild.Value) {
					case BuildResultStates.Always:
						if (!errorsPad.Visible)
							errorsPad.IsOpenedAutomatically = true;
						errorsPad.Visible = true;
						errorsPad.BringToFront ();
						break;
					case BuildResultStates.Never:
						break;
					case BuildResultStates.OnErrors:
						if (TaskService.Errors.Any (task => task.Severity == TaskSeverity.Error))
							goto case BuildResultStates.Always;
						goto case BuildResultStates.Never;
					case BuildResultStates.OnErrorsOrWarnings:
						if (TaskService.Errors.Any (task => task.Severity == TaskSeverity.Error || task.Severity == TaskSeverity.Warning))
							goto case BuildResultStates.Always;
						goto case BuildResultStates.Never;
					}
				} catch {}
				
				if (tasks != null) {
					TaskListEntry jumpTask = null;
					switch (IdeApp.Preferences.JumpToFirstErrorOrWarning.Value) {
					case JumpToFirst.Error:
						jumpTask = tasks.FirstOrDefault (t => t.Severity == TaskSeverity.Error && TaskStore.IsProjectTaskFile (t));
						break;
					case JumpToFirst.ErrorOrWarning:
						jumpTask = tasks.FirstOrDefault (t => (t.Severity == TaskSeverity.Error || t.Severity == TaskSeverity.Warning) && TaskStore.IsProjectTaskFile (t));
						break;
					}
					if (jumpTask != null) {
						tt.Trace ("Jumping to first result position");
						jumpTask.JumpToPosition ();
					}
				}
				
			} finally {
				monitor.Dispose ();
				tt.End ();
			}
		}
		static void SetText (CellRendererText textRenderer, TreeModel model, TreeIter iter, TaskListEntry task, string text)
		{
			textRenderer.Text = text;
			textRenderer.Weight = (int)((bool)model.GetValue (iter, DataColumns.Read) ? Pango.Weight.Normal : Pango.Weight.Bold);
			textRenderer.Strikethrough = task.Completed;
		}
		void AddTaskInternal (TaskListEntry t)
		{
			if (tasks.Contains (t)) return;
			
			Xwt.Drawing.Image stock;
			
			switch (t.Severity) {
				case TaskSeverity.Error:
					stock = iconError;
					errorCount++;
					UpdateErrorsNum ();
					break; 
				case TaskSeverity.Warning:
					stock = iconWarning;
					warningCount++;
					UpdateWarningsNum ();	
					break;
				default:
					stock = iconInfo;
					infoCount++;
					UpdateMessagesNum ();
					break;
			}
			
			tasks [t] = t;

			var indexOfNewLine = t.Description.IndexOfAny (new [] { '\n', '\r' });
			if (indexOfNewLine != -1) {
				var iter = store.AppendValues (stock, false, t, t.Description.Remove (indexOfNewLine));
				store.AppendValues (iter, iconEmpty, false, null, t.Description);
			} else {
				store.AppendValues (stock, false, t, t.Description);
			}

			UpdatePadIcon ();
		}
Beispiel #22
0
		void OnGenTaskJumpto (object o, EventArgs args)
		{
			TaskListEntry task = SelectedTask;
			if (task != null)
				task.JumpToPosition ();
		}
Beispiel #23
0
		void NewUserTaskClicked (object obj, EventArgs e)
		{
			TaskListEntry task = new TaskListEntry ();
			task.WorkspaceObject = IdeApp.ProjectOperations.CurrentSelectedWorkspaceItem;
			updating = true;
			TaskService.UserTasks.Add (task);
			updating = false;
			TreeIter iter = store.AppendValues (GettextCatalog.GetString (Enum.GetName (typeof (TaskPriority), task.Priority)), task.Completed, task.Description, task, GetColorByPriority (task.Priority), task.Completed ? (int)Pango.Weight.Light : (int)Pango.Weight.Bold);
			view.Selection.SelectIter (iter);
			TreePath path = store.GetPath (iter);
			view.ScrollToCell (path, view.Columns[(int)Columns.Description], true, 0, 0);
			view.SetCursorOnCell (path, view.Columns[(int)Columns.Description], cellRendDesc, true);
			TaskService.SaveUserTasks (task.WorkspaceObject);
		}
Beispiel #24
0
		void RemoveGeneratedTask (TaskListEntry t)
		{
			TreeIter iter = FindTask (store, t);
			if (!iter.Equals (TreeIter.Zero))
				store.Remove (ref iter);
		}
 public TaskNavigationPoint(TaskListEntry task) : base(task.FileName, task.Line, task.Column)
 {
     this.task = task;
 }
		public void SetPrimaryError (TaskListEntry task)
		{
			this.primaryTask = task;
			var text = task.Description;
			EnsureLayoutCreated (editor);
			
			var match = mcsErrorFormat.Match (text);
			if (match.Success)
				text = match.Groups[1].Value;
			int idx = -1;
			for (int i = 0; i < errors.Count; i++) {
				if (errors[i].ErrorMessage == text) {
					idx = i;
					break;
				}
			}
			if (idx <= 0)
				return;
			var tmp = errors[idx];
			errors.RemoveAt (idx);
			errors.Insert (0, tmp);
			var tmplayout = layouts[idx];
			layouts.RemoveAt (idx);
			layouts.Insert (0, tmplayout);
		}
 public TaskEventArgs(TaskListEntry task) : this(new TaskListEntry[] { task })
 {
 }
		internal MessageBubbleTextMarker (MessageBubbleCache cache, TaskListEntry task, bool isError, string errorMessage)
		{
			if (cache == null)
				throw new ArgumentNullException ("cache");
			this.cache = cache;
			this.task = task;
			this.isError = isError;
			AddError (task, isError, errorMessage);
//			cache.Changed += (sender, e) => CalculateLineFit (editor, lineSegment);
		}
		internal void SelectTaskListEntry (TaskListEntry taskListEntry)
		{
			TreeIter iter;
			if (!view.Model.GetIterFirst (out iter))
				return;
			do {
				var t = (TaskListEntry) view.Model.GetValue (iter, DataColumns.Task);
				if (t == taskListEntry) {
					view.Selection.SelectIter (iter);
					view.ScrollToCell (view.Model.GetPath (iter), view.Columns[0], false, 0, 0);
					return;
				}
			} while (view.Model.IterNext (ref iter));
		}
		public void AddError (TaskListEntry task, bool isError, string errorMessage)
		{
			if (this.task == null) {
				this.task = task;
			}
			var match = mcsErrorFormat.Match (errorMessage);
			if (match.Success)
				errorMessage = match.Groups [1].Value;
			errors.Add (new ErrorText (task, isError, errorMessage));
			DisposeLayout ();
		}
		static string GetProject (TaskListEntry task)
		{
			return (task != null && task.WorkspaceObject is SolutionFolderItem)? task.WorkspaceObject.Name: string.Empty;
		}
Beispiel #32
0
		void UpdateCommentTags (Solution wob, FilePath fileName, IEnumerable<Tag> tagComments)
		{
			if (fileName == FilePath.Null)
				return;
			
			fileName = fileName.FullPath;
			
			List<TaskListEntry> newTasks = new List<TaskListEntry> ();
			if (tagComments != null) {  
				foreach (Tag tag in tagComments) {
					TaskPriority priority;
					string desc = tag.Text.Trim ();

					if (!priorities.TryGetValue (tag.Key, out priority)) {
						if (!Enum.TryParse (tag.Key, out priority))
							priority = TaskPriority.High;
					} else {
						//prepend the tag if it's not already there
						if (!desc.StartsWith (tag.Key, StringComparison.Ordinal)) {
							if (desc.StartsWith (":", StringComparison.Ordinal))
								desc = tag.Key + desc;
							else if (tag.Key.EndsWith (":", StringComparison.Ordinal))
								desc = tag.Key + " " + desc;
							else
								desc = tag.Key + ": " + desc;
						}
					}
					
					TaskListEntry t = new TaskListEntry (fileName, desc, tag.Region.BeginColumn, tag.Region.BeginLine,
					                   TaskSeverity.Information, priority, wob);
					newTasks.Add (t);
				}
			}
			
			List<TaskListEntry> oldTasks = new List<TaskListEntry> (comments.GetFileTasks (fileName));

			for (int i = 0; i < newTasks.Count; ++i) {
				for (int j = 0; j < oldTasks.Count; ++j) {
					if (oldTasks[j] != null &&
					    newTasks[i].Line == oldTasks[j].Line &&
					    newTasks[i].Column == oldTasks[j].Column &&
					    newTasks[i].Description == oldTasks[j].Description &&
					    newTasks[i].Priority == oldTasks[j].Priority)
					{
						newTasks.RemoveAt (i);
						oldTasks.RemoveAt (j);
						i--;
						break;
					}
				}
			}
			
			comments.BeginTaskUpdates ();
			try {
				comments.AddRange (newTasks);
				comments.RemoveRange (oldTasks);
			} finally {
				comments.EndTaskUpdates ();
			}
		}
		public void AddTask (TaskListEntry t)
		{
			AddTaskInternal (t);
			filter.Refilter ();
		}
Beispiel #34
0
        void UpdateCommentTags(Solution wob, FilePath fileName, IEnumerable <Tag> tagComments)
        {
            if (fileName == FilePath.Null)
            {
                return;
            }

            fileName = fileName.FullPath;

            List <TaskListEntry> newTasks = new List <TaskListEntry> ();

            if (tagComments != null)
            {
                foreach (Tag tag in tagComments)
                {
                    TaskPriority priority;
                    string       desc = tag.Text.Trim();

                    if (!priorities.TryGetValue(tag.Key, out priority))
                    {
                        if (!Enum.TryParse(tag.Key, out priority))
                        {
                            priority = TaskPriority.High;
                        }
                    }
                    else
                    {
                        //prepend the tag if it's not already there
                        if (!desc.StartsWith(tag.Key, StringComparison.Ordinal))
                        {
                            if (desc.StartsWith(":", StringComparison.Ordinal))
                            {
                                desc = tag.Key + desc;
                            }
                            else if (tag.Key.EndsWith(":", StringComparison.Ordinal))
                            {
                                desc = tag.Key + " " + desc;
                            }
                            else
                            {
                                desc = tag.Key + ": " + desc;
                            }
                        }
                    }

                    TaskListEntry t = new TaskListEntry(fileName, desc, tag.Region.BeginColumn, tag.Region.BeginLine,
                                                        TaskSeverity.Information, priority, wob);
                    newTasks.Add(t);
                }
            }

            List <TaskListEntry> oldTasks = new List <TaskListEntry> (comments.GetFileTasks(fileName));

            for (int i = 0; i < newTasks.Count; ++i)
            {
                for (int j = 0; j < oldTasks.Count; ++j)
                {
                    if (oldTasks[j] != null &&
                        newTasks[i].Line == oldTasks[j].Line &&
                        newTasks[i].Column == oldTasks[j].Column &&
                        newTasks[i].Description == oldTasks[j].Description &&
                        newTasks[i].Priority == oldTasks[j].Priority)
                    {
                        newTasks.RemoveAt(i);
                        oldTasks.RemoveAt(j);
                        i--;
                        break;
                    }
                }
            }

            comments.BeginTaskUpdates();
            try {
                comments.AddRange(newTasks);
                comments.RemoveRange(oldTasks);
            } finally {
                comments.EndTaskUpdates();
            }
        }
		public ErrorText (TaskListEntry task, bool isError, string errorMessage)
		{
			this.Task = task;
			this.IsError = isError;
			this.ErrorMessage = errorMessage;
		}
    /// <summary>
    /// Called when a violation is found.
    /// </summary>
    /// <param name="sender">The event sender.</param>
    /// <param name="e">The event arguments.</param>
    internal static void StyleCopCoreViolationEncountered(object sender, ViolationEventArgs e)
    {
      Param.Ignore(sender, e);

      // Check the violation count. At some point we don't allow any more violations so we cancel the analyze run.
      if (e.SourceCode.Project.MaxViolationCount > 0 && styleCopAnalysisResultList.Count == e.SourceCode.Project.MaxViolationCount)
      {
        IdeApp.ProjectOperations.CancelStyleCopAnalysis();
      }

      string trimmedNamespace = e.Violation.Rule.Namespace;
      string searchValue = global::StyleCop.Constants.ProductName + ".";

      int indexOfProductName = trimmedNamespace.IndexOf(searchValue, StringComparison.Ordinal);
      if (indexOfProductName != -1 && indexOfProductName < trimmedNamespace.Length - 1)
      {
        trimmedNamespace = trimmedNamespace.Substring(indexOfProductName + searchValue.Length);

        int indexOfRulesString = trimmedNamespace.LastIndexOf("Rules", StringComparison.Ordinal);
        trimmedNamespace = indexOfRulesString != -1 ? trimmedNamespace.Substring(0, indexOfRulesString) : trimmedNamespace;
      }
      else
      {
        trimmedNamespace = string.Empty;
      }

      string fileName = string.Empty;
      if (e.Element != null)
      {
        fileName = e.Element.Document.SourceCode.Path;
      }
      else
      {
        if (e.SourceCode != null)
        {
          fileName = e.SourceCode.Path;
        }
      }

      TaskSeverity severity = TaskSeverity.Error;
      if (e.Warning || !e.SourceCode.Project.ViolationsAsErrors)
      {
        severity = TaskSeverity.Warning;
      }

      TaskListEntry styleCopWarning = new TaskListEntry(
                               fileName,
                               string.Concat(e.Violation.Rule.CheckId, " : ", trimmedNamespace, " : ", e.Message),
                               e.Location != null ? e.Location.Value.StartPoint.IndexOnLine : 1,
                               e.LineNumber,
                               severity,
                               TaskPriority.Normal,
                               ProjectUtilities.Instance.CachedProjects.GetProjectForFile(fileName),
                               ProjectOperationsExtensions.ownerObject);

      styleCopAnalysisResultList.Add(styleCopWarning);
    }