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

« back to all changes in this revision

Viewing changes to src/addins/CSharpBinding/MonoDevelop.CSharp.CodeGeneration/CodeGenerationCommands.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:
35
35
        {
36
36
                ShowCodeGenerationWindow
37
37
        }
38
 
 
39
 
        public class ShowCodeGenerationWindowHandler : CommandHandler
40
 
        {
41
 
                protected override void Run ()
42
 
                {
43
 
                        Document document = IdeApp.Workbench.ActiveDocument;
44
 
                        if (document == null)
45
 
                                return;
46
 
                        var completionWidget = document.GetContent<ICompletionWidget> ();
47
 
                        if (completionWidget == null)
48
 
                                return;
49
 
                        CodeCompletionContext completionContext = completionWidget.CreateCodeCompletionContext (document.Editor.Caret.Offset);
50
 
                        GenerateCodeWindow.ShowIfValid (document, completionContext);
51
 
                }
52
 
                
53
 
                protected override void Update (CommandInfo info)
54
 
                {
55
 
                        Document document = IdeApp.Workbench.ActiveDocument;
56
 
                        info.Enabled = document != null && document.Editor != null
57
 
                                && document.Editor.HasFocus && document.GetContent<ICompletionWidget> () != null;
58
 
                }
59
 
        }
60
38
}