public RenamerProjectTreeActionHandler(
     UnconfiguredProject unconfiguredProject,
     IUnconfiguredProjectVsServices projectVsServices,
     [Import(typeof(VisualStudioWorkspace))] Workspace workspace,
     IEnvironmentOptions environmentOptions,
     IUserNotificationServices userNotificationServices,
     IRoslynServices roslynServices,
     IWaitIndicator waitService,
     IVsOnlineServices vsOnlineServices,
     IProjectThreadingService threadingService,
     IVsUIService <IVsExtensibility, IVsExtensibility3> extensibility,
     IVsService <SVsOperationProgress, IVsOperationProgressStatusService> operationProgressService,
     IVsService <SVsSettingsPersistenceManager, ISettingsManager> settingsManagerService)
 {
     _unconfiguredProject      = unconfiguredProject;
     _projectVsServices        = projectVsServices;
     _workspace                = workspace;
     _environmentOptions       = environmentOptions;
     _userNotificationServices = userNotificationServices;
     _roslynServices           = roslynServices;
     _waitService              = waitService;
     _vsOnlineServices         = vsOnlineServices;
     _threadingService         = threadingService;
     _extensibility            = extensibility;
     _operationProgressService = operationProgressService;
     _settingsManagerService   = settingsManagerService;
 }
Beispiel #2
0
 public SimpleRenameStrategy(
     IProjectThreadingService threadingService,
     IUserNotificationServices userNotificationService,
     IEnvironmentOptions environmentOptions,
     IRoslynServices roslynServices)
     : base(threadingService, userNotificationService, environmentOptions, roslynServices)
 {
 }
 public FileRenameTracker(IUnconfiguredProjectVsServices projectVsServices, VisualStudioWorkspace visualStudioWorkspace, IEnvironmentOptions environmentOptions, IUserNotificationServices userNotificationServices, IRoslynServices roslynServices)
 {
     _projectVsServices        = projectVsServices;
     _visualStudioWorkspace    = visualStudioWorkspace;
     _environmentOptions       = environmentOptions;
     _userNotificationServices = userNotificationServices;
     _roslynServices           = roslynServices;
 }
 public AbstractRenameStrategy(
     IProjectThreadingService threadingService,
     IUserNotificationServices userNotificationService,
     IEnvironmentOptions environmentOptions,
     IRoslynServices roslynServices)
 {
     _threadingService         = threadingService;
     _userNotificationServices = userNotificationService;
     _environmentOptions       = environmentOptions;
     _roslynServices           = roslynServices;
 }
Beispiel #5
0
 internal Renamer(IUnconfiguredProjectVsServices projectVsServices,
                  IUnconfiguredProjectTasksService unconfiguredProjectTasksService,
                  VisualStudioWorkspace workspace,
                  IVsService <Shell.Interop.SDTE, EnvDTE.DTE> dte,
                  IEnvironmentOptions environmentOptions,
                  IUserNotificationServices userNotificationServices,
                  IRoslynServices roslynServices,
                  IWaitIndicator waitService,
                  IRefactorNotifyService refactorNotifyService)
     : this(projectVsServices, unconfiguredProjectTasksService, workspace as Workspace, dte, environmentOptions, userNotificationServices, roslynServices, waitService, refactorNotifyService)
 {
 }
Beispiel #6
0
        public FileRenameTracker(IUnconfiguredProjectVsServices projectVsServices, VisualStudioWorkspace visualStudioWorkspace, IOptionsSettings optionsSettings, IUserNotificationServices userNotificationServices, IRoslynServices roslynServices)
        {
            Requires.NotNull(projectVsServices, nameof(projectVsServices));
            Requires.NotNull(visualStudioWorkspace, nameof(visualStudioWorkspace));
            Requires.NotNull(optionsSettings, nameof(optionsSettings));
            Requires.NotNull(userNotificationServices, nameof(userNotificationServices));
            Requires.NotNull(roslynServices, nameof(roslynServices));

            _projectVsServices        = projectVsServices;
            _visualStudioWorkspace    = visualStudioWorkspace;
            _optionsSettings          = optionsSettings;
            _userNotificationServices = userNotificationServices;
            _roslynServices           = roslynServices;
        }
Beispiel #7
0
        public FileRenameTracker(IUnconfiguredProjectVsServices projectVsServices, VisualStudioWorkspace visualStudioWorkspace, IEnvironmentOptions environmentOptions, IUserNotificationServices userNotificationServices, IRoslynServices roslynServices)
        {
            Requires.NotNull(projectVsServices, nameof(projectVsServices));
            Requires.NotNull(visualStudioWorkspace, nameof(visualStudioWorkspace));
            Requires.NotNull(environmentOptions, nameof(environmentOptions));
            Requires.NotNull(userNotificationServices, nameof(userNotificationServices));
            Requires.NotNull(roslynServices, nameof(roslynServices));

            _projectVsServices        = projectVsServices;
            _visualStudioWorkspace    = visualStudioWorkspace;
            _environmentOptions       = environmentOptions;
            _userNotificationServices = userNotificationServices;
            _roslynServices           = roslynServices;
        }
 public TestRenamerProjectTreeActionHandler(
     UnconfiguredProject unconfiguredProject,
     IUnconfiguredProjectVsServices projectVsServices,
     [Import(typeof(VisualStudioWorkspace))] Workspace workspace,
     IEnvironmentOptions environmentOptions,
     IUserNotificationServices userNotificationServices,
     IRoslynServices roslynServices,
     IWaitIndicator waitService,
     IVsOnlineServices vsOnlineServices,
     IProjectThreadingService threadingService,
     IVsUIService <IVsExtensibility, IVsExtensibility3> extensibility,
     IVsService <SVsOperationProgress, IVsOperationProgressStatusService> operationProgressService) :
     base(unconfiguredProject, projectVsServices, workspace, environmentOptions, userNotificationServices, roslynServices, waitService,
          vsOnlineServices, threadingService, extensibility, operationProgressService)
 {
 }
        internal async Task RenameAsync(string sourceCode, string oldFilePath, string newFilePath,
                                        IUserNotificationServices userNotificationServices,
                                        IRoslynServices roslynServices,
                                        IVsOnlineServices vsOnlineServices,
                                        string language,
                                        IVsService <SVsSettingsPersistenceManager, ISettingsManager> settingsManagerService)
        {
            var unconfiguredProject = UnconfiguredProjectFactory.Create(fullPath: $@"C:\project1.{ProjectFileExtension}");
            var projectServices     = IUnconfiguredProjectVsServicesFactory.Implement(
                threadingServiceCreator: () => IProjectThreadingServiceFactory.Create(),
                unconfiguredProjectCreator: () => unconfiguredProject);

            using var ws = new AdhocWorkspace();
            ws.AddSolution(InitializeWorkspace(ProjectId.CreateNewId(), oldFilePath, sourceCode, language));

            var environmentOptionsFactory       = IEnvironmentOptionsFactory.Implement((string category, string page, string property, bool defaultValue) => { return(true); });
            var waitIndicator                   = (new Mock <IWaitIndicator>()).Object;
            var projectAsynchronousTasksService = IProjectAsynchronousTasksServiceFactory.Create();
            var projectThreadingService         = IProjectThreadingServiceFactory.Create();
            var refactorNotifyService           = (new Mock <IRefactorNotifyService>()).Object;
            var extensibility                   = new Mock <IVsUIService <IVsExtensibility, IVsExtensibility3> >().Object;
            var operationProgressMock           = new Mock <IVsService <SVsOperationProgress, IVsOperationProgressStatusService> >().Object;
            var context = new Mock <IProjectTreeActionHandlerContext>().Object;

            var mockNode = new Mock <IProjectTree>();

            mockNode.SetupGet(x => x.FilePath).Returns(oldFilePath);
            mockNode.SetupGet(x => x.IsFolder).Returns(false);
            var node = mockNode.Object;

            var renamer = new TestRenamerProjectTreeActionHandler(unconfiguredProject,
                                                                  projectServices,
                                                                  ws,
                                                                  environmentOptionsFactory,
                                                                  userNotificationServices,
                                                                  roslynServices,
                                                                  waitIndicator,
                                                                  vsOnlineServices,
                                                                  projectAsynchronousTasksService,
                                                                  projectThreadingService,
                                                                  extensibility,
                                                                  operationProgressMock,
                                                                  settingsManagerService);

            await renamer.RenameAsync(context, node, newFilePath)
            .TimeoutAfter(TimeSpan.FromSeconds(1));
        }
Beispiel #10
0
 internal Renamer(Workspace workspace,
                  IProjectThreadingService threadingService,
                  IUserNotificationServices userNotificationServices,
                  IEnvironmentOptions environmentOptions,
                  IRoslynServices roslynServices,
                  Project project,
                  string oldFilePath,
                  string newFilePath)
 {
     _workspace                = workspace;
     _threadingService         = threadingService;
     _userNotificationServices = userNotificationServices;
     _environmentOptions       = environmentOptions;
     _roslynServices           = roslynServices;
     _project     = project;
     _newFilePath = newFilePath;
     _oldFilePath = oldFilePath;
 }
 public TestRenamerProjectTreeActionHandler(
     UnconfiguredProject unconfiguredProject,
     IUnconfiguredProjectVsServices projectVsServices,
     [Import(typeof(VisualStudioWorkspace))] Workspace workspace,
     IEnvironmentOptions environmentOptions,
     IUserNotificationServices userNotificationServices,
     IRoslynServices roslynServices,
     IWaitIndicator waitService,
     IVsOnlineServices vsOnlineServices,
     [Import(ExportContractNames.Scopes.UnconfiguredProject)] IProjectAsynchronousTasksService projectAsynchronousTasksService,
     IProjectThreadingService threadingService,
     IVsUIService <IVsExtensibility, IVsExtensibility3> extensibility,
     IVsService <SVsOperationProgress, IVsOperationProgressStatusService> operationProgressService,
     IVsService <SVsSettingsPersistenceManager, ISettingsManager> settingsManagerService) :
     base(unconfiguredProject, projectVsServices, workspace, environmentOptions, userNotificationServices, roslynServices, waitService,
          vsOnlineServices, projectAsynchronousTasksService, threadingService, extensibility, operationProgressService, settingsManagerService)
 {
 }
Beispiel #12
0
 internal Renamer(Workspace workspace,
                  IProjectThreadingService threadingService,
                  IUserNotificationServices userNotificationServices,
                  IOptionsSettings optionsSettings,
                  IRoslynServices roslynServices,
                  Project project,
                  string oldFilePath,
                  string newFilePath)
 {
     _workspace                = workspace;
     _threadingService         = threadingService;
     _userNotificationServices = userNotificationServices;
     _optionsSettings          = optionsSettings;
     _roslynServices           = roslynServices;
     _project     = project;
     _newFilePath = newFilePath;
     _oldFilePath = oldFilePath;
     _oldDocument = (from d in project.Documents where StringComparers.Paths.Equals(d.FilePath, oldFilePath) select d).FirstOrDefault();
 }
Beispiel #13
0
 internal Renamer(IUnconfiguredProjectVsServices projectVsServices,
                  IUnconfiguredProjectTasksService unconfiguredProjectTasksService,
                  [Import(typeof(VisualStudioWorkspace))] Workspace workspace,
                  IVsUIService <Shell.Interop.SDTE, DTE> dte,
                  IEnvironmentOptions environmentOptions,
                  IUserNotificationServices userNotificationServices,
                  IRoslynServices roslynServices,
                  IWaitIndicator waitService,
                  IRefactorNotifyService refactorNotifyService)
 {
     _projectVsServices = projectVsServices;
     _unconfiguredProjectTasksService = unconfiguredProjectTasksService;
     _workspace                = workspace;
     _dte                      = dte;
     _environmentOptions       = environmentOptions;
     _userNotificationServices = userNotificationServices;
     _roslynServices           = roslynServices;
     _waitService              = waitService;
     _refactorNotifyService    = refactorNotifyService;
 }
        internal async Task RenameAsync(string sourceCode, string oldFilePath, string newFilePath, IUserNotificationServices userNotificationServices, IRoslynServices roslynServices, string language)
        {
            using var ws = new AdhocWorkspace();
            var      projectId = ProjectId.CreateNewId();
            Solution solution  = ws.AddSolution(InitializeWorkspace(projectId, newFilePath, sourceCode, language));
            Project  project   = (from d in solution.Projects where d.Id == projectId select d).FirstOrDefault();

            var unconfiguredProject = UnconfiguredProjectFactory.Create(filePath: $@"C:\project1.{ProjectFileExtension}");
            var projectServices     = IUnconfiguredProjectVsServicesFactory.Implement(
                threadingServiceCreator: () => IProjectThreadingServiceFactory.Create(),
                unconfiguredProjectCreator: () => unconfiguredProject);
            var unconfiguredProjectTasksService = IUnconfiguredProjectTasksServiceFactory.Create();
            var environmentOptionsFactory       = IEnvironmentOptionsFactory.Implement((string category, string page, string property, bool defaultValue) => { return(true); });
            var waitIndicator         = (new Mock <IWaitIndicator>()).Object;
            var refactorNotifyService = (new Mock <IRefactorNotifyService>()).Object;

            var dte = IVsServiceFactory.Create <Shell.Interop.SDTE, EnvDTE.DTE>(null !);

            var renamer = new Renamer(projectServices, unconfiguredProjectTasksService, ws, dte, environmentOptionsFactory, userNotificationServices, roslynServices, waitIndicator, refactorNotifyService);
            await renamer.HandleRenameAsync(oldFilePath, newFilePath)
            .TimeoutAfter(TimeSpan.FromSeconds(1));
        }
        private async Task RenameAsync(string soureCode, string oldFilePath, string newFilePath, IUserNotificationServices userNotificationServices, IRoslynServices roslynServices, string language)
        {
            using (var ws = new AdhocWorkspace())
            {
                var      projectId = ProjectId.CreateNewId();
                Solution solution  = ws.AddSolution(InitializeWorkspace(projectId, newFilePath, soureCode, language));
                Project  project   = (from d in solution.Projects where d.Id == projectId select d).FirstOrDefault();

                var environmentOptionsFactory = IEnvironmentOptionsFactory.Implement((string category, string page, string property, bool defaultValue) => { return(true); });

                var renamer = new Renamer(ws, IProjectThreadingServiceFactory.Create(), userNotificationServices, environmentOptionsFactory, roslynServices, project, oldFilePath, newFilePath);
                await renamer.RenameAsync(project);
            }
        }
Beispiel #16
0
 public SimpleRenameStrategy(IProjectThreadingService threadingService, IUserNotificationServices userNotificationService, IOptionsSettings optionsSettings, IRoslynServices roslynServices)
     : base(threadingService, userNotificationService, optionsSettings)
 {
     _roslynServices = roslynServices;
 }