Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/shortcuts@4397 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts^2
19 changed files with 374 additions and 164 deletions
Binary file not shown.
@ -0,0 +1,44 @@
@@ -0,0 +1,44 @@
|
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
|
||||
namespace ICSharpCode.ShortcutsManagement.Data |
||||
{ |
||||
public class MapTable<T1, T2> : IEnumerable<KeyValuePair<T1, T2>> |
||||
{ |
||||
private readonly Dictionary<T1, T2> forwardMaping = new Dictionary<T1, T2>(); |
||||
|
||||
private readonly Dictionary<T2, T1> backwardMaping = new Dictionary<T2, T1>(); |
||||
|
||||
public void Add(T1 mappingObject, T2 mappedObject) |
||||
{ |
||||
forwardMaping.Add(mappingObject, mappedObject); |
||||
backwardMaping.Add(mappedObject, mappingObject); |
||||
} |
||||
|
||||
public T2 MapForward(T1 mappingObject) |
||||
{ |
||||
return forwardMaping[mappingObject]; |
||||
} |
||||
|
||||
public T1 MapBackward(T2 mappingObject) |
||||
{ |
||||
return backwardMaping[mappingObject]; |
||||
} |
||||
|
||||
public void Clear() |
||||
{ |
||||
forwardMaping.Clear(); |
||||
backwardMaping.Clear(); |
||||
} |
||||
|
||||
public IEnumerator<KeyValuePair<T1, T2>> GetEnumerator() |
||||
{ |
||||
return forwardMaping.GetEnumerator(); |
||||
} |
||||
|
||||
IEnumerator IEnumerable.GetEnumerator() |
||||
{ |
||||
return forwardMaping.GetEnumerator(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,48 @@
@@ -0,0 +1,48 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Administrator |
||||
* Date: 7/3/2009 |
||||
* Time: 4:50 PM |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
|
||||
namespace ICSharpCode.Core |
||||
{ |
||||
/// <summary>
|
||||
/// Description of InputBindingInfoCategory.
|
||||
/// </summary>
|
||||
public class InputBindingCategoryDoozer : IDoozer |
||||
{ |
||||
/// <see cref="IDoozer.HandleConditions" />
|
||||
public bool HandleConditions { |
||||
get { |
||||
return true; |
||||
} |
||||
} |
||||
|
||||
/// <see cref="IDoozer.BuildItem(object, Codon, System.Collections.ArrayList)">
|
||||
/// Builds InputBindingDescriptor
|
||||
/// </see>
|
||||
public object BuildItem(object caller, Codon codon, System.Collections.ArrayList subItems) |
||||
{ |
||||
return new InputBindingCategoryDescriptor(codon, subItems); |
||||
} |
||||
} |
||||
|
||||
public class InputBindingCategoryDescriptor |
||||
{ |
||||
public string Id; |
||||
public string Text; |
||||
public List<InputBindingCategoryDescriptor> Children; |
||||
|
||||
public InputBindingCategoryDescriptor(Codon codon, System.Collections.ArrayList subItems) { |
||||
Id = codon.Properties["id"]; |
||||
Text = codon.Properties["text"]; |
||||
Children = subItems != null ? subItems.Cast<InputBindingCategoryDescriptor>().ToList() : new List<InputBindingCategoryDescriptor>(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,85 @@
@@ -0,0 +1,85 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Administrator |
||||
* Date: 7/4/2009 |
||||
* Time: 9:02 PM |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Generic; |
||||
|
||||
namespace ICSharpCode.Core.Presentation |
||||
{ |
||||
/// <summary>
|
||||
/// Description of InputBindingCategoryCollection.
|
||||
/// </summary>
|
||||
public class InputBindingCategoryCollection : ICollection<InputBindingCategory> |
||||
{ |
||||
private List<InputBindingCategory> categories = new List<InputBindingCategory>(); |
||||
|
||||
public InputBindingCategoryCollection() |
||||
{ |
||||
} |
||||
|
||||
public int Count { |
||||
get { |
||||
return categories.Count; |
||||
} |
||||
} |
||||
|
||||
public bool IsReadOnly { |
||||
get { |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
public void Add(InputBindingCategory category) |
||||
{ |
||||
if(category == null) { |
||||
throw new ArgumentException("InputBindingCategory can not be null"); |
||||
} |
||||
|
||||
if(!categories.Contains(category)) { |
||||
categories.Add(category); |
||||
} |
||||
} |
||||
|
||||
public void Clear() |
||||
{ |
||||
categories.Clear(); |
||||
} |
||||
|
||||
public bool Contains(InputBindingCategory category) |
||||
{ |
||||
return categories.Contains(category); |
||||
} |
||||
|
||||
public void AddRange(IEnumerable<InputBindingCategory> categories) |
||||
{ |
||||
foreach(var category in categories) { |
||||
Add(category); |
||||
} |
||||
} |
||||
|
||||
public void CopyTo(InputBindingCategory[] array, int arrayIndex) |
||||
{ |
||||
categories.CopyTo(array, arrayIndex); |
||||
} |
||||
|
||||
public bool Remove(InputBindingCategory category) |
||||
{ |
||||
return categories.Remove(category); |
||||
} |
||||
|
||||
public IEnumerator<InputBindingCategory> GetEnumerator() |
||||
{ |
||||
return categories.GetEnumerator(); |
||||
} |
||||
|
||||
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() |
||||
{ |
||||
return categories.GetEnumerator(); |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue