Example #1
0
 public SolutionManager()
     : this(
         ServiceLocator.GetInstance <DTE>(),
         ServiceLocator.GetGlobalService <SVsSolution, IVsSolution>(),
         ServiceLocator.GetGlobalService <SVsShellMonitorSelection, IVsMonitorSelection>())
 {
 }
        private static bool ShellIsVisualStudioExpressForWindows8()
        {
            if (VsVersionHelper.VsMajorVersion < 11)
            {
                // We only care for the Dev11 or above version of the express SKU.
                return(false);
            }

            var vsShell = ServiceLocator.GetGlobalService <SVsShell, IVsShell>();

            if (vsShell == null)
            {
                return(false);
            }

            object skuValue;
            var    isExpress = ErrorHandler.Succeeded(vsShell.GetProperty((int)__VSSPROPID2.VSSPROPID_SKUEdition, out skuValue)) && skuValue is int && (int)skuValue == ExpressSku;

            if (!isExpress)
            {
                return(false);
            }

            object subSkuValue;
            var    isWindows = ErrorHandler.Succeeded(vsShell.GetProperty((int)__VSSPROPID2.VSSPROPID_SubSKUEdition, out subSkuValue)) && subSkuValue is int && (int)subSkuValue == WindowsSubSku;

            if (!isWindows)
            {
                return(false);
            }

            return(true);
        }
Example #3
0
 public ProductUpdateService() :
     this(ServiceLocator.GetGlobalService <SVsExtensionRepository, IVsExtensionRepository>(),
          ServiceLocator.GetGlobalService <SVsExtensionManager, IVsExtensionManager>(),
          ServiceLocator.GetGlobalService <SVsUIShell, IVsUIShell>(),
          ServiceLocator.GetInstance <IProductUpdateSettings>())
 {
 }
Example #4
0
        private static VsHierarchyItem GetHierarchyItemForProject(EnvDTE.Project project)
        {
            IVsHierarchy hierarchy;

            // Get the solution
            IVsSolution solution = ServiceLocator.GetGlobalService <SVsSolution, IVsSolution>();
            int         hr       = solution.GetProjectOfUniqueName(project.UniqueName, out hierarchy);

            if (hr != VSConstants.S_OK)
            {
                Marshal.ThrowExceptionForHR(hr);
            }
            return(new VsHierarchyItem(hierarchy));
        }
Example #5
0
        private static IHostProvider GetPowerShellHostProvider()
        {
            // The PowerConsole design enables multiple hosts (PowerShell, Python, Ruby)
            // For the Output window console, we're only interested in the PowerShell host.
            // Here we filter out the the PowerShell host provider based on its name.

            // The PowerShell host provider name is defined in PowerShellHostProvider.cs
            const string PowerShellHostProviderName = "NuGetConsole.Host.PowerShell";

            var componentModel      = ServiceLocator.GetGlobalService <SComponentModel, IComponentModel>();
            var exportProvider      = componentModel.DefaultExportProvider;
            var hostProviderExports = exportProvider.GetExports <IHostProvider, IHostMetadata>();
            var psProvider          = hostProviderExports.Where(export => export.Metadata.HostName == PowerShellHostProviderName).Single();

            return(psProvider.Value);
        }
Example #6
0
 public VsPackageManagerFactory(ISolutionManager solutionManager,
                                IPackageRepositoryFactory repositoryFactory,
                                IVsPackageSourceProvider packageSourceProvider,
                                IFileSystemProvider fileSystemProvider,
                                IRepositorySettings repositorySettings,
                                VsPackageInstallerEvents packageEvents,
                                IPackageRepository activePackageSourceRepository,
                                IMachineWideSettings machineWideSettings) :
     this(solutionManager,
          repositoryFactory,
          packageSourceProvider,
          fileSystemProvider,
          repositorySettings,
          packageEvents,
          activePackageSourceRepository,
          ServiceLocator.GetGlobalService <SVsFrameworkMultiTargeting, IVsFrameworkMultiTargeting>(),
          machineWideSettings)
 {
 }
Example #7
0
 public PackageRestoreManager(
     ISolutionManager solutionManager,
     IFileSystemProvider fileSystemProvider,
     IPackageRepositoryFactory packageRepositoryFactory,
     IVsPackageManagerFactory packageManagerFactory,
     IVsPackageSourceProvider packageSourceProvider,
     IVsPackageInstallerEvents packageInstallerEvents,
     ISettings settings) :
     this(ServiceLocator.GetInstance <DTE>(),
          solutionManager,
          fileSystemProvider,
          packageRepositoryFactory,
          packageSourceProvider,
          packageManagerFactory,
          packageInstallerEvents,
          MachineCache.Default,
          ServiceLocator.GetGlobalService <SVsThreadedWaitDialogFactory, IVsThreadedWaitDialogFactory>(),
          settings)
 {
 }
        /// <summary>
        /// DO NOT delete this. This method is only called from PowerShell functional test.
        /// </summary>
        public static void RemoveProject(string projectName)
        {
            if (String.IsNullOrEmpty(projectName))
            {
                throw new ArgumentException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "projectName");
            }

            var solutionManager = (ISolutionManager)ServiceLocator.GetInstance <ISolutionManager>();

            if (solutionManager != null)
            {
                var project = solutionManager.GetProject(projectName);
                if (project == null)
                {
                    throw new InvalidOperationException();
                }

                var dte = ServiceLocator.GetGlobalService <SDTE, DTE>();
                dte.Solution.Remove(project);
            }
        }
 public OptionsPageActivator() :
     this(ServiceLocator.GetGlobalService <SVsUIShell, IVsUIShell>())
 {
 }
 public VsSourceControlTracker(ISolutionManager solutionManager, IFileSystemProvider fileSystemProvider, ISettings solutionSettings) :
     this(solutionManager, fileSystemProvider, ServiceLocator.GetGlobalService <SVsTrackProjectDocuments, IVsTrackProjectDocuments2>(), solutionSettings)
 {
 }
Example #11
0
 public VS2010UpdateWorker() :
     this(ServiceLocator.GetGlobalService <SVsExtensionRepository, IVsExtensionRepository>(),
          ServiceLocator.GetGlobalService <SVsExtensionManager, IVsExtensionManager>())
 {
 }
Example #12
0
 public ProductUpdateService() :
     this(ServiceLocator.GetGlobalService <SVsUIShell, IVsUIShell>(),
          ServiceLocator.GetInstance <IProductUpdateSettings>())
 {
 }
Example #13
0
 public VsFileSystemProvider()
     : this(ServiceLocator.GetInstance <DTE>(),
            ServiceLocator.GetGlobalService <SComponentModel, IComponentModel>())
 {
 }