protected override void Run()
        {
            Document document = IdeApp.Workbench.ActiveDocument;

            if (document == null)
            {
                return;
            }
            var completionWidget = document.GetContent <ICompletionWidget> ();

            if (completionWidget == null)
            {
                return;
            }
            CodeCompletionContext completionContext = completionWidget.CreateCodeCompletionContext(document.TextEditor.CursorPosition);

            GenerateCodeWindow.ShowIfValid(document, completionContext);
        }
Пример #2
0
        public static void ShowIfValid(Document document, MonoDevelop.Ide.CodeCompletion.CodeCompletionContext completionContext)
        {
            var options = CodeGenerationOptions.CreateCodeGenerationOptions(document);

            var validGenerators = new List <ICodeGenerator> ();

            foreach (var generator in CodeGenerationService.CodeGenerators)
            {
                if (generator.IsValid(options))
                {
                    validGenerators.Add(generator);
                }
            }
            if (validGenerators.Count < 1)
            {
                return;
            }

            var window = new GenerateCodeWindow(options, completionContext);

            window.Populate(validGenerators);
        }
Пример #3
0
		public static void ShowIfValid (Document document, MonoDevelop.Ide.CodeCompletion.CodeCompletionContext completionContext)
		{
			var options = CodeGenerationOptions.CreateCodeGenerationOptions (document);
			
			var validGenerators = new List<ICodeGenerator> ();
			foreach (var generator in CodeGenerationService.CodeGenerators) {
				if (generator.IsValid (options))
					validGenerators.Add (generator);
			}
			if (validGenerators.Count < 1)
				return;
			
			var window = new GenerateCodeWindow (options, completionContext);
			window.Populate (validGenerators);
		}