Browse Source

Added BuildError to Task, sightly modified FxCopLogger to pass over the error code to the BuildError instance; Added ShowErrorHelpCommand to directly show help for build errors (except FxCop and StyleCop)

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3679 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Siegfried Pammer 17 years ago
parent
commit
7235fd6683
  1. 1
      src/AddIns/Misc/CodeAnalysis/Src/FxCopLogger.cs
  2. 7
      src/AddIns/Misc/HtmlHelp2/Project/HtmlHelp2.addin
  3. 5
      src/AddIns/Misc/HtmlHelp2/Project/HtmlHelp2.csproj
  4. 65
      src/AddIns/Misc/HtmlHelp2/Project/src/Commands/ShowErrorHelpCommand.cs
  5. 6
      src/Main/Base/Project/Src/Services/Tasks/Task.cs

1
src/AddIns/Misc/CodeAnalysis/Src/FxCopLogger.cs

@ -79,6 +79,7 @@ namespace ICSharpCode.CodeAnalysis @@ -79,6 +79,7 @@ namespace ICSharpCode.CodeAnalysis
string[] moreData = (subcategory ?? "").Split('|');
BuildError err = engineWorker.CurrentErrorOrWarning;
err.ErrorCode = (checkId != null) ? checkId.Split(':')[0] : null;
if (FileUtility.IsValidPath(file) &&
Path.GetFileName(file) == "SharpDevelop.CodeAnalysis.targets")
{

7
src/AddIns/Misc/HtmlHelp2/Project/HtmlHelp2.addin

@ -98,4 +98,11 @@ @@ -98,4 +98,11 @@
insertafter = "PreviousHelpTopic"/>
</Condition>
</Path>
<!-- Show Error Help item -->
<Path name="/SharpDevelop/Pads/ErrorList/TaskContextMenu">
<MenuItem id = "ShowHelp"
label = "Show Help"
class = "HtmlHelp2.Commands.ShowErrorHelpCommand"/>
</Path>
</AddIn>

5
src/AddIns/Misc/HtmlHelp2/Project/HtmlHelp2.csproj

@ -19,7 +19,8 @@ @@ -19,7 +19,8 @@
<FileAlignment>4096</FileAlignment>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<SourceAnalysisOverrideSettingsFile>C:\SharpDevelop Projects\0\SharpDevelop 3\src\AddIns\Misc\HtmlHelp2\Project\Settings.SourceAnalysis</SourceAnalysisOverrideSettingsFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>..\..\..\..\..\AddIns\AddIns\Misc\HtmlHelp2\</OutputPath>
@ -78,6 +79,7 @@ @@ -78,6 +79,7 @@
<None Include="HtmlHelp2.addin">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Compile Include="src\Commands\ShowErrorHelpCommand.cs" />
<Compile Include="src\Service\Help2RegistryWalker.cs" />
<Compile Include="src\Service\HtmlHelp2Dialog.cs">
<SubType>Form</SubType>
@ -137,6 +139,7 @@ @@ -137,6 +139,7 @@
<Name>ICSharpCode.SharpDevelop.Dom</Name>
<Private>False</Private>
</ProjectReference>
<Folder Include="src\Commands" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
</Project>

65
src/AddIns/Misc/HtmlHelp2/Project/src/Commands/ShowErrorHelpCommand.cs

@ -0,0 +1,65 @@ @@ -0,0 +1,65 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Siegfried Pammer" email="sie_pam@gmx.at"/>
// <version>$Revision: 3555 $</version>
// </file>
using MSHelpServices;
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
namespace HtmlHelp2.Commands
{
/// <summary>
/// Description of ShowErrorHelpCommand
/// </summary>
public class ShowErrorHelpCommand : AbstractMenuCommand
{
AxMSHelpControls.AxHxIndexCtrl indexControl;
/// <summary>
/// Starts the command
/// </summary>
public override void Run()
{
ICSharpCode.SharpDevelop.Gui.TaskView view = (ICSharpCode.SharpDevelop.Gui.TaskView)Owner;
// Search all selected tasks
foreach (Task t in new List<Task>(view.SelectedTasks))
{
string code = t.BuildError.ErrorCode;
if (string.IsNullOrEmpty(code))
return;
// Get help content
MSHelpServices.IHxTopic topic;
// If HtmlHelp2 AddIn is initialised correctly we can start!
if (HtmlHelp2.Environment.HtmlHelp2Environment.SessionIsInitialized)
{
// Get the topic
IHxIndex index = HtmlHelp2.Environment.HtmlHelp2Environment.GetIndex(HtmlHelp2.Environment.HtmlHelp2Environment.CurrentFilterQuery);
int indexSlot = index.GetSlotFromString(code);
topic = index.GetTopicsFromSlot(indexSlot).ItemAt(1);
string topicTitle = topic.get_Title(HxTopicGetTitleType.HxTopicGetTOCTitle, HxTopicGetTitleDefVal.HxTopicGetTitleFileName);
if (!topicTitle.Contains(code)) {
MessageService.ShowErrorFormatted("No help available for {0}!", code);
return;
}
}
else // Otherwise we have to show an Error message ...
{
LoggingService.Error("Couldn't initialize help database");
return;
}
// Show Browser window
HtmlHelp2.ShowHelpBrowser.OpenHelpView(topic);
}
}
}
}

6
src/Main/Base/Project/Src/Services/Tasks/Task.cs

@ -97,6 +97,11 @@ namespace ICSharpCode.SharpDevelop @@ -97,6 +97,11 @@ namespace ICSharpCode.SharpDevelop
}
}
/// <summary>
/// Contains a reference to the build error.
/// </summary>
public BuildError BuildError { get; private set; }
public Task(string fileName, string description, int column, int line, TaskType type)
{
this.type = type;
@ -121,6 +126,7 @@ namespace ICSharpCode.SharpDevelop @@ -121,6 +126,7 @@ namespace ICSharpCode.SharpDevelop
contextMenuAddInTreeEntry = error.ContextMenuAddInTreeEntry;
}
tag = error.Tag;
this.BuildError = error;
}
public void JumpToPosition()

Loading…
Cancel
Save