~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Snippets/AnchorSnippetElementProvider.cs

  • Committer: sk
  • Date: 2011-09-10 05:17:57 UTC
  • Revision ID: halega@halega.com-20110910051757-qfouz1llya9m6boy
4.1.0.7915 Release Candidate 1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 
3
 
 
4
using System;
 
5
using ICSharpCode.AvalonEdit.Snippets;
 
6
using ICSharpCode.SharpDevelop.Editor.AvalonEdit;
 
7
 
 
8
namespace ICSharpCode.AvalonEdit.AddIn.Snippets
 
9
{
 
10
        public class AnchorSnippetElementProvider : ISnippetElementProvider
 
11
        {
 
12
                public SnippetElement GetElement(SnippetInfo snippetInfo)
 
13
                {
 
14
                        int typeSeparator = snippetInfo.Tag.IndexOf(':');
 
15
                        
 
16
                        if (typeSeparator > 0) {
 
17
                                string type = snippetInfo.Tag.Substring(0, typeSeparator);
 
18
                                string name = snippetInfo.Tag.Substring(typeSeparator + 1);
 
19
                                
 
20
                                if ("anchor".Equals(type, StringComparison.OrdinalIgnoreCase))
 
21
                                        return new SnippetAnchorElement(name);
 
22
                        }
 
23
                        
 
24
                        return null;
 
25
                }
 
26
        }
 
27
}