From 57e0fd209e97302445830ff09657610f602f9ce1 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Sat, 4 Mar 2006 21:33:49 +0000 Subject: [PATCH] SubversionAddIn now shows commands in the project pad context menu; TortoiseSvn is used to display the dialogs. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1198 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Project/ICSharpCode.Svn.addin | 169 +++++++++-- .../Project/Resources/CommitDialog.xfrm | 51 ---- .../Project/Resources/ExportDialog.xfrm | 146 --------- .../Resources/TortoiseSvnNotFoundForm.xfrm | 46 +++ .../Project/Src/Commands/AutostartCommands.cs | 3 +- .../Src/Commands/Checkout/CheckoutCommand.cs | 52 ---- .../Src/Commands/Checkout/CheckoutDialog.cs | 36 --- .../Project/Src/Commands/CheckoutCommands.cs | 28 ++ .../Src/Commands/Commit/CommitCommand.cs | 45 --- .../Src/Commands/Commit/CommitDialog.cs | 41 --- .../Src/Commands/Export/ExportCommand.cs | 62 ---- .../Src/Commands/Export/ExportDialog.cs | 137 --------- .../Src/Commands/ProjectBrowserCommands.cs | 284 ++++++++++++++---- .../OverlayIconManager.cs | 7 +- .../SvnProjectBrowserVisitor.cs | 15 +- .../Project/Src/Gui/SvnGuiWrapper.cs | 227 ++++++++++++++ .../Src/Gui/TortoiseSvnNotFoundForm.cs | 33 ++ .../Project/Src/SubversionStateCondition.cs | 121 ++++++++ .../Project/SubversionAddIn.csproj | 19 +- 19 files changed, 829 insertions(+), 693 deletions(-) delete mode 100644 src/AddIns/Misc/SubversionAddIn/Project/Resources/CommitDialog.xfrm delete mode 100644 src/AddIns/Misc/SubversionAddIn/Project/Resources/ExportDialog.xfrm create mode 100644 src/AddIns/Misc/SubversionAddIn/Project/Resources/TortoiseSvnNotFoundForm.xfrm delete mode 100644 src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Checkout/CheckoutCommand.cs delete mode 100644 src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Checkout/CheckoutDialog.cs create mode 100644 src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/CheckoutCommands.cs delete mode 100644 src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Commit/CommitCommand.cs delete mode 100644 src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Commit/CommitDialog.cs delete mode 100644 src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Export/ExportCommand.cs delete mode 100644 src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Export/ExportDialog.cs create mode 100644 src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/SvnGuiWrapper.cs create mode 100644 src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/TortoiseSvnNotFoundForm.cs create mode 100644 src/AddIns/Misc/SubversionAddIn/Project/Src/SubversionStateCondition.cs diff --git a/src/AddIns/Misc/SubversionAddIn/Project/ICSharpCode.Svn.addin b/src/AddIns/Misc/SubversionAddIn/Project/ICSharpCode.Svn.addin index 94297dfd2c..baacf4bf6a 100644 --- a/src/AddIns/Misc/SubversionAddIn/Project/ICSharpCode.Svn.addin +++ b/src/AddIns/Misc/SubversionAddIn/Project/ICSharpCode.Svn.addin @@ -11,7 +11,10 @@ - + + + + @@ -27,24 +30,134 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -72,18 +185,16 @@ + insertbefore = "LastSeparator" + type="Menu"> + label = "Export" + icon = "Svn.Export" + class = "ICSharpCode.Svn.Commands.ExportCommand"/> + label = "Checkout" + icon = "Svn.Checkout" + class = "ICSharpCode.Svn.Commands.CheckoutCommand"/> - - diff --git a/src/AddIns/Misc/SubversionAddIn/Project/Resources/CommitDialog.xfrm b/src/AddIns/Misc/SubversionAddIn/Project/Resources/CommitDialog.xfrm deleted file mode 100644 index 61e69d6338..0000000000 --- a/src/AddIns/Misc/SubversionAddIn/Project/Resources/CommitDialog.xfrm +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/AddIns/Misc/SubversionAddIn/Project/Resources/ExportDialog.xfrm b/src/AddIns/Misc/SubversionAddIn/Project/Resources/ExportDialog.xfrm deleted file mode 100644 index 3adbbdd661..0000000000 --- a/src/AddIns/Misc/SubversionAddIn/Project/Resources/ExportDialog.xfrm +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/AddIns/Misc/SubversionAddIn/Project/Resources/TortoiseSvnNotFoundForm.xfrm b/src/AddIns/Misc/SubversionAddIn/Project/Resources/TortoiseSvnNotFoundForm.xfrm new file mode 100644 index 0000000000..ec10f990f2 --- /dev/null +++ b/src/AddIns/Misc/SubversionAddIn/Project/Resources/TortoiseSvnNotFoundForm.xfrm @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/AutostartCommands.cs b/src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/AutostartCommands.cs index 52e4bbd348..be41381cfa 100644 --- a/src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/AutostartCommands.cs +++ b/src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/AutostartCommands.cs @@ -48,7 +48,7 @@ namespace ICSharpCode.Svn.Commands node.AcceptVisitor(visitor, null); } - bool CanBeVersionControlled(string fileName) + internal static bool CanBeVersionControlled(string fileName) { string svnDir = Path.Combine(Path.GetDirectoryName(fileName), ".svn"); return Directory.Exists(svnDir); @@ -63,6 +63,7 @@ namespace ICSharpCode.Svn.Commands FileNode node = pad.ProjectBrowserControl.FindFileNode(fileName); if (node == null) return; OverlayIconManager.Enqueue(node); + SubversionStateCondition.ResetCache(); } void FileAdded(object sender, FileEventArgs e) diff --git a/src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Checkout/CheckoutCommand.cs b/src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Checkout/CheckoutCommand.cs deleted file mode 100644 index 265ccb6e9e..0000000000 --- a/src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Checkout/CheckoutCommand.cs +++ /dev/null @@ -1,52 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Threading; -using System.Windows.Forms; - -using ICSharpCode.Core; -using ICSharpCode.SharpDevelop; -using NSvn.Common; -using NSvn.Core; - -namespace ICSharpCode.Svn.Commands -{ - public class CheckoutCommand : AbstractMenuCommand - { - string from = String.Empty; - string to = String.Empty; - bool recurse; - Revision revision = null; - - void DoCheckoutCommand() - { - try { - SvnClient.Instance.Client.Checkout(from, to, revision, recurse); - } catch (SvnClientException ex) { - MessageService.ShowError(ex.Message); - } - } - - /// - /// Starts the command - /// - public override void Run() - { - using (CheckoutDialog checkoutDialog = new CheckoutDialog()) { - if (checkoutDialog.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm) == DialogResult.OK) { - from = checkoutDialog.Source; - to = checkoutDialog.Destination; - revision = checkoutDialog.Revision; - recurse = !checkoutDialog.NonRecursive; - SvnClient.Instance.OperationStart("Checkout", new ThreadStart(DoCheckoutCommand)); - SvnClient.Instance.WaitForOperationEnd(); - } - } - } - } -} diff --git a/src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Checkout/CheckoutDialog.cs b/src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Checkout/CheckoutDialog.cs deleted file mode 100644 index 973421bdb7..0000000000 --- a/src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Checkout/CheckoutDialog.cs +++ /dev/null @@ -1,36 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Reflection; -using System.Drawing; -using System.Text; -using System.Threading; -using System.IO; -using System.Windows.Forms; -using ICSharpCode.SharpDevelop.Gui; -using NSvn.Common; -using NSvn.Core; -using ICSharpCode.SharpDevelop.Gui.XmlForms; - -namespace ICSharpCode.Svn.Commands -{ - /// - /// Description of Form1. - /// - public class CheckoutDialog : ExportDialog - { - public CheckoutDialog() - { - this.Text = "Checkout"; - ControlDictionary["groupBox1"].Text = "Repository location"; - Get("fromLocalDir").Text = "&Local repository"; - Get("fromUrl").Checked = true; - Get("fromUrl").Text = "&Remote repository"; - } - } -} diff --git a/src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/CheckoutCommands.cs b/src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/CheckoutCommands.cs new file mode 100644 index 0000000000..9eb23e80d4 --- /dev/null +++ b/src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/CheckoutCommands.cs @@ -0,0 +1,28 @@ +/* + * Created by SharpDevelop. + * User: Daniel Grunwald + * Date: 03.03.2006 + * Time: 20:46 + */ + +using System; +using ICSharpCode.Core; + +namespace ICSharpCode.Svn.Commands +{ + public class ExportCommand : AbstractMenuCommand + { + public override void Run() + { + SvnGuiWrapper.ShowExportDialog(null); + } + } + + public class CheckoutCommand : AbstractMenuCommand + { + public override void Run() + { + SvnGuiWrapper.ShowCheckoutDialog(null); + } + } +} diff --git a/src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Commit/CommitCommand.cs b/src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Commit/CommitCommand.cs deleted file mode 100644 index 40017ebb36..0000000000 --- a/src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Commit/CommitCommand.cs +++ /dev/null @@ -1,45 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Text; -using System.IO; -using System.Threading; -using System.Drawing; -using System.Drawing.Printing; -using System.Collections; -using System.ComponentModel; -using System.Windows.Forms; -using System.Diagnostics; - -using ICSharpCode.Core; -using ICSharpCode.SharpDevelop; - -using ICSharpCode.SharpDevelop.Gui; -using NSvn.Common; -using NSvn.Core; -using ICSharpCode.Svn.Gui; - -namespace ICSharpCode.Svn.Commands -{ - - public class CommitCommand : SubversionCommand - { - protected override bool StartOperation() - { - using (CommitDialog commitDialog = new CommitDialog()) { - commitDialog.LogMessage = AddInOptions.DefaultLogMessage; - if (commitDialog.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm) == DialogResult.OK) { - SvnClient.Instance.LogMessage = commitDialog.LogMessage; - MessageService.ShowMessage("Not implemented."); - //SvnClient.Instance.OperationStart("Commit", new ThreadStart(DoCommit)); - } - } - return false; - } - } -} diff --git a/src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Commit/CommitDialog.cs b/src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Commit/CommitDialog.cs deleted file mode 100644 index c7cc76c469..0000000000 --- a/src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Commit/CommitDialog.cs +++ /dev/null @@ -1,41 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Reflection; -using System.Drawing; -using System.Text; -using System.Threading; -using System.IO; -using System.Windows.Forms; -using ICSharpCode.SharpDevelop.Gui; -using NSvn.Common; -using NSvn.Core; -using ICSharpCode.SharpDevelop.Gui.XmlForms; - -namespace ICSharpCode.Svn.Commands -{ - /// - /// Description of Form1. - /// - public class CommitDialog : BaseSharpDevelopForm - { - public string LogMessage { - get { - return ControlDictionary["logMessageTextBox"].Text; - } - set { - ControlDictionary["logMessageTextBox"].Text = value; - } - } - - public CommitDialog() - { - SetupFromXmlStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("ICSharpCode.Svn.Resources.CommitDialog.xfrm")); - } - } -} diff --git a/src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Export/ExportCommand.cs b/src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Export/ExportCommand.cs deleted file mode 100644 index 970d65eac7..0000000000 --- a/src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Export/ExportCommand.cs +++ /dev/null @@ -1,62 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Threading; -using System.Windows.Forms; - -using ICSharpCode.Core; -using ICSharpCode.SharpDevelop; -using NSvn.Common; -using NSvn.Core; - -namespace ICSharpCode.Svn.Commands -{ - /// - /// Description of ExportCommand - /// - public class ExportCommand : AbstractMenuCommand - { - string from = String.Empty; - string to = String.Empty; - Revision revision = null; - - /// - /// Creates a new ExportCommand - /// - public ExportCommand() - { - // You can enable/disable the menu command using the - // IsEnabled property of the AbstractMenuCommand class - } - - void DoExportCommand() - { - try { - SvnClient.Instance.Client.Export(from, to, revision, false); - } catch (SvnClientException ex) { - MessageService.ShowError(ex.Message); - } - } - - /// - /// Starts the command - /// - public override void Run() - { - using (ExportDialog exportDialog = new ExportDialog()) { - if (exportDialog.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm) == DialogResult.OK) { - from = exportDialog.Source; - to = exportDialog.Destination; - revision = exportDialog.Revision; - SvnClient.Instance.OperationStart("Export", new ThreadStart(DoExportCommand)); - SvnClient.Instance.WaitForOperationEnd(); - } - } - } - } -} diff --git a/src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Export/ExportDialog.cs b/src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Export/ExportDialog.cs deleted file mode 100644 index 2abb574710..0000000000 --- a/src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Export/ExportDialog.cs +++ /dev/null @@ -1,137 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Reflection; -using System.Drawing; -using System.Text; -using System.Threading; -using System.IO; -using System.Windows.Forms; -using ICSharpCode.SharpDevelop.Gui; -using NSvn.Common; -using NSvn.Core; -using ICSharpCode.SharpDevelop.Gui.XmlForms; - -namespace ICSharpCode.Svn.Commands -{ - /// - /// Description of Form1. - /// - public class ExportDialog : BaseSharpDevelopForm - { - - public Revision Revision { - get { - if (ControlDictionary["revisionComboBox"].Text == "Date") { - return Revision.FromDate(((DateTimePicker)ControlDictionary["dateTimePicker"]).Value); - } - return Revision.Parse(ControlDictionary["revisionComboBox"].Text); - } - } - - public bool SourceIsLocalDirectory { - get { - return ((RadioButton)ControlDictionary["fromLocalDirRadioButton"]).Checked; - } - } - - public string Source { - get { - return SourceIsLocalDirectory ? ConvertPathToURL(ControlDictionary["sourceDirectoryTextBox"].Text) : ControlDictionary["urlTextBox"].Text; - } - } - - string ConvertPathToURL(string path) - { - if (path.Length == 0) - return ""; - return "file:///" + path.Replace('\\', '/'); - } - - public string Destination { - get { - return ControlDictionary["localDirectoryTextBox"].Text; - } - } - - public bool NonRecursive { - get { - return ((CheckBox)ControlDictionary["nonRecursiveCheckBox"]).Checked; - } - } - - public ExportDialog() - { - SetupFromXmlStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("ICSharpCode.Svn.Resources.ExportDialog.xfrm")); - ((ComboBox)ControlDictionary["revisionComboBox"]).Items.AddRange(new string[] { - "Head", - "Committed", - "Base", - "Previous", - "Working", - "Date" - }); - ((ComboBox)ControlDictionary["revisionComboBox"]).Text = "Head"; - ((ComboBox)ControlDictionary["revisionComboBox"]).TextChanged += new EventHandler(RevisionComboBoxTextChanged); - RevisionComboBoxTextChanged(this, EventArgs.Empty); - - Get("fromLocalDir").Checked = true; - Get("fromLocalDir").CheckedChanged += new EventHandler(FromLocalDirRadioButtonCheckedChanged); - FromLocalDirRadioButtonCheckedChanged(this, EventArgs.Empty); - - ControlDictionary["sourceDirectoryBrowseButton"].Click += new EventHandler(SourceDirectoryBrowseButtonClick); - ControlDictionary["localDirectoryBrowseButton"].Click += new EventHandler(LocalDirectoryBrowseButtonClick); - - ControlDictionary["sourceDirectoryTextBox"].TextChanged += UrlChanged; - ControlDictionary["urlTextBox"].TextChanged += UrlChanged; - ControlDictionary["localDirectoryTextBox"].TextChanged += UrlChanged; - UrlChanged(null, null); - } - - void UrlChanged(object sender, EventArgs e) - { - Get