Example #1
0
            public ExtractMethodRequest GetExtractionInfo(ExtractedMethodCreator previewer)
            {
                AP.ScopeInfo scope = null;
                if (_scopeName == null)
                {
                    scope = previewer.LastExtraction.scopes[0];
                }
                else
                {
                    foreach (var foundScope in previewer.LastExtraction.scopes)
                    {
                        if (foundScope.name == _scopeName)
                        {
                            scope = foundScope;
                            break;
                        }
                    }
                }

                Assert.AreNotEqual(null, scope);
                var requestView = new ExtractMethodRequestView(PythonToolsTestUtilities.CreateMockServiceProvider(), previewer);

                requestView.TargetScope = requestView.TargetScopes.Single(s => s.Scope == scope);
                requestView.Name        = _targetName;
                foreach (var cv in requestView.ClosureVariables)
                {
                    cv.IsClosure = !_parameters.Contains(cv.Name);
                }
                Assert.IsTrue(requestView.IsValid);
                var request = requestView.GetRequest();

                Assert.IsNotNull(request);
                return(request);
            }
Example #2
0
        public ExtractMethodRequest GetExtractionInfo(ExtractedMethodCreator previewer)
        {
            var requestView = new ExtractMethodRequestView(_serviceProvider, previewer);
            var dialog      = new ExtractMethodDialog(requestView);

            bool res = dialog.ShowModal() ?? false;

            if (res)
            {
                return(requestView.GetRequest());
            }

            return(null);
        }