public bool AddRefactoringWarning(IRefactoringWarningMessage message) { // Create a list view item by the given messagesInListView. var item = CreateListViewItem(Split2MessageElements(message), 0); // If the item is created, add to the list view. if (item != null) { refactoringWarningsListView.Items.Add(item); // Save message. messagesInListView.Add(message); refactoringWarningsListView.Invalidate(); logger.Info("Item added."); return true; } return false; }
/* Split a IRefactoringWarningMessage to string elements. */ private IEnumerable<string> Split2MessageElements(IRefactoringWarningMessage message) { var messageElements = new List<string>(); messageElements.Add(message.File); messageElements.Add(message.Line.ToString()); var typeName = RefactoringTypeUtil.GetRefactoringTypeName(message.RefactoringType); messageElements.Add(typeName); messageElements.Add(message.Description); return messageElements; }
/* Split a IRefactoringWarningMessage to string elements. */ private IEnumerable<string> Split2MessageElements(IRefactoringWarningMessage message) { var messageElements = new List<string>(); messageElements.Add(message.File); messageElements.Add(message.Line.ToString()); // Convert the refactoring type to the name that describes it. var converter = new RefactoringType2StringConverter(); var typeName = (string)converter.Convert(message.RefactoringType, null, null, null); messageElements.Add(typeName); messageElements.Add(message.Description); return messageElements; }