Example #1
0
        public AppManifestSpecialFileProvider(IPhysicalProjectTree projectTree,
                                              [Import(ExportContractNames.ProjectItemProviders.SourceFiles)] IProjectItemProvider sourceItemsProvider,
                                              [Import(AllowDefault = true)] Lazy <ICreateFileFromTemplateService> templateFileCreationService,
                                              IFileSystem fileSystem,
                                              ISpecialFilesManager specialFilesManager,
                                              ProjectProperties projectProperties)
            : base(projectTree, sourceItemsProvider, templateFileCreationService, fileSystem, specialFilesManager)
        {
            Requires.NotNull(projectProperties, nameof(projectProperties));

            _projectProperties = projectProperties;
        }
Example #2
0
        protected AbstractMoveCommand(IPhysicalProjectTree projectTree, SVsServiceProvider serviceProvider, ConfiguredProject configuredProject, IProjectAccessor accessor)
        {
            Requires.NotNull(projectTree, nameof(projectTree));
            Requires.NotNull(serviceProvider, nameof(serviceProvider));
            Requires.NotNull(configuredProject, nameof(configuredProject));
            Requires.NotNull(accessor, nameof(accessor));

            _projectTree       = projectTree;
            _serviceProvider   = serviceProvider;
            _configuredProject = configuredProject;
            _accessor          = accessor;
        }
Example #3
0
        internal static T CreateInstanceWithOverrideCreateFileAsync<T>(IPhysicalProjectTree projectTree, params object[] args)
            where T : AbstractFindByNameSpecialFileProvider
        {
            object[] arguments = new object[args.Length + 1];
            arguments[0] = projectTree;
            args.CopyTo(arguments, 1);

            // We override CreateFileAsync to call the CreateEmptyFileAsync which makes writting tests in the base easier
            var mock = new Mock<T>(arguments);
            mock.Protected().Setup<Task>("CreateFileAsync", ItExpr.IsAny<string>())
                .Returns<string>(path => projectTree.TreeStorage.CreateEmptyFileAsync(path));

            mock.CallBase = true;

            return mock.Object;
        }
        public AbstractAddItemCommand(
            IPhysicalProjectTree projectTree,
            IUnconfiguredProjectVsServices projectVsServices,
            SVsServiceProvider serviceProvider,
            OrderAddItemHintReceiver orderAddItemHintReceiver)
        {
            Requires.NotNull(projectTree, nameof(projectTree));
            Requires.NotNull(projectVsServices, nameof(projectVsServices));
            Requires.NotNull(serviceProvider, nameof(serviceProvider));
            Requires.NotNull(orderAddItemHintReceiver, nameof(orderAddItemHintReceiver));

            _projectTree              = projectTree;
            _projectVsServices        = projectVsServices;
            _serviceProvider          = serviceProvider;
            _orderAddItemHintReceiver = orderAddItemHintReceiver;
        }
Example #5
0
        public AbstractSpecialFileProvider(IPhysicalProjectTree projectTree,
                                           [Import(ExportContractNames.ProjectItemProviders.SourceFiles)] IProjectItemProvider sourceItemsProvider,
                                           [Import(AllowDefault = true)] Lazy <ICreateFileFromTemplateService> templateFileCreationService,
                                           IFileSystem fileSystem,
                                           ISpecialFilesManager specialFileManager)
        {
            Requires.NotNull(projectTree, nameof(projectTree));
            Requires.NotNull(sourceItemsProvider, nameof(sourceItemsProvider));
            Requires.NotNull(fileSystem, nameof(fileSystem));
            Requires.NotNull(specialFileManager, nameof(specialFileManager));

            _projectTree                 = projectTree;
            _sourceItemsProvider         = sourceItemsProvider;
            _templateFileCreationService = templateFileCreationService;
            _fileSystem          = fileSystem;
            _specialFilesManager = specialFileManager;
        }
Example #6
0
        /// <summary>
        /// Show the item dialog window to add new/existing items.
        /// </summary>
        private static async Task ShowAddItemDialogAsync(
            IPhysicalProjectTree projectTree,
            IUnconfiguredProjectVsServices projectVsServices,
            SVsServiceProvider serviceProvider,
            IProjectTree target,
            AddItemAction addItemAction)
        {
            Requires.NotNull(projectTree, nameof(projectTree));
            Requires.NotNull(projectVsServices, nameof(projectVsServices));
            Requires.NotNull(serviceProvider, nameof(serviceProvider));
            Requires.NotNull(target, nameof(target));

            await projectVsServices.ThreadingService.SwitchToUIThread();

            var strBrowseLocations = projectTree.TreeProvider.GetAddNewItemDirectory(target);

            ShowAddItemDialog(serviceProvider, target, projectVsServices.VsProject, strBrowseLocations, addItemAction);
        }
        internal static T CreateInstanceWithOverrideCreateFileAsync <T>(ISpecialFilesManager specialFilesManager, IPhysicalProjectTree projectTree, params object[] additionalArguments)
            where T : AbstractFindByNameUnderAppDesignerSpecialFileProvider
        {
            object[] arguments = new object[3 + additionalArguments.Length];
            arguments[0] = specialFilesManager;
            arguments[1] = projectTree;
            arguments[2] = (ICreateFileFromTemplateService)null !;
            additionalArguments.CopyTo(arguments, 3);

            // We override CreateFileAsync to call the CreateEmptyFileAsync which makes writting tests in the base easier
            var mock = new Mock <T>(arguments);

            mock.Protected().Setup <Task>("CreateFileCoreAsync", ItExpr.IsAny <string>())
            .Returns <string>(path => projectTree.TreeStorage.CreateEmptyFileAsync(path));

            mock.CallBase = true;

            return(mock.Object);
        }
        internal AbstractAddItemCommandHandler CreateInstance(IPhysicalProjectTree projectTree = null, IUnconfiguredProjectVsServices projectVsServices = null, IProjectTreeProvider provider = null, IVsAddProjectItemDlg addItemDialog = null, string capability = null)
        {
            var configuredProject = ConfiguredProjectFactory.Create(IProjectCapabilitiesScopeFactory.Create(new string[] { capability ?? TestAddItemCommand.Capability }));

            projectTree ??= IPhysicalProjectTreeFactory.Create(provider);
            projectVsServices ??= IUnconfiguredProjectVsServicesFactory.Implement(
                threadingServiceCreator: () => IProjectThreadingServiceFactory.Create()
                );
            var addItemDialogService = IVsUIServiceFactory.Create <SVsAddProjectItemDlg, IVsAddProjectItemDlg>(addItemDialog);

            string result      = "DirName";
            var    vsShellMock = new Mock <IVsShell>();

            vsShellMock.Setup(x => x.LoadPackageString(ref It.Ref <Guid> .IsAny, (uint)TestAddItemCommand.ResourceIds.DirName, out result)).Returns(0);
            result = "TemplateName";
            vsShellMock.Setup(x => x.LoadPackageString(ref It.Ref <Guid> .IsAny, (uint)TestAddItemCommand.ResourceIds.TemplateName, out result)).Returns(0);

            var vsShellService = IVsUIServiceFactory.Create <SVsShell, IVsShell>(vsShellMock.Object);

            return(new TestAddItemCommand(configuredProject, projectTree, projectVsServices, addItemDialogService, vsShellService));
        }
 override internal AbstractMoveCommand CreateInstance(IPhysicalProjectTree projectTree, Shell.SVsServiceProvider serviceProvider, ConfiguredProject configuredProject, IProjectAccessor accessor)
 {
     return(new MoveDownCommand(projectTree, serviceProvider, configuredProject, accessor));
 }
Example #10
0
 protected AbstractAppXamlSpecialFileProvider(string fileName, IPhysicalProjectTree projectTree)
     : base(fileName, projectTree)
 {
 }
Example #11
0
 public AddItemDialogService(IUnconfiguredProjectVsServices unconfiguredProjectVsServices, IPhysicalProjectTree projectTree, IVsUIService <SVsAddProjectItemDlg, IVsAddProjectItemDlg> addProjectItemDialog)
 {
     _projectVsServices    = unconfiguredProjectVsServices;
     _projectTree          = projectTree;
     _addProjectItemDialog = addProjectItemDialog;
 }
 internal abstract AbstractAddClassProjectCommand CreateInstance(IPhysicalProjectTree tree, IUnconfiguredProjectVsServices services, Shell.SVsServiceProvider serviceProvider);
Example #13
0
 public AddNewItemAboveCommand(IPhysicalProjectTree projectTree, IUnconfiguredProjectVsServices projectVsServices, SVsServiceProvider serviceProvider) : base(projectTree, projectVsServices, serviceProvider)
 {
 }
Example #14
0
 protected AbstractFindByNameSpecialFileProvider(string fileName, IPhysicalProjectTree projectTree)
     : base(projectTree)
 {
     _fileName = fileName;
 }
 internal abstract AbstractFindByNameUnderAppDesignerSpecialFileProvider CreateInstance(ISpecialFilesManager specialFilesManager, IPhysicalProjectTree projectTree);
 internal override AbstractFindByNameUnderAppDesignerSpecialFileProvider CreateInstance(ISpecialFilesManager specialFilesManager, IPhysicalProjectTree projectTree)
 {
     return(CreateInstanceWithOverrideCreateFileAsync <VisualBasicAssemblyInfoSpecialFileProvider>(specialFilesManager, projectTree));
 }
Example #17
0
 internal abstract AbstractFindByNameSpecialFileProvider CreateInstance(IPhysicalProjectTree projectTree);
Example #18
0
        public static IUnconfiguredProjectCommonServices Create(UnconfiguredProject project = null, IPhysicalProjectTree projectTree = null, IProjectThreadingService threadingService = null, ConfiguredProject configuredProject = null, ProjectProperties projectProperties = null)
        {
            var mock = new Mock <IUnconfiguredProjectCommonServices>();

            if (project != null)
            {
                mock.Setup(s => s.Project)
                .Returns(project);
            }

            if (projectTree != null)
            {
                mock.Setup(s => s.ProjectTree)
                .Returns(projectTree);
            }

            if (threadingService != null)
            {
                mock.Setup(s => s.ThreadingService)
                .Returns(threadingService);
            }

            if (configuredProject != null)
            {
                mock.Setup(s => s.ActiveConfiguredProject)
                .Returns(configuredProject);
            }

            if (projectProperties != null)
            {
                mock.Setup(s => s.ActiveConfiguredProjectProperties)
                .Returns(projectProperties);
            }

            return(mock.Object);
        }
Example #19
0
 internal override AbstractAddClassProjectCommand CreateInstance(IPhysicalProjectTree tree, IUnconfiguredProjectVsServices services, SVsServiceProvider serviceProvider) =>
 new AddClassProjectCSharpCommand(tree, services, serviceProvider);
 internal override AbstractAddClassProjectCommand CreateInstance(IPhysicalProjectTree tree, IUnconfiguredProjectVsServices services, IVsUIService <SVsAddProjectItemDlg, IVsAddProjectItemDlg> addItemDialog)
 {
     return(new AddClassProjectCSharpCommand(tree, services, addItemDialog));
 }
Example #21
0
 public AddClassProjectCSharpCommand(IPhysicalProjectTree projectTree, IUnconfiguredProjectVsServices projectVsServices, SVsServiceProvider serviceProvider) : base(projectTree, projectVsServices, serviceProvider)
 {
 }
Example #22
0
 public MoveDownCommand(IPhysicalProjectTree projectTree, SVsServiceProvider serviceProvider, ConfiguredProject configuredProject, IProjectAccessor accessor) : base(projectTree, serviceProvider, configuredProject, accessor)
 {
 }
 public VisualBasicAppXamlSpecialFileProvider(IPhysicalProjectTree projectTree, ICreateFileFromTemplateService templateFileCreationService)
     : base("Application.xaml", projectTree)
 {
     _templateFileCreationService = templateFileCreationService;
 }
 public AppDesignerFolderSpecialFileProvider(IPhysicalProjectTree projectTree, ProjectProperties properties)
     : base(projectTree, isFolder: true)
 {
     _properties = properties;
 }
 internal override AbstractFindByNameSpecialFileProvider CreateInstance(IPhysicalProjectTree projectTree)
 {
     return(CreateInstanceWithOverrideCreateFileAsync <VisualBasicAppConfigSpecialFileProvider>(projectTree, (ICreateFileFromTemplateService)null !));
 }
Example #26
0
 public MoveUpCommand(IPhysicalProjectTree projectTree, SVsServiceProvider serviceProvider, ConfiguredProject configuredProject) : base(projectTree, serviceProvider, configuredProject)
 {
 }
 internal abstract AbstractMoveCommand CreateInstance(IPhysicalProjectTree projectTree, Shell.SVsServiceProvider serviceProvider, ConfiguredProject configuredProject, IProjectAccessor accessor);
 public CSharpAppXamlSpecialFileProvider(IPhysicalProjectTree projectTree)
     : base("App.xaml", projectTree)
 {
 }
Example #29
0
 public AddExistingItemCommand(IPhysicalProjectTree projectTree, IUnconfiguredProjectVsServices projectVsServices, SVsServiceProvider serviceProvider) : base(projectTree, projectVsServices, serviceProvider)
 {
 }
 public VS2kAddItemCommandHandler(ConfiguredProject configuredProject, IPhysicalProjectTree projectTree, IUnconfiguredProjectVsServices projectVsServices, IVsUIService <IVsAddProjectItemDlg> addItemDialog, IVsUIService <SVsShell, IVsShell> vsShell)
     : base(configuredProject, projectTree, projectVsServices, addItemDialog, vsShell)
 {
 }