protected GuidanceLinkBase(IGuidanceManager guidanceManager, string bindingName) : base(guidanceManager) { Guard.NotNull(() => bindingName, bindingName); this.bindingName = bindingName; }
public GuidanceConditionsEvaluator(IGuidanceManager guidanceManager) { Guard.NotNull(() => guidanceManager, guidanceManager); this.guidanceManager = guidanceManager; Current = this; }
private static string GetDescription(IGuidanceManager guidanceManager, IGuidanceExtension extension) { return(guidanceManager.InstalledGuidanceExtensions .Where(reg => reg.ExtensionId.Equals(extension.ExtensionId, StringComparison.OrdinalIgnoreCase)) .Select(reg => reg.ExtensionManifest.Header.Description) .FirstOrDefault()); }
/// <summary> /// Gets whether the given guidance extension is installed in the system. /// </summary> public static bool IsInstalled(this IGuidanceManager manager, string extensionId) { Guard.NotNull(() => manager, manager); Guard.NotNullOrEmpty(() => extensionId, extensionId); return(manager.FindRegistration(extensionId) != null); }
public static void ActivateSharedGuidanceWorkflow(this IGuidanceManager guidanceManager, IServiceProvider provider, string extensionId) { Guard.NotNull(() => guidanceManager, guidanceManager); Guard.NotNull(() => provider, provider); Guard.NotNullOrEmpty(() => extensionId, extensionId); var registration = guidanceManager.InstalledGuidanceExtensions.First(e => e.ExtensionId == extensionId); if (registration == null) { tracer.Error(Resources.GuidanceManagerExtensions_ErrorNoRegistration, extensionId); return; } else { // Ensure at least one instance exists var instance = guidanceManager.InstantiatedGuidanceExtensions.FirstOrDefault(e => e.ExtensionId == extensionId); if (instance == null) { // Create the first instance of the guidance tracer.ShieldUI(() => { instance = guidanceManager.Instantiate(extensionId, registration.DefaultName); }, Resources.GuidanceManagerExtensions_ErrorGuidanceInstantiationFailed, registration.DefaultName, extensionId); } // Activate the instance if (instance != null) { guidanceManager.ActivateGuidanceInstance(provider, instance); } } }
/// <summary> /// Gets whether the given guidance extension has been instantiated in the solution. /// </summary> public static bool IsInstantiated(this IGuidanceManager manager, string extensionId) { Guard.NotNull(() => manager, manager); Guard.NotNullOrEmpty(() => extensionId, extensionId); return(manager.InstantiatedGuidanceExtensions.Any(ge => ge.ExtensionId.Equals(extensionId, StringComparison.OrdinalIgnoreCase))); }
/// <summary> /// Gets the registration with given extension /// </summary> public static IGuidanceExtensionRegistration FindRegistration(this IGuidanceManager manager, string extensionId) { Guard.NotNull(() => manager, manager); Guard.NotNullOrEmpty(() => extensionId, extensionId); return(manager.InstalledGuidanceExtensions.FirstOrDefault(reg => reg.ExtensionId.Equals(extensionId, StringComparison.OrdinalIgnoreCase))); }
private static string GetDescription(IGuidanceManager guidanceManager, IGuidanceExtension extension) { return guidanceManager.InstalledGuidanceExtensions .Where(reg => reg.ExtensionId.Equals(extension.ExtensionId, StringComparison.OrdinalIgnoreCase)) .Select(reg => reg.ExtensionManifest.Header.Description) .FirstOrDefault(); }
/// <summary> /// Instantiates the guidance extension in a solution. /// </summary> /// <param name="registration">The guidance extension registration information, which includes its identifier and manifest information..</param> /// <param name="instanceName">Name of the instance.</param> /// <param name="guidanceManager">An instance of the <see cref="IGuidanceManager"/></param> /// <remarks> /// This method is called when a feature is first instantiated in a solution. /// </remarks> public void Instantiate(IGuidanceExtensionRegistration registration, string instanceName, IGuidanceManager guidanceManager) { using (new GuidanceExtensionInstantiationScope()) { this.ExtensionId = registration.ExtensionId; this.guidanceManager = guidanceManager; this.InstanceName = instanceName; this.Registration = registration; this.Trace = Tracer.Get(this.GetType()); this.OnInstantiate(); if (!DefaultTemplateInstantiationScope.IsActive) { var launchPoint = this.FindLaunchPoint(); if (launchPoint != null) { // There is an issue in all versions of VS up to and including VS2008 SP1 // that won't allow the expansion of a multi-project template unless the Solution node in the Solution explorer // is selected. The code below works for any solution with less than 100,000 items this.Solution.SelectUp(); this.UnfoldDefaultTemplate(launchPoint); } } } }
/// <summary> /// Gets whether the given guidance extension has been instantiated in the solution. /// </summary> public static bool IsInstantiated(this IGuidanceManager manager, string extensionId, string instanceName) { Guard.NotNull(() => manager, manager); Guard.NotNullOrEmpty(() => extensionId, extensionId); Guard.NotNullOrEmpty(() => instanceName, instanceName); return(FindInstance(manager, extensionId, instanceName) != null); }
public static string GetUniqueInstanceName(this IGuidanceManager guidanceManager, string baseName) { Guard.NotNull(() => guidanceManager, guidanceManager); Guard.NotNull(() => baseName, baseName); return(UniqueNameGenerator.EnsureUnique(baseName, newName => !guidanceManager.InstantiatedGuidanceExtensions.Any(ge => ge.InstanceName.Equals(newName, StringComparison.OrdinalIgnoreCase)))); }
internal GuidanceContentUriReferenceProvider(SVsServiceProvider serviceProvider, IGuidanceManager guidanceManager) { Guard.NotNull(() => serviceProvider, serviceProvider); Guard.NotNull(() => guidanceManager, guidanceManager); this.ServiceProvider = serviceProvider; this.guidanceManager = guidanceManager; }
public void Initialize() { this.guidanceManager = VsIdeTestHostContext.ServiceProvider.GetService<IGuidanceManager>(); this.guidanceManager.ActiveGuidanceExtension = null; this.launchService = VsIdeTestHostContext.ServiceProvider.GetService<IShortcutLaunchService>(); this.solution = VsIdeTestHostContext.ServiceProvider.GetService<ISolution>(); this.solution.Open(this.PathTo(@"Runtime.IntegrationTests.Content\Shortcuts\Shortcuts.sln")); this.solutionItemsFolder = this.solution.SolutionFolders.Single(sf => sf.Name == NuPattern.VisualStudio.Solution.SolutionExtensions.SolutionItemsFolderName); }
/// <summary> /// Gets the instance with given name and extension /// </summary> public static IGuidanceExtension FindInstance(this IGuidanceManager manager, string extensionId, string instanceName) { Guard.NotNull(() => manager, manager); Guard.NotNullOrEmpty(() => extensionId, extensionId); Guard.NotNullOrEmpty(() => instanceName, instanceName); return(manager.InstantiatedGuidanceExtensions.FirstOrDefault(ge => ge.ExtensionId.Equals(extensionId, StringComparison.OrdinalIgnoreCase) && ge.InstanceName.Equals(instanceName, StringComparison.OrdinalIgnoreCase))); }
public void Initialize() { this.guidanceManager = VsIdeTestHostContext.ServiceProvider.GetService <IGuidanceManager>(); this.guidanceManager.ActiveGuidanceExtension = null; this.launchService = VsIdeTestHostContext.ServiceProvider.GetService <IShortcutLaunchService>(); this.solution = VsIdeTestHostContext.ServiceProvider.GetService <ISolution>(); this.solution.Open(this.PathTo(@"Runtime.IntegrationTests.Content\Shortcuts\Shortcuts.sln")); this.solutionItemsFolder = this.solution.SolutionFolders.Single(sf => sf.Name == NuPattern.VisualStudio.Solution.SolutionExtensions.SolutionItemsFolderName); }
/// <summary> /// Creates a new instance of the <see cref="VsLaunchPoint"/> class. /// </summary> /// <param name="guidanceManager"></param> /// <param name="id"></param> protected VsLaunchPoint(IGuidanceManager guidanceManager, CommandID id) : base(OnExecute, id) { Guard.NotNull(() => guidanceManager, guidanceManager); this.BeforeQueryStatus += this.OnBeforeQueryStatus; this.GuidanceManager = guidanceManager; this.QueryStatusStrategy = new DefaultQueryStatusStrategy(this.GetType().Name); this.GuidanceInstanceLocator = new DefaultGuidanceInstanceLocator(guidanceManager, this.GetType()); }
protected VsTemplateLaunchPoint(IGuidanceManager guidanceManager, string id, string name, string category) { Guard.NotNull(() => guidanceManager, guidanceManager); this.GuidanceManager = guidanceManager; this.Id = id; this.Name = name; this.Category = category; this.QueryStatusStrategy = new DefaultQueryStatusStrategy(this.GetType().Name); this.GuidanceInstanceLocator = new DefaultGuidanceInstanceLocator(guidanceManager, this.GetType()); }
public GuidanceExplorerViewModel(GuidanceWorkflowContext context, IServiceProvider serviceProvider) { Guard.NotNull(() => context, context); Guard.NotNull(() => serviceProvider, serviceProvider); this.context = context; this.serviceProvider = serviceProvider; this.guidanceManager = context.GuidanceManager; this.Workflows = new ObservableCollection <GuidanceWorkflowViewModel>(); this.SubscribeToExtensionChanges(guidanceManager); this.InitializeCommands(); }
public GuidanceBrowserViewModel(GuidanceBrowserContext context, IServiceProvider serviceProvider) { Guard.NotNull(() => context, context); Guard.NotNull(() => serviceProvider, serviceProvider); this.context = context; this.serviceProvider = serviceProvider; this.NavigationCommand = new RelayCommand <Uri>(uri => this.Navigate(uri)); this.guidanceManager = context.GuidanceManager; this.uriReferenceService = context.UriReferenceService; }
public GuidanceExplorerViewModel(GuidanceWorkflowContext context, IServiceProvider serviceProvider) { Guard.NotNull(() => context, context); Guard.NotNull(() => serviceProvider, serviceProvider); this.context = context; this.serviceProvider = serviceProvider; this.guidanceManager = context.GuidanceManager; this.Workflows = new ObservableCollection<GuidanceWorkflowViewModel>(); this.SubscribeToExtensionChanges(guidanceManager); this.InitializeCommands(); }
public static void ShowGuidanceWindows(this IGuidanceManager guidanceManager, IServiceProvider provider) { Guard.NotNull(() => guidanceManager, guidanceManager); Guard.NotNull(() => provider, provider); var toolWindows = provider.GetService <IPatternWindows>(); if (toolWindows != null) { tracer.Verbose(Resources.GuidanceManagerExtensions_TraceShowingGuidanceWindows); toolWindows.ShowGuidanceExplorer(provider); toolWindows.ShowGuidanceBrowser(provider); } }
public static void ActivateGuidanceInstance(this IGuidanceManager guidanceManager, IServiceProvider provider, IGuidanceExtension instance) { Guard.NotNull(() => guidanceManager, guidanceManager); Guard.NotNull(() => provider, provider); Guard.NotNull(() => instance, instance); if (provider != null) { guidanceManager.ShowGuidanceWindows(provider); } tracer.Info(Resources.GuidanceManagerExtensions_TraceActivation, instance.InstanceName); // Activate guidance extension in Guidance Explorer guidanceManager.ActiveGuidanceExtension = instance; }
/// <summary> /// Initializes the guidance extension. /// </summary> /// <param name="registration">The guidance extension registration information, which includes its identifier and manifest information..</param> /// <param name="instanceName">Name of the instance.</param> /// <param name="version">The version of the guidance extension to intialize</param> /// <param name="guidanceManager">An instance of the <see cref="IGuidanceManager"/></param> /// <remarks> /// This method is called after <see cref="Instantiate"/> /// when a guidance extension is first initialized in a solution, /// or after reopening a solution where the feature /// had been previously instantiated. /// </remarks> public void Initialize(IGuidanceExtensionRegistration registration, string instanceName, Version version, IGuidanceManager guidanceManager) { this.ExtensionId = registration.ExtensionId; this.InstanceName = instanceName; this.Registration = registration; // // note we do this here and in Instantiate because when re-opening a solution, we never call Instantiate // this.guidanceManager = guidanceManager; this.Trace = Tracer.Get(this.GetType()); this.GuidanceWorkflow = this.CreateWorkflow(); if (this.GuidanceWorkflow != null) { this.GuidanceWorkflow.OwningExtension = this; } this.OnInitialize(version); }
private void SubscribeToExtensionChanges(IGuidanceManager guidanceManager) { guidanceManager.InstantiatedExtensionsChanged += (s, e) => this.SetWorkflows(guidanceManager.InstantiatedGuidanceExtensions); this.SetWorkflows(guidanceManager.InstantiatedGuidanceExtensions); guidanceManager.ActiveExtensionChanged += (s, e) => { if (guidanceManager.ActiveGuidanceExtension == null) { this.CurrentWorkflow = null; } else { if (guidanceManager.ActiveGuidanceExtension.GuidanceWorkflow != null) { this.CurrentWorkflow = this.Workflows.FirstOrDefault(w => w.Model == guidanceManager.ActiveGuidanceExtension.GuidanceWorkflow); GuidanceConditionsEvaluator.EvaluateGraph(guidanceManager.ActiveGuidanceExtension); } } }; }
public static IGuidanceExtension InstantiateGuidanceInstance(this IGuidanceManager guidanceManager, IServiceProvider provider, string extensionId, string instanceName) { Guard.NotNull(() => guidanceManager, guidanceManager); Guard.NotNull(() => provider, provider); Guard.NotNullOrEmpty(() => extensionId, extensionId); if (provider != null) { guidanceManager.ShowGuidanceWindows(provider); } tracer.Info(Resources.GuidanceManagerExtensions_TraceInstantiation, extensionId, instanceName); // Create a new instance of guidance workflow var instance = guidanceManager.Instantiate(extensionId, instanceName); // Activate guidance extension in Guidance Explorer guidanceManager.ActiveGuidanceExtension = instance; return(instance); }
public void InitializeContext() { this.guidanceManager = (IGuidanceManager)VsIdeTestHostContext.ServiceProvider.GetService(typeof(IGuidanceManager)); }
public static IEnumerable <IGuidanceExtension> GetResolvedReferences(IProductElement element, IGuidanceManager guidanceManager) { return(GetResolvedReferences(element, guidanceManager, r => true)); }
/// <summary> /// Gets whether the given guidance extension has been instantiated in the solution. /// </summary> public static bool IsInstantiated(this IGuidanceManager manager, IGuidanceExtensionRegistration registration) { return(manager.IsInstantiated(registration.ExtensionId)); }
public static IEnumerable <IGuidanceExtension> GetResolvedReferences(IProductElement element, IGuidanceManager guidanceManager, Func <IReference, bool> whereFilter) { Guard.NotNull(() => element, element); Guard.NotNull(() => guidanceManager, guidanceManager); Guard.NotNull(() => whereFilter, whereFilter); return(GetReferenceValues(element, whereFilter) .Select(reference => guidanceManager.InstantiatedGuidanceExtensions.FirstOrDefault(f => f.InstanceName.Equals(reference, StringComparison.OrdinalIgnoreCase))) .Where(item => item != null)); }
/// <summary> /// Creates a new instance of the <see cref="LinkLaunchPoint"/> class. /// </summary> protected LinkLaunchPoint(IGuidanceManager guidanceManager) { Guard.NotNull(() => guidanceManager, guidanceManager); GuidanceManager = guidanceManager; this.QueryStatusStrategy = new DefaultQueryStatusStrategy(this.GetType().Name); }
private void SubscribeToExtensionChanges(IGuidanceManager guidanceManager) { guidanceManager.InstantiatedExtensionsChanged += (s, e) => this.SetWorkflows(guidanceManager.InstantiatedGuidanceExtensions); this.SetWorkflows(guidanceManager.InstantiatedGuidanceExtensions); guidanceManager.ActiveExtensionChanged += (s, e) => { if (guidanceManager.ActiveGuidanceExtension == null) this.CurrentWorkflow = null; else { if (guidanceManager.ActiveGuidanceExtension.GuidanceWorkflow != null) { this.CurrentWorkflow = this.Workflows.FirstOrDefault(w => w.Model == guidanceManager.ActiveGuidanceExtension.GuidanceWorkflow); GuidanceConditionsEvaluator.EvaluateGraph(guidanceManager.ActiveGuidanceExtension); } } }; }
public DefaultGuidanceInstanceLocator(IGuidanceManager guidanceManager, Type componentType) { this.guidanceManager = guidanceManager; this.componentType = componentType; }
/// <summary> /// Initializes the guidance extension. /// </summary> /// <param name="registration">The guidance extension registration information, which includes its identifier and manifest information..</param> /// <param name="instanceName">Name of the instance.</param> /// <param name="version">The version of the guidance extension to intialize</param> /// <param name="guidanceManager">An instance of the <see cref="IGuidanceManager"/></param> /// <remarks> /// This method is called after <see cref="Instantiate"/> /// when a guidance extension is first initialized in a solution, /// or after reopening a solution where the feature /// had been previously instantiated. /// </remarks> public void Initialize(IGuidanceExtensionRegistration registration, string instanceName, Version version, IGuidanceManager guidanceManager) { this.ExtensionId = registration.ExtensionId; this.InstanceName = instanceName; this.Registration = registration; // // note we do this here and in Instantiate because when re-opening a solution, we never call Instantiate // this.guidanceManager = guidanceManager; this.Trace = Tracer.Get(this.GetType()); this.GuidanceWorkflow = this.CreateWorkflow(); if (this.GuidanceWorkflow != null) this.GuidanceWorkflow.OwningExtension = this; this.OnInitialize(version); }
public InstantiatePatternToolkitLink(IGuidanceManager guidanceManager) : base(guidanceManager) { }
public InstantiateUsingGuidanceLink(IGuidanceManager guidanceManager) : base(guidanceManager, CommandBindingName) { }