~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/EventCreationCompletionData.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
 
39
39
namespace MonoDevelop.CSharp.Completion
40
40
{
41
 
        public class EventCreationCompletionData : CompletionData
 
41
        class EventCreationCompletionData : CompletionData
42
42
        {
43
43
                string parameterList;
44
44
                IUnresolvedMember callingMember;
46
46
                int initialOffset;
47
47
                public bool AddSemicolon = true;
48
48
                TextEditorData editor;
49
 
                
 
49
 
 
50
                public override TooltipInformation CreateTooltipInformation (bool smartWrap)
 
51
                {
 
52
                        var tooltipInfo = new TooltipInformation ();
 
53
                        return tooltipInfo;
 
54
                }
 
55
 
50
56
                public EventCreationCompletionData (CSharpCompletionTextEditorExtension ext, string varName, IType delegateType, IEvent evt, string parameterList, IUnresolvedMember callingMember, IUnresolvedTypeDefinition declaringType) : base (null)
51
57
                {
52
58
                        if (string.IsNullOrEmpty (varName)) {
63
69
                                        }
64
70
                                }
65
71
                        }
66
 
                        this.editor        = ext.textEditorData;
 
72
                        this.editor        = ext.TextEditorData;
67
73
                        this.parameterList = parameterList;
68
74
                        this.callingMember = callingMember;
69
75
                        this.Icon          = "md-newmethod";
87
93
                        pos = Math.Max (0, Math.Min (pos, editor.Document.TextLength - 1));
88
94
                        
89
95
                        // Insert new event handler after closing bracket
90
 
                        string indent = editor.Document.GetLine (callingMember.Region.BeginLine).GetIndentation (editor.Document);
 
96
                        var line = callingMember != null ? editor.Document.GetLine (callingMember.Region.BeginLine) : editor.Document.GetLineByOffset (initialOffset);
 
97
                        string indent = line.GetIndentation (editor.Document);
91
98
                        
92
99
                        StringBuilder sb = new StringBuilder ();
93
100
                        sb.Append (editor.EolMarker);
94
101
                        sb.Append (editor.EolMarker);
95
102
                        sb.Append (indent);
96
 
                        if (callingMember.IsStatic)
 
103
                        if (callingMember != null && callingMember.IsStatic)
97
104
                                sb.Append ("static ");
98
105
                        sb.Append ("void ");
99
106
                        int pos2 = sb.Length;
121
128
                        link.AddLink (new TextSegment (pos - initialOffset + pos2, this.DisplayText.Length));
122
129
                        links.Add (link);
123
130
                        
124
 
                        CompletionTextLinkMode tle = new CompletionTextLinkMode (editor.Parent, initialOffset, links);
125
 
                        tle.TriggerCodeCompletion = false;
 
131
                        var tle = new TextLinkEditMode (editor.Parent, initialOffset, links);
 
132
                        tle.TextLinkMode = TextLinkMode.EditIdentifier;
126
133
                        tle.SetCaretPosition = true;
127
134
                        tle.SelectPrimaryLink = true;
128
135
                        tle.OldMode = editor.CurrentMode;