Browse Source

Extensions shared code moved to GitPluginShared assembly

pull/3331/head
Arkadiy Shapkin 9 years ago
parent
commit
ef226f9afb
  1. 2
      CommonAssemblyInfo.cs
  2. 16
      GitExtensions.VS2015.sln
  3. 27
      GitExtensionsVSIX/GitExtCommands.cs
  4. 12
      GitExtensionsVSIX/GitExtensionsVSIX.csproj
  5. 2
      GitExtensionsVSIX/source.extension.vsixmanifest
  6. 3
      GitPlugin/Connect.cs
  7. 49
      GitPlugin/GitPlugin.csproj
  8. 395
      GitPlugin/Plugin.cs
  9. 2
      GitPlugin/Properties/Resources.Designer.cs
  10. 2
      GitPluginShared/Commands/About.cs
  11. 2
      GitPluginShared/Commands/ApplyPatch.cs
  12. 2
      GitPluginShared/Commands/Browse.cs
  13. 2
      GitPluginShared/Commands/Cherry.cs
  14. 2
      GitPluginShared/Commands/Clone.cs
  15. 4
      GitPluginShared/Commands/CommandBase.cs
  16. 6
      GitPluginShared/Commands/Commit.cs
  17. 2
      GitPluginShared/Commands/CreateBranch.cs
  18. 2
      GitPluginShared/Commands/FileHistory.cs
  19. 4
      GitPluginShared/Commands/FindFile.cs
  20. 2
      GitPluginShared/Commands/FormatPatch.cs
  21. 2
      GitPluginShared/Commands/GitBash.cs
  22. 2
      GitPluginShared/Commands/GitIgnore.cs
  23. 2
      GitPluginShared/Commands/Init.cs
  24. 2
      GitPluginShared/Commands/ItemCommandBase.cs
  25. 2
      GitPluginShared/Commands/Merge.cs
  26. 2
      GitPluginShared/Commands/OpenWithDifftool.cs
  27. 2
      GitPluginShared/Commands/Pull.cs
  28. 2
      GitPluginShared/Commands/Push.cs
  29. 2
      GitPluginShared/Commands/Rebase.cs
  30. 2
      GitPluginShared/Commands/Remotes.cs
  31. 2
      GitPluginShared/Commands/Revert.cs
  32. 2
      GitPluginShared/Commands/Settings.cs
  33. 2
      GitPluginShared/Commands/SolveMergeConflicts.cs
  34. 2
      GitPluginShared/Commands/Stash.cs
  35. 2
      GitPluginShared/Commands/SwitchBranch.cs
  36. 4
      GitPluginShared/Commands/ToolbarCommand.cs
  37. 2
      GitPluginShared/Commands/ViewChanges.cs
  38. 4
      GitPluginShared/Git/GitCommands.cs
  39. 137
      GitPluginShared/GitPluginShared.csproj
  40. 84
      GitPluginShared/PluginHelpers.cs
  41. 5
      GitPluginShared/Properties/AssemblyInfo.cs
  42. 6
      Setup/Product.wxs

2
CommonAssemblyInfo.cs

@ -8,7 +8,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("GitExtensions")]
[assembly: AssemblyProduct("GitExtensions")]
[assembly: AssemblyCopyright("Copyright © 2008-2014 Henk Westhuis")]
[assembly: AssemblyCopyright("Copyright © 2008-2016 GitExt Team")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

16
GitExtensions.VS2015.sln

@ -119,6 +119,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "VS", "VS", "{D3E0C080-5AC9-
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitExtensionsVSIX", "GitExtensionsVSIX\GitExtensionsVSIX.csproj", "{F01BB9F8-40F5-4D19-A8C1-9ED8E30107B6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitPluginShared", "GitPluginShared\GitPluginShared.csproj", "{C0A7B025-B7EE-477A-BAC7-A6365E7BD893}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -528,8 +530,21 @@ Global
{F01BB9F8-40F5-4D19-A8C1-9ED8E30107B6}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{F01BB9F8-40F5-4D19-A8C1-9ED8E30107B6}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{F01BB9F8-40F5-4D19-A8C1-9ED8E30107B6}.ReleaseTC|Any CPU.ActiveCfg = Release|Any CPU
{F01BB9F8-40F5-4D19-A8C1-9ED8E30107B6}.ReleaseTC|Any CPU.Build.0 = Release|Any CPU
{F01BB9F8-40F5-4D19-A8C1-9ED8E30107B6}.ReleaseTC|Mixed Platforms.ActiveCfg = Release|Any CPU
{F01BB9F8-40F5-4D19-A8C1-9ED8E30107B6}.ReleaseTC|Mixed Platforms.Build.0 = Release|Any CPU
{C0A7B025-B7EE-477A-BAC7-A6365E7BD893}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C0A7B025-B7EE-477A-BAC7-A6365E7BD893}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C0A7B025-B7EE-477A-BAC7-A6365E7BD893}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{C0A7B025-B7EE-477A-BAC7-A6365E7BD893}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{C0A7B025-B7EE-477A-BAC7-A6365E7BD893}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C0A7B025-B7EE-477A-BAC7-A6365E7BD893}.Release|Any CPU.Build.0 = Release|Any CPU
{C0A7B025-B7EE-477A-BAC7-A6365E7BD893}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{C0A7B025-B7EE-477A-BAC7-A6365E7BD893}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{C0A7B025-B7EE-477A-BAC7-A6365E7BD893}.ReleaseTC|Any CPU.ActiveCfg = Release|Any CPU
{C0A7B025-B7EE-477A-BAC7-A6365E7BD893}.ReleaseTC|Any CPU.Build.0 = Release|Any CPU
{C0A7B025-B7EE-477A-BAC7-A6365E7BD893}.ReleaseTC|Mixed Platforms.ActiveCfg = Release|Any CPU
{C0A7B025-B7EE-477A-BAC7-A6365E7BD893}.ReleaseTC|Mixed Platforms.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -561,5 +576,6 @@ Global
{699CE23D-8BBD-4C15-82E9-7A628ACCA4C6} = {F1B97F5D-CA42-4280-94A1-CE412BEA20DF}
{101D3C78-27CC-446A-98EC-E2DE88BF0641} = {F1B97F5D-CA42-4280-94A1-CE412BEA20DF}
{F01BB9F8-40F5-4D19-A8C1-9ED8E30107B6} = {D3E0C080-5AC9-45DD-91A5-4933956C3560}
{C0A7B025-B7EE-477A-BAC7-A6365E7BD893} = {D3E0C080-5AC9-45DD-91A5-4933956C3560}
EndGlobalSection
EndGlobal

27
GitExtensionsVSIX/GitExtCommands.cs

@ -5,7 +5,8 @@ using System.ComponentModel.Design;
using EnvDTE;
using EnvDTE80;
using GitPlugin.Commands;
using GitPluginShared;
using GitPluginShared.Commands;
using Microsoft.VisualStudio.Shell;
@ -114,7 +115,7 @@ namespace GitExtensionsVSIX
public OutputWindowPane OutputPane
{
get { return _outputPane ?? (_outputPane = AquireOutputPane(_application, Vsix.Name)); }
get { return _outputPane ?? (_outputPane = PluginHelpers.AquireOutputPane(_application, Vsix.Name)); }
}
/// <summary>
@ -141,27 +142,5 @@ namespace GitExtensionsVSIX
return;
command.OnCommand(_application, OutputPane);
}
private static OutputWindowPane AquireOutputPane(DTE2 app, string name)
{
try
{
if (name == "")
return null;
OutputWindowPane result = Plugin.FindOutputPane(app, name);
if (result != null)
return result;
var outputWindow = (OutputWindow)app.Windows.Item(Constants.vsWindowKindOutput).Object;
OutputWindowPanes panes = outputWindow.OutputWindowPanes;
return panes.Add(name);
}
catch (Exception)
{
//ignore!!
return null;
}
}
}
}

12
GitExtensionsVSIX/GitExtensionsVSIX.csproj

@ -172,12 +172,6 @@
<Reference Include="System.Windows.Forms" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GitPlugin\GitPlugin.csproj">
<Project>{e996be2d-b07d-472d-9d74-3ea2d48ef269}</Project>
<Name>GitPlugin</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="source.extension.resx">
<AutoGen>True</AutoGen>
@ -187,6 +181,12 @@
<ManifestResourceName>VSPackage</ManifestResourceName>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GitPluginShared\GitPluginShared.csproj">
<Project>{c0a7b025-b7ee-477a-bac7-a6365e7bd893}</Project>
<Name>GitPluginShared</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Condition="Exists($(VsSdkTargets))" Project="$(VsSdkTargets)" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

2
GitExtensionsVSIX/source.extension.vsixmanifest

@ -17,7 +17,7 @@
</Installation>
<Dependencies>
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="4.5" />
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="4.0" />
<Dependency Id="Microsoft.VisualStudio.MPF.14.0" DisplayName="Visual Studio MPF 14.0" d:Source="Installed" Version="[14.0,15.0)" />
</Dependencies>

3
GitPlugin/Connect.cs

@ -5,7 +5,8 @@ using System.Resources;
using EnvDTE;
using EnvDTE80;
using Extensibility;
using GitPlugin.Commands;
using GitPluginShared;
using GitPluginShared.Commands;
using Microsoft.VisualStudio.CommandBars;
using Thread = System.Threading.Thread;

49
GitPlugin/GitPlugin.csproj

@ -72,37 +72,6 @@
<Compile Include="..\CommonAssemblyInfo.cs">
<Link>Properties\CommonAssemblyInfo.cs</Link>
</Compile>
<Compile Include="Commands\FindFile.cs" />
<Compile Include="Commands\OpenWithDifftool.cs" />
<Compile Include="Commands\ViewChanges.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Git\GitCommands.cs" />
<Compile Include="Commands\About.cs" />
<Compile Include="Commands\ApplyPatch.cs" />
<Compile Include="Commands\Browse.cs" />
<Compile Include="Commands\Cherry.cs" />
<Compile Include="Commands\Clone.cs" />
<Compile Include="Commands\CommandBase.cs" />
<Compile Include="Commands\Commit.cs" />
<Compile Include="Commands\CreateBranch.cs" />
<Compile Include="Commands\FileHistory.cs" />
<Compile Include="Commands\FormatPatch.cs" />
<Compile Include="Commands\GitBash.cs" />
<Compile Include="Commands\GitIgnore.cs" />
<Compile Include="Commands\Init.cs" />
<Compile Include="Commands\ItemCommandBase.cs" />
<Compile Include="Commands\Merge.cs" />
<Compile Include="Commands\Pull.cs" />
<Compile Include="Commands\Push.cs" />
<Compile Include="Commands\Rebase.cs" />
<Compile Include="Commands\Remotes.cs" />
<Compile Include="Commands\Revert.cs" />
<Compile Include="Commands\Settings.cs" />
<Compile Include="Commands\SolveMergeConflicts.cs" />
<Compile Include="Commands\Stash.cs" />
<Compile Include="Commands\SwitchBranch.cs" />
<Compile Include="Commands\ToolbarCommand.cs" />
<Compile Include="Connect.cs">
<SubType>Code</SubType>
</Compile>
@ -229,15 +198,21 @@
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GitPluginShared\GitPluginShared.csproj">
<Project>{c0a7b025-b7ee-477a-bac7-a6365e7bd893}</Project>
<Name>GitPluginShared</Name>
</ProjectReference>
</ItemGroup>
<Import Project="..\FxCop.targets" />
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
<Target Name="AfterBuild">
<MakeDir Directories="$(TargetDir)en-US" />
<Message Text="Custom Step: Calling Resource Generator on $(ProjectDir)Properties\Resources.resx." />
<GenerateResource Sources="$(ProjectDir)Properties\Resources.resx" UseSourcePath="True" />
<Message Text="Custom Step: Calling AssemblyLinker to make an assembly at $(TargetDir)en-US\GitPlugin.resources.dll out of $(ProjectDir)Properties\Resources.resources." />
<AL EmbedResources="$(ProjectDir)Properties\Resources.resources" Culture="en-US" OutputAssembly="$(TargetDir)en-US\GitPlugin.resources.dll" />
<Message Text="Done with the Custom Step." />
<MakeDir Directories="$(TargetDir)en-US" />
<Message Text="Custom Step: Calling Resource Generator on $(ProjectDir)Properties\Resources.resx." />
<GenerateResource Sources="$(ProjectDir)Properties\Resources.resx" UseSourcePath="True" />
<Message Text="Custom Step: Calling AssemblyLinker to make an assembly at $(TargetDir)en-US\GitPlugin.resources.dll out of $(ProjectDir)Properties\Resources.resources." />
<AL EmbedResources="$(ProjectDir)Properties\Resources.resources" Culture="en-US" OutputAssembly="$(TargetDir)en-US\GitPlugin.resources.dll" />
<Message Text="Done with the Custom Step." />
</Target>
<ProjectExtensions>
<VisualStudio>

395
GitPlugin/Plugin.cs

@ -5,11 +5,15 @@ using System.Linq;
using EnvDTE;
using EnvDTE80;
using Microsoft.VisualStudio.CommandBars;
using GitPluginShared;
using GitPluginShared.Commands;
namespace GitPlugin.Commands
namespace GitPlugin
{
// Wrapper class around registering other classes to handle the actual commands.
// Interfaces with visual studio and handles the dispatch.
/// <summary>
/// Wrapper class around registering other classes to handle the actual commands.
/// Interfaces with visual studio and handles the dispatch.
/// </summary>
public class Plugin
{
private const string GitCommandBarName = "GitExtensions";
@ -36,7 +40,7 @@ namespace GitPlugin.Commands
_application = application;
_addIn = addIn;
_outputPane = AquireOutputPane(application, panelName);
_outputPane = PluginHelpers.AquireOutputPane(application, panelName);
}
public OutputWindowPane OutputPane
@ -157,26 +161,7 @@ namespace GitPlugin.Commands
if (!AllowCaptionUpdate)
return false;
try
{
var cmdBars = (CommandBars)application.CommandBars;
CommandBar commandBar = cmdBars[commandBarName];
var cbcc = commandBar.Controls.Cast<CommandBarButton>().ToArray();
foreach (var control in cbcc)
{
if (control.TooltipText.Trim().Equals(tooltipText.Trim(), StringComparison.CurrentCultureIgnoreCase))
{
control.Caption = caption;
control.Style = MsoButtonStyle.msoButtonIconAndCaption;
}
}
return true;
}
catch (Exception)
{
//ignore!
return false;
}
return GitPluginShared.PluginHelpers.ChangeCommandCaption(application, commandBarName, tooltipText, caption);
}
public void DeleteGitExtCommandBar()
@ -472,367 +457,5 @@ namespace GitPlugin.Commands
}
return command;
}
/*
The toolbar name should be one of the following:
MenuBar
Standard
Build
XML Data
XML Schema
Context Menus
Dialog Editor
Image Editor
Text Editor
Source Control
Formatting
HTML Source Editing
Style Sheet
Device
Layout
Microsoft XML Editor
Class Designer Toolbar
Help
Debug Location
Debug
Recorder
Report Formatting
Report Borders
Data Design
Query Designer
View Designer
Database Diagram
Table Designer
Project Node
A&dd
Cab Project Node
A&dd
File nodes
Dep. file nodes
Assembly nodes
Dep. assembly nodes
MSM nodes
Dep. MSM nodes
Output nodes
Simple file nodes
Simple output nodes
Dependency node
Multiple selections
Dep. Multiple selections
View
Editor
Error List
Docked Window
Menu Designer
Properties Window
Toolbox
Task List
Results List
Stub Project
No Commands Available
Command Window
AutoHidden Windows
Expansion Manager
Find Regular Expression Builder
Replace Regular Expression Builder
Wild Card Expression Builder
Wild Card Expression Builder
External Tools Arguments
External Tools Directories
Easy MDI Tool Window
Easy MDI Document Window
Easy MDI Dragging
Open Drop Down
Object Browser Objects Pane
Object Browser Members Pane
Object Browser Description Pane
Find Symbol
Drag and Drop
Bookmark Window
Error Correction
EzMDI Files
Ca&ll Browser
Preview Changes
Smart Tag
Smart Tag
Editor Context Menus
Class View Context Menus
Debugger Context Menus
Project and Solution Context Menus
Other Context Menus
Sort By
Show Columns
Implement Interface
Resolve
Resolve
Refactor
Organize File
Class View Project
Class View Item
Class View Folder
Class View Grouping Folder
Class View Multi-select
Class View Multi-select members
Class View Member
Class View Grouping Members
Class View Project References Folder
Class View Project Reference
Project
Solution Folder
Cross Project Solution Project
Cross Project Solution Item
Cross Project Project Item
Cross Project Multi Project
Cross Project Multi Item
Cross Project Multi Solution Folder
Cross Project Multi Project/Folder
Item
Folder
Reference Root
Reference Item
Web Reference Folder
App Designer Folder
Web Project Folder
Web Folder
Web Item
Web SubWeb
Misc Files Project
Solution
Code Window
Registry
File System
File System
File Types
User Interface
Launch Conditions
Custom Actions
New
Add
Add Special Folder
View
Resource View
Resource Editors
Binary Editor
Propertysheet
Configuration
Project
Multi-Select
System Propertysheet
Checkin Dialog Context Menu
Pending Checkin Window Context Menu
Standard TreeGrid context menu
GetVersion Dialog Context Menu
Check Out Dialog Context Menu
Context
Basic Context
Context
Context
Context
Context
Context
Context
HTML Context
Script Context
Context
ASPX Context
ASPX Code Context
ASPX VB Code Context
ASMX Code Context
ASMX VB Code Context
ASMX Context
CSSDocOutline
CSSSource
Project Node
A&dd
Cab Project Node
A&dd
File nodes
Dep. file nodes
Assembly nodes
Dep. assembly nodes
MSM nodes
Dep. MSM nodes
Output nodes
Dependency node
Multiple selections
Dep. Multiple selections
View
Registry
File System
File System
New
Add
Add Special Folder
View
Selection
Container
TraySelection
Document Outline
Component Tray
Exe Project
Debug
OTBObjCtxtMenu
Class Designer Context Menu
Class Diagram Context Menu
TocContext
ResListContext
Editor
Script Outline
DefaultContext
ImageContext
SelectionContext
AnchorContext
Autos Window
Breakpoint
Breakpoints Window
Call Stack Window
Data Tip Window
Disassembly Window
Locals Window
Memory Window
Modules Window
Output Window
Processes Window
Registers Window
Threads Window
Watch Window
Server Explorer
PropertyBrowser
Macro
Module
Project
Root
Control
Report
Row/Column
Cell
Field Chooser
Row/Column
Chart
Database Project
DB Project Connection
DB Project Folder
Database References Folder
Folders
DB Project File
Query
Script
Database Reference Node
Files
Multi-select
Database Connection
Folder Multi-Selection
All Diagrams
All Tables
All Views
All Stored Procedures
All Package Specifications
All Package Bodies
All Synonyms
All Databases
All Users
All Roles
Node Multi-Selection
Diagram
Table
View
Stored Procedure
Function
Synonym
Package Spec
Package Body
Trigger
Column
SQL Editor
All Functions
Oracle Function
Oracle Procedure
Change &View
Single objet
Single static
Homogeneous objects
Mixed objects
Multiple static nodes
Mixed nodes
Add &New
Add &New
Surface
DataSourceContext
DbTableContext
DataTableContext
RelationContext
FunctionContext
ColumnContext
QueryContext
DataAccessorContext
Query Diagram Pane
Query Diagram Table
Query Diagram Table Column
Query Diagram Join Line
Query Diagram Multi-select
Query Grid Pane
Query SQL Pane
Query Results Pane
Database Designer
Database Designer Table
Database Designer Relationship
Text Annotation
Class Details Context Menu
TopicMenu
TopicMenu
Favorites Window Context Menu
Data Sources
Managed Resources Editor Context Menu
Settings Designer
System
*/
private static OutputWindowPane AquireOutputPane(DTE2 app, string name)
{
try
{
if ("" == name)
return null;
OutputWindowPane result = FindOutputPane(app, name);
if (null != result)
return result;
var outputWindow = (OutputWindow)app.Windows.Item(Constants.vsWindowKindOutput).Object;
OutputWindowPanes panes = outputWindow.OutputWindowPanes;
return panes.Add(name);
}
catch (Exception)
{
//ignore!!
return null;
}
}
public static OutputWindowPane FindOutputPane(DTE2 app, string name)
{
try
{
if ("" == name)
return null;
var outputWindow = (OutputWindow)app.Windows.Item(Constants.vsWindowKindOutput).Object;
OutputWindowPanes panes = outputWindow.OutputWindowPanes;
foreach (OutputWindowPane pane in panes)
{
if (name != pane.Name)
continue;
return pane;
}
}
catch (Exception)
{
//ignore!!
}
return null;
}
}
}

2
GitPlugin/Properties/Resources.Designer.cs

@ -8,7 +8,7 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace GitPlugin.Properties
namespace GitPluginShared.Properties
{

2
GitPlugin/Commands/About.cs → GitPluginShared/Commands/About.cs

@ -1,6 +1,6 @@
using EnvDTE;
namespace GitPlugin.Commands
namespace GitPluginShared.Commands
{
public sealed class About : ItemCommandBase
{

2
GitPlugin/Commands/ApplyPatch.cs → GitPluginShared/Commands/ApplyPatch.cs

@ -1,6 +1,6 @@
using EnvDTE;
namespace GitPlugin.Commands
namespace GitPluginShared.Commands
{
public sealed class ApplyPatch : ItemCommandBase
{

2
GitPlugin/Commands/Browse.cs → GitPluginShared/Commands/Browse.cs

@ -1,6 +1,6 @@
using EnvDTE;
namespace GitPlugin.Commands
namespace GitPluginShared.Commands
{
public sealed class Browse : ItemCommandBase
{

2
GitPlugin/Commands/Cherry.cs → GitPluginShared/Commands/Cherry.cs

@ -1,6 +1,6 @@
using EnvDTE;
namespace GitPlugin.Commands
namespace GitPluginShared.Commands
{
public sealed class Cherry : ItemCommandBase
{

2
GitPlugin/Commands/Clone.cs → GitPluginShared/Commands/Clone.cs

@ -2,7 +2,7 @@
using System.Linq;
using EnvDTE;
namespace GitPlugin.Commands
namespace GitPluginShared.Commands
{
public sealed class Clone : ItemCommandBase
{

4
GitPlugin/Commands/CommandBase.cs → GitPluginShared/Commands/CommandBase.cs

@ -1,8 +1,8 @@
using EnvDTE;
using EnvDTE80;
using GitPlugin.Git;
using GitPluginShared.Git;
namespace GitPlugin.Commands
namespace GitPluginShared.Commands
{
public abstract class CommandBase
{

6
GitPlugin/Commands/Commit.cs → GitPluginShared/Commands/Commit.cs

@ -1,8 +1,8 @@
using System;
using EnvDTE;
using GitPlugin.Git;
using GitPluginShared.Git;
namespace GitPlugin.Commands
namespace GitPluginShared.Commands
{
public sealed class Commit : ItemCommandBase
{
@ -49,7 +49,7 @@ namespace GitPlugin.Commands
_lastUpdatedCaption = newCaption;
// try apply new caption (operation can fail)
if (!Plugin.ChangeCommandCaption(application, "GitExtensions", "Commit changes", newCaption))
if (!PluginHelpers.ChangeCommandCaption(application, "GitExtensions", "Commit changes", newCaption))
_lastUpdatedCaption = null;
}

2
GitPlugin/Commands/CreateBranch.cs → GitPluginShared/Commands/CreateBranch.cs

@ -1,6 +1,6 @@
using EnvDTE;
namespace GitPlugin.Commands
namespace GitPluginShared.Commands
{
public sealed class CreateBranch : ItemCommandBase
{

2
GitPlugin/Commands/FileHistory.cs → GitPluginShared/Commands/FileHistory.cs

@ -1,6 +1,6 @@
using EnvDTE;
namespace GitPlugin.Commands
namespace GitPluginShared.Commands
{
public sealed class FileHistory : ItemCommandBase
{

4
GitPlugin/Commands/FindFile.cs → GitPluginShared/Commands/FindFile.cs

@ -1,9 +1,9 @@
using System.Threading;
using EnvDTE;
using EnvDTE80;
using GitPlugin.Git;
using GitPluginShared.Git;
namespace GitPlugin.Commands
namespace GitPluginShared.Commands
{
public sealed class FindFile : ItemCommandBase
{

2
GitPlugin/Commands/FormatPatch.cs → GitPluginShared/Commands/FormatPatch.cs

@ -1,6 +1,6 @@
using EnvDTE;
namespace GitPlugin.Commands
namespace GitPluginShared.Commands
{
public sealed class FormatPatch : ItemCommandBase
{

2
GitPlugin/Commands/GitBash.cs → GitPluginShared/Commands/GitBash.cs

@ -1,6 +1,6 @@
using EnvDTE;
namespace GitPlugin.Commands
namespace GitPluginShared.Commands
{
public sealed class Bash : ItemCommandBase
{

2
GitPlugin/Commands/GitIgnore.cs → GitPluginShared/Commands/GitIgnore.cs

@ -1,6 +1,6 @@
using EnvDTE;
namespace GitPlugin.Commands
namespace GitPluginShared.Commands
{
public sealed class GitIgnore : ItemCommandBase
{

2
GitPlugin/Commands/Init.cs → GitPluginShared/Commands/Init.cs

@ -2,7 +2,7 @@
using System.Linq;
using EnvDTE;
namespace GitPlugin.Commands
namespace GitPluginShared.Commands
{
public sealed class Init : ItemCommandBase
{

2
GitPlugin/Commands/ItemCommandBase.cs → GitPluginShared/Commands/ItemCommandBase.cs

@ -4,7 +4,7 @@ using System.Windows.Forms;
using EnvDTE;
using EnvDTE80;
namespace GitPlugin.Commands
namespace GitPluginShared.Commands
{
/// <summary>
/// An item command is a command associated with selected items in solution explorer.

2
GitPlugin/Commands/Merge.cs → GitPluginShared/Commands/Merge.cs

@ -1,6 +1,6 @@
using EnvDTE;
namespace GitPlugin.Commands
namespace GitPluginShared.Commands
{
public sealed class Merge : ItemCommandBase
{

2
GitPlugin/Commands/OpenWithDifftool.cs → GitPluginShared/Commands/OpenWithDifftool.cs

@ -1,6 +1,6 @@
using EnvDTE;
namespace GitPlugin.Commands
namespace GitPluginShared.Commands
{
public sealed class OpenWithDiftool : ItemCommandBase
{

2
GitPlugin/Commands/Pull.cs → GitPluginShared/Commands/Pull.cs

@ -1,6 +1,6 @@
using EnvDTE;
namespace GitPlugin.Commands
namespace GitPluginShared.Commands
{
public sealed class Pull : ItemCommandBase
{

2
GitPlugin/Commands/Push.cs → GitPluginShared/Commands/Push.cs

@ -1,6 +1,6 @@
using EnvDTE;
namespace GitPlugin.Commands
namespace GitPluginShared.Commands
{
public sealed class Push : ItemCommandBase
{

2
GitPlugin/Commands/Rebase.cs → GitPluginShared/Commands/Rebase.cs

@ -1,6 +1,6 @@
using EnvDTE;
namespace GitPlugin.Commands
namespace GitPluginShared.Commands
{
public sealed class Rebase : ItemCommandBase
{

2
GitPlugin/Commands/Remotes.cs → GitPluginShared/Commands/Remotes.cs

@ -1,6 +1,6 @@
using EnvDTE;
namespace GitPlugin.Commands
namespace GitPluginShared.Commands
{
public sealed class Remotes : ItemCommandBase
{

2
GitPlugin/Commands/Revert.cs → GitPluginShared/Commands/Revert.cs

@ -1,6 +1,6 @@
using EnvDTE;
namespace GitPlugin.Commands
namespace GitPluginShared.Commands
{
public sealed class Revert : ItemCommandBase
{

2
GitPlugin/Commands/Settings.cs → GitPluginShared/Commands/Settings.cs

@ -1,6 +1,6 @@
using EnvDTE;
namespace GitPlugin.Commands
namespace GitPluginShared.Commands
{
public sealed class Settings : ItemCommandBase
{

2
GitPlugin/Commands/SolveMergeConflicts.cs → GitPluginShared/Commands/SolveMergeConflicts.cs

@ -1,6 +1,6 @@
using EnvDTE;
namespace GitPlugin.Commands
namespace GitPluginShared.Commands
{
public sealed class SolveMergeConflicts : ItemCommandBase
{

2
GitPlugin/Commands/Stash.cs → GitPluginShared/Commands/Stash.cs

@ -1,6 +1,6 @@
using EnvDTE;
namespace GitPlugin.Commands
namespace GitPluginShared.Commands
{
public sealed class Stash : ItemCommandBase
{

2
GitPlugin/Commands/SwitchBranch.cs → GitPluginShared/Commands/SwitchBranch.cs

@ -1,6 +1,6 @@
using EnvDTE;
namespace GitPlugin.Commands
namespace GitPluginShared.Commands
{
public sealed class SwitchBranch : ItemCommandBase
{

4
GitPlugin/Commands/ToolbarCommand.cs → GitPluginShared/Commands/ToolbarCommand.cs

@ -3,9 +3,9 @@ using System.IO;
using EnvDTE;
using EnvDTE80;
namespace GitPlugin.Commands
namespace GitPluginShared.Commands
{
class ToolbarCommand<ItemCommandT> : CommandBase
public class ToolbarCommand<ItemCommandT> : CommandBase
where ItemCommandT : ItemCommandBase, new()
{
public ToolbarCommand(bool runForSelection = false)

2
GitPlugin/Commands/ViewChanges.cs → GitPluginShared/Commands/ViewChanges.cs

@ -1,6 +1,6 @@
using EnvDTE;
namespace GitPlugin.Commands
namespace GitPluginShared.Commands
{
public sealed class ViewChanges : ItemCommandBase
{

4
GitPlugin/Git/GitCommands.cs → GitPluginShared/Git/GitCommands.cs

@ -5,7 +5,7 @@ using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
namespace GitPlugin.Git
namespace GitPluginShared.Git
{
public static class GitCommands
{
@ -136,7 +136,7 @@ namespace GitPlugin.Git
if (exitCode == 1)
head = "no branch";
}
if (!string.IsNullOrEmpty(head))
{
head = head.Replace("ref:", "").Trim().Replace("refs/heads/", string.Empty);

137
GitPluginShared/GitPluginShared.csproj

@ -0,0 +1,137 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{C0A7B025-B7EE-477A-BAC7-A6365E7BD893}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>GitPluginShared</RootNamespace>
<AssemblyName>GitPluginShared</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="Extensibility, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
<COMReference Include="EnvDTE">
<Guid>{80CC9F66-E7D8-4DDD-85B6-D9E6CD0E93E2}</Guid>
<VersionMajor>8</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
</COMReference>
<COMReference Include="EnvDTE100">
<Guid>{26AD1324-4B7C-44BC-84F8-B86AED45729F}</Guid>
<VersionMajor>10</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
<COMReference Include="EnvDTE80">
<Guid>{1A31287A-4D7D-413E-8E32-3B374931BD89}</Guid>
<VersionMajor>8</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
</COMReference>
<COMReference Include="EnvDTE90">
<Guid>{2CE2370E-D744-4936-A090-3FFFE667B0E1}</Guid>
<VersionMajor>9</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
</COMReference>
<COMReference Include="Microsoft.VisualStudio.CommandBars">
<Guid>{1CBA492E-7263-47BB-87FE-639000619B15}</Guid>
<VersionMajor>8</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
</COMReference>
<COMReference Include="stdole">
<Guid>{00020430-0000-0000-C000-000000000046}</Guid>
<VersionMajor>2</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
</COMReference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\CommonAssemblyInfo.cs">
<Link>Properties\CommonAssemblyInfo.cs</Link>
</Compile>
<Compile Include="Commands\About.cs" />
<Compile Include="Commands\ApplyPatch.cs" />
<Compile Include="Commands\Browse.cs" />
<Compile Include="Commands\Cherry.cs" />
<Compile Include="Commands\Clone.cs" />
<Compile Include="Commands\CommandBase.cs" />
<Compile Include="Commands\Commit.cs" />
<Compile Include="Commands\CreateBranch.cs" />
<Compile Include="Commands\FileHistory.cs" />
<Compile Include="Commands\FindFile.cs" />
<Compile Include="Commands\FormatPatch.cs" />
<Compile Include="Commands\GitBash.cs" />
<Compile Include="Commands\GitIgnore.cs" />
<Compile Include="Commands\Init.cs" />
<Compile Include="Commands\ItemCommandBase.cs" />
<Compile Include="Commands\Merge.cs" />
<Compile Include="Commands\OpenWithDifftool.cs" />
<Compile Include="Commands\Pull.cs" />
<Compile Include="Commands\Push.cs" />
<Compile Include="Commands\Rebase.cs" />
<Compile Include="Commands\Remotes.cs" />
<Compile Include="Commands\Revert.cs" />
<Compile Include="Commands\Settings.cs" />
<Compile Include="Commands\SolveMergeConflicts.cs" />
<Compile Include="Commands\Stash.cs" />
<Compile Include="Commands\SwitchBranch.cs" />
<Compile Include="Commands\ToolbarCommand.cs" />
<Compile Include="Commands\ViewChanges.cs" />
<Compile Include="Git\GitCommands.cs" />
<Compile Include="PluginHelpers.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.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>

84
GitPluginShared/PluginHelpers.cs

@ -0,0 +1,84 @@
// Copyright (C) 2006-2008 Jim Tilander. See COPYING for and README for more details.
using System;
using System.Linq;
using EnvDTE;
using EnvDTE80;
using Microsoft.VisualStudio.CommandBars;
namespace GitPluginShared
{
public static class PluginHelpers
{
public static bool ChangeCommandCaption(DTE2 application, string commandBarName, string tooltipText, string caption)
{
try
{
var cmdBars = (CommandBars)application.CommandBars;
CommandBar commandBar = cmdBars[commandBarName];
var cbcc = commandBar.Controls.Cast<CommandBarButton>().ToArray();
foreach (var control in cbcc)
{
if (control.TooltipText.Trim().Equals(tooltipText.Trim(), StringComparison.CurrentCultureIgnoreCase))
{
control.Caption = caption;
control.Style = MsoButtonStyle.msoButtonIconAndCaption;
}
}
return true;
}
catch (Exception)
{
//ignore!
return false;
}
}
public static OutputWindowPane AquireOutputPane(DTE2 app, string name)
{
try
{
if ("" == name)
return null;
OutputWindowPane result = FindOutputPane(app, name);
if (null != result)
return result;
var outputWindow = (OutputWindow)app.Windows.Item(Constants.vsWindowKindOutput).Object;
OutputWindowPanes panes = outputWindow.OutputWindowPanes;
return panes.Add(name);
}
catch (Exception)
{
//ignore!!
return null;
}
}
public static OutputWindowPane FindOutputPane(DTE2 app, string name)
{
try
{
if ("" == name)
return null;
var outputWindow = (OutputWindow)app.Windows.Item(Constants.vsWindowKindOutput).Object;
OutputWindowPanes panes = outputWindow.OutputWindowPanes;
foreach (OutputWindowPane pane in panes)
{
if (name != pane.Name)
continue;
return pane;
}
}
catch (Exception)
{
//ignore!!
}
return null;
}
}
}

5
GitPluginShared/Properties/AssemblyInfo.cs

@ -0,0 +1,5 @@
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: System.CLSCompliant(false)]
[assembly: InternalsVisibleTo("GitPluginShared")]

6
Setup/Product.wxs

@ -513,6 +513,11 @@
<RemoveFolder Id="VS$(var.VsVersion)_GitPlugin.dll" On="uninstall" />
<RemoveFolder Id="VS$(var.VsVersion)_GitPlugin.dll_Parent" On="uninstall" Directory="VS$(var.VsVersion)" />
</Component>
<Component Id="VS$(var.VsVersion)_GitPluginShared.dll" Guid="*">
<File Id="VS$(var.VsVersion)_GitPluginShared.dll" Source="..\GitPlugin\bin\Release\GitPluginShared.dll" />
<RemoveFolder Id="VS$(var.VsVersion)_GitPluginShared.dll" On="uninstall" />
<RemoveFolder Id="VS$(var.VsVersion)_GitPluginShared.dll_Parent" On="uninstall" Directory="VS$(var.VsVersion)" />
</Component>
<Directory Id="VS$(var.VsVersion)_Addins_enUS" Name="en-US">
<Component Id="VS$(var.VsVersion)_GitPlugin.resources.dll" Guid="*">
<File Id="VS$(var.VsVersion)_GitPlugin.resources.dll" Source="..\GitPlugin\bin\Release\en-US\GitPlugin.resources.dll" />
@ -840,6 +845,7 @@
<Condition Level="2">NOT VS$(var.VsVersion)INSTFOLDER</Condition>
<ComponentRef Id="VS$(var.VsVersion)_GitPlugin.AddIn" />
<ComponentRef Id="VS$(var.VsVersion)_GitPlugin.dll" />
<ComponentRef Id="VS$(var.VsVersion)_GitPluginShared.dll" />
<ComponentRef Id="VS$(var.VsVersion)_GitPlugin.resources.dll" />
</Feature>
<?endforeach ?>

Loading…
Cancel
Save