public MoveCloserToUsageRefactoring(IDeclarationFinderProvider declarationFinderProvider, IMessageBox messageBox, IRewritingManager rewritingManager, ISelectionService selectionService)
 {
     _selectionService          = selectionService;
     _declarationFinderProvider = declarationFinderProvider;
     _rewritingManager          = rewritingManager;
     _messageBox = messageBox;
 }
Exemplo n.º 2
0
 public MoveMultipleFoldersRefactoringAction(
     IRewritingManager rewritingManager,
     MoveFolderRefactoringAction moveFolder)
     : base(rewritingManager)
 {
     _moveFolder = moveFolder;
 }
Exemplo n.º 3
0
 public ImplementInterfaceRefactoringAction(
     AddInterfaceImplementationsRefactoringAction addImplementationsRefactoringAction,
     IRewritingManager rewritingManager)
     : base(rewritingManager)
 {
     _addImplementationsRefactoringAction = addImplementationsRefactoringAction;
 }
Exemplo n.º 4
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();
 }
 /// <summary>
 /// Removes or adds UserDefinedTypeMember declarations to an existing UserDefinedType.
 /// Adding a UDTMember is based on a Declaration prototype (typically a variable declaration but can a UserDefinedTypeMember, Constant, or Function).
 /// </summary>
 /// <remarks>
 /// The refactoring actions does not modify the prototype declaration or its references.
 /// The refactoring actions does not modify references for removed UDTMembers.
 /// The refactoring action does not provide any identifier validation or conflictAnalysis
 /// </remarks>
 public ModifyUserDefinedTypeRefactoringAction(IDeclarationFinderProvider declarationFinderProvider, IRewritingManager rewritingManager, ICodeBuilder codeBuilder)
     : base(rewritingManager)
 {
     _declarationFinderProvider = declarationFinderProvider;
     _rewritingManager          = rewritingManager;
     _codeBuilder = codeBuilder;
 }
 protected RefactoringPreviewProviderWrapperBase(
     ICodeOnlyRefactoringAction <TModel> refactoringAction,
     IRewritingManager rewritingManager)
 {
     _refactoringAction = refactoringAction;
     _rewritingManager  = rewritingManager;
 }
 public RefactorRemoveParametersCommand(IVBE vbe, RubberduckParserState state, IMessageBox msgbox, IRewritingManager rewritingManager)
     : base(vbe)
 {
     _msgbox           = msgbox;
     _state            = state;
     _rewritingManager = rewritingManager;
 }
Exemplo n.º 8
0
 public ProjectExplorerRefactorRenameCommand(IVBE vbe, RubberduckParserState state, IMessageBox msgBox, IRewritingManager rewritingManager)
     : base(vbe)
 {
     _state            = state;
     _rewritingManager = rewritingManager;
     _msgBox           = msgBox;
 }
 public RemoveParametersRefactoring(IDeclarationFinderProvider declarationFinderProvider, IRefactoringPresenterFactory factory, IRewritingManager rewritingManager, ISelectionService selectionService)
 {
     _declarationFinderProvider = declarationFinderProvider;
     _selectionService          = selectionService;
     _rewritingManager          = rewritingManager;
     _presenterFactory          = (model => DisposalActionContainer.Create(factory.Create <IRemoveParametersPresenter, RemoveParametersModel>(model), factory.Release));
 }
Exemplo n.º 10
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 }
            };
        }
Exemplo n.º 11
0
 public ExtractInterfaceRefactoring(IVBE vbe, IMessageBox messageBox, IRefactoringPresenterFactory <IExtractInterfacePresenter> factory, IRewritingManager rewritingManager)
 {
     _vbe = vbe;
     _rewritingManager = rewritingManager;
     _messageBox       = messageBox;
     _factory          = factory;
 }
Exemplo n.º 12
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;
        }
 public EncapsulateFieldRefactoring(IVBE vbe, IIndenter indenter, IRefactoringPresenterFactory <IEncapsulateFieldPresenter> factory, IRewritingManager rewritingManager)
 {
     _vbe              = vbe;
     _indenter         = indenter;
     _factory          = factory;
     _rewritingManager = rewritingManager;
 }
Exemplo n.º 14
0
 public ChangeFolderRefactoringAction(
     IRewritingManager rewritingManager,
     MoveToFolderRefactoringAction moveToFolder)
     : base(rewritingManager)
 {
     _moveToFolder = moveToFolder;
 }
 public RenameFolderRefactoringAction(
     IRewritingManager rewritingManager,
     ChangeFolderRefactoringAction changeFolder)
     : base(rewritingManager)
 {
     _changeFolder = changeFolder;
 }
 public RefactorEncapsulateFieldCommand(IVBE vbe, RubberduckParserState state, Indenter indenter, IRewritingManager rewritingManager)
     : base(vbe)
 {
     _state            = state;
     _rewritingManager = rewritingManager;
     _indenter         = indenter;
 }
Exemplo n.º 17
0
        protected override CommandBase TestCommand(
            IVBE vbe, RubberduckParserState state,
            IRewritingManager rewritingManager,
            ISelectionService selectionService)
        {
            var factory = new Mock <IRefactoringPresenterFactory>().Object;
            var msgBox  = new Mock <IMessageBox>().Object;

            var uiDispatcherMock = new Mock <IUiDispatcher>();

            uiDispatcherMock
            .Setup(m => m.Invoke(It.IsAny <Action>()))
            .Callback((Action action) => action.Invoke());
            var userInteraction = new RefactoringUserInteraction <IAnnotateDeclarationPresenter, AnnotateDeclarationModel>(factory, uiDispatcherMock.Object);

            var annotationUpdater         = new AnnotationUpdater(state);
            var attributesUpdater         = new AttributesUpdater(state);
            var annotateDeclarationAction = new AnnotateDeclarationRefactoringAction(rewritingManager, annotationUpdater, attributesUpdater);

            var selectedDeclarationProvider = new SelectedDeclarationProvider(selectionService, state);

            var refactoring = new AnnotateDeclarationRefactoring(annotateDeclarationAction, selectedDeclarationProvider, selectionService, userInteraction);
            var notifier    = new AnnotateDeclarationFailedNotifier(msgBox);

            return(new AnnotateSelectedMemberCommand(refactoring, notifier, selectionService, state, state, selectedDeclarationProvider));
        }
 public RefactorExtractInterfaceCommand(IVBE vbe, RubberduckParserState state, IMessageBox messageBox, IRewritingManager rewritingManager)
     : base(vbe)
 {
     _state            = state;
     _rewritingManager = rewritingManager;
     _messageBox       = messageBox;
 }
 public RefactorMoveCloserToUsageCommand(IVBE vbe, RubberduckParserState state, IMessageBox msgbox, IRewritingManager rewritingManager)
     : base(vbe)
 {
     _state            = state;
     _rewritingManager = rewritingManager;
     _msgbox           = msgbox;
 }
Exemplo n.º 20
0
        //The only relevant test is in the base class.

        protected override CommandBase TestCommand(
            IVBE vbe,
            RubberduckParserState state,
            IRewritingManager rewritingManager,
            ISelectionService selectionService)
        {
            var factory = new Mock <IRefactoringPresenterFactory>().Object;
            var msgBox  = new Mock <IMessageBox>().Object;

            var uiDispatcherMock = new Mock <IUiDispatcher>();

            uiDispatcherMock
            .Setup(m => m.Invoke(It.IsAny <Action>()))
            .Callback((Action action) => action.Invoke());
            var userInteraction = new RefactoringUserInteraction <IMoveMultipleFoldersPresenter, MoveMultipleFoldersModel>(factory, uiDispatcherMock.Object);

            var annotationUpdater         = new AnnotationUpdater(state);
            var moveToFolderAction        = new MoveToFolderRefactoringAction(rewritingManager, annotationUpdater);
            var changeFolderAction        = new ChangeFolderRefactoringAction(rewritingManager, moveToFolderAction);
            var moveFolderAction          = new MoveFolderRefactoringAction(rewritingManager, changeFolderAction);
            var moveMultipleFoldersAction = new MoveMultipleFoldersRefactoringAction(rewritingManager, moveFolderAction);

            var selectedDeclarationProvider = new SelectedDeclarationProvider(selectionService, state);

            var refactoring = new MoveContainingFolderRefactoring(moveMultipleFoldersAction, selectedDeclarationProvider, selectionService, userInteraction, state, state);
            var notifier    = new MoveContainingFolderRefactoringFailedNotifier(msgBox);

            return(new CodePaneRefactorMoveContainingFolderCommand(refactoring, notifier, selectionService, state, selectedDeclarationProvider));
        }
 public CodePaneRefactorRenameCommand(IVBE vbe, RubberduckParserState state, IMessageBox messageBox, IRewritingManager rewritingManager)
     : base(vbe)
 {
     _state            = state;
     _rewritingManager = rewritingManager;
     _messageBox       = messageBox;
 }
        protected override IRefactoring TestRefactoring(IRewritingManager rewritingManager, RubberduckParserState state, ISelectionService selectionService)
        {
            var selectedDeclarationProvider = new SelectedDeclarationProvider(selectionService, state);
            var baseRefactoring             = new IntroduceFieldRefactoringAction(state, rewritingManager);

            return(new IntroduceFieldRefactoring(baseRefactoring, selectionService, selectedDeclarationProvider));
        }
Exemplo n.º 23
0
 public EncapsulateFieldUseBackingFieldPreviewProvider(EncapsulateFieldUseBackingFieldRefactoringAction refactoringAction,
                                                       IRewritingManager rewritingManager,
                                                       INewContentAggregatorFactory aggregatorFactory)
     : base(refactoringAction, rewritingManager)
 {
     _aggregatorFactory = aggregatorFactory;
 }
Exemplo n.º 24
0
 public MoveToFolderRefactoringAction(
     IRewritingManager rewritingManager,
     IAnnotationUpdater annotationUpdater)
     : base(rewritingManager)
 {
     _annotationUpdater = annotationUpdater;
 }
Exemplo n.º 25
0
 public EncapsulateFieldRefactoring(RubberduckParserState state, IIndenter indenter, IRefactoringPresenterFactory factory, IRewritingManager rewritingManager, ISelectionService selectionService)
 {
     _state            = state;
     _indenter         = indenter;
     _factory          = factory;
     _rewritingManager = rewritingManager;
     _selectionService = selectionService;
 }
Exemplo n.º 26
0
 protected override IRefactoring TestRefactoring(
     IRewritingManager rewritingManager,
     RubberduckParserState state,
     RefactoringUserInteraction <IEncapsulateFieldPresenter, EncapsulateFieldModel> userInteraction,
     ISelectionService selectionService)
 {
     return(Support.SupportTestRefactoring(rewritingManager, state, userInteraction, selectionService));
 }
Exemplo n.º 27
0
 public RenameCommand(IVBE vbe, IRefactoringDialog <RenameViewModel> view, RubberduckParserState state, IMessageBox msgBox, IRewritingManager rewritingManager)
 {
     _vbe              = vbe;
     _state            = state;
     _rewritingManager = rewritingManager;
     _view             = view;
     _msgBox           = msgBox;
 }
 public RemoveUnusedParameterQuickFix(IVBE vbe, RubberduckParserState state, IMessageBox messageBox, IRewritingManager rewritingManager)
     : base(typeof(ParameterNotUsedInspection))
 {
     _vbe              = vbe;
     _state            = state;
     _rewritingManager = rewritingManager;
     _messageBox       = messageBox;
 }
Exemplo n.º 29
0
        private static IRefactoring TestRefactoring(IVBE vbe, IRewritingManager rewritingManager, RubberduckParserState state, EncapsulateFieldModel model)
        {
            var selectionService = MockedSelectionService();
            var indenter         = CreateIndenter(vbe);
            var factory          = SetupFactory(model);

            return(new EncapsulateFieldRefactoring(state, indenter, factory.Object, rewritingManager, selectionService));
        }
 public MoveFieldCloserToUsageQuickFix(IVBE vbe, RubberduckParserState state, IMessageBox messageBox, IRewritingManager rewritingManager)
     : base(typeof(MoveFieldCloserToUsageInspection))
 {
     _vbe              = vbe;
     _state            = state;
     _rewritingManager = rewritingManager;
     _messageBox       = messageBox;
 }