Browse Source

Add IOutputPad.GetOrCreateCategory()

pull/374/merge
Daniel Grunwald 12 years ago
parent
commit
032f01c73c
  1. 16
      src/Main/Base/Project/Src/Gui/Pads/CompilerMessageView/CompilerMessageView.cs
  2. 10
      src/Main/Base/Project/Workbench/IOutputPad.cs

16
src/Main/Base/Project/Src/Gui/Pads/CompilerMessageView/CompilerMessageView.cs

@ -56,6 +56,22 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -56,6 +56,22 @@ namespace ICSharpCode.SharpDevelop.Gui
return cat;
}
IOutputCategory IOutputPad.GetOrCreateCategory(string displayName)
{
return SD.MainThread.InvokeIfRequired(() => GetOrCreateCategory(displayName));
}
IOutputCategory GetOrCreateCategory(string displayName)
{
foreach (var cat in messageCategories) {
if (cat.DisplayCategory == displayName)
return cat;
}
var newcat = new MessageViewCategory(displayName, displayName);
AddCategory(newcat);
return newcat;
}
void IOutputPad.RemoveCategory(IOutputCategory category)
{
throw new NotImplementedException();

10
src/Main/Base/Project/Workbench/IOutputPad.cs

@ -38,8 +38,16 @@ namespace ICSharpCode.SharpDevelop.Workbench @@ -38,8 +38,16 @@ namespace ICSharpCode.SharpDevelop.Workbench
/// <summary>
/// Creates a new output category.
/// </summary>
/// <param name="displayName">The title of the category. This is parsed using StringParser and shown to the user.</param>
IOutputCategory CreateCategory(string displayName);
/// <summary>
/// Gets an output category, or creates a new output category if no category with the given
/// title already exists.
/// </summary>
/// <param name="displayName">The title of the category. This is parsed using StringParser and shown to the user.</param>
IOutputCategory GetOrCreateCategory(string displayName);
/// <summary>
/// Removes an existing output category.
/// </summary>
@ -65,6 +73,8 @@ namespace ICSharpCode.SharpDevelop.Workbench @@ -65,6 +73,8 @@ namespace ICSharpCode.SharpDevelop.Workbench
{
/// <summary>
/// Gets the display name of this category.
/// May contain StringParser-tags ($res) for localization; these will be replaced
/// by the UI showing the display name.
/// </summary>
string DisplayName { get; }

Loading…
Cancel
Save