예제 #1
0
        public RenameRefactoring(
            IRefactoringPresenterFactory factory,
            IDeclarationFinderProvider declarationFinderProvider,
            IProjectsProvider projectsProvider,
            IRewritingManager rewritingManager,
            ISelectionProvider selectionProvider,
            ISelectedDeclarationProvider selectedDeclarationProvider,
            IParseManager parseManager,
            IUiDispatcher uiDispatcher)
            : base(rewritingManager, selectionProvider, factory, uiDispatcher)
        {
            _declarationFinderProvider   = declarationFinderProvider;
            _selectedDeclarationProvider = selectedDeclarationProvider;
            _projectsProvider            = projectsProvider;
            _parseManager = parseManager;

            _renameActions = new Dictionary <DeclarationType, Action <RenameModel, IRewriteSession> >
            {
                { DeclarationType.Member, RenameMember },
                { DeclarationType.Parameter, RenameParameter },
                { DeclarationType.Event, RenameEvent },
                { DeclarationType.Variable, RenameVariable },
                { DeclarationType.Module, RenameModule },
                { DeclarationType.Project, RenameProject }
            };
        }
예제 #2
0
        public EncapsulateFieldTestsResolver(IDeclarationFinderProvider declarationFinderProvider, IRewritingManager rewritingManager = null, ISelectionService selectionService = null, IIndenter indenter = null)
        {
            _declarationFinderProvider = declarationFinderProvider;

            _rewritingManager = rewritingManager;

            _selectionService = selectionService;

            _testIndenter = indenter ?? new Indenter(null, () =>
            {
                var s = IndenterSettingsTests.GetMockIndenterSettings();
                s.VerticallySpaceProcedures = true;
                s.LinesBetweenProcedures    = 1;
                return(s);
            });

            _codeBuilder = new CodeBuilder(_testIndenter);

            _presenterFactory = new Mock <IRefactoringPresenterFactory>().Object;

            var uiDispatcherMock = new Mock <IUiDispatcher>();

            uiDispatcherMock
            .Setup(m => m.Invoke(It.IsAny <Action>()))
            .Callback((Action action) => action.Invoke());

            _uiDispatcher = uiDispatcherMock.Object;

            _messageBox = new Mock <IMessageBox>().Object;
        }
예제 #3
0
 public ExtractInterfaceRefactoring(IVBE vbe, IMessageBox messageBox, IRefactoringPresenterFactory <IExtractInterfacePresenter> factory, IRewritingManager rewritingManager)
 {
     _vbe = vbe;
     _rewritingManager = rewritingManager;
     _messageBox       = messageBox;
     _factory          = factory;
 }
 public ReorderParametersRefactoring(IVBE vbe, IRefactoringPresenterFactory <IReorderParametersPresenter> factory, IMessageBox messageBox, IProjectsProvider projectsProvider)
 {
     _vbe              = vbe;
     _factory          = factory;
     _messageBox       = messageBox;
     _projectsProvider = projectsProvider;
 }
 public RefactorReorderParametersCommand(RubberduckParserState state, IRefactoringPresenterFactory factory, IMessageBox msgbox, IRewritingManager rewritingManager, ISelectionService selectionService)
     : base(rewritingManager, selectionService)
 {
     _state   = state;
     _msgbox  = msgbox;
     _factory = factory;
 }
 public RenameRefactoring(IRefactoringPresenterFactory <IRenamePresenter> factory, IActiveCodePaneEditor editor, IMessageBox messageBox, RubberduckParserState state)
 {
     _factory    = factory;
     _editor     = editor;
     _messageBox = messageBox;
     _state      = state;
 }
예제 #7
0
 public RenameRefactoring(IVBE vbe, IRefactoringPresenterFactory <IRenamePresenter> factory, IMessageBox messageBox, IDeclarationFinderProvider declarationFinderProvider, IProjectsProvider projectsProvider, IRewritingManager rewritingManager)
 {
     _vbe        = vbe;
     _factory    = factory;
     _messageBox = messageBox;
     _declarationFinderProvider = declarationFinderProvider;
     _projectsProvider          = projectsProvider;
     _rewritingManager          = rewritingManager;
     _model = null;
     using (var activeCodePane = _vbe.ActiveCodePane)
     {
         _initialSelection = activeCodePane.GetQualifiedSelection();
     }
     _renameActions = new Dictionary <DeclarationType, Action <IRewriteSession> >
     {
         { DeclarationType.Member, RenameMember },
         { DeclarationType.Parameter, RenameParameter },
         { DeclarationType.Event, RenameEvent },
         { DeclarationType.Variable, RenameVariable },
         { DeclarationType.Module, RenameModule },
         { DeclarationType.Project, RenameProject }
     };
     IsInterfaceMemberRename = false;
     _neverRenameIdentifiers = NeverRenameList();
 }
예제 #8
0
 public ExtractInterfaceRefactoring(VBE vbe, RubberduckParserState state, IMessageBox messageBox, IRefactoringPresenterFactory <IExtractInterfacePresenter> factory)
 {
     _vbe        = vbe;
     _state      = state;
     _messageBox = messageBox;
     _factory    = factory;
 }
예제 #9
0
 public RefactorExtractInterfaceCommand(RubberduckParserState state, IMessageBox messageBox, IRefactoringPresenterFactory factory, IRewritingManager rewritingManager, ISelectionService selectionService)
     : base(rewritingManager, selectionService)
 {
     _state      = state;
     _messageBox = messageBox;
     _factory    = factory;
 }
예제 #10
0
 public RenameRefactoring(IRefactoringPresenterFactory<IRenamePresenter> factory, IActiveCodePaneEditor editor, IMessageBox messageBox, RubberduckParserState state)
 {
     _factory = factory;
     _editor = editor;
     _messageBox = messageBox;
     _state = state;
 }
 public RefactorEncapsulateFieldCommand(RubberduckParserState state, Indenter indenter, IRefactoringPresenterFactory factory, IRewritingManager rewritingManager, ISelectionService selectionService)
     : base(rewritingManager, selectionService)
 {
     _state    = state;
     _indenter = indenter;
     _factory  = factory;
 }
예제 #12
0
 public RenameRefactoring(VBE vbe, IRefactoringPresenterFactory <IRenamePresenter> factory, IMessageBox messageBox, RubberduckParserState state)
 {
     _vbe        = vbe;
     _factory    = factory;
     _messageBox = messageBox;
     _state      = state;
 }
 public EncapsulateFieldRefactoring(IVBE vbe, IIndenter indenter, IRefactoringPresenterFactory <IEncapsulateFieldPresenter> factory, IRewritingManager rewritingManager)
 {
     _vbe              = vbe;
     _indenter         = indenter;
     _factory          = factory;
     _rewritingManager = rewritingManager;
 }
 public ReorderParametersRefactoring(RubberduckParserState state, IRefactoringPresenterFactory factory, IMessageBox messageBox, IRewritingManager rewritingManager, ISelectionService selectionService)
 {
     _state            = state;
     _selectionService = selectionService;
     _factory          = factory;
     _messageBox       = messageBox;
     _rewritingManager = rewritingManager;
 }
 public ProjectExplorerRefactorRenameCommand(IVBE vbe, RubberduckParserState state, IMessageBox msgBox, IRefactoringPresenterFactory factory, IRewritingManager rewritingManager, ISelectionService selectionService)
     : base(rewritingManager, selectionService)
 {
     _state   = state;
     _msgBox  = msgBox;
     _factory = factory;
     _vbe     = vbe;
 }
예제 #16
0
 public EncapsulateFieldRefactoring(RubberduckParserState state, IIndenter indenter, IRefactoringPresenterFactory factory, IRewritingManager rewritingManager, ISelectionService selectionService)
 {
     _state            = state;
     _indenter         = indenter;
     _factory          = factory;
     _rewritingManager = rewritingManager;
     _selectionService = selectionService;
 }
예제 #17
0
 public RenameCommand(RubberduckParserState state, IMessageBox msgBox, IRefactoringPresenterFactory factory, IRewritingManager rewritingManager, ISelectionService selectionService)
 {
     _selectionService = selectionService;
     _state            = state;
     _rewritingManager = rewritingManager;
     _msgBox           = msgBox;
     _factory          = factory;
 }
 public ExtractInterfaceRefactoring(RubberduckParserState state, IMessageBox messageBox, IRefactoringPresenterFactory <ExtractInterfacePresenter> factory,
                                    IActiveCodePaneEditor editor)
 {
     _state      = state;
     _messageBox = messageBox;
     _factory    = factory;
     _editor     = editor;
 }
 public RemoveUnusedParameterQuickFix(IDeclarationFinderProvider declarationFinderProvider, IRefactoringPresenterFactory factory, IRewritingManager rewritingManager, ISelectionService selectionService)
     : base(typeof(ParameterNotUsedInspection))
 {
     _declarationFinderProvider = declarationFinderProvider;
     _factory          = factory;
     _rewritingManager = rewritingManager;
     _selectionService = selectionService;
 }
 public ReorderParametersRefactoring(IVBE vbe, IRefactoringPresenterFactory <IReorderParametersPresenter> factory,
                                     IMessageBox messageBox, IRewritingManager rewritingManager)
 {
     _vbe              = vbe;
     _factory          = factory;
     _messageBox       = messageBox;
     _rewritingManager = rewritingManager;
 }
예제 #21
0
 public EncapsulateFieldQuickFix(RubberduckParserState state, IIndenter indenter, IRefactoringPresenterFactory factory, IRewritingManager rewritingManager, ISelectionService selectionService)
     : base(typeof(EncapsulatePublicFieldInspection))
 {
     _state            = state;
     _selectionService = selectionService;
     _rewritingManager = rewritingManager;
     _indenter         = indenter;
     _factory          = factory;
 }
예제 #22
0
        protected InteractiveRefactoringBase(
            IRewritingManager rewritingManager,
            ISelectionProvider selectionProvider,
            IRefactoringPresenterFactory factory,
            IUiDispatcher uiDispatcher)
            : base(rewritingManager, selectionProvider)
        {
            Action <TPresenter> presenterDisposalAction = (TPresenter presenter) => uiDispatcher.Invoke(() => factory.Release(presenter));

            _presenterFactory = ((model) => DisposalActionContainer.Create(factory.Create <TPresenter, TModel>(model), presenterDisposalAction));
        }
예제 #23
0
 public ReorderParametersRefactoring(
     IDeclarationFinderProvider declarationFinderProvider,
     IRefactoringPresenterFactory factory,
     IRewritingManager rewritingManager,
     ISelectionProvider selectionProvider,
     ISelectedDeclarationProvider selectedDeclarationProvider,
     IUiDispatcher uiDispatcher)
     : base(rewritingManager, selectionProvider, factory, uiDispatcher)
 {
     _declarationFinderProvider   = declarationFinderProvider;
     _selectedDeclarationProvider = selectedDeclarationProvider;
 }
 public RenameDeclarationQuickFix(RubberduckParserState state, IMessageBox messageBox, IRefactoringPresenterFactory factory, IRewritingManager rewritingManager, ISelectionService selectionService)
     : base(typeof(HungarianNotationInspection),
            typeof(UseMeaningfulNameInspection),
            typeof(DefaultProjectNameInspection),
            typeof(UnderscoreInPublicClassModuleMemberInspection),
            typeof(ExcelUdfNameIsValidCellReferenceInspection))
 {
     _selectionService = selectionService;
     _state            = state;
     _rewritingManager = rewritingManager;
     _messageBox       = messageBox;
     _factory          = factory;
 }
 public EncapsulateFieldRefactoring(
     IDeclarationFinderProvider declarationFinderProvider,
     IIndenter indenter,
     IRefactoringPresenterFactory factory,
     IRewritingManager rewritingManager,
     ISelectionProvider selectionProvider,
     ISelectedDeclarationProvider selectedDeclarationProvider,
     IUiDispatcher uiDispatcher)
     : base(rewritingManager, selectionProvider, factory, uiDispatcher)
 {
     _declarationFinderProvider   = declarationFinderProvider;
     _selectedDeclarationProvider = selectedDeclarationProvider;
     _indenter = indenter;
 }
        protected override IRefactoring TestRefactoring(
            IRewritingManager rewritingManager,
            RubberduckParserState state,
            IRefactoringPresenterFactory factory,
            ISelectionService selectionService)
        {
            var selectedDeclarationProvider = new SelectedDeclarationProvider(selectionService, state);
            var uiDispatcherMock            = new Mock <IUiDispatcher>();

            uiDispatcherMock
            .Setup(m => m.Invoke(It.IsAny <Action>()))
            .Callback((Action action) => action.Invoke());
            return(new ReorderParametersRefactoring(state, factory, rewritingManager, selectionService, selectedDeclarationProvider, uiDispatcherMock.Object));
        }
예제 #27
0
        public ExtractInterfaceRefactoring(
            IDeclarationFinderProvider declarationFinderProvider,
            IParseManager parseManager,
            IRefactoringPresenterFactory factory,
            IRewritingManager rewritingManager,
            ISelectionProvider selectionProvider,
            IUiDispatcher uiDispatcher)
            : base(rewritingManager, selectionProvider, factory, uiDispatcher)
        {
            _declarationFinderProvider = declarationFinderProvider;
            _parseManager = parseManager;

            _implementInterfaceRefactoring = new ImplementInterfaceRefactoring(_declarationFinderProvider, RewritingManager, SelectionProvider);
        }
예제 #28
0
 public RenameRefactoring(IVBE vbe, IRefactoringPresenterFactory <IRenamePresenter> factory, IMessageBox messageBox, RubberduckParserState state)
 {
     _vbe              = vbe;
     _factory          = factory;
     _messageBox       = messageBox;
     _state            = state;
     _model            = null;
     _initialSelection = new Tuple <ICodePane, Selection>(_vbe.ActiveCodePane, _vbe.ActiveCodePane.IsWrappingNullReference ? Selection.Empty : _vbe.ActiveCodePane.Selection);
     _modulesToRewrite = new List <QualifiedModuleName>();
     _renameActions    = new Dictionary <DeclarationType, Action>
     {
         { DeclarationType.Member, new Action(RenameMember) },
         { DeclarationType.Parameter, new Action(RenameParameter) },
         { DeclarationType.Event, new Action(RenameEvent) },
         { DeclarationType.Variable, new Action(RenameVariable) },
         { DeclarationType.Module, new Action(RenameModule) },
         { DeclarationType.Project, new Action(RenameProject) }
     };
     IsInterfaceMemberRename = false;
     RequestParseAfterRename = true;
     _neverRenameIdentifiers = NeverRenameList();
 }
예제 #29
0
        public RenameRefactoring(IRefactoringPresenterFactory factory, IMessageBox messageBox, IDeclarationFinderProvider declarationFinderProvider, IProjectsProvider projectsProvider, IRewritingManager rewritingManager, ISelectionService selectionService)
        {
            _messageBox = messageBox;
            _declarationFinderProvider = declarationFinderProvider;
            _projectsProvider          = projectsProvider;
            _rewritingManager          = rewritingManager;
            _selectionService          = selectionService;
            _model            = null;
            _presenterFactory = ((model) => DisposalActionContainer.Create(factory.Create <IRenamePresenter, RenameModel>(model), factory.Release));

            _renameActions = new Dictionary <DeclarationType, Action <IRewriteSession> >
            {
                { DeclarationType.Member, RenameMember },
                { DeclarationType.Parameter, RenameParameter },
                { DeclarationType.Event, RenameEvent },
                { DeclarationType.Variable, RenameVariable },
                { DeclarationType.Module, RenameModule },
                { DeclarationType.Project, RenameProject }
            };
            IsInterfaceMemberRename = false;
            _neverRenameIdentifiers = NeverRenameList();
        }
예제 #30
0
 public ExtractMethodRefactoring(IRefactoringPresenterFactory <IExtractMethodPresenter> factory, IActiveCodePaneEditor editor)
 {
     _factory = factory;
     _editor  = editor;
 }
 public RemoveParametersRefactoring(IRefactoringPresenterFactory<IRemoveParametersPresenter> factory, IActiveCodePaneEditor editor)
 {
     _factory = factory;
     _editor = editor;
 }
 public EncapsulateFieldRefactoring(IRefactoringPresenterFactory<IEncapsulateFieldPresenter> factory, IActiveCodePaneEditor editor)
 {
     _factory = factory;
     _editor = editor;
 }
 public RemoveParametersRefactoring(IRefactoringPresenterFactory<IRemoveParametersPresenter> factory)
 {
     _factory = factory;
 }
예제 #34
0
 public RenameRefactoring(IRefactoringPresenterFactory<RenamePresenter> factory)
 {
     _factory = factory;
 }
 public ExtractMethodRefactoring(IRefactoringPresenterFactory<IExtractMethodPresenter> factory, IActiveCodePaneEditor editor)
 {
     _factory = factory;
     _editor = editor;
 }
 public ReorderParametersRefactoring(IRefactoringPresenterFactory<IReorderParametersPresenter> factory, IActiveCodePaneEditor editor, IMessageBox messageBox)
 {
     _factory = factory;
     _editor = editor;
     _messageBox = messageBox;
 }
 public EncapsulateFieldRefactoring(IVBE vbe, IIndenter indenter, IRefactoringPresenterFactory <IEncapsulateFieldPresenter> factory)
 {
     _vbe      = vbe;
     _indenter = indenter;
     _factory  = factory;
 }
 public ReorderParametersRefactoring(IRefactoringPresenterFactory<ReorderParametersPresenter> factory)
 {
     _factory = factory;
 }