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

« back to all changes in this revision

Viewing changes to src/addins/CBinding/Gui/DataProvider.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2011-06-27 17:03:13 UTC
  • mto: (1.8.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 54.
  • Revision ID: james.westby@ubuntu.com-20110627170313-6cvz3s19x6e9hqe9
ImportĀ upstreamĀ versionĀ 2.5.92+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
{
45
45
        public class ParameterDataProvider : IParameterDataProvider
46
46
        {
47
 
                private TextEditor editor;
 
47
                private Mono.TextEditor.TextEditorData editor;
48
48
                private List<Function> functions = new List<Function> ();
49
49
                
50
50
                public ParameterDataProvider (Document document, ProjectInformation info, string functionName)
51
51
                {
52
 
                        this.editor = document.TextEditor;
 
52
                        this.editor = document.Editor;
53
53
                        
54
54
                        foreach (Function f in info.Functions) {
55
55
                                if (f.Name == functionName) {
79
79
                // -1 means the cursor is outside the method parameter list
80
80
                // 0 means no parameter entered
81
81
                // > 0 is the index of the parameter (1-based)
82
 
                public int GetCurrentParameterIndex (CodeCompletionContext ctx)
 
82
                public int GetCurrentParameterIndex (ICompletionWidget widget, CodeCompletionContext ctx)
83
83
                {
84
 
                        int cursor = editor.CursorPosition;
 
84
                        int cursor = widget.CurrentCodeCompletionContext.TriggerOffset;
85
85
                        int i = ctx.TriggerOffset;
86
 
                        if (i < 0 || i >= editor.TextLength || editor.GetCharAt (i) == ')')
 
86
                        if (i < 0 || i >= editor.Length || editor.GetCharAt (i) == ')')
87
87
                                return -1;
88
88
                        
89
89
                        if (i > cursor)
94
94
                        int parameterIndex = 1;
95
95
                        
96
96
                        while (i++ < cursor) {
97
 
                                if (i >= editor.TextLength)
 
97
                                if (i >= widget.TextLength)
98
98
                                        break;
99
 
                                char ch = editor.GetCharAt (i);
 
99
                                char ch = widget.GetChar (i);
100
100
                                if (ch == ',')
101
101
                                        parameterIndex++;
102
102
                                else if (ch == ')')