Skip to content

Commit

Permalink
ReSharper 7.0 support
Browse files Browse the repository at this point in the history
  • Loading branch information
citizenmatt committed Oct 8, 2012
1 parent fa63900 commit 2d07b3d
Show file tree
Hide file tree
Showing 7 changed files with 549 additions and 421 deletions.
147 changes: 76 additions & 71 deletions CleanCode/src/CleanCode/CleanCode.csproj
@@ -1,72 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ReSharperSdkTargets Condition=" '$(ReSharperSdkTargets)' == '' ">$(MSBuildExtensionsPath)\JetBrains\ReSharper.SDK\v6.1</ReSharperSdkTargets>
</PropertyGroup>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{4FF42D42-187D-4332-8154-49506B1DB698}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CleanCode</RootNamespace>
<AssemblyName>CleanCode</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="TooManyDependencies\TooManyDependenciesDaemonStage.cs" />
<Compile Include="TooManyDependencies\TooManyDependenciesDaemonStageProcess.cs" />
<Compile Include="TooManyDependencies\TooManyDependenciesElementProcessor.cs" />
<Compile Include="TooManyDependencies\TooManyDependenciesInvalidateOnMaximumDependenciesChange.cs" />
<Compile Include="TooManyDependencies\TooManyDependenciesHighlighting.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Settings\Stringtable.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Stringtable.resx</DependentUpon>
</Compile>
<Compile Include="Settings\CleanCodeOptionsPage.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Settings\CleanCodeSettings.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Settings\Stringtable.resx">
<SubType>Designer</SubType>
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Stringtable.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Settings\CleanCode.png" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(ReSharperSdkTargets)\Plugin.Targets" />
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ReSharperSdkTargets Condition=" '$(ReSharperSdkTargets)' == '' ">$(MSBuildExtensionsPath)\JetBrains\ReSharper.SDK\v7.0</ReSharperSdkTargets>
</PropertyGroup>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{4FF42D42-187D-4332-8154-49506B1DB698}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CleanCode</RootNamespace>
<AssemblyName>CleanCode</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.XML" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="Settings\ThemedIcons.Settings.Generated.cs" />
<Compile Include="TooManyDependencies\TooManyDependenciesDaemonStage.cs" />
<Compile Include="TooManyDependencies\TooManyDependenciesDaemonStageProcess.cs" />
<Compile Include="TooManyDependencies\TooManyDependenciesElementProcessor.cs" />
<Compile Include="TooManyDependencies\TooManyDependenciesInvalidateOnMaximumDependenciesChange.cs" />
<Compile Include="TooManyDependencies\TooManyDependenciesHighlighting.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Settings\Stringtable.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Stringtable.resx</DependentUpon>
</Compile>
<Compile Include="Settings\CleanCodeOptionsPage.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Settings\CleanCodeSettings.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Settings\Stringtable.resx">
<SubType>Designer</SubType>
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Stringtable.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ThemedIconPng Include="Settings\CleanCode.png" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(ReSharperSdkTargets)\Plugin.Targets" />
<Import Project="$(ReSharperSdkTools)\MSBuild\JetBrains.Build.Platform.ThemedIconsConverter.Targets" />
</Project>
200 changes: 100 additions & 100 deletions CleanCode/src/CleanCode/Settings/CleanCodeOptionsPage.cs
@@ -1,101 +1,101 @@
#region License

// Copyright (C) 2012 Hadi Hariri and Contributors
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated
// documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall
// be included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
// OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
// OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
// OR OTHER DEALINGS IN THE SOFTWARE.

#endregion

using System.Windows.Forms;
using JetBrains.Application.Settings;
using JetBrains.DataFlow;
using JetBrains.ReSharper.Features.Environment.Options.Inspections;
using JetBrains.UI.CommonControls.Fonts;
using JetBrains.UI.Options;
using JetBrains.UI.Options.Helpers;

namespace CleanCode.Settings
{
/// <summary>
/// Implements an options page that holds a set of setting editors stacked in lines from top to bottom.
/// </summary>
[OptionsPage(PID, "Clean Code", "CleanCode.Settings.CleanCode.png",
ParentId = CodeInspectionPage.PID)]
public class CleanCodeOptionsPage : AStackPanelOptionsPage
{
const string PID = "CleanCode";
readonly Lifetime _lifetime;
readonly OptionsSettingsSmartContext _settings;

/// <summary>
/// Creates new instance of CleanCodeOptionsPage
/// </summary>
public CleanCodeOptionsPage(Lifetime lifetime, FontsManager fontsManager,
OptionsSettingsSmartContext settings)
: base(lifetime, fontsManager, PID)
{
_lifetime = lifetime;
_settings = settings;
InitControls();
}

void InitControls()
{
Controls.Spin maximumDependencies; // This variable may be reused if there's more than one spin on the page
Controls.HorzStackPanel stack;

// The upper cue banner, stacked in the first line of our page, docked to full width with word wrapping, as needed
Controls.Add(new Controls.Label(Stringtable.Options_Header));

Controls.Add(new Controls.Label(Stringtable.Options_SubHeader));

// Some spacing
Controls.Add(JetBrains.UI.Options.Helpers.Controls.Separator.DefaultHeight);

// A horizontal stack of a text label and a spin-edit
Controls.Add(stack = new Controls.HorzStackPanel());
stack.Controls.Add(new Controls.Label(Stringtable.Options_LabelMaximumDependenciesCheck));
var maximumDependenciesCheckbox = new Controls.CheckBox();
stack.Controls.Add(maximumDependenciesCheckbox);
stack.Controls.Add(new Controls.Label(Stringtable.Options_LabelTooManyDependencies)); // The first column of the stack
stack.Controls.Add(maximumDependencies = new Controls.Spin());

// Set up the spin we've just added
maximumDependencies.Maximum = new decimal(new[] {20, 0, 0, 0});
maximumDependencies.Minimum = new decimal(new[] {1, 0, 0, 0});
maximumDependencies.Value = new decimal(new[] {1, 0, 0, 0});

_settings.SetBinding(_lifetime, (CleanCodeSettings s) => s.MaximumDependencies,
maximumDependencies.IntegerValue);
_settings.SetBinding(_lifetime, (CleanCodeSettings s) => s.MaximumDependenciesEnabled,
maximumDependenciesCheckbox.Checked);
maximumDependenciesCheckbox.CheckedChanged +=
(sender, args) =>
{ maximumDependencies.Enabled = maximumDependenciesCheckbox.CheckState == CheckState.Checked; };



}
}
#region License

// Copyright (C) 2012 Hadi Hariri and Contributors
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated
// documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall
// be included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
// OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
// OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
// OR OTHER DEALINGS IN THE SOFTWARE.

#endregion

using System.Windows.Forms;
using JetBrains.Application.Settings;
using JetBrains.DataFlow;
using JetBrains.ReSharper.Features.Environment.Options.Inspections;
using JetBrains.UI.CommonControls.Fonts;
using JetBrains.UI.Options;
using JetBrains.UI.Options.Helpers;

namespace CleanCode.Settings
{
/// <summary>
/// Implements an options page that holds a set of setting editors stacked in lines from top to bottom.
/// </summary>
[OptionsPage(PID, "Clean Code", typeof(SettingsThemedIcons.CleanCode),
ParentId = CodeInspectionPage.PID)]
public class CleanCodeOptionsPage : AStackPanelOptionsPage
{
const string PID = "CleanCode";
readonly Lifetime _lifetime;
readonly OptionsSettingsSmartContext _settings;

/// <summary>
/// Creates new instance of CleanCodeOptionsPage
/// </summary>
public CleanCodeOptionsPage(Lifetime lifetime, FontsManager fontsManager,
OptionsSettingsSmartContext settings)
: base(lifetime, fontsManager, PID)
{
_lifetime = lifetime;
_settings = settings;
InitControls();
}

void InitControls()
{
Controls.Spin maximumDependencies; // This variable may be reused if there's more than one spin on the page
Controls.HorzStackPanel stack;

// The upper cue banner, stacked in the first line of our page, docked to full width with word wrapping, as needed
Controls.Add(new Controls.Label(Stringtable.Options_Header));

Controls.Add(new Controls.Label(Stringtable.Options_SubHeader));

// Some spacing
Controls.Add(JetBrains.UI.Options.Helpers.Controls.Separator.DefaultHeight);

// A horizontal stack of a text label and a spin-edit
Controls.Add(stack = new Controls.HorzStackPanel());
stack.Controls.Add(new Controls.Label(Stringtable.Options_LabelMaximumDependenciesCheck));
var maximumDependenciesCheckbox = new Controls.CheckBox();
stack.Controls.Add(maximumDependenciesCheckbox);
stack.Controls.Add(new Controls.Label(Stringtable.Options_LabelTooManyDependencies)); // The first column of the stack
stack.Controls.Add(maximumDependencies = new Controls.Spin());

// Set up the spin we've just added
maximumDependencies.Maximum = new decimal(new[] {20, 0, 0, 0});
maximumDependencies.Minimum = new decimal(new[] {1, 0, 0, 0});
maximumDependencies.Value = new decimal(new[] {1, 0, 0, 0});

_settings.SetBinding(_lifetime, (CleanCodeSettings s) => s.MaximumDependencies,
maximumDependencies.IntegerValue);
_settings.SetBinding(_lifetime, (CleanCodeSettings s) => s.MaximumDependenciesEnabled,
maximumDependenciesCheckbox.Checked);
maximumDependenciesCheckbox.CheckedChanged +=
(sender, args) =>
{ maximumDependencies.Enabled = maximumDependenciesCheckbox.CheckState == CheckState.Checked; };



}
}
}

0 comments on commit 2d07b3d

Please sign in to comment.