private bool TryCreateXamlDocument(AbstractProject project, string filePath, out IVisualStudioHostDocument vsDocument) { vsDocument = _vsWorkspace.ProjectTracker.DocumentProvider.TryGetDocumentForFile( project, ImmutableArray <string> .Empty, filePath, SourceCodeKind.Regular, tb => tb.ContentType.IsOfType(ContentTypeNames.XamlContentType)); return(vsDocument != null); }
public void SetUnits(IEnumerable <Programmer> programmers, AbstractProject boss, Field stageField) { CommonLogger.Log("UnitManager::SetUnits => 초기화 시작."); if (programmers == null || boss == null || stageField == null) { DebugLogger.LogError("UnitManager::SetUnits => 주어진 프로그래머, 보스 또는 필드 중 Null이 존재함."); throw new ArgumentNullException(); } CurrentAppliedFormation = null; OnTurnChanged += RemoveDeadPlayerIfTurnChangedToPlayer; OnTurnChanged += RequestBossActionIfTurnChangedToBoss; OnTurnChanged += PermitProgrammersActionIfTurnChangedToPlayer; OnTurnChanged += ApplyBurfsIfTurnChangedToPlayer; OnTurnChanged += DecreaseActiveSkillCooldownIfTurnChangedToPlayer; programmerActingDictionary = programmers.ToDictionary(keySelector: programmer => programmer, elementSelector: programmer => false); this.boss = boss; this.stageField = stageField; SubscribeToBoss(); SubscribeToProgrammers(); Turn = TurnState.Player; SetVacationLimitToProgrammers(); CommonLogger.Log("UnitManager::SetUnits => 초기화 완료."); }
public void VsTextViewCreated(IVsTextView vsTextView) { if (vsTextView == null) { throw new ArgumentNullException(nameof(vsTextView)); } if (ErrorHandler.Failed(vsTextView.GetBuffer(out var textLines))) { return; } IVsUserData userData = textLines as IVsUserData; if (userData == null) { return; } Guid monikerGuid = typeof(IVsUserData).GUID; if (ErrorHandler.Failed(userData.GetData(ref monikerGuid, out var monikerObj))) { return; } string filePath = monikerObj as string; _rdt.Value.FindDocument(filePath, out var hierarchy, out var itemId, out var docCookie); AbstractProject project = GetXamlProject(hierarchy); if (project == null) { project = new XamlProject( _vsWorkspace.GetProjectTrackerAndInitializeIfNecessary(_serviceProvider), hierarchy, _serviceProvider, _vsWorkspace); } IVisualStudioHostDocument vsDocument = project.GetCurrentDocumentFromPath(filePath); if (vsDocument == null) { if (!TryCreateXamlDocument(project, filePath, out vsDocument)) { return; } project.AddDocument(vsDocument, isCurrentContext: true, hookupHandlers: true); } AttachRunningDocTableEvents(); var wpfTextView = _editorAdaptersFactory.GetWpfTextView(vsTextView); var target = new XamlOleCommandTarget(wpfTextView, CommandHandlerServiceFactory, _editorAdaptersFactory, _serviceProvider); target.AttachToVsTextView(); }
public ContainedLanguage( IVsTextBufferCoordinator bufferCoordinator, IComponentModel componentModel, AbstractProject project, IVsHierarchy hierarchy, uint itemid, TLanguageService languageService, SourceCodeKind sourceCodeKind, IFormattingRule vbHelperFormattingRule, Workspace workspace ) : base( bufferCoordinator, componentModel, project.VisualStudioProject, hierarchy, itemid, project.ProjectTracker, project.Id, languageService.LanguageServiceId, vbHelperFormattingRule: null ) { Contract.ThrowIfTrue(vbHelperFormattingRule != null); }
private ProjectDescriptionPanel CreateProjectButton(AbstractProject project) { var newButton = Instantiate(projectPanelPrefab, projectsParent); newButton.gameObject.SetActive(true); newButton.Init(project, OnSelectProject); return(newButton); }
private void InitializeBoss() { var newBoss = Instantiate(bossTemplate); Boss = newBoss; Boss.Status = CurrentStage.Boss.Status.Clone(); Boss.Ability = CurrentStage.Boss.Ability.Clone(); }
protected virtual IVsContainedLanguage CreateContainedLanguage( IVsTextBufferCoordinator bufferCoordinator, AbstractProject project, IVsHierarchy hierarchy, uint itemid) { return(new ContainedLanguage <TPackage, TLanguageService>( bufferCoordinator, this.Package.ComponentModel, project, hierarchy, itemid, (TLanguageService)this, SourceCodeKind.Regular)); }
public void SearchTest() { AbstractProject project = ProjectLoader.Load(@"D:\Research\projects\GUI-Testing-Automation\Solution Utilities\SampleInput"); List <IFile> re = SearchFile.Search(project.RootFolder, new CsprojSearchCondition()); Assert.AreEqual(re.Count, 1); Assert.AreEqual(re[0].Path, @"D:\Research\projects\GUI-Testing-Automation\Solution Utilities\SampleInput\SampleInput.csproj"); }
private bool TryCreateXamlDocument(AbstractProject project, string filePath, out IVisualStudioHostDocument vsDocument) { vsDocument = _vsWorkspace.ProjectTracker.DocumentProvider.TryGetDocumentForFile( project, filePath, SourceCodeKind.Regular, tb => tb.ContentType.IsOfType(ContentTypeNames.XamlContentType), _ => SpecializedCollections.EmptyReadOnlyList <string>()); return(vsDocument != null); }
private bool TryCreateXamlDocument(AbstractProject project, string filePath, out IVisualStudioHostDocument vsDocument) { // We already have an AbstractProject, so the workspace has been created vsDocument = _vsWorkspace.DeferredState.ProjectTracker.DocumentProvider.TryGetDocumentForFile( project, filePath, SourceCodeKind.Regular, tb => tb.ContentType.IsOfType(ContentTypeNames.XamlContentType), ImmutableArray <string> .Empty); return(vsDocument != null); }
public AbstractContainedLanguage( AbstractProject project) { if (project == null) { throw new ArgumentNullException("project"); } this.Project = project; }
private void InitializeBoss() { var selectedBossTemplate = bossTemplates.Where(template => template.modelType == CurrentStage.Boss.Status.Model) .Select(template => template.boss) .First(); var newBoss = Instantiate(selectedBossTemplate); Boss = newBoss; Boss.Status = CurrentStage.Boss.Status.Clone(); Boss.Ability = CurrentStage.Boss.Ability.Clone(); }
public void AddProject(AbstractProject project) { var provider = (IProjectCodeModelProvider)project; IEnumerable <ComHandle <EnvDTE80.FileCodeModel2, FileCodeModel> > fcms = provider.ProjectCodeModel.GetFileCodeModelInstances(); foreach (var fcm in fcms) { var globalNodeKeys = fcm.Object.GetCurrentNodeKeys(); _nodeKeysMap.Add(fcm, globalNodeKeys); } }
public void AddProject(AbstractProject project) { var provider = (IProjectCodeModelProvider)project; var fcms = provider.ProjectCodeModel.GetCachedFileCodeModelInstances(); foreach (var fcm in fcms) { var globalNodeKeys = fcm.Object.GetCurrentNodeKeys(); _nodeKeysMap.Add(fcm, globalNodeKeys); } }
public VsReadOnlyDocumentTracker(IEditAndContinueService encService, IVsEditorAdaptersFactoryService adapters, AbstractProject vsProject) : base(assertIsForeground: true) { Debug.Assert(encService.DebuggingSession != null); _encService = encService; _adapters = adapters; _workspace = encService.DebuggingSession.InitialSolution.Workspace; _vsProject = vsProject; _workspace.DocumentOpened += OnDocumentOpened; UpdateWorkspaceDocuments(); }
internal void Initialize1(IProgressMonitor progressMonitor) { ICollection <ProjectItem> items = project.Items; ProjectService.ProjectItemAdded += OnProjectItemAdded; ProjectService.ProjectItemRemoved += OnProjectItemRemoved; UpdateDefaultImports(items); // TODO: Translate me // progressMonitor.TaskName = "Resolving references for " + project.Name + "..."; AbstractProject abstractProject = project as AbstractProject; ReferencedContents.Clear(); if (abstractProject != null) { foreach (var reference in abstractProject.ResolveAssemblyReferences(progressMonitor.CancellationToken)) { if (!initializing) { return; // abort initialization } AddReference(reference, false, progressMonitor.CancellationToken); } } else { project.ResolveAssemblyReferences(); AddReferencedContent(AssemblyParserService.DefaultProjectContentRegistry.Mscorlib); foreach (ProjectItem item in items) { if (!initializing) { return; // abort initialization } progressMonitor.CancellationToken.ThrowIfCancellationRequested(); if (ItemType.ReferenceItemTypes.Contains(item.ItemType)) { ReferenceProjectItem reference = item as ReferenceProjectItem; if (reference != null) { AddReference(reference, false, progressMonitor.CancellationToken); } } } } UpdateReferenceInterDependencies(); OnReferencedContentsChanged(EventArgs.Empty); }
public ContainedLanguage( IVsTextBufferCoordinator bufferCoordinator, IComponentModel componentModel, AbstractProject project, IVsHierarchy hierarchy, uint itemid, TLanguageService languageService, SourceCodeKind sourceCodeKind, IFormattingRule vbHelperFormattingRule) : this(bufferCoordinator, componentModel, project.VisualStudioProject, hierarchy, itemid, languageService, vbHelperFormattingRule) { }
public ContainedLanguage( IVsTextBufferCoordinator bufferCoordinator, IComponentModel componentModel, AbstractProject project, IVsHierarchy hierarchy, uint itemid, TLanguageService languageService, SourceCodeKind sourceCodeKind, IFormattingRule vbHelperFormattingRule = null) : base(project) { this.BufferCoordinator = bufferCoordinator; this.ComponentModel = componentModel; _languageService = languageService; this.Workspace = componentModel.GetService <VisualStudioWorkspace>(); _editorAdaptersFactoryService = componentModel.GetService <IVsEditorAdaptersFactoryService>(); // Get the ITextBuffer for the secondary buffer IVsTextLines secondaryTextLines; Marshal.ThrowExceptionForHR(bufferCoordinator.GetSecondaryBuffer(out secondaryTextLines)); var secondaryVsTextBuffer = (IVsTextBuffer)secondaryTextLines; SetSubjectBuffer(_editorAdaptersFactoryService.GetDocumentBuffer(secondaryVsTextBuffer)); var bufferTagAggregatorFactory = ComponentModel.GetService <IBufferTagAggregatorFactoryService>(); _bufferTagAggregator = bufferTagAggregatorFactory.CreateTagAggregator <ITag>(SubjectBuffer); IVsTextLines primaryTextLines; Marshal.ThrowExceptionForHR(bufferCoordinator.GetPrimaryBuffer(out primaryTextLines)); var primaryVsTextBuffer = (IVsTextBuffer)primaryTextLines; var dataBuffer = _editorAdaptersFactoryService.GetDataBuffer(primaryVsTextBuffer); SetDataBuffer(dataBuffer); this.ContainedDocument = new ContainedDocument( this, sourceCodeKind, this.Workspace, hierarchy, itemid, componentModel, vbHelperFormattingRule); // TODO: Can contained documents be linked or shared? this.Project.AddDocument(this.ContainedDocument, isCurrentContext: true, hookupHandlers: true); }
private void OnDocumentClosed(uint docCookie) { RunningDocumentInfo info = _rdt.Value.GetDocumentInfo(docCookie); AbstractProject project = GetXamlProject(info.Hierarchy); if (project == null) { return; } IVisualStudioHostDocument document = project.GetCurrentDocumentFromPath(info.Moniker); if (document == null) { return; } project.RemoveDocument(document); }
public static ProfilerRunner CreateRunner(IProfilingDataWriter writer) { AbstractProject currentProj = ProjectService.CurrentProject as AbstractProject; if (currentProj == null) { return(null); } if (!currentProj.IsStartable) { if (MessageService.AskQuestion("${res:AddIns.Profiler.Messages.NoStartableProjectWantToProfileStartupProject}")) { currentProj = ProjectService.OpenSolution.StartupProject as AbstractProject; if (currentProj == null) { MessageService.ShowError("${res:AddIns.Profiler.Messages.NoStartableProjectFound}"); return(null); } } else { return(null); } } if (!File.Exists(currentProj.OutputAssemblyFullPath)) { MessageService.ShowError("${res:AddIns.Profiler.Messages.FileNotFound}"); return(null); } ProcessStartInfo startInfo; try { startInfo = currentProj.CreateStartInfo(); } catch (ProjectStartException ex) { MessageService.ShowError(ex.Message); return(null); } ProfilerRunner runner = new ProfilerRunner(startInfo, true, writer); return(runner); }
public VSTypeScriptContainedLanguageWrapper( IVsTextBufferCoordinator bufferCoordinator, IComponentModel componentModel, AbstractProject project, IVsHierarchy hierarchy, uint itemid, Guid languageServiceGuid) { var workspace = componentModel.GetService <VisualStudioWorkspace>(); var filePath = ContainedLanguage.GetFilePathFromHierarchyAndItemId(hierarchy, itemid); _underlyingObject = new ContainedLanguage( bufferCoordinator, componentModel, workspace, project.Id, project.VisualStudioProject, filePath, languageServiceGuid, vbHelperFormattingRule: null); }
private void OnDocumentMonikerChanged(IVsHierarchy hierarchy, string oldMoniker, string newMoniker) { // If the moniker change only involves casing differences then the project system will // not remove & add the file again with the new name, so we should not clear any state. // Leaving the old casing in the DocumentKey is safe because DocumentKey equality // checks ignore the casing of the moniker. if (oldMoniker.Equals(newMoniker, StringComparison.OrdinalIgnoreCase)) { return; } // If the moniker change only involves a non-XAML project then ignore it. AbstractProject project = GetXamlProject(hierarchy); if (project == null) { return; } // Managed languages rely on the msbuild host object to add and remove documents during rename. // For XAML we have to do that ourselves. IVisualStudioHostDocument oldDocument = project.GetCurrentDocumentFromPath(oldMoniker); if (oldDocument != null) { project.RemoveDocument(oldDocument); } IVisualStudioHostDocument newDocument = project.GetCurrentDocumentFromPath(newMoniker); Debug.Assert(newDocument == null, "Why does the renamed document already exist in the project?"); if (newDocument == null) { if (TryCreateXamlDocument(project, newMoniker, out newDocument)) { project.AddDocument(newDocument, isCurrentContext: true, hookupHandlers: true); } } }
public AbstractProjectCodeModel(AbstractProject project, VisualStudioWorkspace visualStudioWorkspace, IServiceProvider serviceProvider) { _vsProject = project; _visualStudioWorkspace = visualStudioWorkspace; _serviceProvider = serviceProvider; }
internal CodeModelProjectCache(AbstractProject project, IServiceProvider serviceProvider, HostLanguageServices languageServices, VisualStudioWorkspace workspace) { _project = project; _state = new CodeModelState(serviceProvider, languageServices, workspace); }
public AbstractProjectCodeModel(AbstractProject project, VisualStudioWorkspaceImpl visualStudioWorkspace, IServiceProvider serviceProvider) { VSProject = project; VisualStudioWorkspace = visualStudioWorkspace; ServiceProvider = serviceProvider; }
public AbstractContainedLanguage( AbstractProject project) { this.Project = project ?? throw new ArgumentNullException(nameof(project)); }
public void Init(AbstractProject currentProject, Action <AbstractProject> onSelectProjectClickCallback) { project = currentProject; onSelectProjectClick = onSelectProjectClickCallback; ShowProjectParams(); }
private void OnProjectClosing(IVsHierarchy hierarchy) { AbstractProject project = GetXamlProject(hierarchy); project?.Disconnect(); }
private void OnSelectProject(AbstractProject project) { city.SetProject(project.ID, project.Cost); UpdateText(); }