8 changed files with 245 additions and 1 deletions
@ -0,0 +1,65 @@
@@ -0,0 +1,65 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// 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.
|
||||
|
||||
using System; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop; |
||||
|
||||
namespace ICSharpCode.GitAddIn |
||||
{ |
||||
public static class AddInOptions |
||||
{ |
||||
public static readonly string OptionsProperty = "ICSharpCode.Git.Options"; |
||||
|
||||
static readonly Properties properties; |
||||
|
||||
static AddInOptions() |
||||
{ |
||||
properties = SD.PropertyService.NestedProperties(OptionsProperty); |
||||
} |
||||
|
||||
#region Properties
|
||||
public static bool AutomaticallyAddFiles { |
||||
get { |
||||
return properties.Get("AutomaticallyAddFiles", true); |
||||
} |
||||
set { |
||||
properties.Set("AutomaticallyAddFiles", value); |
||||
} |
||||
} |
||||
|
||||
public static bool AutomaticallyDeleteFiles { |
||||
get { |
||||
return properties.Get("AutomaticallyDeleteFiles", true); |
||||
} |
||||
set { |
||||
properties.Set("AutomaticallyDeleteFiles", value); |
||||
} |
||||
} |
||||
|
||||
public static string PathToGit { |
||||
get { |
||||
return properties.Get("PathToGit", (string)null); |
||||
} |
||||
set { |
||||
properties.Set("PathToGit", value); |
||||
} |
||||
} |
||||
#endregion
|
||||
} |
||||
} |
||||
@ -0,0 +1,35 @@
@@ -0,0 +1,35 @@
|
||||
<gui:OptionPanel x:Class="ICSharpCode.GitAddIn.GitOptionsPanel" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:core="http://icsharpcode.net/sharpdevelop/core" |
||||
xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets" |
||||
xmlns:local="clr-namespace:ICSharpCode.GitAddIn" |
||||
xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
||||
<widgets:StackPanelWithSpacing SpaceBetweenItems="10"> |
||||
<GroupBox Header="{core:Localize AddIns.Git.Options.Title}"> |
||||
<widgets:StackPanelWithSpacing SpaceBetweenItems="10"> |
||||
<CheckBox |
||||
Content="{core:Localize AddIns.Subversion.Options.AutoDelete}" |
||||
IsChecked="{core:OptionBinding local:AddInOptions.AutomaticallyDeleteFiles}" /> |
||||
<CheckBox |
||||
Content="{core:Localize AddIns.Subversion.Options.AutoAdd}" |
||||
IsChecked="{core:OptionBinding local:AddInOptions.AutomaticallyAddFiles}" /> |
||||
</widgets:StackPanelWithSpacing> |
||||
</GroupBox> |
||||
<GroupBox Header="{core:Localize AddIns.Git.Options.GitPath}"> |
||||
<StackPanel> |
||||
<TextBlock Margin="3,5,3,20" x:Name="status" TextAlignment="Center" TextWrapping="Wrap" /> |
||||
<widgets:StackPanelWithSpacing SpaceBetweenItems="10" HorizontalAlignment="Center" Orientation="Horizontal"> |
||||
<Button Content="{core:Localize AddIns.Git.Options.FindGitPath}" |
||||
HorizontalAlignment="Center" |
||||
Click="FindGitPath_Click" |
||||
Style="{x:Static core:GlobalStyles.ButtonStyle}" /> |
||||
<Button Content="{core:Localize AddIns.Git.Options.ResetGitPath}" |
||||
HorizontalAlignment="Center" |
||||
Click="ResetGitPath_Click" |
||||
Style="{x:Static core:GlobalStyles.ButtonStyle}" /> |
||||
</widgets:StackPanelWithSpacing> |
||||
</StackPanel> |
||||
</GroupBox> |
||||
</widgets:StackPanelWithSpacing> |
||||
</gui:OptionPanel> |
||||
@ -0,0 +1,77 @@
@@ -0,0 +1,77 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// 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.
|
||||
|
||||
using System; |
||||
using System.IO; |
||||
using System.Windows; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using Microsoft.Win32; |
||||
|
||||
namespace ICSharpCode.GitAddIn |
||||
{ |
||||
/// <summary>
|
||||
/// Interaction logic for GitOptionsPanel.xaml
|
||||
/// </summary>
|
||||
public partial class GitOptionsPanel : OptionPanel |
||||
{ |
||||
public GitOptionsPanel() |
||||
{ |
||||
InitializeComponent(); |
||||
|
||||
SetGitStatus(); |
||||
} |
||||
|
||||
void SetGitStatus() |
||||
{ |
||||
string path = AddInOptions.PathToGit; |
||||
if (path == null) { |
||||
path = Git.FindGit(); |
||||
if (path == null) { |
||||
path = SD.ResourceService.GetString("AddIns.Git.NoPathFoundStatus"); |
||||
} else { |
||||
path += Environment.NewLine + SD.ResourceService.GetString("AddIns.Git.PathAutoDetectStatus"); |
||||
} |
||||
} |
||||
status.Text = path; |
||||
} |
||||
|
||||
void FindGitPath_Click(object sender, RoutedEventArgs a) |
||||
{ |
||||
OpenFileDialog dlg = new OpenFileDialog(); |
||||
dlg.DefaultExt = "exe"; |
||||
dlg.Filter = StringParser.Parse("Git|git.exe|${res:SharpDevelop.FileFilter.AllFiles}|*.*"); |
||||
if (dlg.ShowDialog() == true) { |
||||
string path = Path.GetDirectoryName(dlg.FileName); |
||||
if (Git.IsGitPath(path)) { |
||||
AddInOptions.PathToGit = Path.Combine(path, "git.exe"); |
||||
} else { |
||||
MessageService.ShowError("${res:AddIns.Git.DirectoryDoesNotContainGit}"); |
||||
} |
||||
} |
||||
SetGitStatus(); |
||||
} |
||||
|
||||
void ResetGitPath_Click(object sender, RoutedEventArgs a) |
||||
{ |
||||
AddInOptions.PathToGit = null; |
||||
SetGitStatus(); |
||||
} |
||||
} |
||||
} |
||||
Loading…
Reference in new issue