Skip to content

Commit

Permalink
first commit V 0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
yysun committed May 26, 2010
0 parents commit 6d80ea7
Show file tree
Hide file tree
Showing 29 changed files with 11,033 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .gitignore
@@ -0,0 +1,29 @@

#ignore thumbnails created by windows
Thumbs.db
#Ignore files build by Visual Studio
*.obj
*.exe
*.pdb
*.user
*.aps
*.pch
*.vspscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.cache
*.ilk
*.log
[Bb]in
[Dd]ebug*/
*.lib
*.sbr
obj/
[Rr]elease*/
_ReSharper*/
[Tt]est[Rr]esult*
217 changes: 217 additions & 0 deletions BasicSccProvider.cs
@@ -0,0 +1,217 @@
using System;
using System.Diagnostics;
using System.Globalization;
using System.Runtime.InteropServices;
using System.ComponentModel.Design;
using Microsoft.Win32;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio.OLE.Interop;
using Microsoft.VisualStudio;

using MsVsShell = Microsoft.VisualStudio.Shell;
using ErrorHandler = Microsoft.VisualStudio.ErrorHandler;

namespace GitScc
{
/////////////////////////////////////////////////////////////////////////////
// BasicSccProvider
[MsVsShell.ProvideLoadKey("Standard", "0.1", "Git Source Control Provider", "Yiyisun@hotmail.com", 15261)]
[MsVsShell.DefaultRegistryRoot("Software\\Microsoft\\VisualStudio\\9.0Exp")]
// Register the package to have information displayed in Help/About dialog box
[MsVsShell.InstalledProductRegistration(false, "#100", "#101", "1.0.0.0", IconResourceID = CommandId.iiconProductIcon)]
// Declare that resources for the package are to be found in the managed assembly resources, and not in a satellite dll
[MsVsShell.PackageRegistration(UseManagedResourcesOnly = true)]
// Register the resource ID of the CTMENU section (generated from compiling the VSCT file), so the IDE will know how to merge this package's menus with the rest of the IDE when "devenv /setup" is run
// The menu resource ID needs to match the ResourceName number defined in the csproj project file in the VSCTCompile section
// Everytime the version number changes VS will automatically update the menus on startup; if the version doesn't change, you will need to run manually "devenv /setup /rootsuffix:Exp" to see VSCT changes reflected in IDE
[MsVsShell.ProvideMenuResource(1000, 1)]
// Register a sample options page visible as Tools/Options/SourceControl/SampleOptionsPage when the provider is active
//[MsVsShell.ProvideOptionPageAttribute(typeof(SccProviderOptions), "Source Control", "Sample Options Page Basic Provider", 106, 107, false)]
//[ProvideToolsOptionsPageVisibility("Source Control", "Sample Options Page Basic Provider", "ADC98052-0000-41D1-A6C3-704E6C1A3DE2")]
// Register a sample tool window visible only when the provider is active
//[MsVsShell.ProvideToolWindow(typeof(SccProviderToolWindow))]
//[MsVsShell.ProvideToolWindowVisibility(typeof(SccProviderToolWindow), "ADC98052-0000-41D1-A6C3-704E6C1A3DE2")]
// Register the source control provider's service (implementing IVsScciProvider interface)
[MsVsShell.ProvideService(typeof(SccProviderService), ServiceName = "Git Source Control Service")]
// Register the source control provider to be visible in Tools/Options/SourceControl/Plugin dropdown selector
[ProvideSourceControlProvider("Git Source Control Provider", "#100")]
// Pre-load the package when the command UI context is asserted (the provider will be automatically loaded after restarting the shell if it was active last time the shell was shutdown)
[MsVsShell.ProvideAutoLoad("C4128D99-0000-41D1-A6C3-704E6C1A3DE2")]
// Declare the package guid
[Guid("C4128D99-2000-41D1-A6C3-704E6C1A3DE2")]
public class BasicSccProvider : MsVsShell.Package
{
private SccProviderService sccService = null;

public BasicSccProvider()
{
Trace.WriteLine(String.Format(CultureInfo.CurrentUICulture, "Entering constructor for: {0}", this.ToString()));
}

/////////////////////////////////////////////////////////////////////////////
// BasicSccProvider Package Implementation
#region Package Members

protected override void Initialize()
{
Trace.WriteLine(String.Format(CultureInfo.CurrentUICulture, "Entering Initialize() of: {0}", this.ToString()));
base.Initialize();

// Proffer the source control service implemented by the provider
sccService = new SccProviderService(this);
((IServiceContainer)this).AddService(typeof(SccProviderService), sccService, true);

// Add our command handlers for menu (commands must exist in the .vsct file)
MsVsShell.OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as MsVsShell.OleMenuCommandService;
if (mcs != null)
{
CommandID cmd = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdSccCommand);
MenuCommand menuCmd = new MenuCommand(new EventHandler(OnSccCommand), cmd);
mcs.AddCommand(menuCmd);

cmd = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdSccCommandCommit);
menuCmd = new MenuCommand(new EventHandler(OnSccCommand), cmd);
mcs.AddCommand(menuCmd);

cmd = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdSccCommandHistory);
menuCmd = new MenuCommand(new EventHandler(OnSccCommand), cmd);
mcs.AddCommand(menuCmd);

cmd = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdSccCommandCompare);
menuCmd = new MenuCommand(new EventHandler(OnSccCommand), cmd);
mcs.AddCommand(menuCmd);

//// ToolWindow Command
//cmd = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdViewToolWindow);
//menuCmd = new MenuCommand(new EventHandler(ViewToolWindow), cmd);
//mcs.AddCommand(menuCmd);

// // ToolWindow's ToolBar Command
// cmd = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdToolWindowToolbarCommand);
// menuCmd = new MenuCommand(new EventHandler(ToolWindowToolbarCommand), cmd);
// mcs.AddCommand(menuCmd);
}

// Register the provider with the source control manager
// If the package is to become active, this will also callback on OnActiveStateChange and the menu commands will be enabled
IVsRegisterScciProvider rscp = (IVsRegisterScciProvider)GetService(typeof(IVsRegisterScciProvider));
rscp.RegisterSourceControlProvider(GuidList.guidSccProvider);
}

protected override void Dispose(bool disposing)
{
Trace.WriteLine(String.Format(CultureInfo.CurrentUICulture, "Entering Dispose() of: {0}", this.ToString()));

base.Dispose(disposing);
}

#endregion

private void OnSccCommand(object sender, EventArgs e)
{
// Toggle the checked state of this command
MenuCommand thisCommand = sender as MenuCommand;
if (thisCommand != null)
{
//thisCommand.Checked = !thisCommand.Checked;

sccService.Refresh();
}
}

/// <summary>
/// The function can be used to bring back the provider's toolwindow if it was previously closed
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
//private void ViewToolWindow(object sender, EventArgs e)
//{
// this.ShowSccProviderToolWindow();
//}

//private void ToolWindowToolbarCommand(object sender, EventArgs e)
//{
// SccProviderToolWindow window = (SccProviderToolWindow)this.FindToolWindow(typeof(SccProviderToolWindow), 0, true);

// if (window != null)
// {
// window.ToolWindowToolbarCommand();
// }
//}

// This function is called by the IVsSccProvider service implementation when the active state of the provider changes
// The package needs to show or hide the scc-specific commands
public virtual void OnActiveStateChange()
{
MsVsShell.OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as MsVsShell.OleMenuCommandService;
if (mcs != null)
{
CommandID cmd = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdSccCommand);
MenuCommand menuCmd = mcs.FindCommand(cmd);
menuCmd.Supported = true;
menuCmd.Enabled = sccService.Active;
menuCmd.Visible = sccService.Active;

cmd = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdSccCommandCommit);
menuCmd = mcs.FindCommand(cmd);
menuCmd.Supported = true;
menuCmd.Enabled = sccService.Active;
menuCmd.Visible = sccService.Active;

cmd = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdSccCommandHistory);
menuCmd = mcs.FindCommand(cmd);
menuCmd.Supported = true;
menuCmd.Enabled = sccService.Active;
menuCmd.Visible = sccService.Active;

cmd = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdSccCommandCompare);
menuCmd = mcs.FindCommand(cmd);
menuCmd.Supported = true;
menuCmd.Enabled = sccService.Active;
menuCmd.Visible = sccService.Active;

// cmd = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdViewToolWindow);
// menuCmd = mcs.FindCommand(cmd);
// menuCmd.Supported = true;
// menuCmd.Enabled = sccService.Active;
// menuCmd.Visible = sccService.Active;

// cmd = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdToolWindowToolbarCommand);
// menuCmd = mcs.FindCommand(cmd);
// menuCmd.Supported = true;
// menuCmd.Enabled = sccService.Active;
// menuCmd.Visible = sccService.Active;
}

//ShowSccProviderToolWindow();
}

private void ShowSccProviderToolWindow()
{
//MsVsShell.ToolWindowPane window = this.FindToolWindow(typeof(SccProviderToolWindow), 0, true);
//IVsWindowFrame windowFrame = null;
//if (window != null && window.Frame != null)
//{
// windowFrame = (IVsWindowFrame)window.Frame;
//}
//if (windowFrame == null)
//{
// throw new InvalidOperationException("No valid window frame object was returned from Toolwindow pane");
//}
//if (sccService.Active)
//{
// ErrorHandler.ThrowOnFailure(windowFrame.Show());
//}
//else
//{
// ErrorHandler.ThrowOnFailure(windowFrame.Hide());
//}
}

public new Object GetService(Type serviceType)
{
return base.GetService(serviceType);
}

}
}
108 changes: 108 additions & 0 deletions BasicSccProvider.csproj
@@ -0,0 +1,108 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{ADECE07A-5D80-4950-9DA5-A681CE2F5106}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>GitScc</RootNamespace>
<AssemblyName>GitSccProvider</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</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="GitSharp, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>lib\GitSharp.dll</HintPath>
</Reference>
<Reference Include="GitSharp.Core, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>lib\GitSharp.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.OLE.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<Reference Include="Microsoft.VisualStudio.Shell.9.0" />
<Reference Include="Microsoft.VisualStudio.Shell.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<Reference Include="Microsoft.VisualStudio.Shell.Interop.8.0, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<Reference Include="Microsoft.VisualStudio.Shell.Interop.9.0, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Design" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Drawing" />
</ItemGroup>
<ItemGroup>
<Compile Include="GitFileStatusTracker.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="BasicSccProvider.cs" />
<Compile Include="CommandId.cs" />
<Compile Include="Guids.cs" />
<Compile Include="ProvideSourceControlProvider.cs" />
<Compile Include="Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="SccProviderService.cs" />
<Compile Include="GitFileStatus.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources.resx">
<SubType>Designer</SubType>
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<MergeWithCTO>true</MergeWithCTO>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Content Include="Resources\Images_24bit.bmp" />
<Content Include="Resources\Images_32bit.bmp" />
<Content Include="Resources\SccGlyphs.bmp" />
<None Include="Resources\Product.ico" />
</ItemGroup>
<ItemGroup>
<VSCTCompile Include="PkgCmd.vsct">
<ResourceName>1000</ResourceName>
</VSCTCompile>
<None Include="ClassDiagram.cd" />
</ItemGroup>
<PropertyGroup>
<!--
To specify a different registry root to register your package, uncomment the TargetRegistryRoot
tag and specify a registry root in it.
<TargetRegistryRoot></TargetRegistryRoot>
-->
<RegisterOutputPackage>true</RegisterOutputPackage>
<RegisterWithCodebase>true</RegisterWithCodebase>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\VSSDK\Microsoft.VsSDK.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
34 changes: 34 additions & 0 deletions BasicSccProvider.sln
@@ -0,0 +1,34 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BasicSccProvider", "BasicSccProvider.csproj", "{ADECE07A-5D80-4950-9DA5-A681CE2F5106}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "lib", "lib", "{A0417584-B3B4-4991-8435-4B86D643322B}"
ProjectSection(SolutionItems) = preProject
lib\DiffieHellman.dll = lib\DiffieHellman.dll
lib\GitSharp.Core.dll = lib\GitSharp.Core.dll
lib\GitSharp.dll = lib\GitSharp.dll
lib\ICSharpCode.SharpZipLib.dll = lib\ICSharpCode.SharpZipLib.dll
lib\Org.Mentalis.Security.dll = lib\Org.Mentalis.Security.dll
lib\Tamir.SharpSSH.dll = lib\Tamir.SharpSSH.dll
lib\Winterdom.IO.FileMap.dll = lib\Winterdom.IO.FileMap.dll
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{ADECE07A-5D80-4950-9DA5-A681CE2F5106}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ADECE07A-5D80-4950-9DA5-A681CE2F5106}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ADECE07A-5D80-4950-9DA5-A681CE2F5106}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ADECE07A-5D80-4950-9DA5-A681CE2F5106}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
DebugSamples90.Connect = 1;Configure Project for VSIP Experimental Environment;ConfigVSIPDebug
EndGlobalSection
EndGlobal

0 comments on commit 6d80ea7

Please sign in to comment.