20 changed files with 150 additions and 111 deletions
			
			
		@ -1,53 +1,53 @@ | 
				
			|||||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 | 
					// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 | 
				
			||||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 | 
					// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
using System; | 
					using System; | 
				
			||||||
using ICSharpCode.NRefactory.Editor; | 
					using ICSharpCode.NRefactory.Editor; | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace ICSharpCode.SharpDevelop.Editor | 
					namespace ICSharpCode.SharpDevelop.Editor | 
				
			||||||
{ | 
					{ | 
				
			||||||
	/// <summary>
 | 
						/// <summary>
 | 
				
			||||||
	/// Allows language specific search for matching brackets.
 | 
						/// Allows language specific search for matching brackets.
 | 
				
			||||||
	/// </summary>
 | 
						/// </summary>
 | 
				
			||||||
	public interface IBracketSearcher | 
						public interface IBracketSearcher | 
				
			||||||
	{ | 
						{ | 
				
			||||||
		/// <summary>
 | 
							/// <summary>
 | 
				
			||||||
		/// Searches for a matching bracket from the given offset to the start of the document.
 | 
							/// Searches for a matching bracket from the given offset to the start of the document.
 | 
				
			||||||
		/// </summary>
 | 
							/// </summary>
 | 
				
			||||||
		/// <returns>A BracketSearchResult that contains the positions and lengths of the brackets. Return null if there is nothing to highlight.</returns>
 | 
							/// <returns>A BracketSearchResult that contains the positions and lengths of the brackets. Return null if there is nothing to highlight.</returns>
 | 
				
			||||||
		BracketSearchResult SearchBracket(IDocument document, int offset); | 
							BracketSearchResult SearchBracket(IDocument document, int offset); | 
				
			||||||
	} | 
						} | 
				
			||||||
	 | 
						 | 
				
			||||||
	public class DefaultBracketSearcher : IBracketSearcher | 
						public class DefaultBracketSearcher : IBracketSearcher | 
				
			||||||
	{ | 
						{ | 
				
			||||||
		public static readonly DefaultBracketSearcher DefaultInstance = new DefaultBracketSearcher(); | 
							public static readonly DefaultBracketSearcher DefaultInstance = new DefaultBracketSearcher(); | 
				
			||||||
		 | 
							 | 
				
			||||||
		public BracketSearchResult SearchBracket(IDocument document, int offset) | 
							public BracketSearchResult SearchBracket(IDocument document, int offset) | 
				
			||||||
		{ | 
							{ | 
				
			||||||
			return null; | 
								return null; | 
				
			||||||
		} | 
							} | 
				
			||||||
	} | 
						} | 
				
			||||||
	 | 
						 | 
				
			||||||
	/// <summary>
 | 
						/// <summary>
 | 
				
			||||||
	/// Describes a pair of matching brackets found by IBracketSearcher.
 | 
						/// Describes a pair of matching brackets found by IBracketSearcher.
 | 
				
			||||||
	/// </summary>
 | 
						/// </summary>
 | 
				
			||||||
	public class BracketSearchResult | 
						public class BracketSearchResult | 
				
			||||||
	{ | 
						{ | 
				
			||||||
		public int OpeningBracketOffset { get; private set; } | 
							public int OpeningBracketOffset { get; private set; } | 
				
			||||||
		 | 
							 | 
				
			||||||
		public int OpeningBracketLength { get; private set; } | 
							public int OpeningBracketLength { get; private set; } | 
				
			||||||
		 | 
							 | 
				
			||||||
		public int ClosingBracketOffset { get; private set; } | 
							public int ClosingBracketOffset { get; private set; } | 
				
			||||||
 | 
					
 | 
				
			||||||
		public int ClosingBracketLength { get; private set; } | 
							public int ClosingBracketLength { get; private set; } | 
				
			||||||
		 | 
							 | 
				
			||||||
		public BracketSearchResult(int openingBracketOffset, int openingBracketLength, | 
							public BracketSearchResult(int openingBracketOffset, int openingBracketLength, | 
				
			||||||
		                           int closingBracketOffset, int closingBracketLength) | 
							                           int closingBracketOffset, int closingBracketLength) | 
				
			||||||
		{ | 
							{ | 
				
			||||||
			this.OpeningBracketOffset = openingBracketOffset; | 
								this.OpeningBracketOffset = openingBracketOffset; | 
				
			||||||
			this.OpeningBracketLength = openingBracketLength; | 
								this.OpeningBracketLength = openingBracketLength; | 
				
			||||||
			this.ClosingBracketOffset = closingBracketOffset; | 
								this.ClosingBracketOffset = closingBracketOffset; | 
				
			||||||
			this.ClosingBracketLength = closingBracketLength; | 
								this.ClosingBracketLength = closingBracketLength; | 
				
			||||||
		} | 
							} | 
				
			||||||
	} | 
						} | 
				
			||||||
} | 
					} | 
				
			||||||
@ -0,0 +1,51 @@ | 
				
			|||||||
 | 
					// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 | 
				
			||||||
 | 
					// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					using System; | 
				
			||||||
 | 
					using System.Collections.Generic; | 
				
			||||||
 | 
					using System.IO; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					using ICSharpCode.Core; | 
				
			||||||
 | 
					using ICSharpCode.SharpDevelop.Gui; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace ICSharpCode.SharpDevelop.Editor | 
				
			||||||
 | 
					{ | 
				
			||||||
 | 
						/// <summary>
 | 
				
			||||||
 | 
						/// Provides the BASE-version for a given file - the original unmodified
 | 
				
			||||||
 | 
						/// copy from the last commit.
 | 
				
			||||||
 | 
						/// This interface is implemented by the version control AddIns.
 | 
				
			||||||
 | 
						/// </summary>
 | 
				
			||||||
 | 
						public interface IDocumentVersionProvider | 
				
			||||||
 | 
						{ | 
				
			||||||
 | 
							/// <summary>
 | 
				
			||||||
 | 
							/// Provides the BASE-Version for a file. This can be either the file saved
 | 
				
			||||||
 | 
							/// to disk or a base version provided by any VCS.
 | 
				
			||||||
 | 
							/// </summary>
 | 
				
			||||||
 | 
							Stream OpenBaseVersion(string fileName); | 
				
			||||||
 | 
							 | 
				
			||||||
 | 
							/// <summary>
 | 
				
			||||||
 | 
							/// Starts watching for changes to the BASE-version of the specified file.
 | 
				
			||||||
 | 
							/// The callback delegate gets called whenever the BASE-version has changed.
 | 
				
			||||||
 | 
							/// </summary>
 | 
				
			||||||
 | 
							/// <returns>Returns a disposable that can be used to stop watching for changes.
 | 
				
			||||||
 | 
							/// You must dispose the disposable to prevent a memory leak, the GC will
 | 
				
			||||||
 | 
							/// not help out in this case!</returns>
 | 
				
			||||||
 | 
							IDisposable WatchBaseVersionChanges(string fileName, EventHandler callback); | 
				
			||||||
 | 
						} | 
				
			||||||
 | 
						 | 
				
			||||||
 | 
						public class VersioningServices | 
				
			||||||
 | 
						{ | 
				
			||||||
 | 
							public static readonly VersioningServices Instance = new VersioningServices(); | 
				
			||||||
 | 
							 | 
				
			||||||
 | 
							List<IDocumentVersionProvider> baseVersionProviders; | 
				
			||||||
 | 
							 | 
				
			||||||
 | 
							public List<IDocumentVersionProvider> DocumentVersionProviders { | 
				
			||||||
 | 
								get { | 
				
			||||||
 | 
									if (baseVersionProviders == null) | 
				
			||||||
 | 
										baseVersionProviders = AddInTree.BuildItems<IDocumentVersionProvider>("/Workspace/DocumentVersionProviders", this, false); | 
				
			||||||
 | 
									 | 
				
			||||||
 | 
									return baseVersionProviders; | 
				
			||||||
 | 
								} | 
				
			||||||
 | 
							} | 
				
			||||||
 | 
						} | 
				
			||||||
 | 
					} | 
				
			||||||
					Loading…
					
					
				
		Reference in new issue