Example #1
0
        public void Refactor()
        {
            var selection = _editor.GetSelection();

            if (!selection.HasValue)
            {
                _messageBox.Show(RubberduckUI.PromoteVariable_InvalidSelection, RubberduckUI.IntroduceParameter_Caption,
                                 MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            Refactor(selection.Value);
        }
Example #2
0
        public void Refactor()
        {
            var selection = _editor.GetSelection();

            if (!selection.HasValue)
            {
                _messageBox.Show(RubberduckUI.ImplementInterface_InvalidSelectionMessage, RubberduckUI.ImplementInterface_Caption,
                                 System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
                return;
            }

            Refactor(selection.Value);
        }
Example #3
0
        public RemoveParametersPresenter Create()
        {
            var selection = _editor.GetSelection();

            if (selection == null)
            {
                return(null);
            }

            var model = new RemoveParametersModel(_parseResult, selection.Value);

            return(new RemoveParametersPresenter(_view, model));
        }
        public EncapsulateFieldPresenter Create()
        {
            var selection = _editor.GetSelection();

            if (selection == null)
            {
                return(null);
            }

            var model = new EncapsulateFieldModel(_parseResult, selection.Value);

            return(new EncapsulateFieldPresenter(_view, model));
        }
        public IReorderParametersPresenter Create()
        {
            var selection = _editor.GetSelection();

            if (selection == null)
            {
                return(null);
            }

            var model = new ReorderParametersModel(_parseResult, selection.Value, _messageBox);

            return(new ReorderParametersPresenter(_view, model, _messageBox));
        }
        public void Refactor()
        {
            var qualifiedSelection = _editor.GetSelection();

            if (qualifiedSelection != null)
            {
                Refactor(_declarations.FindVariable(qualifiedSelection.Value));
            }
            else
            {
                _messageBox.Show(RubberduckUI.MoveCloserToUsage_InvalidSelection, RubberduckUI.MoveCloserToUsage_Caption, MessageBoxButtons.OK,
                                 MessageBoxIcon.Exclamation);
            }
        }
        public ExtractInterfacePresenter Create()
        {
            var selection = _editor.GetSelection();

            if (selection == null)
            {
                return(null);
            }

            var model = new ExtractInterfaceModel(_state, selection.Value);

            if (!model.Members.Any())
            {
                // don't show the UI if there's no member to extract
                return(null);
            }

            return(new ExtractInterfacePresenter(_view, model));
        }
        public IExtractMethodPresenter Create()
        {
            var selection = _editor.GetSelection();

            if (selection == null)
            {
                return(null);
            }

            ExtractMethodModel model;

            try
            {
                model = new ExtractMethodModel(_editor, _declarations, selection.Value);
            }
            catch (InvalidOperationException)
            {
                return(null);
            }

            var view = new ExtractMethodDialog();

            return(new ExtractMethodPresenter(view, model, _indenter));
        }