Browse Source

Fixed SD2-990: Allow to specify path to FxCop in the options

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1887 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 19 years ago
parent
commit
083b5340a2
  1. BIN
      data/resources/StringResources.nl.resources
  2. 2
      data/templates/project/CSharp/WebpageProject.xpt
  3. 9
      src/AddIns/Misc/CodeAnalysis/CodeAnalysis.addin
  4. 3
      src/AddIns/Misc/CodeAnalysis/CodeAnalysis.csproj
  5. 35
      src/AddIns/Misc/CodeAnalysis/Resources/AnalysisIdeOptionPanel.xfrm
  6. 68
      src/AddIns/Misc/CodeAnalysis/Src/AnalysisIdeOptionsPanel.cs
  7. 16
      src/AddIns/Misc/CodeAnalysis/Src/FxCopWrapper.cs
  8. 3
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/NRefactoryResolver/NRefactoryResolver.cs
  9. BIN
      src/Main/StartUp/Project/Resources/StringResources.resources

BIN
data/resources/StringResources.nl.resources

Binary file not shown.

2
data/templates/project/CSharp/WebpageProject.xpt

@ -273,7 +273,7 @@ namespace ${StandardNamespace} @@ -273,7 +273,7 @@ namespace ${StandardNamespace}
<html>
<head>
<title>${ClassName}</title>
<title>${ProjectName}</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">

9
src/AddIns/Misc/CodeAnalysis/CodeAnalysis.addin

@ -36,10 +36,17 @@ @@ -36,10 +36,17 @@
<Path name="/SharpDevelop/Pads/ErrorList/CodeAnalysisTaskContextMenu">
<MenuItem id = "Exclude"
label = "Suppress message"
label = "${res:ICSharpCode.CodeAnalysis.SuppressMessage}"
loadclasslazy = "false"
class = "ICSharpCode.CodeAnalysis.SuppressMessageCommand"/>
<MenuItem id = "Separator" type = "Separator"/>
<Include id="default" path="/SharpDevelop/Pads/ErrorList/TaskContextMenu"/>
</Path>
<!-- Options panel -->
<Path name = "/SharpDevelop/Dialogs/OptionsDialog/ToolsOptions">
<DialogPanel id = "CodeAnalysisOptionPanel"
label = "${res:ICSharpCode.CodeAnalysis}"
class = "ICSharpCode.CodeAnalysis.AnalysisIdeOptionsPanel"/>
</Path>
</AddIn>

3
src/AddIns/Misc/CodeAnalysis/CodeAnalysis.csproj

@ -64,6 +64,8 @@ @@ -64,6 +64,8 @@
<Compile Include="Src\CheckCurrentProjectCommand.cs" />
<Compile Include="Src\FxCopLogger.cs" />
<Compile Include="Src\SuppressMessageCommand.cs" />
<Compile Include="Src\AnalysisIdeOptionsPanel.cs" />
<EmbeddedResource Include="Resources\AnalysisIdeOptionPanel.xfrm" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj">
@ -89,6 +91,7 @@ @@ -89,6 +91,7 @@
<Name>ICSharpCode.SharpDevelop.Dom</Name>
<Private>False</Private>
</ProjectReference>
<Folder Include="Resources" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>

35
src/AddIns/Misc/CodeAnalysis/Resources/AnalysisIdeOptionPanel.xfrm

@ -0,0 +1,35 @@ @@ -0,0 +1,35 @@
<Components version="1.0">
<System.Windows.Forms.UserControl>
<Name value="AnalysisIdeOptionPanel" />
<ClientSize value="{Width=348, Height=301}" />
<Controls>
<System.Windows.Forms.GroupBox>
<Name value="groupBox1" />
<Location value="3, 3" />
<Text value="${res:ICSharpCode.CodeAnalysis.IdeOptions.FxCopPath}" />
<Anchor value="Top, Left, Right" />
<Size value="342, 117" />
<TabIndex value="0" />
<Controls>
<System.Windows.Forms.Button>
<Name value="findFxCopPathButton" />
<Location value="92, 81" />
<Text value="${res:ICSharpCode.CodeAnalysis.IdeOptions.FindFxCopPath}" />
<Anchor value="Top" />
<UseVisualStyleBackColor value="True" />
<Size value="150, 23" />
<TabIndex value="1" />
</System.Windows.Forms.Button>
<System.Windows.Forms.Label>
<Name value="statusLabel" />
<Location value="6, 17" />
<Text value="(showing current FxCop path)" />
<Anchor value="Top, Left, Right" />
<Size value="330, 61" />
<TabIndex value="0" />
</System.Windows.Forms.Label>
</Controls>
</System.Windows.Forms.GroupBox>
</Controls>
</System.Windows.Forms.UserControl>
</Components>

68
src/AddIns/Misc/CodeAnalysis/Src/AnalysisIdeOptionsPanel.cs

@ -0,0 +1,68 @@ @@ -0,0 +1,68 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
// <version>$Revision$</version>
// </file>
using System;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.CodeAnalysis
{
/// <summary>
/// Option panel to choose the FxCop path from.
/// </summary>
public class AnalysisIdeOptionsPanel : AbstractOptionPanel
{
public override void LoadPanelContents()
{
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("ICSharpCode.CodeAnalysis.Resources.AnalysisIdeOptionPanel.xfrm"));
ShowStatus();
Get<Button>("findFxCopPath").Click += FindFxCopPathClick;
}
void ShowStatus()
{
string path = FxCopWrapper.FindFxCopPath();
if (path == null) {
Get<Label>("status").Text = StringParser.Parse("${res:ICSharpCode.CodeAnalysis.IdeOptions.FxCopNotFound}");
} else {
Get<Label>("status").Text = StringParser.Parse("${res:ICSharpCode.CodeAnalysis.IdeOptions.FxCopFoundInPath}")
+ Environment.NewLine + path;
}
}
void FindFxCopPathClick(object sender, EventArgs e)
{
using (OpenFileDialog dlg = new OpenFileDialog()) {
dlg.DefaultExt = "exe";
dlg.Filter = StringParser.Parse("FxCop|fxcop.exe|${res:SharpDevelop.FileFilter.AllFiles}|*.*");
if (dlg.ShowDialog() == DialogResult.OK) {
string path = Path.GetDirectoryName(dlg.FileName);
if (FxCopWrapper.IsFxCopPath(path)) {
FxCopPath = path;
} else {
MessageService.ShowError("${res:ICSharpCode.CodeAnalysis.IdeOptions.DirectoryDoesNotContainFxCop}");
}
}
}
ShowStatus();
}
public static string FxCopPath {
get {
return PropertyService.Get("CodeAnalysis.FxCopPath");
}
set {
PropertyService.Set("CodeAnalysis.FxCopPath", value);
}
}
}
}

16
src/AddIns/Misc/CodeAnalysis/Src/FxCopWrapper.cs

@ -74,19 +74,27 @@ namespace ICSharpCode.CodeAnalysis @@ -74,19 +74,27 @@ namespace ICSharpCode.CodeAnalysis
}
}
public static bool IsFxCopPath(string fxCopPath)
{
if (string.IsNullOrEmpty(fxCopPath))
return false;
else
return File.Exists(Path.Combine(fxCopPath, "FxCopCommon.dll"));
}
public static string FindFxCopPath()
{
string fxCopPath = PropertyService.Get("CodeAnalysis.FxCopPath");
if (fxCopPath.Length > 0 && File.Exists(Path.Combine(fxCopPath, "FxCopCommon.dll"))) {
string fxCopPath = AnalysisIdeOptionsPanel.FxCopPath;
if (IsFxCopPath(fxCopPath)) {
return fxCopPath;
}
// Code duplication: FxCop.cs in ICSharpCode.Build.Tasks
fxCopPath = FromRegistry(Registry.CurrentUser.OpenSubKey(@"Software\Classes\FxCopProject\Shell\Open\Command"));
if (fxCopPath.Length > 0 && File.Exists(Path.Combine(fxCopPath, "FxCopCommon.dll"))) {
if (IsFxCopPath(fxCopPath)) {
return fxCopPath;
}
fxCopPath = FromRegistry(Registry.ClassesRoot.OpenSubKey(@"FxCopProject\Shell\Open\Command"));
if (fxCopPath.Length > 0 && File.Exists(Path.Combine(fxCopPath, "FxCopCommon.dll"))) {
if (IsFxCopPath(fxCopPath)) {
return fxCopPath;
}
return null;

3
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/NRefactoryResolver/NRefactoryResolver.cs

@ -153,6 +153,9 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver @@ -153,6 +153,9 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
if (cu != null) {
callingClass = cu.GetInnermostClass(caretLine, caretColumn);
if (cu.ProjectContent != null) {
this.ProjectContent = cu.ProjectContent;
}
}
callingMember = GetCurrentMember();
return true;

BIN
src/Main/StartUp/Project/Resources/StringResources.resources

Binary file not shown.
Loading…
Cancel
Save