~ubuntu-branches/ubuntu/oneiric/monodevelop/oneiric-updates

« back to all changes in this revision

Viewing changes to src/addins/SourceEditor2/MonoDevelop.SourceEditor.Actions/EditActionCollection.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2009-02-18 08:40:51 UTC
  • mfrom: (1.2.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090218084051-gh8m6ukvokbwj7cf
Tags: 1.9.2+dfsg-1ubuntu1
* Merge from Debian Experimental (LP: #330519), remaining Ubuntu changes:
  + debian/control:
    - Update for Gnome# 2.24
    - Add libmono-cairo1.0-cil to build-deps to fool pkg-config check

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
using System;
2
 
using System.Collections;
3
 
using MonoDevelop.SourceEditor.Gui;
4
 
 
5
 
namespace MonoDevelop.SourceEditor.Actions
6
 
{
7
 
        public sealed class EditActionCollection //: IEnumerable
8
 
        {
9
 
                ArrayList actions = new ArrayList ();
10
 
 
11
 
                public void Add (IEditAction action)
12
 
                {
13
 
                        actions.Add (action);
14
 
                }
15
 
                
16
 
                /* requires C# 2.0 for iterators
17
 
                public IEnumerator GetEnumerator ()
18
 
                {
19
 
                        foreach (IEditAction action in actions)
20
 
                                yield return action;
21
 
                }
22
 
                */
23
 
 
24
 
                public IEditAction GetAction (Gdk.Key key, Gdk.ModifierType state)
25
 
                {
26
 
                        // some problematic ones have to be filtered
27
 
                        Gdk.ModifierType filteredState = state & ~(Gdk.ModifierType.LockMask | Gdk.ModifierType.Mod2Mask);
28
 
                        foreach (IEditAction action in actions)
29
 
                        {
30
 
                                if (action.State == filteredState && action.Key == key)
31
 
                                        return action;
32
 
                        }
33
 
 
34
 
                        return null;
35
 
                }
36
 
        }
37
 
}
38